Stage I · Bachelor's: Foundations
Part 2 of 65Chance, Counted
How do you reason exactly about what might happen?
In 1654 a game to three points is interrupted at two to one, and Pascal and Fermat divide the pot: Fermat completes the future and counts four equally likely continuations, Pascal averages backwards from the end, and expectation is born. Galileo's dice and de Mere's bets show how easily the wrong cases are called equally likely, and Bertrand's three random chords show that 'at random' means nothing until a measure is chosen. Kolmogorov's axioms make the measure the foundation. Conditioning renormalizes a slice, and Bayes' theorem in odds form turns a ninety percent sensitive screening test into a fifteen percent chance of having the condition. The transposed conditional then sends Sally Clark to prison, and Monty Hall shows that the host's protocol is part of the data. Random variables, expectation, variance, the St. Petersburg game and generating functions follow, and the part ends with the old argument about what a probability is.
What you need. School algebra, and sums of series for the 1/e and coupon-collector limits.
- Hook
- the problem of points, 1654
- Mathematics
- axioms, conditioning, Bayes, independence, random variables, expectation, Dutch books
- Built
- an exact probability engine
What you will be able to do
Bachelor's
- Compute a probability by counting equally likely cases, and say which cases are equally likely and why.
- Compute the chance of a condition given a positive test from the prevalence, sensitivity and specificity, in natural frequencies and in odds form.
- Compute expectations by linearity and indicators: matches in a shuffle, birthdays, the coupon collector.
Master's
- Derive inclusion-exclusion and the union bound from the axioms, and the derangement probability's limit 1/e.
- Compute Monty Hall under each host protocol and explain why the likelihood depends on how the evidence was produced.
PhD
- Prove that betting prices immune to a finite Dutch book are finitely additive, and state what countable additivity needs beyond that.
- Explain why the Cantor distribution is continuous yet has no density.
Practice
- Diagnose a transposed conditional in a report or a courtroom, and restate the evidence as a likelihood ratio.
- Check an exact answer against a seeded simulation and say how large a gap is noise.
Contents
Each chapter has a home level. Choose a track to see what to read and watch: Bachelor's 52 min · Master's 71 min · PhD 74 min · Practice 57 min.
- 0The problem of pointsBachelor's5 min
- 1Before the axiomsBachelor's5 min
- 2CountingBachelor's5 min
- 3Bertrand's paradoxBachelor's4 min
- 4Kolmogorov's axiomsMaster's6 min
- 5ConditioningBachelor's4 min
- 6Bayes' theoremBachelor's6 min
- 7The prosecutor's fallacyPractice5 min
- 8Monty HallBachelor's5 min
- 9IndependenceBachelor's4 min
- 10Random variablesMaster's4 min
- 11ExpectationBachelor's6 min
- 12Variance, and a game worth infinityBachelor's5 min
- 13Generating functionsMaster's4 min
- 14What probability meansPhD4 min
- Recap, problems, and the road aheadAll tracks4 min
Also on this page: Lecture · Key results · Try it · Lab · Problems · Notes and sources · Build the film.
Lecture
The text of each chapter is the film's narration, as it is spoken, so you can read along or revise without the film. The pictures are in the film. A dashed box stands for a number the film computes when it is rendered (hover over it to see what is computed); the README's figures for each chapter, where it lists them, follow the chapter's text.
The problem of pointsBachelor's5 min
In the summer of 1654, two Frenchmen began exchanging letters about a gambling problem. One was Blaise Pascal, in Paris: thirty-one years old, already famous for a calculating machine and for experiments on the vacuum. The other was Pierre de Fermat, a magistrate in Toulouse, who did mathematics in the evenings and rarely published any of it. The problem had reached Pascal, by most accounts, from a gambler and writer, the Chevalier de Méré. It was already two hundred years old, and nobody had solved it. In a few letters, they did, and in solving it they invented the mathematics of chance.
Here's the problem, in the form Pascal wrote it down. Two players, call them A and B, each put thirty-two pistoles into the pot. They play a game of rounds, each round a fair toss: whoever wins a round scores a point, and the first to three points takes all sixty-four. They play. A wins a round, then B, then A. The score is two to one, and the game is interrupted: there's no more time, or the lights go out, or someone knocks at the door. The game will never be finished. How should they divide the pot? Not fifty-fifty: A is ahead. Not all to A: A hasn't won yet. Then what's fair?
People had tried. In 1494 the Franciscan friar Luca Pacioli, Leonardo's friend and the father of double-entry bookkeeping, proposed dividing the pot in proportion to the points won: two to one. Forty-two and two-thirds pistoles to A, twenty-one and a third to B. Sixty years later Tartaglia pointed out the flaw. If the game stopped at one to nothing, Pacioli's rule would give A the entire pot, after a single round of a game to three. That can't be fair. The fault is deeper than the arithmetic. Pacioli divides by the past, by what has already happened. A fair division should depend on the future: on what could still happen, if the game went on.
Fermat's answer is a trick of the imagination. A needs one more point; B needs two. So at most two more rounds would settle it. Imagine those two rounds are played, whatever happens. There are four ways they could go, each equally likely: A A, A B, B A, B B. In three of the four, A gets the point first. Only if B wins both does B take the game. So A should have three quarters of the pot, forty-eight pistoles, and B one quarter, sixteen. A colleague of Pascal's, Gilles de Roberval, objected: if A wins the next round, the second is never played, so why count it? Fermat's reply is the heart of the method: playing a round that can't change the winner changes nothing, so you may imagine it played. Complete the future, then count. Sixty-four pistoles, split forty-eight to sixteen.
Pascal solved it differently, and his way would turn out to be even more powerful. Start from the score, two to one, and look one round ahead. If A wins it, A has three points and takes all sixty-four. If B wins it, the score is two all; then the game is symmetric, and each deserves half, thirty-two. Each happens with probability one half, so A deserves the average of sixty-four and thirty-two: forty-eight. The same answer as Fermat's, by a different road. And the road goes everywhere. Write the value to A of every score in a table: sixty-four where A has won, zero where B has, and fill in the rest backwards, each cell the average of the cell above it and the cell to its right. That one rule, the value now is the average of the values next, is what Christiaan Huygens would call, three years later, the value of a chance. We call it expectation. Working backwards from the end is what we now call dynamic programming.
Throughout this part we'll check every exact answer against simulation. Here are games, each restarted from two to one and actually played out with simulated fair tosses. The fraction that A wins wanders, then settles: , against Fermat's three quarters. The exact answer is gold, the simulated one blue, and the gap between them is the noise of a finite experiment, a gap the rest of this series will learn to measure.
What it does: Pascal and Fermat, 1654. Pacioli's split by the past (1494) and Tartaglia's objection. Fermat completes the future: 4 equally likely continuations. Pascal's backward recursion, the table of values for a game to three, and expectation.; Numbers (computed): A's share 3/4 → 48 of 64 pistoles; 10,000 simulated finishes 0.7515
1Before the axiomsBachelor's5 min
Pascal and Fermat didn't start from nothing. About ninety years earlier, Gerolamo Cardano, a physician, a mathematician and a compulsive gambler, wrote a little Book on Games of Chance. It sat unpublished for a hundred years. Cardano's idea was the circuit: list every way a throw can go. One die has six. If they're equally likely, the fair odds of an event are just the number of ways it can happen against the number it can't. Say it as a fraction and you have the classical definition, the one Laplace would make famous: the probability of an event is the number of outcomes in it over the number of outcomes in all, provided every outcome is equally likely. Everything rests on that proviso. It sounds harmless. It isn't.
Around 1620 someone put a question to Galileo. Gamblers playing with three dice had noticed that a total of ten comes up more often than a total of nine. But both totals can be made in exactly six ways. Nine is one-two-six, one-three-five, one-four-four, two-two-five, two-three-four, three-three-three. Ten is one-three-six, one-four-five, two-two-six, two-three-five, two-four-four, three-three-four. Six each. So why the difference? Galileo's answer: the six ways are not equally likely. The dice are three different objects, and the outcomes that are equally likely are the ordered triples, red then green then blue, six times six times six, two hundred and sixteen of them. One-two-six can come in six orders. One-four-four in only three: the odd die can be first, second or third. Three-three-three in only one. Count the orders, and nine has twenty-five of the two hundred and sixteen, while ten has twenty-seven.
Here's the whole distribution of the total, all two hundred and sixteen ordered throws sorted by their sum. Ten and eleven are the peak; nine is a little lower. This is the first time we use the engine we're building. Three dice are a die to the third power, a product of three independent copies; map each triple to its sum, and ask for the probability of nine or ten. It answers with exact fractions. And a hundred thousand simulated throws agree, to about three decimals. The difference between nine and ten is two chances in two hundred and sixteen, less than one percent. To see it at the table, a gambler would have needed thousands of throws, and a good memory.
The Chevalier de Méré, the gambler who brought Pascal his problem, had a second puzzle. He knew it paid to bet on getting at least one six in four throws of a die. The chance of no six in one throw is five sixths; in four independent throws, five sixths to the fourth; so the chance of at least one six is one minus that, , a little better than even. He reasoned that a double six with two dice is six times rarer, so six times as many throws, twenty-four, should give the same odds: four out of six equals twenty-four out of thirty-six. But the same calculation gives one minus thirty-five thirty-sixths to the twenty-fourth: . Worse than even. Simulation agrees on both. Probability doesn't scale like a proportion. The chance of at least one double six crosses one half between twenty-four throws and twenty-five. Pascal told Fermat that de Méré had a very good mind, but was not a geometer. Whether he really noticed the difference from his losses is doubtful; the edge is under one percent. But his argument was wrong, and the mistake, treating chances as if they added up in proportion, is still made every day.
In 1657 the young Dutch scientist Christiaan Huygens, who had heard about the Paris problems on a visit but never seen the letters, worked out the theory for himself and published it: the first printed book on probability. Its central idea is what Pascal used for the stake. If you have p equally likely chances of winning a, and q of winning b, your chance is worth p a plus q b, over p plus q. At two to one, that's one chance of sixty-four and one of thirty-two: forty-eight. Huygens' book was the standard text for half a century; its last problem, about two players gambling until one is ruined, comes back when we study random walks. So far everything has rested on equally likely cases. Galileo had to think hard about which cases those were. Our next tool counts cases, and the chapter after it shows what happens when nobody can agree on which ones are equally likely.
What it does: Cardano's circuit and the classical definition. Galileo's three dice: 25 vs 27 orderings. De Méré's two bets, exactly and simulated. Huygens' value of a chance (1657).; Numbers (computed): 671/1296 = 0.5177 vs 0.4914; a double six needs 25 throws
2CountingBachelor's5 min
Classical probability turns every question into a count, so we need to count well. The first rule is multiplication. One die: six outcomes. Two dice: for each of the first die's six faces, six for the second, thirty-six pairs, a six by six grid. Three dice: six of those grids, one for each face of the third die, two hundred and sixteen. In general, if one choice can be made in m ways and then another in n ways, whatever the first was, the pair can be made in m times n ways.
Arrangements next. In how many orders can five different balls be put in a row? Five choices for the first place; whichever we chose, four left for the second; then three, two, one. Five times four times three times two times one: five factorial, a hundred and twenty. Factorials grow ferociously. A deck of fifty-two cards can be ordered in fifty-two factorial ways, a number with digits. If every person who has ever lived had shuffled a deck every second since the universe began, they would not have made a dent in it. A well-shuffled deck is almost surely in an order no deck has ever been in.
Often order doesn't matter: a hand of cards, a committee, a lottery ticket. To choose k things from n in order, there are n choices, then n minus one, down to n minus k plus one: n factorial over n minus k factorial. But every set of k things has been counted once for each of its orders, and there are k factorial of those. Divide them out: n choose k, n factorial over n minus k factorial times k factorial. Choose six numbers from forty-nine and there are tickets: one chance in nearly fourteen million.
Arrange the counts n choose k in rows, and you get the triangle that bears Pascal's name, though it was known centuries earlier in China, India and Persia. Each entry is the sum of the two above it. Why? Fix one of the n items. The sets of k either contain it, and then choose k minus one of the rest, or don't, and choose all k from the rest. Pascal used the triangle to solve the problem of points in general. If A needs a more points and B needs b, imagine all a plus b minus one remaining rounds played, as Fermat did. A wins the match exactly when A wins at least a of them, so the answer is a sum along one row of the triangle, divided by two to that power. Our game, A needing one and B two, is row two: three of four. And here's the whole family: the chance that A wins, for every pair of points still needed, from one to five each. It's one half down the diagonal, of course, and it falls off as A needs more.
One more counting trick, and one more trap. If we ignore the order of three dice, how many different rolls are there? Write a roll as stars and bars: a star for each die, sorted into six bins by face, with five bars between the bins. One, two, three is a star in each of the first three bins. Three, three, six: two stars in bin three, one in bin six. Five, five, five: three stars in bin five. Every roll is an arrangement of three stars and five bars in eight places, so there are eight choose three of them: fifty-six. And here's the trap Galileo avoided. Fifty-six rolls, but they are not equally likely. Five, five, five happens one way in two hundred and sixteen; three, three, six three ways; one, two, three six ways. Divide by fifty-six and you get the wrong answer for real dice. Nature also uses occupation-number counting for indistinguishable bosons, including photons. That does not make every occupation pattern equally likely: the physical state and the energies determine the probabilities. Which cases are equally likely is a modelling assumption, not a consequence of counting.
What it does: The multiplication principle; n!, and 52! with its 68 digits. C(n, k) derived on screen. Pascal's triangle and the general problem of points. Stars and bars: 56 unordered rolls of three dice, not equally likely (Bose–Einstein aside).; Numbers (computed): C(49, 6) = 13,983,816
3Bertrand's paradoxBachelor's4 min
Galileo had to choose which cases were equally likely. In 1889 Joseph Bertrand showed that sometimes the choice decides the answer. Take a circle, and draw the equilateral triangle inside it; its side is root three times the radius. Now draw a chord of the circle at random. What's the probability that the chord is longer than the triangle's side? It sounds like a question with one answer. Bertrand gave three, each argued correctly.
Here they are, side by side. Method one: pick two points on the circle at random and join them. By symmetry, fix the first point at the top. The chord is long exactly when the second point lands on the far third of the circle, between the triangle's other two corners. Probability one third. Method two: pick a radius at random, then a point on it at random, and draw the chord through that point, at right angles to the radius. The chord is long exactly when the point is in the inner half of the radius. Probability one half. Method three: pick a point anywhere in the disc at random and draw the chord that has it as its midpoint. The chord is long exactly when the midpoint is inside the circle of half the radius, which has a quarter of the area. Probability one quarter. And simulation agrees with all three: chords each, long in , and of cases. Three correct calculations, three different answers.
How can that be? Look at what each method actually does. A chord is determined by its midpoint, so shrink every chord to its midpoint. The three methods scatter the midpoints in three different ways. Two random endpoints put most midpoints near the rim. A random point on a random radius crowds them toward the centre. A random midpoint spreads them evenly. These are three different probability distributions on the same set of chords. Each method is a different meaning of the words at random, and the question, as asked, didn't say which.
The lesson is the reason modern probability is built the way it is. A probability model has two parts: a set of possible outcomes, and a rule that assigns each event a probability. Counting equally likely cases is one such rule, and it works for dice. On a continuum, like the set of all chords, there's no natural count, and at random means nothing until you've chosen the rule. Can a principle choose it for us? In 1973 the physicist Edwin Jaynes argued that for a line-sampling process defined independently of the circle, invariant under translation and rotation. Conditional on a line hitting the circle, this gives the second method and one half. That specifies an extra physical sampling model. Simply rotating or scaling each of our three constructions along with its circle does not distinguish them. On a continuum, equally likely is a choice of measure. So the measure itself must be part of the foundations. In 1933 Andrey Kolmogorov wrote those foundations down.
What it does: Three ways to pick a random chord: 1/3, 1/2, 1/4, each simulated 3,000 times. The chords' midpoints form three different clouds, three measures on the same set. Jaynes's stationary, isotropic line-sampling model (1973).; Numbers (computed): 0.343, 0.495, 0.242
4Kolmogorov's axiomsMaster's6 min
Bertrand's paradox showed that at random has to be defined. In 1933 Andrey Kolmogorov, thirty years old, defined it. In 1900 David Hilbert had listed the axioms of probability among the great open problems. Kolmogorov's answer was to treat probability like area. Take a square of area one: that's omega, the set of all outcomes. An event is a region in it, and its probability is its area. Formally, a probability space has three parts: the outcomes; a collection of events, which must include complements and countable unions of events; and the probability itself, which obeys three rules. Probabilities are never negative. The whole space has probability one. And for events that don't overlap, the probability of their union is the sum of their probabilities, even for infinitely many of them. Why not let every set of outcomes be an event? Because on a continuum some sets can't be given a size at all without contradiction. That's a story for Part 43. Everything in this part uses only the three rules.
From three rules, everything else follows. An event and its complement don't overlap and together make up everything, so their probabilities add to one: the chance that A doesn't happen is one minus the chance that it does. If A is inside B, then B is A plus the part of B outside A, so B is at least as probable. For two events that do overlap, add their probabilities, and the overlap has been counted twice, so subtract it once: the probability of A or B is P of A plus P of B minus P of A and B. Drop the subtraction and you get an inequality that holds for any events at all: the probability that at least one happens is at most the sum of their probabilities. It's called the union bound, it's crude, and it will hold up a surprising amount of this series, from multiple testing to learning theory.
Inclusion–exclusion extends to any number of events, and it gives us de Méré's first bet a second way. Let A i be the event that throw i is a six. At least one six is the union of four events. Add their probabilities, four sixths; subtract the six pairwise overlaps, each one thirty-sixth; add back the four triple overlaps; subtract the one quadruple. Six hundred and seventy-one over twelve hundred and ninety-six, the same as before. Watch the partial sums. The first term alone is the union bound, two thirds, too big. Two terms, too small. Three, too big again, by a little. Each truncation alternates around the truth, narrowing as it goes: these are Bonferroni's inequalities, and they turn inclusion–exclusion into a source of upper and lower bounds.
Inclusion–exclusion's most famous answer is a puzzle from 1708, Montmort's problem of matches. People check their hats at a theatre, and the attendant hands them back at random. What's the chance that nobody gets their own hat back? With four people there are twenty-four ways to return the hats. A white outline marks someone who got their own. In nine of the twenty-four, nobody did: three eighths. For n people, let A i be the event that person i gets their own hat. Any k particular people get their own hats in n minus k factorial of the n factorial orders, and there are n choose k ways to pick the k. Inclusion–exclusion adds and subtracts these, and the binomials cancel the factorials, leaving the chance of no match as the sum of minus one to the k over k factorial. That's the series for e to the x at minus one.
Here's that answer for one to twelve people. For one person it's zero, for two a half, for three a third, for four three eighths, and then it locks onto one over e, zero point three six eight, almost at once. The engine confirms the first eight exactly, by listing every possible order; for eight people that's forty thousand three hundred and twenty orders. And ten thousand simulated shuffles of ten hats give the same answer to two decimals. A theatre of ten people or ten thousand: the chance that nobody gets their own hat is about thirty-seven percent, almost independent of the size of the crowd.
The third axiom's infinite sums buy one more property, continuity. If events grow, each containing the last, the probability of their union is the limit of their probabilities. Toss a coin until a head appears. The chance of a head within n tosses is one minus two to the minus n, so the chance of a head eventually is the limit, one. Infinite processes like this one are everywhere in statistics, and continuity is what lets us reason about them. Notice what the axioms don't say. They say how probabilities must fit together; they say nothing about what a probability is: a frequency, a degree of belief, a betting price. We'll come back to that question at the end of the part. First, the most useful operation in all of probability: learning something, and updating.
What it does: Probability as area (1933). Complement, monotonicity, inclusion–exclusion and the union bound derived. De Méré's bet by inclusion–exclusion, with Bonferroni's alternating partial sums. Montmort's hat-check problem → 1/e (exact for n ≤ 8 by enumeration; 10,000 shuffles). Continuity.; Numbers (computed): 9 of 24 derangements of 4; 1/e = 0.3679, simulated 0.3701
5ConditioningBachelor's4 min
Two dice are rolled out of your sight. Thirty-six equally likely outcomes. What's the chance that at least one die shows a six? Eleven of the thirty-six cells. Now someone tells you the sum is eight. Most of the grid is now impossible. Only five outcomes are left: two-six, three-five, four-four, five-three and six-two. Nothing you've heard favours one of them over another, so they stay equally likely, and since one of them certainly happened, each now has probability one fifth. Two of the five contain a six. The chance of a six has gone from eleven thirty-sixths, about thirty percent, to two fifths, forty percent. Learning something has changed the probability.
That's the whole idea of conditioning, and it has a picture. In the square of outcomes, learning that B happened throws away everything outside B. What's left of A is the part of A inside B. So the probability of A given B is the share of B that's also A: the probability of A and B, divided by the probability of B. Dividing by P of B rescales B to have total probability one; B becomes the whole world. In the engine, that's one operation: given, which keeps the outcomes in the event and rescales them.
Multiply the definition out and it becomes a rule for building probabilities in stages. The chance of A and B is the chance of B, times the chance of A once B is known. Deal two cards from a shuffled deck. The first is an ace with probability four in fifty-two. Given that, three aces remain among fifty-one cards. So both are aces with probability four fifty-seconds times three fifty-firsts: one in two hundred and twenty-one. Chains like this, each factor conditional on everything before it, are how every complicated probability model is built, from a card game to a weather forecast.
The multiplication rule runs along a tree; adding over branches gives the law of total probability. Three urns, holding a quarter, a half and three quarters red balls. Pick an urn at random, then a ball from it. The tree has one branch for each urn, then one for each colour. The chance of any path is the product of the probabilities along it. Red can happen along three paths. Add them: a third times a quarter, plus a third times a half, plus a third times three quarters. One half. Now turn the question around. You drew a red ball: which urn did it probably come from? Of the half of the probability that ends in red, the third urn's path carries the most. The answer is a sixth, a third and a half. That reversal, from the chance of the evidence given the cause to the chance of the cause given the evidence, has a name: Bayes' theorem.
Conditioning is simple to state and easy to get wrong, because you must condition on exactly what you learned. A family has two children. Elder and younger, each a boy or a girl, gives four equally likely families. You learn that at least one of them is a boy. What's the chance both are? Three families survive, and only one is two boys: one third, not one half. Simulated families agree. But if you learn instead that the elder child is a boy, two families survive, and the answer is a half. Two pieces of news that sound almost the same are different events, with different answers. In real life we rarely learn a clean event. We learn that someone told us something, and the way the information reached us is part of what we learned. We'll meet that again with three doors and a game-show host.
What it does: The two-dice grid sliced by "the sum is 8". The definition as renormalized area. The multiplication rule (two aces 1/221). Total probability on a tree of three urns, and its reversal. The two-child problem.; Numbers (computed): P(six | sum 8) = 2/5; P(BB | ≥ 1 boy) = 1/3, simulated 0.334
6Bayes' theoremBachelor's6 min
The theorem is named for Thomas Bayes, a Presbyterian minister in Tunbridge Wells. His essay was found among his papers after his death and sent to the Royal Society by his friend Richard Price in 1763. Laplace discovered the same result on his own eleven years later, and it was Laplace who turned it into a method. The derivation is one line. The chance of A and B can be built in either order: B, then A given B; or A, then B given A. Divide by the chance of B. The probability of A given B equals the probability of B given A, times the probability of A, over the probability of B. And the denominator, by total probability, splits into the two ways B can happen: with A, or without it. It turns the chance of the evidence given the cause, which we can often measure, into the chance of the cause given the evidence, which is what we want.
Here's where it matters. In the World, a silent condition affects about one adult in a hundred: percent of the World's adults, more of the old than the young. There's a screening test. It catches ninety percent of people who have the condition: its sensitivity. And it correctly clears ninety-five percent of those who don't: its specificity. You take the test, and it's positive. How likely is it that you have the condition? Pause and make a guess. Many people, doctors included, say something close to ninety percent.
Let's count instead of guessing. Here are a thousand of the World's adults, one square each. of them have the condition. Now test everyone. The test catches most of the , but it also flags five percent of the healthy majority, and five percent of a big number is a big number. people test positive, and only of them have the condition. About one positive in six. The same calculation is easier to see in round numbers, a style of reasoning called natural frequencies. Of ten thousand people, a hundred have the condition and ninety of them test positive. Of the nine thousand nine hundred who don't, four hundred and ninety-five test positive too. So of five hundred and eighty-five positives, ninety are real: percent. Studies by Gerd Gigerenzer and Ulrich Hoffrage found that people reason far better in counts like these than in percentages and conditional probabilities.
There's a neater way to write Bayes' theorem, and it's the form to remember. Write Bayes for the condition and for its absence, and divide one by the other: the awkward denominator cancels. What's left says posterior odds equal prior odds times the likelihood ratio. Prior odds, purple, are what you believed before the evidence. The likelihood ratio, green, is how much more likely the evidence is if the condition is present than if it isn't. Their product, orange, is what you should believe after. For our test the likelihood ratio is ninety percent over five percent, eighteen. The prior odds are about one to a hundred. So the posterior odds are about eighteen to a hundred: a probability of fifteen percent. And the World itself, with all its positive adults, gives . A strong test, applied to a rare condition, mostly finds false alarms.
In the World, the condition is rarer in the young. Split the adults by age, and apply the same test. The prior changes with age, and so does the posterior. A positive test means a percent chance for someone under thirty-five and a percent chance for someone over seventy-five. The World's actual positives, blue dots, agree with Bayes in every group. Same test, same result, different meaning. That's why screening programmes target the people most at risk: the test is only as good as the prior it multiplies.
What happens if we observe a second positive test? After one positive, the odds are the prior odds times eighteen. That posterior becomes the prior for the next test. A second positive multiplies by eighteen again, provided the two tests make their mistakes independently of each other, among people with the condition and among people without; that's a condition we'll examine in chapter nine. Now the probability is percent. The World's adults who tested positive twice agree: percent of them have the condition. Evidence multiplies odds. The prior never disappears from the calculation, but enough evidence can overwhelm it. That one sentence is the whole of Bayesian statistics, which begins in Part 15.
What it does: Bayes (1763) and Laplace (1774). The World's screening test as an icon array and a natural-frequency tree (Gigerenzer & Hoffrage 1995). Odds form: prior odds × likelihood ratio 18. The posterior by age group. A second test.; Numbers (computed): P(condition | +) = 0.150 exactly, 0.151 in the World; two positives 0.760 (World 0.758)
7The prosecutor's fallacyPractice5 min
Bayes' theorem has been tested in court, and the results have not always been just. This chapter is about a real case, and a real person, so we'll keep to the published record. In 1999 Sally Clark, a solicitor in Cheshire, was tried for murder. Her first son had died suddenly in 1996, aged eleven weeks; her second in 1998, aged eight weeks. A prominent paediatrician told the jury that the chance of a single sudden infant death, a cot death, in a family like hers was about one in . And so, he said, the chance of two was that number squared: about one in seventy-three million. She was convicted, by a majority of ten to two. There are two errors in that number, and they are worth understanding exactly.
The first error is the squaring. The multiplication rule says the chance of two deaths is the chance of the first, times the chance of the second given the first. That's always true. Squaring replaces the conditional chance with the plain one: it assumes the deaths are independent, like two tosses of a coin. But two children in one family are not two coin tosses. They share genes, a home, a way of being put to sleep. Whatever raises the risk for one raises it for the other. The mathematician Ray Hill, analysing British data, estimated that after one cot death the chance of a second is five to ten times higher than for a family with none. That alone moves one in seventy-three million to somewhere between one in and one in million. Still rare. But the second error is much bigger.
The second error is in what the number was taken to mean. One in seventy-three million was offered as the probability of two such deaths in a family where nothing criminal happened. It's easy to hear it as something else: the probability that she was innocent. Those two probabilities have the same ingredients in a different order, and they can be wildly different. Swapping them is called the prosecutor's fallacy. Here's the same mistake somewhere it's obvious. The chance that a given lottery ticket wins, in a fair draw, is one in fourteen million. Someone wins most weeks. Nobody concludes the draw was rigged, because the comparison that matters isn't with one, it's with the alternative: how likely is the evidence if the draw was rigged, and how likely was a rigged draw to begin with?
Bayes' theorem in odds form says what must be compared. For a schematic model with just double SIDS and double homicide as explanations, posterior odds equal prior odds times the likelihood ratio. Take the evidence here to mean only that two deaths occurred. Both explanations imply that coarse event, so its likelihood ratio is one. Other medical and case evidence would contribute different likelihood ratios. Everything rests on comparing two rare events with each other: a double cot death, and a double murder of babies by their mother, which is rarer still. Hill estimated that in families with two such deaths, double SIDS was between four and a half and nine times as likely as double murder. On those figures, of a hundred families like this restricted model, about eighty-two to ninety would be double SIDS. That is not a probability of innocence for a particular defendant. It illustrates why a rare natural explanation must be compared with the alternatives, using all the evidence.
In October 2001 the Royal Statistical Society took the unusual step of issuing a public statement: the figure of one in seventy-three million, it said, had no statistical basis, and the reasoning behind it was a well-known fallacy. In January 2003, on a second appeal, Sally Clark's convictions were quashed, chiefly because medical evidence suggesting that her second son had died of natural causes had not been disclosed at her trial. Other convictions resting on similar testimony were reviewed, and several were overturned. Sally Clark had spent more than three years in prison. She died in 2007, aged forty-two. The lesson is a single line. The probability of the evidence given a hypothesis is not the probability of the hypothesis given the evidence. And the fallacy has a mirror image, the defence attorney's: dismissing a match simply because many innocent people could share it. A match frequency alone is not a posterior probability. The likelihoods under competing hypotheses and the prior odds must both enter the comparison.
What it does: R v Clark, from the published record. Squaring 1/8,543 assumes independence (Hill's dependence factor 5–10). P(E | innocent) ≠ P(innocent | E). Double SIDS vs double murder in odds form (Hill 2004: 4.5–9 : 1). The RSS statement (2001) and the quashed convictions (2003).; Numbers (computed): 8,543² = 72,982,849
8Monty HallBachelor's5 min
In 1990 a puzzle about a game show became one of the most argued-over questions in the history of probability. There are three doors. Behind one is a car; behind the other two, goats. You pick a door, say door one. The host, who knows where the car is, opens another door, door three, and shows you a goat. Then he asks: do you want to stay with door one, or switch to door two? Two doors left, one car. Does it matter?
The puzzle was first posed and solved in 1975 by the statistician Steve Selvin, in two letters to The American Statistician. It became famous in 1990, when Marilyn vos Savant answered it in her magazine column: yes, you should switch; switching wins two times in three. She received about ten thousand letters, nearly a thousand of them from people with doctorates, most of them telling her she was wrong. The intuition is strong: two doors are left, so it must be fifty-fifty. Even Paul Erdős, one of the great mathematicians of the century, was convinced, by his biographer's account, only when he was shown a simulation. Let's not argue. Let's compute.
Draw the tree. The car is behind each door with probability a third. You picked door one. Now the host acts, and his rule decides the second branch. If the car is behind door one, he can open either of the others; say he picks at random, half and half. If it's behind door two, he must open door three. If it's behind door three, he must open door two. You saw him open door three. Two paths end there: car behind door one and he chose three, probability a third times a half, one sixth; and car behind door two, probability a third times one, one third. Renormalize. The car is behind door two with probability a third over a half: two thirds. Behind door one, one third. Switch. The asymmetry comes from the host's constraint: when you've picked a goat, he has no choice about which door to open, so his opening door three is twice as likely when the car is behind door two.
Erdős wanted a simulation, so here's one. Three thousand games, the car placed at random, the host following his rule, the contestant always switching. The fraction of wins settles at : two thirds, not one half. And in the engine the whole game is three lines: the car's door, the host's rule as a second stage of the tree, and the condition we observed.
But notice what the answer depended on: the host's rule. Change the rule and the same observation means something else. The standard host gives two thirds. Suppose instead the host doesn't know where the car is, and opens one of the other doors at random; this time, by luck, it hid a goat. Now the answer is a half: his door told you nothing about the others except that this one is empty. Suppose he's devious, and opens a door only when you've already picked the car, to tempt you away. Then switching always loses. And if he knows, but prefers door three whenever he has a choice, with probability q, then, conditional on seeing door three opened with a goat, switching wins with probability one over one plus q: anywhere from a half to certainty, but never less than a half. Averaging over whichever door he opens, switching still wins two thirds of all games under this knowledgeable host. So the data are not only what you saw, but how it came to be shown to you. The probability of the evidence under each hypothesis depends on the process that produced it; that probability is the likelihood, the central object of Parts 9 and 22.
What it does: Selvin (1975) and vos Savant (1990). The tree, renormalized: 2/3. 3,000 simulated games. Four host protocols computed exactly: 2/3, 1/2, 0 and 1/(1+q). The data include how they were shown.; Numbers (computed): switching wins 0.658 in simulation
9IndependenceBachelor's4 min
Squaring one in eight thousand five hundred assumed independence. So what is it, exactly? Two events are independent if the probability that both happen is the product of their probabilities. Equivalently, learning that one happened leaves the other's probability unchanged. On the two-dice grid, let A be the first die showing an even number, half the columns, and B the second die showing five or six, a third of the rows. Their overlap is six cells of thirty-six: exactly a half times a third. The dice don't influence each other, and the arithmetic says so. Don't confuse independent with disjoint. Disjoint events can't both happen, so learning that one happened changes the other's probability to zero. When both have positive probability, they are dependent, though the dependence need not be perfect.
For three events, independence is subtler than it looks. Here's an example from the Russian mathematician Sergei Bernstein. Take a tetrahedron, a four-sided die. Paint one face red, one green, one blue, and the fourth with all three colours. Roll it, and look at the face it lands on. Red appears on two of the four faces, so the chance of seeing red is a half; the same for green and for blue. Red and green together appear only on the striped face: a quarter, which is a half times a half. The same for every pair. So every pair of colours is independent. But all three together also appear only on the striped face: a quarter, not an eighth. If you know you see red and green, you know you see blue. The three events are pairwise independent, but not mutually independent. Mutual independence demands the product rule for every subcollection, pairs, triples and all. When this series says independent, it means mutually.
Independence can also appear and disappear when you condition. Go back to the World's two screening tests. Overall, among all adults, a positive result on test A makes a positive on test B three times likelier: instead of . The tests are strongly dependent. But look within the people who have the condition: test B is positive percent of the time whatever test A said. And among those without it, percent, whatever test A said. Once you know whether someone has the condition, the tests tell you nothing about each other. They're conditionally independent given the condition, and dependent overall, because both depend on it. That's exactly the assumption we used to multiply two likelihood ratios of eighteen. Conditional independence is the workhorse of statistical modelling, from naive Bayes to hierarchical models to causal graphs, where a common cause makes its effects dependent; Part 36 is built on that observation.
So independence is a strong and specific claim, not a default. It's a product rule. For many events, it must hold for every subcollection, not just in pairs. And it depends on what you condition on: dependence can vanish once you know a common cause, and, as we'll see in Part 36, appear once you condition on a common effect. Two screening tests, two deaths in one family: whenever a calculation multiplies probabilities, ask whether independence has been checked, or only assumed.
What it does: The product rule; independent is not disjoint. Bernstein's tetrahedron (rotating, painted): pairwise but not mutually independent. The World's two tests: dependent overall, independent given the condition.; Numbers (computed): P(B | A) = 0.18 vs P(B) = 0.06 overall; 0.90 vs 0.90 given the condition
10Random variablesMaster's4 min
So far we've asked about events. Most statistical questions are about numbers. Here are the thirty-six outcomes of two dice again. Write in each cell the sum of the two dice. That assignment, a number for every outcome, is a random variable. The name is unfortunate: it's neither random nor a variable. It's a function on the outcomes, and the randomness lives in which outcome happens. What we usually care about is its distribution: for each value, the probability of the set of outcomes that produce it. Watch the outcomes sort themselves by their value. One way to make two, six ways to make seven, one way to make twelve. The thirty-six cells have become the familiar triangle. The engine calls this map: it carries the probability from the outcomes to the values, and statisticians call the result the push-forward of P.
One function describes any distribution, of any kind: the cumulative distribution function. F of x is the probability that X is at most x. For the sum of two dice it's a staircase, climbing from zero to one, with a jump at each possible value. The height of each jump is the probability of that value: six thirty-sixths at seven. Every CDF has the same three properties: it never decreases, its limits at minus and plus infinity are zero and one, and it's continuous from the right, so at each jump the function takes the upper value. And every function with those properties is the CDF of some random variable. If this looks familiar, it should: Part 1's empirical distribution function is exactly this, for the data.
CDFs come in kinds. A discrete variable, like a die, has a CDF that only jumps. An absolutely continuous distribution, like the exponential waiting time drawn here, has a density. Its CDF has no jumps, and integrating the density gives its probabilities. Having no jumps alone will turn out to be weaker than having a density. And some distributions are mixed. The rainfall on a given day is exactly zero with probability, say, sixty percent, a jump at zero, and otherwise it's spread smoothly over positive amounts. Discrete distributions, ones with a density, and their mixtures: is that every kind? Surprisingly, no.
Here's a fourth kind, and it's strange. Build a number between zero and one in base three, digit by digit, flipping a fair coin for each digit: zero or two, never one. Its distribution function starts out as a straight line, but at each stage the middle third of every remaining interval is removed, because a digit one is impossible, and the CDF goes flat there. In the limit you get the devil's staircase, Cantor's function. It's continuous, so the variable takes no single value with positive probability. But it's flat almost everywhere, so there's no density either: all the probability lives on the Cantor set, a dust of points with total length zero. Twenty thousand draws from the coin-flip recipe fall right on the staircase, with mean a half and variance an eighth, as the theory predicts. This distribution is singular continuous: its CDF is continuous but it has no density. Every real distribution splits uniquely into an atomic part, an absolutely continuous part with a density, and a singular continuous part. Part 43 proves it. For the rest of Stage One, discrete and continuous will be enough, and Part 3 names the shapes that keep appearing.
What it does: The sum of two dice as a function on Ω, sorted into its distribution (the push-forward). The CDF and its properties. Discrete, continuous and mixed; then the Cantor distribution: continuous, no density (devil's staircase, five levels, 20,000 draws).; Numbers (computed): E X = 1/2, Var X = 1/8; simulated 0.5004, 0.1259
11ExpectationBachelor's6 min
Pascal valued the interrupted game by averaging over its futures, and Huygens called it the value of a chance. Today it's called expectation. The expectation of a random variable is the sum of its values, each weighted by its probability. In pictures, it's the balance point of the distribution: put the probability bars on a seesaw, and the fulcrum that balances them is the expectation. For the sum of two dice it's seven. To find the expectation of a function of X, say X squared, you don't need the distribution of X squared. Weight g of each value by that value's probability. It's called the law of the unconscious statistician, because people use it without noticing that it needs a proof; on a finite space the proof is just regrouping a sum.
There's a second way to compute an expectation, and it's often easier. Draw a die's six values as columns of blocks, the column for face v v blocks tall; the expectation is the average column height, twenty-one sixths. Now count the blocks by layer instead of by column. The bottom layer runs across every face: X is at least one with probability one. The second layer misses face one: X is at least two with probability five sixths. And so on up. Adding by layers gives the same total: the expectation of a variable with values one, two, three and so on is the sum of the chances that it's at least k. For a continuous variable the sum becomes an integral of the tail probability. It's called the layer-cake formula, and we'll use it again and again.
The most useful fact about expectation is the simplest. The expectation of a sum is a sum over outcomes, and a sum over outcomes splits in two. So the expectation of X plus Y is the expectation of X plus the expectation of Y. Here the expectations are finite, so there is no undefined infinity minus infinity. X and Y can be as dependent as you like. Combine that with indicators, variables that are one when an event happens and zero when it doesn't, whose expectation is the event's probability, and you can compute averages of things whose distributions are hopeless.
Here's linearity working a miracle. Shuffle a deck, and count how many cards end up in their original position. Write that count as a sum of indicators, one per card. Each card lands in its own place with probability one over n, so the expected number of matches is n times one over n: one. For every n. The indicators are dependent, since if fifty-one cards are in place the fifty-second must be too, and it doesn't matter. The engine confirms it exactly for decks of two to eight cards, by listing every order; the variance turns out to be one as well. And ten thousand shuffles of a real deck average one match, with a distribution that's almost exactly e to the minus one over k factorial, a shape Part 3 will name: the Poisson.
Two more classics. How many people must be in a room for it to be more likely than not that two share a birthday? Ignoring leap years and assuming birthdays are equally likely, the chance that n people all differ is three sixty-five, times three sixty-four, and so on down, over three sixty-five to the n. The chance of a match crosses one half at just twenty-three people, and twenty thousand simulated rooms agree. Why so few? Because a match can happen between any pair, and twenty-three people make two hundred and fifty-three pairs. By indicators and linearity, the expected number of shared pairs is two hundred and fifty-three over three sixty-five, about seven tenths.
Last, the coupon collector. An album has fifty different stickers, and each pack contains one, chosen at random. How many packs do you expect to buy to fill the album? Split the wait into stages: T one packs until your first new sticker, T two until the second new kind, and so on. The total is their sum. When you have i minus one kinds, a pack is new with probability n minus i plus one over n, and a wait for an event of chance p averages one over p. Early on, almost every pack is new. At the end you wait fifty packs, on average, for the last sticker. Add the expectations, linearity again, and you get n times the harmonic number H n, which grows like n log n. For fifty stickers, packs. Two thousand simulated albums average , with a long right tail: some collectors need four hundred.
What it does: The balance point; LOTUS. The layer-cake formula on a die. Linearity without independence. Matches in a shuffle (E = Var = 1, exact for n ≤ 8; 10,000 decks against e⁻¹/k!). Birthdays (23 people). The coupon collector, n H_n.; Numbers (computed): P₂₃ = 0.507 (sim 0.505); 50 stickers: 225.0 packs (sim 224.0)
12Variance, and a game worth infinityBachelor's5 min
Expectation is the centre. With a finite second moment, variance measures the spread around it, as it did for data in Part 1. The variance of X is the expected squared distance from its mean, mu. Expand the square and use linearity: expected X squared, minus two mu times the expectation of X, plus mu squared. The expectation of X is mu, so this collapses to the shortcut: the mean of the square minus the square of the mean. For one die the mean of the square is ninety-one sixths and the mean is seven halves, so the variance is thirty-five twelfths. Its square root, the standard deviation, about one point seven, is in the same units as the die.
Variances of sums are where independence earns its keep. In general the variance of a sum is the sum of the variances plus twice the covariance, which measures how X and Y move together. For independent variables every covariance is zero, so variances simply add: n independent copies have n times the variance. Ten dice: ten times thirty-five twelfths, as the engine confirms by convolving ten dice exactly. So the standard deviation of a sum grows only like root n, and the standard deviation of an average shrinks like one over root n. That's the sigma over root n we met at the end of Part 1, now derived; Part 6 turns it into the law of large numbers.
Now a game that broke the theory of expectation, or seemed to. It was posed by Nicolaus Bernoulli in 1713, and his cousin Daniel published the most famous analysis of it in 1738, in the journal of the academy at St. Petersburg. Toss a fair coin until it lands heads. If the first head comes on toss k, you win two to the k ducats: two if it's the first toss, four if the second, eight if the third, doubling each time. How much would you pay to play? Pascal and Huygens would say: the expected prize. Each term of the expectation is a probability of one over two to the k times a prize of two to the k: one ducat. Infinitely many terms of one. The expected prize is infinite. Yet almost nobody would pay even twenty ducats.
What actually happens if you play, again and again? Here are a million simulated games, and the average prize so far, with the number of games on a doubling scale. The average never settles. It drifts upward, jumping whenever a long run of tails pays out a huge prize, and the biggest of the million paid ducats. William Feller showed that the average of n games, divided by the base-two logarithm of n, converges to one in probability. That describes typical growth, with occasional much larger excursions; it is not a promise that every running path hugs this line. An infinite expectation doesn't mean infinite winnings. It means there's no average for the averages to settle down to, and the law of averages in Part 6 will need a finite mean.
Daniel Bernoulli's own answer changed economics. A ducat means less to a rich man than to a poor one, he argued, so we should value money by its logarithm: each doubling of wealth adds the same amount of satisfaction. The expected logarithm of the prize is the sum of k over two to the k, which is exactly two. So the game is worth the sure amount whose logarithm is two: four ducats. This is the certainty equivalent of the prize alone, not an entry fee. A player's willingness to pay depends on initial wealth: compare the expected log of wealth minus the fee plus the prize with the log of starting wealth. The expectation of money is not the value of money. Two centuries later the idea became expected utility theory, and the logarithm became Kelly's rule for sizing bets.
What it does: Var X = E X² − μ², derived. Variances of sums and σ/√n. The St. Petersburg game (N. Bernoulli 1713, D. Bernoulli 1738): infinite expectation; 2²⁰ simulated games, typical running-mean growth on the log₂ n scale (Feller 1945, convergence in probability). Log utility: a 4-ducat certainty equivalent for the prize, with entry fees depending on wealth.; Numbers (computed): Var(die) = 35/12; Var(10 dice) = 175/6
13Generating functionsMaster's4 min
Here's a device that turns probability into algebra, invented by de Moivre and made systematic by Laplace. For a variable that takes the values zero, one, two and so on, its probability generating function is the expectation of s to the X: a power series whose coefficient of s to the k is the probability that X equals k. For one die, it's a sixth of s plus s squared, up to s to the sixth. The exponents record the values and the coefficients record their chances. A distribution has become a polynomial.
Why bother? Because generating functions turn sums into products. The generating function of X plus Y is the expectation of s to the X times s to the Y. If X and Y are independent, the expectation of the product splits into the product of the expectations: the generating function of a sum is the product of the generating functions. Square the die's polynomial and watch what happens. Each term of one factor meets each term of the other: s to the i times s to the j is s to the i plus j. The terms with the same power lie on the anti-diagonals, and collecting them gives one, two, three, up to six, and back down: the distribution of the sum of two dice. It's the two-dice grid of chapter ten, in algebra. Adding independent variables convolves their distributions, and multiplying polynomials does exactly that.
Generating functions also hand you the moments. Differentiate, then set s to one, and every term becomes k times the probability of k: the expectation. Differentiate twice and you get the expectation of X times X minus one. Combine them for the variance. For one die this gives thirty-five twelfths, the answer of the last chapter, now by calculus. Part 3 meets another transform, the moment generating function, and Part 6 uses its complex cousin, the characteristic function, to prove the central limit theorem.
Here's the most charming use of generating functions. Are ordinary dice the only pair whose totals have the usual distribution? Factor the die's polynomial over the integers: s, times one plus s, times one plus s plus s squared, times one minus s plus s squared. The pair's generating function is its square, every factor twice. Now deal the factors out differently. Each die must keep one factor of s, so no face shows zero, and its polynomial must add up to six at s equals one, so it has six faces. The only other way: give one die both copies of the last factor and the other die none. Expand, and read off the faces. One die is one, two, two, three, three, four. The other is one, three, four, five, six, eight. These are Sicherman's dice, popularized by Martin Gardner in 1978. Roll them together, and every total from two to twelve comes up with exactly the same probability as with ordinary dice. The engine agrees, outcome by outcome.
What it does: G(s) = E sˣ. Sums become products: the convolution grid. Moments by differentiation. Sicherman's dice by factoring (Gardner 1978), checked by the engine.; Numbers (computed): G'(1) = 7/2, G''(1) = 35/3
14What probability meansPhD4 min
Kolmogorov's axioms tell us how probabilities must fit together. They don't say what a probability is, and for three centuries people have disagreed. The first answer is frequency. Toss a coin again and again, and the fraction of heads settles down. On this view, championed by John Venn and then by Richard von Mises, the probability of heads simply is that limiting fraction. It's concrete and testable, and it's the meaning the Coverage Board uses. But it has problems. Nobody ever observes an infinite sequence. And many probabilities we care about are about single events: rain tomorrow, a candidate winning an election, whether this defendant committed this crime. There's no sequence of identical tomorrows.
Two other answers make probability about knowledge rather than about the world. The logical view, John Maynard Keynes's in 1921, is that a probability measures how strongly a body of evidence supports a conclusion, the way logic measures whether it proves it. The subjective view, Frank Ramsey's in 1926 and Bruno de Finetti's a few years later, is that a probability is a degree of belief: yours, about this. De Finetti put it provocatively: probability does not exist, outside our minds. To make belief measurable, measure it by betting. Your probability for an event is the price at which you'd be equally willing to buy or to sell a ticket that pays one if the event happens.
Betting prices bring a surprise: they must obey the finite rules of probability, or a finite set of bets can exploit you. Suppose you price a ticket on rain tomorrow at sixty cents, and a ticket on no rain also at sixty cents. Your probabilities add up to more than one. A bookmaker sells you both tickets. You pay a dollar twenty. Tomorrow, exactly one ticket pays: a dollar. Rain or shine, you've lost twenty cents. That's called a Dutch book, and the theorem of Ramsey and de Finetti says it's avoidable exactly when your prices satisfy the finite rules of probability. Coherence forces nonnegativity, normalization and finite additivity. It does not by itself force countable additivity: passing to infinitely many events needs another continuity assumption. In our finite examples the usual probability calculus follows.
The logical view has its own theorem. In 1946 the physicist Richard Cox showed how real-valued plausibility can lead to probability's sum and product rules after a change of scale. Regularity and a sufficiently rich domain of plausibilities matter. Joseph Halpern's 1999 counterexamples show why weaker informal assumptions do not establish a universal theorem. Different interpretations can support the same probability calculus, while infinite collections still require their own assumptions.
In practice, statistics divides along this line. Frequentist statistics treats probability as a property of repeatable experiments, and grades methods by how often they're wrong: that's the promise the Coverage Board checks. Bayesian statistics treats probability as a description of what's known, and updates it with Bayes' theorem, as we did with the screening test. This series uses both, because both work, and because in the World we can check either kind of claim against the truth. The argument between them is old and sometimes bitter, and Part 26 tells it properly.
What it does: Frequency (Venn, von Mises), logic (Keynes), belief (Ramsey, de Finetti). Finite Dutch books give finite additivity; countable additivity needs continuity. Cox-style results require regularity and richness assumptions (1946; Halpern 1999). Frequentist and Bayesian, and how the series uses both.
Recap, problems, and the road aheadAll tracks4 min
Part two in fifteen lines. Fermat completed the future and counted it; Pascal averaged over it, and expectation was born. Probability began with equally likely cases, and Galileo and de Méré showed how easy it is to choose the wrong ones. We learned to count. Bertrand showed that at random means nothing until a measure is chosen, and Kolmogorov's three axioms made the measure the foundation; from them came inclusion–exclusion and the one over e of the hat-check problem. Conditioning renormalizes a slice, and Bayes' theorem, in odds form, multiplies prior odds by a likelihood ratio. The chance of the evidence given innocence is not the chance of innocence given the evidence. In Monty Hall, the host's protocol is part of the data. Independence is a product rule, and pairwise is not mutual. Random variables push probability forward onto numbers, sometimes in strange ways. Expectation is linear without any independence; the St. Petersburg game has no finite mean; generating functions turn sums into products. Different interpretations can support the same probability calculus; assumptions about infinite collections still matter.
Almost all of it comes back. Expectation and its linearity drive the laws of averages in Part 6 and estimation in Parts 9 and 22. Bayes' theorem becomes Bayesian statistics in Parts 15 and 26, and the false discovery rate in Part 33. Conditional independence is the language of Part 5's joint distributions and Part 36's causal graphs. The likelihood, which Monty Hall showed us depends on the protocol, is the subject of Parts 9 and 22. Generating functions name the distributions in Part 3 and prove the central limit theorem in Part 6. The humble union bound holds up multiple testing and learning theory. Measure theory returns in Part 43; the meaning of probability in Parts 15 and 26.
Six problems, with full solutions in this part's README. A problem of points solved both ways; inclusion–exclusion for three events and a Bonferroni bound; a screening test with a rarer condition; Monty Hall with many doors; the number of different faces in n rolls, by indicators; and the St. Petersburg game at a casino with a finite bankroll. Pause here if you want to try them.
The books and papers this part follows are on screen and in the README: Feller's classic first volume, the modern textbooks of Blitzstein and Hwang, Ross, and Grimmett and Stirzaker, Hald's history, and the original papers, from the letters of 1654 to the Royal Statistical Society's statement of 2001.
Two parts of sixty-five. We can now compute any probability on a finite space exactly, and we've seen how random variables carry probability onto numbers. But the same few shapes keep appearing: the bell, the exponential, the Poisson that fitted our shuffled decks. In 1898 a statistician counted the Prussian cavalrymen killed by the kicks of their horses, corps by corps and year by year, and found one of those shapes in them. Why do the same few distributions turn up everywhere? That's Part 3.
Where it goes next. Expectation and its linearity drive the laws of averages in Part 6 and estimation in Parts 9 and 22; Bayes' theorem becomes Bayesian statistics in Parts 15 and 26 and the false discovery rate in Part 33; conditional independence returns in Part 5 and in the causal graphs of Part 36; generating functions name the distributions of Part 3; measure theory returns in Part 43.
Key results
The part's results in one place, for revision.
Try it
Lab 2 · Exact answers, checked by simulation
Solve the problem of points by Fermat's enumeration and by Pascal's recursion, a screening test by Bayes' theorem, and Monty Hall under a host who prefers one door, exactly as fractions; then simulate each and see the frequencies settle on the fractions.
python -m videos.stats.labs 2
needs numpy, scipy, matplotlib · download lab02.py ·
source on GitHubproblem of points at 2-1: A's share 3/4 = 0.7500 simulated 0.7511 (10,000 games)
A's fair stake of 64 pistoles 48
P(condition | positive) 2/13 = 0.1538 simulated 0.1535 (P(positive | condition) = 0.9)
after a second, independent positive 36/47 = 0.7660
Monty Hall, fair host: switching wins 2/3 = 0.6667 simulated 0.6718
host always opens door 3 if he can 1/2 (1 / (1 + q) with q = 1)
Each fraction is the exact value of its model, and each simulated frequency lands within the noise of a finite experiment; 0.9 and 2/13 are different conditionals of the same test.
The code (132 lines; it asserts its own result)
"""Lab 2: three exact answers from the probability engine, each checked against a seeded simulation."""
from fractions import Fraction
from functools import lru_cache
import numpy as np
from videos.coursekit import labs
from explainer.stats.prob import Dist, coin
TITLE = "Exact answers, checked by simulation"
GOAL = ("Solve the problem of points by Fermat's enumeration and by Pascal's recursion, a screening test by Bayes' "
"theorem, and Monty Hall under a host who prefers one door, exactly as fractions; then simulate each and "
"see the frequencies settle on the fractions.")
TASKS = [
"Change the interrupted score so that A needs 2 points and B needs 3. What is A's fair share of the 64 pistoles?",
"Lower the test's specificity from 19/20 to 9/10. What happens to the chance of the condition given a positive?",
"Make the host open a door at random, without knowing where the car is, and condition on his showing a goat. "
"What does switching win now?",
]
SENS, SPEC = Fraction(9, 10), Fraction(19, 20)
def fermat(a: int, b: int) -> Fraction:
"""A needs a points, B needs b: play all a + b - 1 remaining fair rounds and count the futures A wins."""
rounds = coin() ** (a + b - 1)
return rounds.P(lambda r: r.count("H") >= a)
@lru_cache(maxsize=None)
def pascal(a: int, b: int) -> Fraction:
"""A's share by backward recursion: the average of the two scores one round ahead."""
if a == 0:
return Fraction(1)
if b == 0:
return Fraction(0)
return (pascal(a - 1, b) + pascal(a, b - 1)) / 2
def screening(prev: Fraction) -> Dist:
"""The two-stage tree: the condition, then the test result given the condition."""
return coin(prev, "sick", "well").then(lambda s: coin(SENS if s == "sick" else 1 - SPEC, "+", "-"))
def posterior(prev: Fraction) -> Fraction:
return screening(prev).given(lambda o: o[1] == "+").P(lambda o: o[0] == "sick")
def monty(q: Fraction) -> Fraction:
"""You pick door 1; the host knows, never shows the car, and opens door 3 with probability q when he may open
either. The chance the car is behind door 2 given that he opened door 3."""
def host(car):
return {1: Dist({3: q, 2: 1 - q}), 2: Dist({3: 1}), 3: Dist({2: 1})}[car]
game = Dist.uniform([1, 2, 3]).then(host)
return game.given(lambda o: o[1] == 3).P(lambda o: o[0] == 2)
def run(seed=0):
rng = np.random.default_rng(seed)
lab = labs.Lab()
# 1. The problem of points: two roads to one answer, for every score of a short game.
share = fermat(1, 2)
assert share == pascal(1, 2) == Fraction(3, 4)
assert all(fermat(a, b) == pascal(a, b) for a in range(1, 6) for b in range(1, 6)), "Fermat and Pascal agree"
n_games = 10_000
tosses = rng.random((n_games, 2)) < 0.5 # True: A wins the round. A needs one of the next two rounds.
a_wins = tosses.any(1)
freq = a_wins.mean()
lab.row("problem of points at 2-1: A's share", f"{share} = {float(share):.4f} simulated {freq:.4f} ({n_games:,} games)")
lab.row("A's fair stake of 64 pistoles", f"{64 * share}")
assert abs(freq - 0.75) < 4 * np.sqrt(0.75 * 0.25 / n_games)
# 2. The screening test: one adult in a hundred has the condition.
prev = Fraction(1, 100)
post = posterior(prev)
odds = prev / (1 - prev) * SENS / (1 - SPEC) # prior odds times the likelihood ratio, 18
assert post == odds / (1 + odds) == Fraction(2, 13), "the tree and the odds form give the same posterior"
odds2 = odds * SENS / (1 - SPEC)
post2 = odds2 / (1 + odds2)
n_people = 400_000
sick = rng.random(n_people) < float(prev)
positive = np.where(sick, rng.random(n_people) < float(SENS), rng.random(n_people) < float(1 - SPEC))
sim_post = sick[positive].mean()
lab.row("P(condition | positive)", f"{post} = {float(post):.4f} simulated {sim_post:.4f} (P(positive | condition) = 0.9)")
lab.row("after a second, independent positive", f"{post2} = {float(post2):.4f}")
assert abs(sim_post - float(post)) < 4 * np.sqrt(float(post) * (1 - float(post)) / positive.sum())
# 3. Monty Hall: the host's protocol is part of the data.
for q in (Fraction(1, 2), Fraction(1), Fraction(0)):
assert monty(q) == 1 / (1 + q)
n_shows = 30_000
car = rng.integers(1, 4, n_shows)
q = 0.5
opened = np.where(car == 1, np.where(rng.random(n_shows) < q, 3, 2), np.where(car == 2, 3, 2))
saw3 = opened == 3
sim_switch = (car[saw3] == 2).mean()
lab.row("Monty Hall, fair host: switching wins", f"{monty(Fraction(1, 2))} = {float(monty(Fraction(1, 2))):.4f} simulated {sim_switch:.4f}")
lab.row("host always opens door 3 if he can", f"{monty(Fraction(1))} (1 / (1 + q) with q = 1)")
assert abs(sim_switch - 2 / 3) < 4 * np.sqrt(2 / 9 / saw3.sum())
lab.note = ("Each fraction is the exact value of its model, and each simulated frequency lands within the noise "
"of a finite experiment; 0.9 and 2/13 are different conditionals of the same test.")
fig, ax = labs.figure(2, size=(11, 4.2))
k = np.arange(1, n_games + 1)
ax[0].plot(k, np.cumsum(a_wins) / k, color=labs.BLUE, label="fraction of games A wins")
ax[0].axhline(0.75, color=labs.GOLD, ls="--", label="Fermat and Pascal: 3/4")
band = 2 * np.sqrt(0.75 * 0.25 / k)
ax[0].fill_between(k, 0.75 - band, 0.75 + band, color=labs.GOLD, alpha=0.12, label="3/4 plus or minus 2 SE")
ax[0].set(xscale="log", ylim=(0.5, 1.0), title="The problem of points, played out from 2-1",
xlabel="simulated games", ylabel="running fraction")
ax[0].legend(loc="upper right")
prevs = np.logspace(-3, np.log10(0.5), 80)
lr = float(SENS / (1 - SPEC))
one = prevs * lr / (prevs * lr + 1 - prevs)
two = prevs * lr ** 2 / (prevs * lr ** 2 + 1 - prevs)
ax[1].plot(prevs, one, color=labs.GOLD, label="after one positive test")
ax[1].plot(prevs, two, color=labs.PURPLE, label="after two independent positives")
ax[1].axhline(float(SENS), color=labs.MUTED, ls=":", label="P(positive | condition) = 0.9")
sim_prev = np.array([0.002, 0.01, 0.05, 0.2])
sims = []
for pv in sim_prev:
s = rng.random(100_000) < pv
pos = np.where(s, rng.random(100_000) < float(SENS), rng.random(100_000) < float(1 - SPEC))
sims.append(s[pos].mean())
ax[1].plot(sim_prev, sims, "o", color=labs.BLUE, ms=5, label="simulated, 100,000 people each")
ax[1].set(xscale="log", title="What a positive test means depends on the prior", xlabel="prevalence of the condition",
ylabel="P(condition | positive)")
ax[1].legend(loc="lower right")
lab.fig = fig
return lab
Now change it
- Change the interrupted score so that A needs 2 points and B needs 3. What is A's fair share of the 64 pistoles?
- Lower the test's specificity from 19/20 to 9/10. What happens to the chance of the condition given a positive?
- Make the host open a door at random, without knowing where the car is, and condition on his showing a goat. What does switching win now?
Problems, with solutions
Try each problem before opening its solution.
1. Points, both ways. A needs 2 more points and B needs 3, fair rounds.
Solution
Fermat. At most 2 + 3 − 1 = 4 more rounds settle it; imagine all four played. A wins the match exactly when A wins at least 2 of the 4, so P(A) = [C(4,2) + C(4,3) + C(4,4)] / 2⁴ = (6 + 4 + 1)/16 = 11/16.
Pascal. Let V(a, b) be A's chance when A needs a and B needs b. Then V(0, b) = 1, V(a, 0) = 0, and V(a, b) = ½ V(a−1, b) + ½ V(a, b−1). This gives:
- V(1,1) = ½ and V(2,2) = ½;
- V(1,2) = ¾ and V(1,3) = ⅞;
- V(2,3) = ½(⅞ + ½) = 11/16.
2. Inclusion–exclusion and Bonferroni. Prove inclusion–exclusion for three events, and the Bonferroni lower bound \(P(\bigcup_i A_i) \ge \sum_i P(A_i) - \sum_{i<j} P(A_i \cap A_j)\).
Solution
Apply the two-event rule to (A ∪ B) ∪ C:
P(A∪B∪C) = P(A∪B) + P(C) − P((A∩C) ∪ (B∩C)).
Expand the first term and the last one by the two-event rule again; the last uses (A∩C) ∩ (B∩C) = A∩B∩C. The result is
P(A∪B∪C) = ΣP(A) − ΣP(A∩B) + P(A∩B∩C).
For the lower bound, let N be the number of the events Aᵢ that occur. Then 1{N ≥ 1} ≥ N − C(N, 2) for every integer N ≥ 0:
- for N = 0 both sides are 0;
- for N ≥ 1 the inequality is (N − 1)(N − 2) ≥ 0.
Take expectations. E N = Σ P(Aᵢ) and E C(N, 2) = Σ_{i<j} P(Aᵢ ∩ Aⱼ), both by indicators and linearity.
3. A rarer condition. Sensitivity = specificity = 0.99; prevalence 1/1,000.
Solution
- One positive. Prior odds 1 : 999; likelihood ratio 0.99/0.01 = 99. Posterior odds 99/999, so P = 99/1,098 ≈ 0.090.
- Two positives that err independently given the condition: odds 99²/999 = 9,801/999 ≈ 9.81, so P = 9,801/10,800 ≈ 0.908.
Even a 99%-accurate test mostly raises false alarms for a condition this rare.
4. Monty Hall with n doors. Monty Hall with \(n\) doors: the host, who knows, opens \(n - 2\) goat doors other than yours. Show that switching to the last closed door wins with probability \((n-1)/n\).
Solution
Assume a knowledgeable host always opens n − 2 goat doors and always offers the switch. Switching wins exactly when your initial pick is a goat, so its unconditional success probability is (n − 1)/n, regardless of how the host chooses among eligible doors. Conditional odds after a particular set of doors is opened also require the host's selection rule; that finer observation need not be independent of the car's location.
5. Different faces in n rolls. Use indicators to find the expected number of different faces seen in \(n\) rolls of a die. How large must \(n\) be for the expectation to exceed \(5\)?
Solution
Let I_f indicate that face f appears at least once. Then E I_f = 1 − (5/6)ⁿ, and by linearity E[#faces] = 6(1 − (5/6)ⁿ). This exceeds 5 iff (5/6)ⁿ < 1/6, that is n > ln 6 / ln 1.2 ≈ 9.83. So n = 10, which gives 5.03; at n = 9 it is 4.84.
6. A finite casino. The prize is min(2ᵏ, 2²⁰) when the first head is on toss k.
Solution
E = Σ_{k=1}^{20} 2ᵏ · 2⁻ᵏ + Σ_{k≥21} 2²⁰ · 2⁻ᵏ = 20 + 2²⁰ · 2⁻²⁰ = 21.
A bankroll of about a million ducats makes the "infinite" game worth 21 ducats; each doubling of the bankroll adds only one more.
Notes and sources
Where it comes back
| Idea | Returns in |
|---|---|
| expectation and linearity | 6 (laws of averages), 9 (estimation), 22 (likelihood) |
| conditioning and Bayes | 15 (first Bayes), 26 (Bayesian data analysis), 33 (false discovery rate) |
| conditional independence | 5 (joint distributions), 36 (causal graphs) |
| the likelihood (Monty Hall's protocol) | 9, 22; the design of data collection in 18 |
| generating functions | 3 (named distributions, mgfs), 6 (characteristic functions and the CLT) |
| the union bound | 33, 51, 54 |
| measure, singular distributions | 43 |
| what probability means | 15, 26 |
Sources
- The problem of points. The Pascal–Fermat correspondence of 1654 (Pascal's letter of 29 July 1654 states the game to three at 32 pistoles a side). Pacioli, Summa de arithmetica (1494). Tartaglia, General trattato (1556). Huygens, De ratiociniis in ludo aleae (1657), Proposition III. Background: A. Hald, A History of Probability and Statistics and Their Applications before 1750 (1990).
- Galileo, Sopra le scoperte dei dadi (c. 1620). Cardano, Liber de ludo aleae (written c. 1564, printed 1663).
- Bertrand, Calcul des probabilités (1889). Jaynes, "The well-posed problem", Foundations of Physics 3 (1973).
- Kolmogorov, Grundbegriffe der Wahrscheinlichkeitsrechnung (1933). Montmort, Essay d'analyse sur les jeux de hazard (1708).
- Bayes, "An essay towards solving a problem in the doctrine of chances", Phil. Trans. (1763). Gigerenzer & Hoffrage, "How to improve Bayesian reasoning without instruction: frequency formats", Psychological Review (1995).
- R v Clark. Conviction November 1999; first appeal dismissed 2000; convictions quashed on a second appeal, January 2003. Royal Statistical Society, statement of 23 October 2001. R. Hill, "Multiple sudden infant deaths — coincidence or beyond coincidence?", Paediatric and Perinatal Epidemiology 18 (2004), 320–326: a dependence factor of 5–10 for a second SIDS, and double SIDS : double homicide of 4.5–9 : 1. The chapter's comparison uses Hill's ratio as published and is tagged schematic.
- Monty Hall. S. Selvin, letters to The American Statistician 29 (1975). M. vos Savant, Parade (1990) and The Power of Logical Thinking (1996), for the letters. P. Hoffman, The Man Who Loved Only Numbers (1998), for Erdős.
- St. Petersburg. D. Bernoulli, "Specimen theoriae novae de mensura sortis" (1738). W. Feller, "Note on the law of large numbers and 'fair' games", Ann. Math. Statist. 16 (1945).
- Sicherman's dice. M. Gardner, "Mathematical Games", Scientific American, February 1978.
- Interpretations. J. Venn, The Logic of Chance (1866); R. von Mises, Wahrscheinlichkeit, Statistik und Wahrheit (1928); J. M. Keynes, A Treatise on Probability (1921); F. P. Ramsey, "Truth and probability" (1926); B. de Finetti, "La prévision" (1937); R. T. Cox, "Probability, frequency and reasonable expectation", Am. J. Phys. (1946); J. Y. Halpern, "A counterexample to theorems of Cox and Fine", JAIR (1999).
- Textbooks. Feller, vol. 1 (3rd ed., 1968). Blitzstein & Hwang (2nd ed., 2019). Ross, A First Course in Probability (10th ed., 2019). Grimmett & Stirzaker (4th ed., 2020). I. Hacking, An Introduction to Probability and Inductive Logic (2001).
About this partfrom its README
Part 2 of a sixty-five-part course in statistics, from a first course to a PhD (see the series plan and the syllabus), in Stage I, Bachelor's: Foundations. Part 1 ended with the discovery that every summary of a sample is random. This part builds the language for reasoning about chance exactly. It begins in 1654, with an interrupted dice game in the letters of Pascal and Fermat, and ends with the old argument about what a probability is. Between them:
- counting, and its traps;
- Bertrand's paradox and Kolmogorov's axioms;
- conditioning, Bayes' theorem, a courtroom and three doors;
- independence;
- random variables, expectation, variance and generating functions.
Built in this part: explainer.stats.prob, an exact probability engine on finite spaces. A Dist is a finite
probability space whose outcomes carry exact rational probabilities. Its operations are the ones the part
introduces:
P,given(conditioning) andmap(a random variable's distribution);E,varandmoment;- independent products
*/**, and sums+/iid_sum, by convolution; - two-stage experiments with
then, which is the multiplication rule as a tree; pgf.
Every exact answer on screen is checked against a seeded simulation. The screening example uses the World's new
screening block (World.screening, about 1% prevalence, two tests independent given the condition).
Chapter notes
| # | Chapter | What it does | Numbers (computed) |
|---|---|---|---|
| 0 | The problem of points | Pascal and Fermat, 1654. Pacioli's split by the past (1494) and Tartaglia's objection. Fermat completes the future: 4 equally likely continuations. Pascal's backward recursion, the table of values for a game to three, and expectation. | A's share 3/4 → 48 of 64 pistoles; 10,000 simulated finishes 0.7515 |
| 1 | Before the axioms | Cardano's circuit and the classical definition. Galileo's three dice: 25 vs 27 orderings. De Méré's two bets, exactly and simulated. Huygens' value of a chance (1657). | 671/1296 = 0.5177 vs 0.4914; a double six needs 25 throws |
| 2 | Counting | The multiplication principle; n!, and 52! with its 68 digits. C(n, k) derived on screen. Pascal's triangle and the general problem of points. Stars and bars: 56 unordered rolls of three dice, not equally likely (Bose–Einstein aside). | C(49, 6) = 13,983,816 |
| 3 | Bertrand's paradox | Three ways to pick a random chord: 1/3, 1/2, 1/4, each simulated 3,000 times. The chords' midpoints form three different clouds, three measures on the same set. Jaynes's stationary, isotropic line-sampling model (1973). | 0.343, 0.495, 0.242 |
| 4 | Kolmogorov's axioms | Probability as area (1933). Complement, monotonicity, inclusion–exclusion and the union bound derived. De Méré's bet by inclusion–exclusion, with Bonferroni's alternating partial sums. Montmort's hat-check problem → 1/e (exact for n ≤ 8 by enumeration; 10,000 shuffles). Continuity. | 9 of 24 derangements of 4; 1/e = 0.3679, simulated 0.3701 |
| 5 | Conditioning | The two-dice grid sliced by "the sum is 8". The definition as renormalized area. The multiplication rule (two aces 1/221). Total probability on a tree of three urns, and its reversal. The two-child problem. | P(six | sum 8) = 2/5; P(BB | ≥ 1 boy) = 1/3, simulated 0.334 |
| 6 | Bayes' theorem | Bayes (1763) and Laplace (1774). The World's screening test as an icon array and a natural-frequency tree (Gigerenzer & Hoffrage 1995). Odds form: prior odds × likelihood ratio 18. The posterior by age group. A second test. | P(condition | +) = 0.150 exactly, 0.151 in the World; two positives 0.760 (World 0.758) |
| 7 | The prosecutor's fallacy | R v Clark, from the published record. Squaring 1/8,543 assumes independence (Hill's dependence factor 5–10). P(E | innocent) ≠ P(innocent | E). Double SIDS vs double murder in odds form (Hill 2004: 4.5–9 : 1). The RSS statement (2001) and the quashed convictions (2003). | 8,543² = 72,982,849 |
| 8 | Monty Hall | Selvin (1975) and vos Savant (1990). The tree, renormalized: 2/3. 3,000 simulated games. Four host protocols computed exactly: 2/3, 1/2, 0 and 1/(1+q). The data include how they were shown. | switching wins 0.658 in simulation |
| 9 | Independence | The product rule; independent is not disjoint. Bernstein's tetrahedron (rotating, painted): pairwise but not mutually independent. The World's two tests: dependent overall, independent given the condition. | P(B | A) = 0.18 vs P(B) = 0.06 overall; 0.90 vs 0.90 given the condition |
| 10 | Random variables | The sum of two dice as a function on Ω, sorted into its distribution (the push-forward). The CDF and its properties. Discrete, continuous and mixed; then the Cantor distribution: continuous, no density (devil's staircase, five levels, 20,000 draws). | E X = 1/2, Var X = 1/8; simulated 0.5004, 0.1259 |
| 11 | Expectation | The balance point; LOTUS. The layer-cake formula on a die. Linearity without independence. Matches in a shuffle (E = Var = 1, exact for n ≤ 8; 10,000 decks against e⁻¹/k!). Birthdays (23 people). The coupon collector, n H_n. | P₂₃ = 0.507 (sim 0.505); 50 stickers: 225.0 packs (sim 224.0) |
| 12 | Variance, and a game worth infinity | Var X = E X² − μ², derived. Variances of sums and σ/√n. The St. Petersburg game (N. Bernoulli 1713, D. Bernoulli 1738): infinite expectation; 2²⁰ simulated games, typical running-mean growth on the log₂ n scale (Feller 1945, convergence in probability). Log utility: a 4-ducat certainty equivalent for the prize, with entry fees depending on wealth. | Var(die) = 35/12; Var(10 dice) = 175/6 |
| 13 | Generating functions | G(s) = E sˣ. Sums become products: the convolution grid. Moments by differentiation. Sicherman's dice by factoring (Gardner 1978), checked by the engine. | G'(1) = 7/2, G''(1) = 35/3 |
| 14 | What probability means | Frequency (Venn, von Mises), logic (Keynes), belief (Ramsey, de Finetti). Finite Dutch books give finite additivity; countable additivity needs continuity. Cox-style results require regularity and richness assumptions (1946; Halpern 1999). Frequentist and Bayesian, and how the series uses both. | — |
| 15 | Outro | Fifteen-line recap, where the ideas return, problems, references, the Transcript, and Part 3's question. | — |
Companion material in this repository
The syllabus's plan for this partfrom SYLLABUS.md, the plan of record
- Hook: the problem of points (1654). A game to three, interrupted at 2–1; Fermat's enumeration vs Pascal's recursion.
- Before axioms. Cardano; Galileo's three dice (27 ways vs 25); Huygens (1657).
- Counting. Permutations, combinations, multinomials, stars and bars.
- Bertrand's paradox (1889). Three random chords: 1/3, 1/2, 1/4 (simulated). "Random" needs a measure.
- Kolmogorov's axioms (1933).
- Events as a σ-algebra, previewed (the full theory is Part 43; Analysis, Built Part 5).
- Consequences: inclusion–exclusion; derangements → 1/e; continuity; the union bound.
- Conditioning. Renormalizing a slice; the multiplication rule; total probability as a tree.
- Bayes' theorem. The odds form; the World's screening test; natural frequencies.
- The prosecutor's fallacy. The Sally Clark case (1999; RSS statement 2001; quashed 2003), told with care from the published record.
- Monty Hall (Selvin 1975; vos Savant 1990). The host's protocol; variants enumerated exactly.
- Independence. Pairwise but not mutual (Bernstein's tetrahedron); conditional independence.
- Random variables. Functions on Ω; CDFs; atomic laws, laws with a density, mixtures and singular continuous laws (the Cantor distribution).
- Expectation. The layer-cake formula; LOTUS; linearity; indicators (fixed points, birthdays, the coupon collector's nH_n).
- Variance and moments. Var of sums; St. Petersburg (D. Bernoulli 1738) and log utility.
- Generating functions, first look. pgfs of dice sums; convolution as polynomial multiplication.
- What probability means. Frequency, logic and belief (von Mises, Keynes, Ramsey, de Finetti); the Dutch book (de Finetti 1937): finite bets enforce finite additivity; countable additivity needs continuity. Cox-style results (1946) require explicit regularity and richness assumptions.
- Outro.
Built: an exact probability engine on finite spaces (Python fractions), checked against simulation.
Build the film
python -m videos.stats.stats2.compute # the part's numbers, into .cache/stats2
python tools/build.py stats2 # render and assemble the film
EXPLAINER_TTS=silent python tools/qa_scene.py stats2 Hook # one chapter, silent, with a contact sheet
Scenes: videos/stats/stats2. Setup: see the course page. Source of these notes: the README and the scenes' narration.
Build it
From the repo root, after the one-time setup in the top-level README:
python -m videos.stats.stats2.compute # once: every computed item (seconds; cached in .cache/stats2)
python tools/build.py stats2 -q l # fast 480p preview
python tools/build.py stats2 # 1080p30 -> renders/stats2.mp4
python tools/qa_scene.py stats2 Monty # one chapter, silent, with a contact sheet
python tools/lecture_length.py stats2 --floor 50