Of 100 people, 40 own a bike. Keep only the 50 who live in the city, and count the bikes again.
Probability, given what you know
100 people: who owns a bike, and who lives in the city.
100 people: 40 own a bike (filled) and 50 live in the city (ringed); 30 do both.
Predict first. Among city people, is the share who own a bike lower than, the same as or higher than among everyone (40 %)?
Describe this picture
A grid of 10 by 10 dots, one per person. The 40 who own a bike are filled, the 50 who live in the city have a ring, and the 30 who do both are filled and ringed. Before the clip, a question asks: among city people, is the share who own a bike lower than, the same as, or higher than among everyone (40 %)? Three small bar drawings answer it, “lower”, “the same” and “higher”, and a tap picks one and starts the clip. Then the 50 people outside the city fade, the 50 who are left line up in a block labelled “lives in the city: 50”, bike owners first, and a bar shows “own a bike: 30 of 50”, a share of 0.60, with a dashed mark at “everyone 0.40” and your guess as a dotted outline over the part of the bar it named. Readouts give the fact you are given, “30 of 50 = 0.60” in that world, and “40 of 100 = 0.40” among everyone. After the clip a switch, “Given that a person”, sets “lives in the city” or “owns a bike”. With “owns a bike”, the 60 people without a bike fade instead, the 40 owners line up, city people first, and the bar shows 30 of 40, a share of 0.75, against 0.50 for everyone.
Knowing shrinks the world
Before the clip you guessed. Among everyone, 40 people in 100 own a bike, a share of 0.40. Among the 50 city people, 30 own a bike, a share of 0.60. Knowing that someone lives in the city changed the answer.
What happened in the picture is the whole idea. Once you know a fact, every person it rules out leaves the picture. The world shrinks to the people who are left, and the new probability is a share of that smaller world.
The probability of once you know that happened is called the conditional probability of given . I write it , and read the bar as “given”. With “owns a bike” and “lives in the city”, the picture counted
Divide the top and the bottom by the 100 people in the whole grid, and the counts become probabilities:
This is the definition, and it works whenever is not 0. The top is the part of that survives the shrinking. The bottom is the size of the new world.
After the clip, switch the fact to “owns a bike”. Now the 60 people without a bike fade. Of the 40 bike owners, 30 live in the city: .
Watch out
and are different numbers. Both have the same 30 people on top, but the world they are shared out over is not the same: 50 people in one, 40 in the other.
The multiplication rule
Turn the definition around and you get a way to find the chance that two things both happen:
In words: first must happen, then, in the world where it did, must happen too. This is the multiplication rule.
Deal two cards from a shuffled deck of 52. What is the chance both are aces? The first card is an ace with chance . Given that it was, 51 cards are left and 3 of them are aces, so the second is an ace with chance :
The second card’s chance depends on the first, because the first card is not put back. The conditional probability carries that.
Trees and total probability
A factory has two machines. Machine 1 makes 60 % of the parts, and 2 % of its parts are defective. Machine 2 makes 40 %, and 5 % of its parts are defective. What share of all parts is defective?
Counts first. Of 1000 parts, 600 come from machine 1 and 2 % of those, 12, are defective. 400 come from machine 2 and 5 % of those, 20, are defective. So 32 of the 1000 are defective.
A probability tree draws this. Each branch carries a conditional probability, and following a path multiplies them, by the multiplication rule.
Let be “the part is defective”, “it came from machine 1” and “it came from machine 2”. Every part comes from exactly one machine, so splits into two disjoint pieces, one per machine. Adding the pieces gives
32 parts in 1000, as counted.
The same works for any number of pieces. Events that never overlap and together cover are a partition, and for any event
This is the law of total probability: add up every path of the tree that ends in .
Where this leads · trees become matrices
A tree whose branches repeat the same step, again and again, is a Markov chain: the chance of the next state depends only on the present one. Its branch probabilities fill a table, a matrix, and following the tree for many steps is multiplying by that matrix again and again. Markov chains here and Markov matrices in the linear algebra course take it from there.
Three doors
Here is a famous puzzle that uses everything on this page. A game show has three closed doors. Behind one is a car; behind the other two, goats. You pick a door. The host, who knows where the car is, opens one of the other two doors and shows a goat. Then you may stay with your door, or switch to the last closed door.
Most people say it makes no difference: two doors are left, so it is fifty-fifty. Make your guess, then watch 600 games.
Switching doors wins twice as often
600 games of the three-door show, played by a computer (seed 1301).
You pick a door. The host, who knows where the car is, opens another door with a goat. Stay, or switch?
Predict first. Over many games, who wins more often: a player who always stays, or one who always switches?
Describe this picture
Three doors above two bars that count wins over 600 seeded games (seed 1301): one bar for a player who always stays, one for a player who always switches, on a scale of the share of games won with dashed guides at 1/3 and 2/3. Before the clip, three small drawings of the two bars ask which wins more: “staying”, “switching” or “no difference”; a tap picks one and starts the clip. The first four games play slowly on the doors: your pick is outlined, the host opens a door with a goat, then the car is revealed and the winning bar grows. Then the other 596 games pour in, and each bar shows its share of wins so far, with its count above it. The shares wobble at first and settle at 190 of 600 (0.317) for staying and 410 (0.683) for switching; your guess is drawn as dotted outlines on the bars. After the clip a slider, “Games counted”, sets how many of the games are counted, from 10 to 600 in tens.
In the clip, switching won 410 of the 600 games and staying won 190, close to the 400 and 200 that two thirds and one third would give. Switching wins about twice as often as staying. Here is why, with counts first.
Say you always pick door 1, and picture 600 games with the car behind each door exactly 200 times. When the car is behind door 1, the host can open either other door; say the host opens door 3 in half of those games, 100. When the car is behind door 2, the host must open door 3: all 200 games. When it is behind door 3, door 3 stays shut.
So in 300 games you see door 3 open with a goat, and the car is behind door 2 in 200 of them. Given what you saw, switching to door 2 wins 200 times in 300. The same holds when the host opens door 2.
In symbols, by total probability and then the definition:
Your first pick was right one time in three, and nothing the host does changes that. The host’s knowledge is what pushes the other two thirds onto the one door the host leaves closed.
Worked example
1. Which machine made it? In the factory above, you pick up a part and it is defective. What is the chance it came from machine 1?
Shrink the world to the 32 defective parts. Machine 1 made 12 of them, so
Machine 1 makes most of the parts, but only 37.5 % of the defective ones. Turning “defective given machine” around into “machine given defective” is the subject of Bayes’ theorem.
2. A host who does not know. Suppose the host opens one of the two other doors at random, and it happens to show a goat. Does switching still help?
Again you pick door 1. The car is at door 1 and the host opens door 3, with chance ; that door has a goat. The car is at door 2 and the host opens door 3, also with chance ; that door has a goat too.
The two paths that show a goat behind door 3 are equally likely, so stay and switch each win with chance . A random host who happens to show a goat tells you nothing about doors 1 and 2.
3. A queen, then not a queen. From a deck of 52, what is the chance the first card is a queen and the second is not? .
Where you’ll meet this
Diagnosis and reliability. A doctor or an engineer rarely asks “how likely is a fault?” in general. They ask how likely it is given what they see: given this batch, this symptom, this alarm. Each new fact shrinks the world, as in the grid.
Sorting by evidence. A spam filter asks how likely a message is to be spam given the words in it. Getting the direction of the condition right is the subject of Bayes’ theorem.
Sampling without putting back. Dealing cards, drawing a sample of people for a survey, or testing parts from a batch without returning them: each draw changes the world the next one comes from, as with the two aces.
Games. The three doors show how much a little knowledge can be worth, and why it matters who knew what.
Reference card
| Quantity | Formula | Notes |
|---|---|---|
| Conditional probability | a share of ; needs | |
| Reversed condition | in general | same top, different world |
| Multiplication rule | multiply along a tree’s path | |
| Total probability | a partition of | |
| Three doors, host knows | stay , switch | |
| Three doors, host at random, goat shown | stay , switch |