A car hides behind one door and goats behind the rest. You pick a door, the host opens a goat door, and offers you a swap. Most people stay put. They shouldn't: switching wins two times out of three.
Pick a door to start. Changing the number of doors or the host starts a fresh tally and a fresh simulation.
Say you pick door 1 and the host opens door 3. Before he acts, each door has a 1/3 chance. Then ask how likely his move was in each case:
Bayes' rule weighs each possibility by how well it explains what you saw. If the car is behind door 2, the host was forced to open door 3, so seeing door 3 open is twice as likely in that world. That doubles door 2's odds relative to yours.
The host knows where the car is. He always opens every other door except one, never shows the car, and always offers the swap. Your first pick is right only 1 time in 3. Switching wins exactly when that first pick was wrong, which is the other 2 times in 3.
The chart replays the game a thousand times. Early on the two lines wander; as games pile up they settle onto the dashed lines at 1/3 and 2/3.
Two closed doors feel like a coin toss. But the host's choice was not random: he had to avoid the car, and that carries information about the door he skipped and none about yours.
When Marilyn vos Savant gave the switching answer in Parade magazine in 1990, about 10,000 readers wrote in, nearly 1,000 of them with PhDs, most saying she was wrong. The mathematician Paul Erdős reportedly stayed unconvinced until he saw a computer simulation.
The Monty Hall trap is mixing up "how likely is this evidence" with "how likely is my guess, given the evidence". Bayes' rule keeps them apart, and getting it right matters far beyond game shows.
Suppose 1 person in 1,000 has a disease, and a test catches 99% of cases but also flags 5% of healthy people. A positive result then means only about a 2% chance of disease, because healthy people vastly outnumber sick ones. Ignoring that base rate is one of the most common errors in reading screening results.
In the demo: your door's starting odds of 1/3 still count after the evidence.Bayesian spam filters, popularised by Paul Graham's 2002 essay "A Plan for Spam", start from how common spam is and update on each word in a message. A word like "unsubscribe" shifts the odds a little; dozens of such clues together make the verdict nearly certain.
In the demo: the host's door choice is a clue, weighed by Bayes' rule.Websites show two versions of a page to different visitors and compare results. Early numbers swing wildly, and stopping as soon as one looks ahead produces false winners. Bayesian A/B tests report the probability that one version is truly better, given the data so far.
In the demo: watch how far the lines stray before 1,000 games settle them.After the 2009 crash in the Atlantic, two years of searching found no wreck. In 2011 analysts built a Bayesian map of where the plane could be, updating it with every area already searched. The wreck was found within about a week once searching resumed in the area the map ranked highest. The US Coast Guard plans searches the same way.
In the demo: every opened door with no car moves probability onto the doors left.In 1999 Sally Clark was convicted of murdering her two baby sons, partly on testimony that two cot deaths in one family had a 1 in 73 million chance. That figure was flawed, and it answered the wrong question: double murder is also extremely rare, so the two had to be compared. Her conviction was overturned in 2003.
In the demo: a rare event alone proves little until you weigh the alternatives.Robot vacuums and self-driving cars track where they are with Bayes filters, updating a map of likely positions after every sensor reading. Many machine learning methods also treat learning as Bayesian updating: start with a prior, then let the data reshape it.
In the demo: the probability bars are a belief being updated by one observation.