Probability – calculating with uncertainty

Probability theory was born at the gaming table in the 17th century and is today the foundation of quantum mechanics, statistical physics, insurance, clinical trials and weather forecasts. Here are the basic ideas: sample spaces and events, the rules of calculation and Kolmogorov’s axioms, probability as area in Venn diagrams, the combinatorics behind dice and lotteries – and a few classic problems where intuition goes wrong.

From the gaming table

Around 1560 the Italian physician and mathematician Gerolamo Cardano wrote the first book on dice games, Liber de ludo aleae, which was not printed until 1663. The real breakthrough came in 1654, when the French gambler Chevalier de Méré put two questions to Blaise Pascal. One was why he made money betting on at least one six in four throws of one die, but lost betting on at least one double six in 24 throws of two dice. The answer:

$$1 - \left(\tfrac56\right)^4 = 0.518 \qquad\text{but}\qquad 1 - \left(\tfrac{35}{36}\right)^{24} = 0.491$$

The other was the “problem of points”: how should the stakes be divided fairly if a game is interrupted early? Pascal’s correspondence with Pierre de Fermat on that question is regarded as the birth of probability theory. Christiaan Huygens wrote the first textbook in 1657, Jacob Bernoulli proved the law of large numbers (1713), and Pierre-Simon Laplace gathered it all together in Théorie analytique des probabilités (1812).

What is probability?

A sample space $U$ is the set of all possible outcomes of an experiment: $\{1,2,3,4,5,6\}$ for a die. An event is a subset, e.g. “an even number” $= \{2,4,6\}$. The probability of an event can be understood in three ways:

Classical (Laplace)

If all outcomes are equally likely: $P(A) = \dfrac{\text{number of favourable}}{\text{number of possible}}$. For “even” with a die: $3/6 = \tfrac12$. Requires symmetry.

Frequentist

The relative frequency in the long run: $P(A) = \lim_{n\to\infty} n_A/n$. This is how the probability of a drawing pin landing point up is determined – or of a nucleus decaying.

Subjective (Bayesian)

The degree of reasonable belief, given the knowledge one has: “70 % chance of rain tomorrow”. It is updated when new data arrive – see the page on Bayes’ theorem.

Rules of calculation and Kolmogorov’s axioms

Only in 1933 did the Russian mathematician Andrey Kolmogorov give probability theory a rigorous mathematical foundation with three axioms: (1) $P(A) \ge 0$, (2) $P(U) = 1$, and (3) for mutually exclusive events the probabilities add. Everything else follows:

$$P(\bar A) = 1 - P(A),\qquad P(A \cup B) = P(A) + P(B) - P(A \cap B)$$

The complement rule is often the easy route: the probability of at least one six is $1$ minus the probability of none. The addition rule subtracts the intersection because it would otherwise be counted twice – as the Venn diagrams familiar from logic show.

Probability as area

Probabilities behave like areas: draw the sample space as a square of area 1, and an event is a region whose probability is its area. The diagram on the left is drawn to scale; the Venn diagram on the right shows the probabilities of the four regions.

Try it: In the area diagram B fills part of the column A (the height is $P(B\,|\,A)$) and part of the rest (the height is $P(B\,|\,\bar A)$). When the two heights are equal, A and B are independent: knowing that A has occurred does not change the probability of B. Try the “Disjoint” button: mutually exclusive events are not independent – on the contrary, if A occurs, B cannot.

Conditional probability and independence

The probability of $A$ given that $B$ has occurred is

$$P(A\,|\,B) = \frac{P(A \cap B)}{P(B)}\qquad\Longleftrightarrow\qquad P(A \cap B) = P(B)\,P(A\,|\,B)$$

Conditioning means shrinking the sample space down to $B$. $A$ and $B$ are independent if $P(A \cap B) = P(A)\,P(B)$, i.e. $P(A\,|\,B) = P(A)$. Throws of a die are independent; drawing cards without replacement is not. Conditional probabilities are best handled with contingency tables and tree diagrams – see the separate page – and turning them round, from $P(B\,|\,A)$ to $P(A\,|\,B)$, is exactly what Bayes’ theorem does.

Combinatorics – the art of counting

Classical probabilities require counting. The basic rule is the multiplication principle: if one choice can be made in $m$ ways and a subsequent one in $n$ ways, the two can be made in $m \cdot n$ ways. Hence:

