Lemma
← All topics
Statistics

Probability

Reasoning precisely about uncertainty.

Introduction

Probability measures how likely an event is, on a scale from 00 (impossible) to 11 (certain). This topic covers sample spaces, Venn diagrams and set notation, the addition rule, mutually exclusive and independent events, conditional probability, and tree diagrams and two-way tables for combined events.

Why it matters

A medical test is 99% accurate, and you test positive for a rare disease. Are you 99% likely to have it? Usually not, and conditional probability shows why. Insurance prices, weather forecasts, spam filters and court cases all depend on reasoning about probability correctly.

Intuitive explanation

IntuitionConditional probability shrinks the world

P(A∣B)P(A \mid B) asks: "Given that BB happened, how likely is AA?" Knowing BB happened throws away every outcome outside BB. Within that smaller world, the chance of AA is the share of BB that also lies in AA: P(A∩B)P(B)\frac{P(A \cap B)}{P(B)}.

IntuitionIndependent means "tells you nothing"

Events are independent if knowing one happened does not change the probability of the other. Rolling a six does not change the chance of a coin landing heads.

Formal definitions

DefinitionSample space and events

The sample space is the set of all possible outcomes. An event is a subset of it. For equally likely outcomes, P(A)=n(A)n(sample space)P(A) = \dfrac{n(A)}{n(\text{sample space})}.

DefinitionMutually exclusive

AA and BB are mutually exclusive if they cannot both happen: P(A∩B)=0P(A \cap B) = 0.

DefinitionIndependent

AA and BB are independent if P(A∩B)=P(A)P(B)P(A \cap B) = P(A)P(B), equivalently P(A∣B)=P(A)P(A \mid B) = P(A).

DefinitionConditional probability
P(A∣B)=P(A∩B)P(B),P(B)>0.P(A \mid B) = \frac{P(A \cap B)}{P(B)}, \qquad P(B) > 0.

Notation

  • A∩BA \cap B: AA and BB.  A∪B\ A \cup B: AA or BB (or both).  A′\ A': not AA.
  • P(A∣B)P(A \mid B): probability of AA given BB.

Key rules

