Examining the Famous Monty Hall Paradox with Bayes Theorem and Repeated Simulations

Sam Liebman
5 min readAug 9, 2018

One of the most infamous statistical debates stemmed from a segment in the gameshow Lets Make a Deal, at the time hosted by Monty Hall. The featured game became a popular brainteaser for statisticians around the globe, when a curious reader wrote to Marilyn vos Savant (who holds the highest ever recorded IQ according to the Guinness Book of World Records) detailing the game:

Suppose you’re on a game show, and you’re given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say 1, and the host, who knows what’s behind the doors, opens another door, say 3, which has a goat. He then says to you, “Do you want to pick door 2?” Is it to your advantage to switch your choice?

vos Savant’s response, in which she correctly identified the odds of winning the car based on switching vs. not switching, was immediately criticized. Over 10 thousand readers — roughly 1,000 of whom had PhDs — responded to her column, with the majority claiming her solution was incorrect.

Monty Hall hosting Let’s Make a Deal — source: http://www.retroland.com/lets-make-a-deal/

When I first heard of this problem, it seemed to me that the choice was irrelevant: given two doors to choose from, one of which contained the car, it made intuitive sense that there would be a 50% chance of winning, regardless of whether the contestant chose to stay with their original choice or switch to a new door. Yet, what appeared to be a simple decision ultimately sparked one of the hottest statistical debates regarding whether it was beneficial to switch doors or not.

A Dive into the Probability

The Monty Hall problem is a veridical paradox, i.e. one where the solution appears extremely counterintuitive but can demonstrably be proven true. A quick glance at the problem might lead the contestant to assume that switching or not switching each gives them a 50% chance to win the car. The logic behind this is simple: after the host opened a door to reveal no car, the remaining two doors either contained a car or a goat, leaving the contestant with even odds to win the car whether they switch or not.

However, a quick examination of the theoretical probability using Bayes’ theorem reveals this to be wildly inaccurate. When the contestant first selects a door, they have a 1/3 chance of correctly having guessed the prize door, and a 2/3 chance of selecting a door containing a goat. When the host reveals one of the other doors to not contain a car, there is zero impact on the probability the contestant originally selected the car. Therefore, since the probability of an event happening (in this case the door containing either a goat or car) is always equal to 1, the probability of the remaining unopened door must be 2/3. This means switching doors would double the contestants chance of winning the prize, and thus rational decision makers should always choose to switch.

The diagram below illustrates how these probabilities are calculated using Bayes’ Theorem, with my accompanied code where I calculated the probabilities for each decision.

source: https://en.wikipedia.org/wiki/Monty_Hall_problem

Running Multiple Simulations in Python to Confirm Bayes’ Theorem

I thought it would be a neat exercise to use python to confirm Bayes’ theorem and see how many simulations it would take to have the probability of winning the car converge to ~67%. First, I built a function to simulate one instance of the game. Obviously it would be impossible to prove Bayes’ correct with just one simulation, so I wrote another function that would simulate the game a selected number of times, and output the winning percentage for the contestant in instances where they decide to switch and not switch.

Function to simulate one game

Using Plotly, I was able to create a graph that showed the divergence of the two winning percentages as the number of simulations increased. When the sample size was small, it was hard to determine exactly how much of a benefit switching provided to the contestant. Even at 100 simulations, there was no clear trend towards the true probability, and there were multiple simulations where the contestant would have been better off staying with their original choice. However, as the number of simulations increased, a clear divergence started to appear. The graphs below detail the contestant’s win percentage for switching vs. not switching doors, for 10, 100, 1,000, and 10,000 simulations, respectively. As you can see, the probabilities converge towards the true probability as the number of simulations increase, and by 10,000 simulations the random noise is minimal.

Conclusion

This was a problem I agonized over for days when I was first told about it, and I couldn’t conceptualize how the probability differed so dramatically from what made intuitive sense to me. Statistical paradoxes are absolutely fascinating to me, and this problem, in addition to similar paradoxes such as the birthday problem, boost my drive to learn more about statistics and probability.

--

--