Chapter 1: Sample spaces, events and axioms

PS 00 Course Map | Next: PS 02 Conditional Probability and Bayes Rule

The big idea

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.

In this chapter you will learn to
  1. Write down the sample space of an experiment and describe events as sets.
  2. State the three axioms and derive the complement rule, inclusion-exclusion and the union bound from them.
  3. Compute probabilities by counting equally likely outcomes, and know when that is allowed.
  4. Use the complement trick for “at least one” questions.
  5. Explain the two interpretations of probability.
Before you start

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.

Definition: sample space

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

ExperimentSample space Size
flip a coin2
roll a die6
flip two coins4
roll two diceall pairs with 36
number of emails todayinfinite (countable)
time until a motor failsinfinite (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 ).
Rule of thumb

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.


1.2 Events

Definition: event

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 wordsAs 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 wordsSet notationExample 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.


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.

Kolmogorov’s axioms
  1. Non-negativity: for every event .
  2. Normalization: . (Something certainly happens.)
  3. 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, .

The complement trick

“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”.

The conjunction fallacy

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”.


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

Classical probability

Worked example 1.1: two dice, sum 7

ordered pairs, all equally likely. The pairs with sum 7 are

six of them. So .

Why ordered pairs?

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

Sum23456789101112
Ways12345654321
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:


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.

102023305070
0.1170.4110.5070.7060.9700.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.

Why this matters in computing

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 is not a promise

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

IdeaFormula or meaning
sample space all possible outcomes
eventa subset of
axioms; ; additive for disjoint events
complement
inclusion-exclusion
union bound
equally likely

Three facts to remember:

  1. Choose a sample space whose outcomes are equally likely (usually: keep track of order).
  2. “At least one” = 1 minus “none”.
  3. 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 .

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).

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 ?)

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?


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.