Chapter 1: Sample spaces, events and axioms
PS 00 Course Map | Next: PS 02 Conditional Probability and Bayes Rule
Probability assigns a number between 0 and 1 to sets of possible outcomes. Three simple rules about those numbers (the axioms) generate the entire theory. When all outcomes are equally likely, computing a probability becomes counting.
- Write down the sample space of an experiment and describe events as sets.
- State the three axioms and derive the complement rule, inclusion-exclusion and the union bound from them.
- Compute probabilities by counting equally likely outcomes, and know when that is allowed.
- Use the complement trick for “at least one” questions.
- Explain the two interpretations of probability.
You need basic set language: union, intersection, complement (DM 04 Sets). For counting questions, DM 07 Counting helps, but this chapter only uses simple multiplication.
1.1 Experiments and sample spaces
The setting
Probability studies experiments with uncertain outcomes: rolling a die, flipping a coin, measuring a sensor, running a robot trial. Before the experiment, you do not know what will happen; afterwards, exactly one outcome has occurred.
The sample space (capital omega) is the set of all possible outcomes of an experiment. Each run of the experiment produces exactly one element of .
Examples
| Experiment | Sample space | Size |
|---|---|---|
| flip a coin | 2 | |
| roll a die | 6 | |
| flip two coins | 4 | |
| roll two dice | all pairs with | 36 |
| number of emails today | infinite (countable) | |
| time until a motor fails | infinite (continuous) |
Choosing the sample space carefully
Two coins can be described as (which coin shows what) or as (just the count). Both are valid sample spaces, but they are not equally convenient:
- In the first, all four outcomes are equally likely (each has probability ).
- In the second, “1 head” is twice as likely as “0 heads”, because it can happen two ways ( or ).
Choose a sample space whose outcomes are as detailed as needed to be equally likely. Usually that means keeping track of order and of which object is which, even if you only care about a summary in the end.
- Write the sample space for flipping a coin and rolling a die.
- How many outcomes are there when flipping 5 coins?
Answers. 1. , 12 outcomes. 2. .
1.2 Events
An event is a subset of the sample space: a collection of outcomes that you are interested in. The event occurs if the actual outcome belongs to it.
Examples with one die.
| In words | As a set |
|---|---|
| the roll is even | |
| the roll is at least 5 | |
| the roll is 7 | (impossible event) |
| the roll is between 1 and 6 | (certain event) |
If the die shows 4, then occurs and does not.
Combining events
Because events are sets, set operations describe combinations of events:
| In words | Set notation | Example with above |
|---|---|---|
| or (or both) | ||
| and | ||
| not | ||
| but not |
Two events are disjoint (mutually exclusive) when they cannot both happen: . For example, “even” and “odd” are disjoint.
With two dice, let = “sum is 7” and = “both dice equal”. Are and disjoint?
Answer. Yes. Equal dice give an even sum (), never 7.
1.3 The axioms of probability
The idea
We want a function that assigns each event a number measuring how likely it is. What properties must such a function have? Remarkably, three are enough.
- Non-negativity: for every event .
- Normalization: . (Something certainly happens.)
- Additivity: if and are disjoint, then . (The same holds for any countable list of pairwise disjoint events.)
A picture to keep in mind
Think of probability as one unit of sand spread over the sample space. The probability of an event is the amount of sand sitting on it.
- Sand amounts are never negative (axiom 1).
- The total is one unit (axiom 2).
- The sand on two separate regions is the sum of the sand on each (axiom 3).
Every rule below follows from this picture, and from the axioms by short proofs.
1.4 Rules derived from the axioms
Rule 1: complement
Proof. and are disjoint and together make up . By axioms 3 and 2, .
“At least one” is usually hard to count directly and easy to count through its complement, “none”.
Rule 2: the impossible event
Proof. is the complement of , so .
Rule 3: probabilities are at most 1
. Proof: since .
Rule 4: monotonicity
If , then .
Proof. splits into the disjoint pieces and , so .
In words: a more specific event can never be more likely. “It rains and is windy” cannot be more probable than “it rains”.
People are often asked: “Linda is 31, outspoken and was active in social justice causes. Which is more likely: (a) Linda is a bank teller, or (b) Linda is a bank teller and active in a feminist movement?” Many choose (b), because it fits the description. But (b) is a subset of (a), so by monotonicity it can never be more probable.
Rule 5: inclusion-exclusion
For any two events (disjoint or not):
Why. Adding counts the sand on the overlap twice. Subtracting it once corrects the double count.
Proof. Split into three disjoint pieces: , , . Also and . Add the last two and compare.
For three events:
Rule 6: the union bound
This follows from inclusion-exclusion, since . It is crude but needs no knowledge of the overlap, which makes it a favourite tool in proofs: “the chance that any of these 10 bad things happens is at most the sum of their chances”.
- , , . Find .
- Can and if and are disjoint?
Answers. 1. . 2. No: disjoint would give .
1.5 Equally likely outcomes: probability as counting
The rule
When is finite and every outcome is equally likely, each outcome has probability , and additivity gives
Worked example 1.1: two dice, sum 7
ordered pairs, all equally likely. The pairs with sum 7 are
six of them. So .
If you list unordered results (, , , …), outcomes like "" (one way) and "" (two ways: or ) are not equally likely, and counting them as equal gives wrong answers. Imagine the dice are different colours: then the 36 ordered pairs are clearly equally likely.
The distribution of the sum of two dice
| Sum | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Ways | 1 | 2 | 3 | 4 | 5 | 6 | 5 | 4 | 3 | 2 | 1 |
| Probability |
The middle sums are most likely because they can be made in the most ways. This “triangle” is the first hint of the central limit theorem (PS 08 Law of Large Numbers and Central Limit Theorem).
Worked example 1.2: at least one six in two rolls
Direct, wrong attempt: . This double counts .
Complement: “no six” means each die shows 1 to 5: outcomes. So
Inclusion-exclusion (check): ✓.
Worked example 1.3: at least one six in four rolls
Complement: . So . Slightly better than even. (This was a famous gambling bet in 17th-century France.)
Worked example 1.4: drawing cards
A standard deck has 52 cards: 4 suits (hearts, diamonds, clubs, spades) of 13 ranks each.
: hearts 13, kings 4, the king of hearts counted in both:
- Three fair coins. Find and .
- Two dice. Find .
- Two dice. Find .
Answers. 1. : . Complement of : . 2. Sums 10, 11, 12: ways, . 3. Complement of “equal” (6 ways): .
1.6 A famous surprise: the birthday problem
Question. In a room of people, what is the probability that at least two share a birthday? (Assume 365 equally likely days, and ignore leap years.)
Step 1: complement. Compute .
Step 2: count. Line the people up. The first can have any birthday. The second must avoid one day. The third must avoid two days. And so on:
Step 3: compute.
| 10 | 20 | 23 | 30 | 50 | 70 | |
|---|---|---|---|---|---|---|
| 0.117 | 0.411 | 0.507 | 0.706 | 0.970 | 0.999 |
With just 23 people, a shared birthday is more likely than not.
Why so few? The intuition “23 is much less than 365” compares the wrong things. What matters is the number of pairs of people, each of which is a chance for a match: pairs. Each pair matches with probability , and 253 chances at add up quickly.
The same arithmetic explains hash collisions. With a hash of possible values, collisions become likely after only about items, not . A 32-bit hash () starts colliding after roughly 77,000 items.
1.7 What does a probability mean?
Two interpretations are in common use. They use the same mathematics; they differ in what the numbers are about.
Frequentist. is the long-run fraction of times occurs if the experiment is repeated many times under the same conditions. “A fair coin has ” means that in many flips, about half are heads. This suits dice, sensor noise and repeatable trials.
Bayesian. is a degree of belief in , given what you know. “The probability that this grasp succeeds is 0.9” describes your confidence about a single event that will happen only once. This suits one-off questions and is the basis of PS 11 Bayesian Inference.
A probability of 0.9 does not mean the next trial will succeed. It means that, among many situations like this one, about 9 in 10 succeed, or that you should be about as confident as you would be of drawing a red ball from a bag with 9 red and 1 blue.
Summary
| Idea | Formula or meaning |
|---|---|
| sample space | all possible outcomes |
| event | a subset of |
| axioms | ; ; additive for disjoint events |
| complement | |
| inclusion-exclusion | |
| union bound | |
| equally likely |
Three facts to remember:
- Choose a sample space whose outcomes are equally likely (usually: keep track of order).
- “At least one” = 1 minus “none”.
- When adding probabilities of overlapping events, subtract the overlap.
Exercises
Part A: warm-up
A1. A card is drawn from a standard deck. Find , (J, Q, K) and .
A2. Two dice are rolled. Find and .
A3. , , . Find , and .
A4. A coin is flipped 6 times. Find and .
A1. ; ; .
A2. Sum 8: , so . Product 12: , so .
A3. ; ; .
A4. ; .
Part B: core
B1. In a class of 40, 25 study maths, 20 study physics, and 8 study neither. What is the probability that a randomly chosen student studies both?
B2. Three dice are rolled. Find and .
B3. A robot test suite has 5 independent tests, each passing with probability 0.9. Find and .
B4. A 4-digit PIN is chosen uniformly at random (digits 0 to 9, repeats allowed). Find .
B5. Use the union bound to show that if each of 20 components fails with probability at most 0.001, the probability that any fails is at most 0.02. Does this need independence?
B6. In a room of 5 people, find the probability that at least two share a birth month (assume 12 equally likely months).
B1. At least one subject: . Both: . Probability .
B2. All different: . At least two the same: .
B3. . At least one fails: . Even with 90% per test, a 5-test suite fails 41% of the time.
B4. .
B5. . No independence needed: that is the power of the union bound.
B6. All different: . Shared: .
Part C: explain and prove
C1. Prove from the axioms that if , then .
C2. Prove the three-event inclusion-exclusion formula from the two-event one. (Hint: apply it to and .)
C3. Someone says: “There are three possible outcomes for two coin flips: two heads, two tails, or one of each. So .” Explain the error.
C4. Explain why disjoint events with positive probabilities cannot be “unrelated” to each other. (What does learning that happened tell you about ?)
C1. is the disjoint union of and , so .
C2. . Expand , and note , whose probability is . Collect terms.
C3. The three outcomes are not equally likely. “One of each” happens two ways (, ). The correct answer is .
C4. If happened, certainly did not. So knowing changes the probability of from positive to zero: the events are strongly dependent. (Independence is defined in the next chapter.)
Part D: practise with code
D1. Simulate rolling two dice 100,000 times (np.random.randint(1, 7, size=(100000, 2))). Estimate and compare with .
D2. Simulate the birthday problem for : in each of 10,000 trials, draw 23 random birthdays and check for a repeat (len(set(b)) < 23). Compare with 0.507.
D3. Write a function that computes the exact birthday probability for any using the product formula. Plot it for to . Find the smallest with probability above 0.99.
D4. Estimate and by simulation. (This was the Chevalier de Méré’s puzzle.) Which bet is better?
D3. is the first value above 0.99.
D4. About versus about . The first bet is slightly favourable, the second slightly unfavourable, even though “naive” reasoning ( and , both ) suggests they are the same.
Where this is used
- A robot’s success rate is an estimate of a probability, and comparing two policies means comparing two unknown probabilities from finite trials (16 Evaluation and Uncertainty).
- Reliability: the chance that a multi-step task completes is (at least roughly) a product of the per-step success chances, which falls fast as tasks get longer.
- The union bound appears in proofs of how much data a learning algorithm needs.
Next: PS 02 Conditional Probability and Bayes Rule: how probabilities change when you learn something.