2 ways to look at The Monty Hall Problem

Analyzing The Monty Hall Problem with Probability Tree Diagram, Bayes’ Theorem, and a computer simulation…

Shen Huang
6 min readFeb 11, 2019
Image by JONO HEY at SKETCHPLANATIONS

The Monty Hall problem originally came from the TV show Let’s Make a Deal. There are 3 doors where one has a car behind it and the two others have a goat. The contestant of the game will try to pick the door that has the car behind it. After the contestant picked his door, the host will reveal a goat from the two remaining doors, and then the contestant will have the opportunity to swap his selection with the remaining door. The contestant will then open the door and see if he gets to take the car home.

One of the big question to this problem is whether doing the swap gives the contestant better odds of winning the car. The short answer is YES. And here is an extreme example to help you visualize it.

An Extreme Example of Monty Hall Problem
  1. The contestant picks from 999 doors with a goat behind it, and 1 door with a car behind it.
  2. In most cases the contestant probably picked a door with a goat behind it.
  3. Now the host eliminated the rest 998 doors with a goat behind it, would it be a wise decision for the contestant to switch?

One would claim that there are 1/1000 chance where the contestant benefits from not switching, but it is obvious in this scenario that switching gives the contestant much better odds in winning the car home. However, such extreme examples does not give a solid analytical reasoning. In this article, we will be analyzing the problem with 2 commonly used techniques in statistics, the Probability Tree Diagram and the Bayes’ Theorem. In the end I will attach a computer simulation of the problem to give a better visualization.

Now analyzing it with the nonexistent extreme example above may only give us an intuition to the problem. We will be analyzing this problem with 2 commonly used technique in mathematics, proving the correctness of the statement.

1. The Probability Tree Diagram

A probability tree diagram maps the possible outcomes with their corresponding probability of occurrence. The probability tree diagram is consisted of 3 parts, the branch which leads to the possible outcomes, the probability of the event occurring for that branch, and the final outcome after the events. The diagram below maps the possible outcomes of two consecutive coin flips.

Probability Tree Diagram of Coin Toss

To evaluate the probability of the final outcome you simply multiply the probability on each branch, in this case each outcome have an occurrence probability of 25%.

Probability Tree Diagram of Coin Toss with Calculated Probability

And since we do not really care how the head & tail toss differ from each other, we can sum its probability into one, giving a 50% chance of landing a head & tail after 2 coin tosses.

Now if we plot the probability tree diagram of the Monty Hall Problem, we will get the following diagram.

Probability Tree Diagram of Monty Hall Problem

As we can see from the diagram, the only place where there is a random event involved is during the initial pick, the elimination process is actually deterministic and the swap process is entirely controlled by the contestant.

From the diagram we can easily see that the chance of swap and get a car is twice as high as keep and get a car. Therefore it is generally better to pick swap rather than keep.

2. The Bayes’ Theorem

Bayes’ theorem, sometimes known as Bayes’ Law is often used to calculate the conditional probability of events. The theorem can be described by the following equation.

Bayes’ Theorem

In plain English, it means that the conditional probability of an event A, given that event B occurred, is equal to the probability where event A and B both occurred, divided by the probability where event B occurred.

The relationship can be best illustrated with the following Venn Diagram, where it is not difficult to see that the P(A∩B) is also the region where P(A) happened inside P(B).

Venn Diagram of Bayes’ Theorem

We can describe the Monty Hall Problem with a set of conditions. The probability of the car behind any of the door is 1/3. The probability of the host eliminating one of the remaining door is 1/2 when a door is picked with a car behind it, and 100% when a door is picked with a goat behind it.

Probability Table of Monty Hall Problem

And therefore, the conditional probability of getting a car after a switch is calculated to be 2/3.

The conditional probability of getting a goat after a switch is calculated to be 1/2, which is half as much as getting a car.

Similarly we can calculate the probabilities for not switching, which is just the opposite of switching, where there is a 1/3 chance of getting a car and 2/3 chance of ending up with a goat.

And thus we have arrived with the conclusion that switching gives the contestant a better odd winning the car.

Here is the result of a Python code simulation from trinket.io.

Monty Hall Problem Simulation with Python

As one can see from the chart where points are taken for every 100 trials, Swap Win has about twice as many instances compare to Keep Win after certain number of trials. The final result of this simulation yields a ratio of 2.02, which is fairly close to our conclusions in the mathematical reasoning.

Proving a theorem using computer simulation is generally not to be considered mathematically strong but does give us a better understanding to the problem.

In the future I may write more about things related to math and statistics depending on the the feedbacks I get. The first time I did a computer simulation for the Monty Hall Problem was back during my freshman year in college, when I was arguing with a bunch of masters students online about it and a bunch of other problems related to conditional probabilities.

I am now a master student myself in computer science, and my passion in mathematics have not changed since then. I can write about RSA and all the math relating to Prime Numbers or Quantum Computing. I also had my bachelor’s degree in Electrical Engineering and therefore I can explain a bit about Fourier Transform, Differential Equations or Electromagnetism. My interests in robotics also lead me Computer Vision algorithms, and I can explain about all sorts of classifiers in Data Science as well. I would be happy to learn and write things relating to math and science, so let me know if you have any special requests. I may also write about some math you have never seen before after they are out of my NDA. Or I can try to bring alive some of my other dead articles such as faster Closest Pair Algorithm with some experimental results.

Have fun doing math and programming!!!

--

--