Monty Hall Problem
In the Monty Hall problem you pick one of three doors, the host opens another to show a goat, and switching wins 2 times in 3. Play up to a million games and watch the count land on the exact odds.
Switch wins
- Switch wins Exactly 2/3 (66.67%). Over 10,000 games, 95 runs in 100 land between 65.74% and 67.59%.
- 67.16% (6,716 of 10,000)
- Stay wins Exactly 1/3 (33.33%). Over 10,000 games, 95 runs in 100 land between 32.41% and 34.26%.
- 32.84% (3,284 of 10,000)
- Exact odds of switching (n - 1)/n x 1/(n - 1 - k) = 2/3 x 1/1. Your first pick is a goat 2 times in 3, and then the car is behind the one other door left closed.
- 2/3 (66.67%)
- Switching versus staying (n - 1)/(n - 1 - k) = 2/1. Any door the host opens moves chance onto the doors you did not pick, never onto yours.
- 2 times as likely to win
- Game 1, door by door
- Car behind door 1. You picked door 1. The host opened door 2. Switching to door 3 loses, and staying wins.
- Where the games came from Your browser's cryptographically secure generator, with the few 32-bit words that would favor some doors thrown away, so every door is exactly equally likely to hide the car.
- crypto.getRandomValues()
| Strategy | Wins | Simulated | Exact | 95% range |
|---|---|---|---|---|
| Switch | 6,716 | 67.16% | 2/3 (66.67%) | 65.74% to 67.59% |
| Stay | 3,284 | 32.84% | 1/3 (33.33%) | 32.41% to 34.26% |
- The games in the HTML were played once when the site was built, so without JavaScript every visitor sees the same run. With JavaScript on, they are played again in your own browser on load and every time you press Generate.
How the Monty Hall Problem works
The game has three doors. A car is behind one and a goat is behind each of the other two. You pick a door. The host, who knows where the car is, opens one of the other two to show a goat, then offers you the switch. Staying wins 1 time in 3. Switching wins 2 times in 3.
Here is the Monty Hall problem explained in two steps. First, your pick is the car 1 time in 3, and nothing the host does can change that, because he can always find a goat to show whatever you chose. So staying wins 1/3. Second, the other 2/3 sits on the two doors you did not pick, and the host has just removed the goat from one of them. Switching collects the whole 2/3.
More doors make it obvious. With 100 doors the host opens 98, all goats, and leaves one other door shut. Your first pick was right 1 time in 100, so the door he carefully avoided opening holds the car 99 times in 100.
The general rule covers n doors with k opened by a host who knows. Staying wins 1/n. Switching wins (n - 1)/n x 1/(n - 1 - k), because your pick is a goat (n - 1)/n of the time and then the car is one of the n - 1 - k other closed doors. With four doors and one opened, staying wins 1/4 and switching 3/4 x 1/2 = 3/8. Switching wins more often whenever the host opens at least one door.
The simulator plays every game with the car and your pick drawn from your browser's crypto.getRandomValues(), then scores staying and switching on the same deal. Random runs wobble, so each rate comes with the range it lands in 95 times out of 100. Over 10,000 games the switch rate stays within about 0.92 percentage points of 2/3. Over 1,000,000 that narrows to about 0.09.
The host's knowledge is what makes switching pay. Jeffrey Rosenthal called the other version Monty Fall: the host opens a door at random. With three doors he shows the car 1 time in 3 and that game is void. In the games where a goat appears, staying and switching each win 1/2. In general each wins 1/(n - k), and k/n of the games are void. A goat shown by luck is evidence that your door hides the car, and that evidence exactly cancels the edge.
The puzzle is named for Monty Hall, the host of the game show Let's Make a Deal. Steve Selvin posed it in The American Statistician in 1975, and Marilyn vos Savant gave the switching answer in her Parade column in 1990, which drew many letters insisting she was wrong.
Monty Hall Problem FAQ
Should you switch doors in the Monty Hall problem?
Yes. With three doors and a host who knows where the car is and always opens a goat, switching wins 2/3 of the time and staying wins 1/3.
Why isn't it 50/50 once a door is open?
Because the host's choice is not random. He must avoid the car, so opening a door tells you nothing about your own pick, which stays at 1/3. The chance he steered around belongs to the door he left shut.
What if the host does not know where the car is?
Then it is 50/50. If he opens a door at random and happens to show a goat, staying and switching each win 1/2 with three doors. He shows the car 1 time in 3, and those games do not count.
Does switching always win?
No. It wins 2 games in 3, so staying wins the other 1 in 3. The 2/3 also depends on the host always opening a goat and always offering the switch. A host who offers it only when you picked the car would make switching lose every time.
How many games does a simulation need?
10,000 games put the switch rate within about 0.92 percentage points of 2/3 in 95 runs out of 100. A million games narrow that to about 0.09 points.