Mausam.
HomeAboutExperienceProjectsPublicationsSkillsBlogContact
Mausam.

Machine learning engineer & researcher based in Nepal. Exploring computer vision and medical imaging in fundus images.

Quick Links

  • About
  • Experience
  • Projects
  • Publications
  • Blog
  • Contact

Connect

hello@mausamgrg.com.np

© 2026 Mausam Gurung. All rights reserved.

Back to blog
Math · Simulation

The Monty Hall Problem: Why Your Gut Is Wrong, and How to Prove It

Three doors, two goats, one car — and a probability puzzle that fooled a thousand PhDs. Play it, see the equation move, then let a Monte Carlo simulation settle the argument.

June 20267 min readProbability, Monte Carlo, Simulation

You're under the studio lights of Let's Make a Deal, sometime in the 1970s. The host, Monty Hall, gestures at three closed doors. Behind one is a brand-new car. Behind the other two — goats.

You pick door 1. But Monty doesn't open it. He knows where the car is, and he theatrically opens door 3 — revealing a goat. Then he turns to you and smiles:

"Do you want to stay with door 1… or switch to door 2?"

Almost everyone's gut says the same thing: two doors left, so it's 50/50 — switching can't matter. When columnist Marilyn vos Savant wrote in 1990 that you should always switch, around 10,000 readers — including nearly a thousand with PhDs — wrote in to tell her she was wrong.

She wasn't. Switching wins twice as often. Don't believe it? Good — you shouldn't believe it yet. That's the whole point of this post.

I also made a video walking through the whole thing — if you'd rather watch first and play after, here it is:

The video version of this post — play the game and run the simulation below.

First, play it yourself

Before any math, build some skin in the game. Play a few rounds below — stay sometimes, switch sometimes, and watch the scoreboard.

Then do the one thing that makes the answer feel obvious: set it to 100 doors. You pick one; Monty opens 98 goat doors and leaves exactly one other door closed. Still think your first guess — 1 chance in 100 — is as good as the door he so carefully didn't open?

Step Into the Studio

Pick a door, watch Monty work, then decide: stay or switch?

DoorsMonty

The car is hidden. Pick a door — any of the 3.

Games: 0Stay: 0/0 (–)Switch: 0/0 (–)

Try the "Opens at random" host too. That's a Monty who doesn't know where the car is — sometimes he embarrasses himself by opening it. Keep that variant in mind; it's the key to the whole puzzle, and we'll come back to it.

The intuition: probability doesn't evaporate

Here's the entire trick in one sentence: your first pick traps a fixed amount of probability, and Monty's reveal funnels all the rest onto the doors he avoided.

When you first choose, you split the world in two. Your door holds a 1-in-3 chance. The "somewhere else" pile holds the other 2-in-3. When Monty opens a goat door from that pile, he tells you nothing new about your own door — he can always find a goat to show you, no matter what you picked. So your door stays at 1/3. But the 2/3 doesn't evaporate. It all collapses onto the one remaining closed door.

Don't take the sentence on faith — drag the slider and watch the equation do it:

The Equation, Live

Drag the number of doors — your first pick traps 1/n, and Monty funnels all the rest onto one door

Doors n3

1 · You pick one door blind

your door
everywhere else · 67%

2 · Monty knowingly opens 1 goat door — the mass has nowhere left to go

stay
the one door he avoided · 67%
P(stay wins) = 1n = 13 ≈ 33.3%|P(switch wins) = n − 1n = 23 ≈ 66.7%

Switching is 2× better — even in the classic game it's never a coin flip.

Notice what happens as n grows. The blue sliver (your blind first pick) shrinks toward nothing, and the green block (the door Monty conspicuously avoided) swallows everything else. At 100 doors, "stay" is a 1% bet. The 3-door game is the same picture — just zoomed in close enough to fool you.

A little Bayes, for the skeptics

If you want the formal version, Bayes' theorem delivers it in one line. Say you picked door 1 and Monty opened door 3. How likely is the car behind door 2?

Bayes' theorem

P(C2 | M3) = P(M3 | C2) · P(C2) / P(M3) = (1 · ⅓) / (½·⅓ + 1·⅓ + 0·⅓) = ⅔

And this is exactly why the random host breaks the magic. A Monty who opens doors blindly makes no forced moves and leaks no information — and given that he got lucky and showed a goat, stay and switch genuinely tie at ½. The advantage never came from the open door. It came from the host's knowledge.

When intuition and math fight, simulate

In the 1940s, Stanislaw Ulam was stuck on a nuclear physics problem too hairy for pencil and paper. His idea — later named after the Monaco casino — was beautifully lazy: if you can't compute the probability, play the game thousands of times and count.

The law of large numbers guarantees the count converges to the truth:

Law of large numbers

p̂N = (1/N) Σ Xi → p  as N → ∞,   error ∼ 1/√N

So let's do exactly that. Two robot contestants play simultaneously — one always stays, one always switches — and we watch their win rates settle onto the dashed theoretical lines.

The Monte Carlo Lab

Two robot contestants — one always stays, one always switches — play thousands of games while you watch

DoorsMontyGames
0
games played
–
stay win rate
–
switch win rate
–
switch advantage
0%25%50%75%100%1101001k10k— stay— switch

Solid lines: simulated win rates (log-scale x-axis). Dashed lines: the exact theoretical values. The early wobble is real randomness — watch it die out like 1/√N.

Run it a few times and look at the left edge of the chart. At 30 games, staying sometimes looks better! That early wobble is real randomness — and it's exactly why human intuition fails at probability. We live maybe a few dozen trials of anything, deep inside the wobble zone. Monte Carlo is what it looks like to escape it.

Flip the host to Random and run it again: both lines settle on 50%. The simulation confirms what Bayes told us — same doors, same goats on screen, completely different probabilities, all because of what's inside the host's head.

What the goats teach

Three lessons worth taking home:

  1. Information has a source. The open door looked like information about the doors. It was actually information about the host — his forced moves. Change his behaviour and the same picture on screen means something completely different.

  2. Probabilities don't redistribute evenly. "Two doors left = 50/50" assumes symmetry, but the two doors have different histories: one was picked blind, the other survived a goat-revealing filter. Histories matter.

  3. When intuition and math fight, simulate. A hundred lines of code settles an argument that ten thousand letter-writing PhDs got wrong. That's the quiet superpower of Monte Carlo methods — the same trick prices financial options, designs nuclear reactors, and powers the physics in video games.

Always switch. Trust the goats. 🐐🚗🐐

Share this post