IdentitiesRules
P(A′)=1−P(A),P(A∪B)=P(A)+P(B)−P(A∩B)P(A') = 1 - P(A), \qquad P(A \cup B) = P(A) + P(B) - P(A \cap B)
P(A∩B)=P(A∣B)P(B)=P(B∣A)P(A)P(A \cap B) = P(A \mid B)P(B) = P(B \mid A)P(A)

Key results

TheoremTesting independence

To show AA and BB are independent, show P(A∩B)=P(A)×P(B)P(A \cap B) = P(A)\times P(B) (or P(A∣B)=P(A)P(A \mid B) = P(A)). To show they are not, show these are different.

PropositionMutually exclusive is not independent

If P(A),P(B)>0P(A), P(B) > 0 and AA, BB are mutually exclusive, then knowing BB happened tells you AA did not: they are certainly not independent.

Why the addition rule works

ProofAddition rule

Adding P(A)P(A) and P(B)P(B) counts the overlap A∩BA \cap B twice, once in each. Subtract it once: P(A∪B)=P(A)+P(B)−P(A∩B)P(A \cup B) = P(A) + P(B) - P(A \cap B).

∎

Methods

MethodFilling a Venn diagram

Start from the centre (the intersection) and work outwards, then fill in the outside region so the total is 11.

MethodTree diagrams

Multiply along branches for "and"; add the end results of different paths for "or". Second-stage branches are conditional probabilities.

MethodConditional probability from a table or tree

Restrict to the given row/column (or the branches where the condition holds) and work out the share.

Where the rules come from: thinking in frequencies

Imagine repeating an experiment NN times, with AA happening NAN_A times, BB happening NBN_B times, and both together NABN_{AB} times. Probabilities are long-run proportions, so:

  • Addition rule: the outcomes in AA or BB number NA+NB−NABN_A + N_B - N_{AB} (the overlap was counted twice). Divide by NN to get P(A∪B)=P(A)+P(B)−P(A∩B)P(A\cup B) = P(A) + P(B) - P(A\cap B).
  • Conditional probability: among the NBN_B trials where BB happened, AA also happened NABN_{AB} times. So P(A∣B)=NABNB=NAB/NNB/N=P(A∩B)P(B)P(A\mid B) = \frac{N_{AB}}{N_B} = \frac{N_{AB}/N}{N_B/N} = \frac{P(A\cap B)}{P(B)}.
  • Multiplication rule: rearranging, P(A∩B)=P(B)P(A∣B)P(A\cap B) = P(B)P(A\mid B). This is why you multiply along tree branches.
  • Independence: BB gives no information about AA, so P(A∣B)=P(A)P(A\mid B) = P(A), which is equivalent to P(A∩B)=P(A)P(B)P(A\cap B) = P(A)P(B).

The law of total probability

If B1,…,BnB_1, \ldots, B_n split the sample space (exactly one happens), then AA happens together with exactly one of them:

P(A)=∑iP(A∩Bi)=∑iP(A∣Bi)P(Bi).P(A) = \sum_iP(A\cap B_i) = \sum_iP(A\mid B_i)P(B_i).

On a tree diagram, this is "add up all the branches that end in AA".

Bayes' theorem in one line

P(B∣A)P(A)=P(A∩B)=P(A∣B)P(B)P(B\mid A)P(A) = P(A\cap B) = P(A\mid B)P(B), so

P(B∣A)=P(A∣B)P(B)P(A).P(B\mid A) = \frac{P(A\mid B)P(B)}{P(A)}.

It reverses a conditional. The answer depends heavily on P(B)P(B), the prior, and ignoring it is the base rate fallacy (questions Q31 and Q34).

Examples

ExampleTwo dice

The probability of a total of 9 with two fair dice: outcomes (3,6),(4,5),(5,4),(6,3)(3,6), (4,5), (5,4), (6,3), so 436=19\frac{4}{36} = \frac19.

More worked examples are in the Worked examples tab.

Common mistakes

Common mistakeConfusing P(A∣B)P(A \mid B) with P(B∣A)P(B \mid A)

"The probability a person who tests positive has the disease" is different from "the probability a person with the disease tests positive".

Common mistakeAssuming independence

Only multiply P(A)P(B)P(A)P(B) if you know the events are independent.

Common mistakeWithout replacement

When items are not replaced, the second-stage probabilities change.

Applications

  • Medical testing: false positives and conditional probability.
  • Reliability: a system with independent components fails with probability given by products.
  • Games and insurance: pricing depends on probabilities of events.

Connections

Summary

  • P(A∪B)=P(A)+P(B)−P(A∩B)P(A \cup B) = P(A) + P(B) - P(A \cap B); P(A′)=1−P(A)P(A') = 1 - P(A).
  • Mutually exclusive: P(A∩B)=0P(A \cap B) = 0. Independent: P(A∩B)=P(A)P(B)P(A \cap B) = P(A)P(B).
  • P(A∣B)=P(A∩B)P(B)P(A \mid B) = \frac{P(A \cap B)}{P(B)}.
  • Trees: multiply along, add between paths.

Worked examples

Try each one yourself first, then open the solution.

Example 1A Venn diagram from given probabilities

P(A)=0.5P(A) = 0.5, P(B)=0.4P(B) = 0.4 and P(A∪B)=0.7P(A \cup B) = 0.7. Find P(A∩B)P(A \cap B) and P(A∩B′)P(A \cap B').

Show the solution
  1. 1Addition rule

    0.7=0.5+0.4−P(A∩B)⇒P(A∩B)=0.20.7 = 0.5 + 0.4 - P(A \cap B) \Rightarrow P(A \cap B) = 0.2.

  2. 2Only AA

    P(A∩B′)=0.5−0.2=0.3P(A \cap B') = 0.5 - 0.2 = 0.3.

Answer

0.20.2 and 0.30.3

Example 2Testing independence

P(A)=0.6P(A) = 0.6, P(B)=0.3P(B) = 0.3, P(A∩B)=0.18P(A \cap B) = 0.18. Are AA and BB independent?

Show the solution
  1. 1Product

    P(A)P(B)=0.6×0.3=0.18P(A)P(B) = 0.6 \times 0.3 = 0.18.

  2. 2Compare

    This equals P(A∩B)P(A \cap B), so AA and BB are independent.

Answer

Yes, independent

Example 3Conditional probability from a table

80 students chose a language.

FrenchSpanishTotal
Year 12182240
Year 13261440

A student who chose Spanish is picked at random. Find the probability they are in Year 13.

Show the solution
  1. 1Restrict to Spanish

    22+14=3622 + 14 = 36 students chose Spanish.

  2. 2Share in Year 13

    1436=718\frac{14}{36} = \frac{7}{18}.

Answer

718\frac{7}{18}

Example 4Without replacement

A bag has 5 red and 3 blue counters. Two are taken without replacement. Find the probability they are different colours.

Show the solution
  1. 1Red then blue

    58×37=1556\frac58 \times \frac37 = \frac{15}{56}.

  2. 2Blue then red

    38×57=1556\frac38 \times \frac57 = \frac{15}{56}.

  3. 3Add

    3056=1528\frac{30}{56} = \frac{15}{28}.

Answer

1528\frac{15}{28}

Example 5A medical test

1% of people have a condition. A test is positive for 95% of people with it and 5% of people without it. Find the probability that someone who tests positive has the condition.

Show the solution
  1. 1Positive and has it

    0.01×0.95=0.00950.01 \times 0.95 = 0.0095.

  2. 2Positive and does not

    0.99×0.05=0.04950.99 \times 0.05 = 0.0495.

  3. 3Conditional

    0.00950.0095+0.0495=0.00950.059=0.161\dfrac{0.0095}{0.0095 + 0.0495} = \dfrac{0.0095}{0.059} = 0.161.

  4. 4Interpret

    Only about 16%: most positives are false positives because the condition is rare.

Answer

0.1610.161

Beyond the specification

University-level ideas and the deeper mathematics behind this topic. Not needed for exams, but this is where the subject really opens up.

Kolmogorov's axioms: probability made rigorous (university)

For centuries probability was a collection of clever tricks for dice and cards, with no agreed foundation. In 1933 Kolmogorov gave one, based on measure theory, and it is still the standard.

DefinitionProbability space

A sample space Ω\Omega, a collection F\mathcal F of subsets of Ω\Omega called events (closed under complements and countable unions: a σ\sigma-algebra), and a function P:F→[0,1]P: \mathcal F\to[0, 1] satisfying:

  1. P(Ω)=1P(\Omega) = 1;
  2. countable additivity: if A1,A2,…A_1, A_2, \ldots are pairwise disjoint, then P(⋃Ai)=∑P(Ai)P\left(\bigcup A_i\right) = \sum P(A_i).

Everything else is a theorem. For example:

  • P(∅)=0P(\emptyset) = 0;
  • P(A′)=1−P(A)P(A') = 1 - P(A);
  • A⊆B⇒P(A)≤P(B)A \subseteq B \Rightarrow P(A) \le P(B);
  • the addition rule;
  • continuity: if A1⊆A2⊆⋯A_1 \subseteq A_2 \subseteq \cdots then P(⋃An)=lim⁡P(An)P\left(\bigcup A_n\right) = \lim P(A_n).

Why such machinery?

Infinite sample spaces. "Pick a uniformly random real number in [0,1][0, 1]": every single point has probability 00, yet the total is 11. You cannot add up the probabilities of points. You must work with intervals and, more generally, with measurable sets.

Not every set can have a probability. Vitali (1905) showed, using the axiom of choice, that there are subsets of [0,1][0, 1] to which no "length" can consistently be assigned. That is why F\mathcal F is not simply "all subsets".

ParadoxBertrand's chord paradox (1889)

What is the probability that a "random chord" of a circle is longer than the side of the inscribed equilateral triangle?

  • Random endpoints on the circle: 13\frac13.
  • Random distance of the chord from the centre: 12\frac12.
  • Random midpoint in the disc: 14\frac14.

Three reasonable answers, because "random chord" is not well defined until you specify the probability measure. The lesson: probabilities depend on the model, and "uniformly at random" must be made precise.

Bayesian inference (university)

Bayes' theorem is more than a formula for medical tests. It is a complete theory of learning from evidence: start with a prior belief, observe data, and update to a posterior.

posterior∝likelihood×prior.\text{posterior} \propto \text{likelihood}\times\text{prior}.
ExampleIs the coin biased?

Let pp be the unknown probability of heads, with a uniform prior on [0,1][0, 1]. We toss nn times and see kk heads. The likelihood is proportional to pk(1−p)n−kp^k(1-p)^{n-k}, so the posterior density is

f(p∣data)=pk(1−p)n−kB(k+1,n−k+1),f(p\mid\text{data}) = \frac{p^k(1-p)^{n-k}}{B(k+1, n-k+1)},

a Beta distribution. (The normalising constant is the Beta integral from the Integration lesson.) Its mean is k+1n+2\frac{k+1}{n+2}.

TheoremLaplace's rule of succession (1774)

After kk successes in nn trials, with a uniform prior, the probability that the next trial succeeds is k+1n+2\frac{k+1}{n+2}.

Laplace famously asked: given that the sun has risen every day for 50005000 years, what is the probability it rises tomorrow? His answer, about 1−11 826 2001 - \frac{1}{1\,826\,200}, was partly a joke, but the formula is sound. It never claims certainty from finite data, and it gives sensible answers for small samples: after 11 success in 11 trial, 23\frac23 rather than the overconfident 11.

Bayesian vs frequentist

  • Frequentist: probability is a long-run frequency. Parameters are fixed unknowns; data are random. This gives hypothesis tests and confidence intervals (see Hypothesis testing).
  • Bayesian: probability is a degree of belief. Parameters have distributions. This gives posterior distributions and credible intervals.

Both are internally consistent. Modern statistics and machine learning use both, often together. Spam filters, recommendation systems and many AI models are Bayesian at heart.

Mathematical curiosityCromwell's rule

Never give a prior probability of exactly 00 or 11 to anything not logically certain. If P(H)=0P(H) = 0, then P(H∣E)=0P(H\mid E) = 0 whatever the evidence: no amount of data can change your mind. The name comes from Cromwell's plea: "I beseech you, in the bowels of Christ, think it possible that you may be mistaken."

Markov chains (university)

Many random processes move between states, with the next state depending only on the current one, not on the history. That is a Markov chain.

DefinitionMarkov chain

States 1,…,n1, \ldots, n and a transition matrix PP, where pijp_{ij} is the probability of moving from state ii to state jj. Each row sums to 11. If πt\boldsymbol\pi_t is the row vector of state probabilities at time tt, then

πt+1=πtP,soπt=π0Pt.\boldsymbol\pi_{t+1} = \boldsymbol\pi_tP, \qquad\text{so}\qquad \boldsymbol\pi_t = \boldsymbol\pi_0P^t.
ExampleWeather

Sunny tomorrow with probability 0.80.8 after a sunny day, and 0.40.4 after a rainy one:

P=(0.80.20.40.6).P = \begin{pmatrix}0.8 & 0.2\\ 0.4 & 0.6\end{pmatrix}.

A stationary distribution satisfies πP=π\boldsymbol\pi P = \boldsymbol\pi. Here πS=0.8πS+0.4πR\pi_S = 0.8\pi_S + 0.4\pi_R gives πS=2πR\pi_S = 2\pi_R, so π=(23,13)\boldsymbol\pi = \left(\frac23, \frac13\right). In the long run it is sunny two days in three, whatever today's weather.

TheoremConvergence (ergodic theorem)

If every state can reach every other (irreducible) and the chain is not periodic, then πt→π\boldsymbol\pi_t \to \boldsymbol\pi, the unique stationary distribution, from any starting distribution. Moreover, the long-run fraction of time spent in each state equals π\boldsymbol\pi.

In linear algebra terms, π\boldsymbol\pi is a left eigenvector of PP with eigenvalue 11. The other eigenvalues have modulus less than 11, and their influence decays geometrically.

Applications

  • Google PageRank: a random surfer follows links. Each page's importance is its stationary probability.
  • Gambler's ruin (question Q44): a chain with absorbing states, solved by first-step analysis.
  • Text prediction: Shannon (1948) generated eerily English-like text with letter-level Markov chains. Modern language models are vastly more sophisticated descendants.
  • MCMC (Markov chain Monte Carlo): build a chain whose stationary distribution is a target you cannot sample directly. It is the workhorse of Bayesian statistics and computational physics.
  • Card shuffling: Bayer and Diaconis (1992) showed that about 77 riffle shuffles bring a pack close to the uniform distribution. Fewer leave detectable order.

Paradoxes of probability (university)

Probability is where intuition most often fails. These classic paradoxes each teach a precise lesson.

ParadoxSimpson's paradox

A hospital trial of two kidney-stone treatments (a real 1986 study):

small stoneslarge stonesall
A81/87=93%81/87 = 93\%192/263=73%192/263 = 73\%273/350=78%273/350 = 78\%
B234/270=87%234/270 = 87\%55/80=69%55/80 = 69\%289/350=83%289/350 = 83\%

AA is better for small stones and for large stones, yet BB looks better overall. Why: AA was mostly given to the harder, large-stone cases. Stone size is a confounding variable. Aggregated data can reverse a trend that holds in every subgroup, so correlation alone cannot settle causation.

ParadoxThe St Petersburg paradox (1713)

Toss a coin until it lands heads; if that takes nn tosses you win £2n2^n. The expected winnings are

∑n≥112n⋅2n=1+1+1+⋯=∞.\sum_{n\ge1}\frac{1}{2^n}\cdot2^n = 1 + 1 + 1 + \cdots = \infty.

Yet nobody would pay £1000 to play. Daniel Bernoulli's resolution (1738): people value money by its utility, roughly log⁡(wealth)\log(\text{wealth}), not its face value. The expected utility is finite. This was the birth of economic decision theory.

ParadoxThe two-envelope paradox

One envelope holds twice as much as the other. You open one and find £xx. "The other holds £2x2x or £x2\frac x2 with equal chance, expected £1.25x1.25x, so switch!" But the same argument then says switch back, for ever. The flaw: "equal chance" for every xx requires a uniform prior on all amounts, which is not a probability distribution. With any genuine prior, the argument breaks down.

ParadoxThe gambler's fallacy and the hot hand

After ten reds at roulette, black is not "due": each spin is independent (question Q50). In 1913 at Monte Carlo, black came up 2626 times in a row, and gamblers lost millions betting on red. The converse belief, the "hot hand" in sport, was long dismissed as the same fallacy. Then Miller and Sanjurjo (2018) found a subtle bias in the original statistical analysis, and a modest hot-hand effect may be real after all.

Why does this work?

Why does this work?Why is P(A∣B)=P(A∩B)P(B)P(A \mid B) = \frac{P(A \cap B)}{P(B)}?

Knowing BB has happened restricts the possible outcomes to BB. Probabilities within this new world must still add to 11, so we rescale everything in BB by 1P(B)\frac{1}{P(B)}. The part of AA still possible is A∩BA \cap B. Rearranging gives Bayes' theorem, P(A∣B)=P(B∣A)P(A)P(B)P(A \mid B) = \frac{P(B \mid A)P(A)}{P(B)}, which turns "probability of the evidence given the cause" into "probability of the cause given the evidence".

Beyond the syllabus

Beyond the syllabusKolmogorov's axioms and measure-theoretic probability

In 1933 Kolmogorov based probability on measure theory: a probability space is a set Ω\Omega of outcomes, a collection F\mathcal F of events closed under complements and countable unions, and a measure PP with P(Ω)=1P(\Omega) = 1 and P(⋃Ai)=∑P(Ai)P\left(\bigcup A_i\right) = \sum P(A_i) for disjoint events. Everything else (conditional probability, independence, expectation as an integral) follows. This framework makes sense of questions such as "choose a real number uniformly in [0,1][0, 1]: what is the probability it is rational?" (Answer: 00, although it is possible.)

Beyond the syllabusThe Monty Hall problem, explained by conditioning

You pick door 1. The host, who knows where the car is, opens door 3 to reveal a goat. Should you switch to door 2? Let CiC_i be "car behind door ii" and H3H_3 "host opens 3". Then P(H3∣C1)=12P(H_3 \mid C_1) = \frac12, P(H3∣C2)=1P(H_3 \mid C_2) = 1, P(H3∣C3)=0P(H_3 \mid C_3) = 0. By Bayes, P(C2∣H3)=1⋅1312⋅13+1⋅13=23P(C_2 \mid H_3) = \frac{1 \cdot \frac13}{\frac12\cdot\frac13 + 1\cdot\frac13} = \frac23. Switching wins twice as often.

Mathematical curiosities

ParadoxThe birthday problem

With just 23 people, the probability that two share a birthday exceeds 12\frac12: 1−365×364×⋯×34336523≈0.5071 - \frac{365 \times 364 \times \cdots \times 343}{365^{23}} \approx 0.507. There are (232)=253\binom{23}{2} = 253 pairs, each a chance for a match.

ParadoxThe two-envelope paradox

Two envelopes hold amounts xx and 2x2x. You open one and see £100. Switching seems to give 12(50)+12(200)=125>100\frac12(50) + \frac12(200) = 125 > 100, so always switch... and by symmetry switch back. The error: there is no uniform distribution over all possible amounts, so the "12\frac12" is not justified.

Further exploration

Further explorationInvestigations
  • How many people are needed for a 99% chance of a shared birthday? (Answer: 57.)
  • Bertrand's paradox: what is the probability a "random" chord of a circle is longer than the side of the inscribed equilateral triangle? Three reasonable methods give 13\frac13, 12\frac12 and 14\frac14. Why?

Reading pathway: Fifty Challenging Problems in Probability (Mosteller); Probability and Random Processes (Grimmett and Stirzaker).

Now practise60 questions from Very easy to Extreme →