Monty Hall - The True picture with Simulation

Many of you might have come across the Monty Hall problem . Here is the wikipedia definition of the problem

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 No. 1, and the host, who knows what's behind the doors, opens another door, say No. 2, which has a goat. He then says to you, "Do you want to pick door No. 3?" Is it to your advantage to switch your choice? - Wikipedia


Although it's relatively easy to have an intuitive idea of the solution at times its hard to break it down into its more probabilistic form. This problem primarily arises in our inability to grasp the underlying constraints the problem has to adhere to. Here is my humble effort to explain the Monty Hall problem using Bayes theorem followed by a simulation of the same.


Let the variable  \displaystyle {E} denote the door behind which the prize (the car) might be present.  Since each of the door is equally likely to contain the prize hence


 \displaystyle P(E=1) = P(E=2) = P(E=3) =  \frac{1}{3}


where   \displaystyle P(E=i) denotes the probability of the prize(car) behind the door number  \displaystyle {i} .


Similarly, let the random variable  \displaystyle {H}  denote the host's choice of the door and hence   \displaystyle P(H=i)  denotes the probability of the host choosing the door number  \displaystyle {i}


We are given that the contestant chooses the door 1. Since the contestant chooses the door 1 the host is restricted to open either of the door 2 or 3 with equal probability. Hence the probability of host choosing different doors are as below



 \displaystyle P(H=1) = 0


 \displaystyle P(H=2) = P(H=3) = \frac{1}{2}


Now if the actual prize is behind door 2, in that case the host will always open 3 since the host will open a door that doesn’t reveal the prize. This gives us the conditional probabilities


 \displaystyle P(H=2)/E=2) = 0


 \displaystyle P(H=3)/E=2) = 1


Similarly, if the prize is behind door 3, the conditional probabilities we would have are as below


 \displaystyle P(H=2)/E=3) = 1


 \displaystyle P(H=3)/E=3) = 0


Also, if the actual prize is behind door 1, the host can choose either 2 or 3 with equal probability unless the host has any bias towards any door. The conditional probabilities would be given by


 \displaystyle P(H=2)/E=1) = P(H=3)/E=1) = \frac{1}{2}


Now given that the host has opened door 2, we would have to evaluate the contestant's winning probability in sticking to door 1 (initial door) and in switching to door 3. The probability that the actual door that holds the prize is door 1 given that the host has opened door 2 is given by


 \displaystyle P(E=1)/H=2) = \frac{P(E=1,H=2)}{P(H=2)}


 \displaystyle = \frac{P(H=2/E=1)P(E=1)}{P(H=2)}   = \frac{(\frac{1}{2})(\frac{1}{3})}{\frac{1}{2}}


 \displaystyle = \frac{1}{3}


So, we see that if the contestant sticks to door 1 he/she has a   \displaystyle  \frac{1}{3} chance of winning.

Now let’s calculate the probability of the actual door being 3 given the host has chosen door 2


 \displaystyle P(E=3)/H=2) = \frac{P(E=3,H=2)}{P(H=2)}


 \displaystyle = \frac{P(H=2/E=3)P(E=3)}{P(H=2)}   = \frac{(1)(\frac{1}{3})}{\frac{1}{2}}

 \displaystyle = \frac{2}{3}


So, given the host has opened door 2, the probability of the door 1 hiding the prize is   \displaystyle = \frac{1}{3}  while that for door 3 is  \displaystyle = \frac{2}{3} . Hence the contestant has a better chance of winning the car by deciding to switch to the other closed door.


Below is the simulation of the Monty Hall problem with the Contestant holding on to the original door followed by Monty Hall Simulation where the contestant do chose to switch to the other door.


We can see from the above simulations also the chances of winning is almost double if one chooses to switch to the other door instead of holding on to the original door.

Leave a Reply