Monty Hall Problem Simulator

Run thousands of Monte Carlo simulations of the Monty Hall problem and watch the “always switch” strategy win about two-thirds of the time.

Each trial randomly places the car, makes a first pick, has the host reveal a goat, then records whether switching or staying would have won. Theory predicts switching wins 2/3 of the time.

About the Monty Hall problem

The Monty Hall problem, named after the host of the game show Let’s Make a Deal, is one of the most famous counterintuitive results in probability. You choose one of three doors; a car hides behind one and goats behind the other two. The host — who knows where the car is — opens one of the doors you did not pick to reveal a goat, then asks whether you want to switch to the other unopened door. Although it feels like a 50/50 choice, switching wins two-thirds of the time. Your original door keeps its initial 1-in-3 chance, so the remaining door inherits the full 2-in-3 probability once a goat is revealed. This simulator plays the game thousands of times at random so you can watch the win rates converge on 66.7% for switching and 33.3% for staying — a hands-on confirmation of the math.

How to use it

  • Enter the number of simulations to run (more trials converge closer to the theoretical values).
  • Click Run simulation.
  • Compare the empirical win rates for always switching versus always staying.
  • Run it again or with more trials to see the results stabilize near 2/3 and 1/3.

Frequently asked questions

What is the Monty Hall problem?
A probability puzzle based on a game show. You pick one of three doors; behind one is a car, behind the others goats. The host, who knows what is behind each door, opens a different door revealing a goat, then offers you the chance to switch to the remaining door. The counterintuitive answer: you should switch.
Why should you switch doors?
Your first pick has a 1/3 chance of being the car, so the other two doors together hold 2/3. When the host reveals a goat behind one of those two, that entire 2/3 probability concentrates on the single remaining door. Switching therefore wins 2/3 of the time, versus 1/3 for staying.
Does this simulator prove it?
Empirically, yes. Running thousands of random trials, the “always switch” win rate converges on about 66.7% and “always stay” on about 33.3%. More trials give a tighter convergence to the theoretical values — a demonstration of the law of large numbers.
Why is the answer so counterintuitive?
People tend to think that once one door is removed, the two remaining doors are equally likely (50/50). But the host’s choice is not random — he always reveals a goat — which transfers information and breaks the symmetry, giving the switch door the advantage.
What if the host opened a door at random?
Then the puzzle changes. If the host might reveal the car (and the game only continues when a goat happens to appear), switching and staying become equally good (50/50). The 2/3 advantage depends specifically on the host knowingly always showing a goat.
Does switching guarantee a win?
No. Switching wins about two times out of three, not every time. In any single game you might lose by switching; the advantage only shows up over many plays, which is exactly what this simulator demonstrates.

Related tools