Monty Hall problem
About this app
Three, ten or a hundred doors: probability visibly flows onto the door the host leaves shut — plus a Bayes table, a tree, an ignorant host and the strategies always switch, never switch, 50/50 simulated thousands of times.
The puzzle
Behind one of three doors is a car, behind the others a goat each. You pick a door. The host knows where the car is and opens another door with a goat. Should you switch? Yes: your first pick is right only 1/3 of the time. With probability 2/3 the car is behind one of the other two doors, and then the host must leave exactly that door closed. Switching therefore wins 2/3 of the time. In general, with n doors and a host who opens all but one: P(win | switch) = (n − 1)/n.
What you see
A bar above each door shows how likely the car is to be there; once doors are opened, the probability visibly flows onto the remaining door. Alongside the game there is a Bayes table with prior, likelihood and posterior, a tree of all cases, and a simulation over 100, 1,000 or 10,000 rounds. In it, the strategies “always switch”, “never switch” and “50/50 random” compete on the same rounds. A record keeps track of your own games.
What to look for
Try 100 doors: the host opens 98 goat doors, your door keeps 1 %, the other one has 99 %. Then switch to a host who opens doors at random. He sometimes reveals the car, and those rounds do not count. If he only shows goats, both closed doors are equally good, 1/2 to 1/2. What shifts the probability is the host’s knowledge; opening doors alone does not do it.
Frequently asked questions
- Why should you switch in the Monty Hall problem?
- Your first pick finds the car with probability 1/3 only. In the remaining 2/3 of cases the car is behind one of the other doors, and the host has to keep exactly that door closed. If you switch, you win with probability 2/3.
- Why is the Monty Hall problem not 50/50?
- The two remaining doors are not equivalent: you picked yours at random, while the host left the other one closed knowing where the car is. Bayes’ theorem gives P(car behind the other door | host opens a goat door) = 2/3. Only if the host opened a door at random and happened to show a goat would it be 1/2 to 1/2.
- How do you solve Monty Hall with Bayes’ theorem?
- Each door starts with probability 1/3. If the car is behind your door 1, the host opens door 3 with probability 1/2; if it is behind door 2, he must open door 3. So P(car behind 2 | host opens 3) = (1 · 1/3) / (1/2) = 2/3.
- What can I try in this app?
- You play with 3, 10 or 100 doors and choose whether the host knows where the car is or opens doors at random. The Bayes table and the tree work through each round. The simulation compares always switching, never switching and 50/50 over up to 10,000 rounds.
Subject: Probability & statistics
More from Probability & statistics
- Curve-fitting playground
- Galton board
- Covariance & Regression
- Covariance & regression 2.0
- Coin flips: law of large numbers
- Spray a Point Cloud
- Regression & R²
A VisuApp by heyprof: interactive, free in your browser, no sign-up. What is a VisuApp? · All apps