The Monty Hall problem is a probability puzzle about three doors, one car, and two goats. You pick a door, the host opens another one to show a goat, and you decide whether to stay or switch. Here you can play it round by round, then let a simulator check the answer over thousands of rounds.
The Monty Hall problem, step by step
Each round starts with the doors closed. A car is behind one of them and a goat is behind each of the others, placed at random before you pick. Click or tap a door to choose it. The host then opens every other door except one, and shows you what's behind them.
Now you choose. Stay keeps your first door, and Switch moves you to the one other door the host left closed. You can also click your own door to stay or the other closed door to switch. Both doors open, your door is marked won or lost, and Next round deals new doors.
Why switching wins the Monty Hall problem
Say you pick door 1. The car is equally likely to be behind any of the three doors, so look at each case:
- Car behind door 1: the host opens either other door. Staying wins.
- Car behind door 2: the host must open door 3. Switching wins.
- Car behind door 3: the host must open door 2. Switching wins.
Staying wins in one case out of three and switching wins in two. Another way to see it: switching is like being allowed to take both doors you didn't pick. The host just opens the empty one for you.
Bayes' theorem and the host's choice
The key is that the host's choice is evidence. Suppose you pick door 1 and he opens door 3. If the car is behind door 1, he could have opened door 2 or door 3, so he opens door 3 only half the time. If the car is behind door 2, he opens door 3 every time. If it's behind door 3, he never does.
Weigh each door's starting chance of 1 in 3 by how likely the host was to do what he did: 1/3 × 1/2 for door 1 and 1/3 × 1 for door 2. Door 2 carries twice the weight, so after door 3 opens, door 1 has a 1 in 3 chance and door 2 has 2 in 3. That's Bayes' theorem, the rule for updating a probability when you learn something new.
More doors: 5 and 10
Choose 5 or 10 doors under Settings and the host still opens every other door but one. Your first pick is right 1 time in however many doors there are, and the door the host leaves closed has the car every other time:
- 3 doors: staying wins 1 in 3, switching 2 in 3.
- 5 doors: the host opens 3 goat doors. Staying wins 1 in 5, switching 4 in 5.
- 10 doors: the host opens 8 goat doors. Staying wins 1 in 10, switching 9 in 10.
More doors make the answer easier to feel. Few people would keep a 1 in 10 guess after the host has carefully skipped one door out of nine.
When the host is guessing
Set The host to Guesses and the host opens doors at random, so sometimes the car is behind one of them. That happens 1 round in 3 with 3 doors, 3 rounds in 5 with 5 doors, and 4 rounds in 5 with 10. Those rounds don't count, and the results panel shows how many there have been.
In the rounds where only goats appear, staying and switching each win half the time. Both closed doors were left shut by chance, so neither is special. The 2 in 3 answer depends on a host who knows where the car is and always shows a goat.
Running 10,000 rounds at once
Under Run the experiment, choose 100, 1,000, or 10,000 rounds and press Run. Two computer players use your door and host settings: one always stays and one always switches. Every round is played in a moment in your browser, and the two lines draw across the chart in about a second and a half, with dashed lines at the expected win rates.
Short runs wander. After 100 rounds, the switching line can easily finish 5 points or more away from 66.7%. After 10,000, it nearly always lands within about 1 point. The caption gives each player's wins to a tenth of a percent, and with a guessing host it says how many extra rounds were replayed because the car was shown.
Your results, kept for each setting
Above the doors, Rounds, Cars won, and Win rate count the rounds you've played with the current setting. Your results splits them into the times you stayed and the times you switched, each with a bar and a tick at the long-run chance, so you can watch your own numbers drift toward it.
Each combination of doors and host keeps its own results, so 10 doors with a guessing host doesn't mix with the classic game. Changing a setting starts a new round, and Reset results clears the results for every setting.
Where the Monty Hall problem came from
The statistician Steve Selvin posed the puzzle in a letter to The American Statistician in 1975 and named it the Monty Hall problem in a second letter that year. Monty Hall hosted the American TV game show Let's Make a Deal from 1963, though the real show didn't offer contestants this switch. A closely related puzzle, the three prisoners problem, had appeared in Martin Gardner's Mathematical Games column in Scientific American in 1959.
The problem became famous in September 1990, when Marilyn vos Savant answered a reader's version in her Ask Marilyn column in Parade magazine and said to switch. About 10,000 readers wrote in, nearly 1,000 of them with PhDs, and most said she was wrong. By a well-known account, the mathematician Paul Erdős wasn't convinced until he saw a computer simulation. This game isn't affiliated with Let's Make a Deal.
Opening doors by tap, number key, or screen reader
Each round needs only two choices, your first door and stay or switch, and both work however you play:
- Touch or mouse: tap a door to pick it, then tap Stay or Switch, or tap the door you want.
- Keyboard: press 1 to 9 to choose a door, and 0 for door 10. After the host opens doors, your door's number stays and the other closed door's number switches. N starts a new round.
- Screen readers: each door is labeled, such as your pick, the door you can switch to, or open with a goat, and every step and result is read out.
For more probability you can feel, flip a fair coin a few hundred times, or play Higher or Lower, where the odds change as the deck runs down.
How the doors stay fair
No account is needed. The car is placed with your browser's cryptographic random number generator before you pick, and a door's prize is only added to the page when that door opens, so a closed door carries no clue about what's behind it.
The simulator plays its rounds in your browser, and your picks and results aren't sent to a server. What the game keeps in this browser's local storage is small: your door count, host, simulator size, and your stay and switch tallies for each of the six door and host settings. A half-played round isn't saved, so reloading the page deals fresh doors. The privacy policy shows the exact entry.