Choosing k from nOrder mattersOrder does not matter
With replacement$n^k$ (e.g. PIN codes: $10^4$)$\binom{n+k-1}{k}$
Without replacement$\dfrac{n!}{(n-k)!}$ (e.g. medals: $8\cdot7\cdot6$)$\dbinom{n}{k} = \dfrac{n!}{k!\,(n-k)!}$ (e.g. lotteries)

The numbers grow astonishingly fast. A pack of cards can be shuffled in $52! \approx 8 \cdot 10^{67}$ ways – so many that a well-shuffled pack is almost certainly in an order that has never existed before.

Two dice

With two dice there are $6 \cdot 6 = 36$ equally likely outcomes. The sum, however, is not uniformly distributed: there are six ways of getting 7 but only one way of getting 2 or 12. It was just this kind of counting that Galileo helped a gambler with around 1620: why does the sum 10 come up more often than 9 with three dice, when both can be formed in six ways? (Answer: 10 can be formed in 27 ordered ways, 9 in 25.)

Try it: Click a cell in the table or a bar in the chart to see which outcomes give that value. Switch to “the larger”: the probability that the larger is $k$ is $(2k-1)/36$ – sixes are clearly the most frequent. Throw 1000 times and compare the red (simulated) bars with the blue (theoretical) ones.

The birthday problem

How many people must be in a room before it is more likely than not that two share a birthday? The answer is surprisingly low: 23. It is easiest to calculate the complement – that everyone has a different birthday:

$$P(\text{at least two the same}) = 1 - \frac{365}{365}\cdot\frac{364}{365}\cdots\frac{365-n+1}{365}$$

Intuition goes wrong because it thinks of my birthday. But with 23 people there are $\binom{23}{2} = 253$ pairs, each of which may share a birthday. The same mathematics lies behind “collisions” in computer science: if a password is stored as a random number with $N$ possible values, two identical ones can be expected after only about $\sqrt N$ attempts.

Try it: On the right a calendar for a random group: blue days have one birthday, red days two or more. Press “1000 groups” and see that about half the groups of 23 have a coincidence. The blue dashed curve is the probability that someone shares your birthday – it only reaches 50 % at about 250 people.

Lotteries and the hypergeometric distribution

In the Danish Lotto you choose 7 numbers out of 36. The number of possible rows is $\binom{36}{7} = 8\,347\,680$. The probability of exactly $j$ correct follows the hypergeometric distribution: choose $j$ of the 7 winning numbers and $7-j$ of the 29 others:

$$P(j\ \text{correct}) = \frac{\binom{7}{j}\binom{29}{7-j}}{\binom{36}{7}}$$
Try it: The most likely result in Lotto is 1 correct. The bar for all correct is too low to be seen. In Eurojackpot one must also match 2 of 12 “Euro numbers”, which multiplies the number of combinations by 66, so the chance of the jackpot is 1 in 139,838,160.

Expected value – what do you get in the long run?

The expected value of a winning is the sum of each prize times its probability: $E(X) = \sum x_i\,p_i$. In roulette with 37 pockets (0–36) and a stake on red you win 1 unit with probability $18/37$ and lose 1 unit with probability $19/37$; the expectation is $-1/37 \approx -2.7$ % of the stake. That is the casino’s edge, and the law of large numbers ensures it turns into money. In lotteries typically around half the stakes are paid out as prizes, so the expected value is around −50 % of the stake.

Common fallacies

The gambler’s fallacy

“Red has come up eight times in a row, now black must come.” But the ball has no memory. In Monte Carlo in 1913 black came up 26 times in a row, and gamblers lost fortunes betting on red.

The conjunction fallacy

Tversky and Kahneman’s “Linda problem” (1983): many judge “Linda is a bank teller and a feminist” to be more probable than “Linda is a bank teller”. But $P(A \cap B) \le P(A)$ always.

Swapping the condition

$P(\text{wet street}\,|\,\text{rain})$ is high, but it is not the same as $P(\text{rain}\,|\,\text{wet street})$. Confusing the two is called the prosecutor’s fallacy – see Bayes’ theorem.

The law of small numbers

Small samples fluctuate a lot. The smallest schools have both the best and the worst averages – not because they are special, but because the average of a few pupils is uncertain (standard deviation $\sigma/\sqrt n$).

Further reading