Part 4 of 33 7 min dated to the video that prompted it

The Monty Hall problem, and why switching wins

Three doors, one car, a host who knows where it is. Switching wins two thirds of the time — here is the intuition, the enumeration, and the lesson underneath it.

On this page 5 sections
  1. The one-line intuition
  2. The enumeration
  3. Change the host, change the answer
  4. Simulating it
  5. Where this shows up at work

Three doors. A car behind one, a goat behind each of the other two. You pick door 1. The host — who knows what is behind every door — opens door 3, shows you a goat, and offers you the swap to door 2. Stay or switch?

Switching wins two thirds of the time. Staying wins one third. This is not a trick of wording, and it is not a close call: switch and you double your money. The problem is famous because the wrong answer feels so obviously right. Two doors are left, so it must be fifty-fifty. That reasoning has convinced people with doctorates in mathematics, in public, at length. The puzzle reached statisticians through Steve Selvin, who set it out in a 1975 letter to The American Statistician and, in a second letter later that year, gave it the name it still carries.

The reason it is wrong is worth more than the answer. The two remaining doors did not get to their positions the same way. One was chosen blindly by you. The other survived a filter applied by someone who could see.

The one-line intuition

Your first pick is right one third of the time. Nothing the host does can change that, because the host was always going to open a goat door. Whatever you picked, he had at least one goat available to reveal, and he revealed one. An event that was certain to happen carries no information about your door.

So your door stays at one third. The car is somewhere, so the remaining door must carry the other two thirds. The host did not shuffle the probability — he concentrated it. All the weight that was spread over the two doors you did not pick is now piled onto the single one still closed.

If that still slides off, scale it up. A hundred doors, one car. You pick door 37. The host opens ninety-eight doors, all goats, leaving door 37 and door 84. Nobody thinks that is fifty-fifty. You know exactly what happened: you guessed, almost certainly wrong, and the host walked around the studio carefully avoiding the car. Door 84 is where the car is, unless your one-in-a-hundred guess landed. The three-door version is the same machine with the drama turned down.

The enumeration

Say you pick door 1. There are three equally likely worlds.

Car is behindHost can openStaySwitch
Door 12 or 3WinLose
Door 23 onlyLoseWin
Door 32 onlyLoseWin

Drawn out, the three worlds look like this:

The three equally likely worlds when you have picked door 1. If the car is behind door 1, staying wins and switching loses. If it is behind door 2 or door 3, the host is forced to open the other goat door, so switching wins. Switching wins in two worlds out of three. your pick door 1door 2door 3 stayswitch car behind door 1door 2door 3 car goat goat the host opens either of these Win Lose goat car goat opened Lose Win goat goat opened car Lose Win switching wins in two of the three worlds

The thick outline is your door in every world. In the top world the host has a free choice, and that is the only world where staying wins. In the other two his hand is forced, and the door he leaves closed is the car.

Two of the three rows favour switching. Notice which column does the work: the host’s options. When you picked wrong, he has no choice at all. His hand is forced, and a forced move tells you a great deal.

The same thing in Bayes’ terms, for the case where he opens door 3. If the car is behind door 1, he had two goat doors and picked door 3 with probability one half. If it is behind door 2, he had to open door 3 — probability one. If it is behind door 3, he could not have opened it — probability zero. Weighting the three equal priors by those numbers gives one third for your door and two thirds for door 2. The evidence is not “door 3 has a goat”. The evidence is “the host opened door 3, given the rules he plays by”.

Change the host, change the answer

Here is the part that turns a puzzle into a principle. Suppose the host does not know where the car is. He opens one of the other two doors at random, and it happens to show a goat. You see exactly the same thing: your door closed, one goat revealed, one door left.

Now it really is fifty-fifty. Switching gains you nothing.

Identical observation, different probability. What changed is the process that produced it. The knowing host filters out the car; the ignorant host does not. When the ignorant host reveals a goat, you have learned something about your own door too — the worlds where he would have exposed the car have been eliminated, and those were disproportionately the worlds where your first pick was wrong.

So the answer depends on a fact that is nowhere in the picture of three doors: how the door came to be opened. State the rules or the question has no answer.

Simulating it

Ten lines settle any remaining argument. The only line that matters is the one where the player picked wrong: the host is then forced to leave the prize door closed.

import random
def play(switch, doors=3):
prize = random.randrange(doors)
pick = random.randrange(doors)
if not switch:
return pick == prize
if pick == prize:
other = random.choice([d for d in range(doors) if d != pick])
else:
other = prize # the host must leave the prize door closed
return other == prize
trials = 100_000
for switch in (False, True):
wins = sum(play(switch) for _ in range(trials))
print(f"switch={switch}: {wins / trials:.3f}")

Roughly 0.333 and 0.667. Change the rules — let the host open a random door and discard the rounds where he shows the car — and both numbers move to 0.5. Writing the simulation forces you to state the host’s rule explicitly, which is why it convinces people that arguing does not. Newcolator lays the same argument out on screen in The Monty Hall Problem.

Where this shows up at work

Rarely with goats. Constantly with data that reached you through a filter.

Customers who answered the survey are the ones willing to answer surveys. Trades in the backtest are the ones the strategy chose to take. Machines still in the fleet are the ones that did not fail. Rows that survived the join are the rows that matched. In each case the sample in front of you passed through something that was not blind, and treating it as a random draw gives a confident wrong answer — the same mistake as calling the two doors even.

This is also the deep reason leakage is so hard to see: a leaked feature is information that arrived through a channel the deployed model will not have. And it is a cousin of Simpson’s paradox, where the number flips depending on what you condition on. The habit that protects you in all three is the same one Monty Hall teaches: before you reason about a number, ask how it got to your desk.

Most people remember Monty Hall as a counterintuitive answer. It is better remembered as a question. Who chose what you are looking at, and what did they know when they chose it?