Monty Hall Problem — From Zero to Hero

Shane De Silva
Analytics Vidhya
Published in
8 min readMar 7, 2020

Statistics is a weird and wonderful place filled with many counter-intuitive results and I think that is what makes it seem so elusive to so many (myself included). I think most of us could name someone we know that is proficient in a quantitative field such as mathematics, physics, or biology, but fewer could name someone who has a good grasp on statistics. With the rise of Big Data, Machine Learning and all the questions it promises to elucidate, gaining mastery over statistics and its associated learning methods is currently a well sought-after skill employers are looking for.

seems about right [credit: https://imgflip.com/i/17m7k8]

In this article I hope to step the reader through various explanations to one of the standard problems students of statistics are introduced to — the Monty Hall problem.

The Monty Hall Problem has many similarities with other problems such as the Three Prisoners Problem or Bertrand’s Box Paradox. These set of problems belong to a class of paradox’s called veridical paradox’s whereby the answer gained by the end of logical reasoning seems absurd in light of the original statement. Other examples of such paradox’s are the famous Schrodinger’s Cat thought experiment and the Infinite Hotel paradox.

The first half of this article will present the logical way of reasoning yourself to the absurd answer whilst the second half will present the answer in the universal language of mathematics. Stick around to the end for a bonus answer to really show off to your peers, housemates, significant other or postman.

The Monty Hall Problem

Monty Hall was the presenter of a TV show first aired in the early 1960’s. In the show, called Let’s Make a Deal, audience members were selected at random to become ‘traders’. These ‘traders’ would be offered deals periodically throughout the show by Monty Hall to either keep what they had or swap for a mystery prize. The Monty Hall Problem centres around the final segment of the show whereby a ‘trader’ gives up what they had earned and selects 1 of 3 doors randomly. One of the doors contains the ‘Big Deal’ such as a holiday, car, or large cash prize whilst the others contained low prizes such as less money than the ‘trader’ had accumulated already.

The man himself — Monty Hall [credit: https://medium.com/kharpann/why-the-monty-hall-problem-is-fascinating-for-a-statistician-1ce475120af1]

Once the ‘trader’ had selected a door, Monty Hall would open a door with one of the remaining two doors with a low prize behind it. For dramatic effect Monty would then either open the contestants door to show that they had won the big prize or the other door to show that they had lost. If we take a step back, the Monty Hall problem comes from this simple question,

“If after the first box is opened Monty asks if you would like to switch your box, should you?”

When students encounter this problem in one of their first stats lectures the answer that immediately comes to mind is “well it could be in either box that is left so the chance is 50/50. Since it is 50/50 there is no benefit of switching boxes”. Then the professor proceeds to tell the auditorium that it is in fact twice as likely to be in the other box and so you should always switch.

The Logical Explanation

In this problem, and many others, I find it useful to take the problem to the extreme which helps the logical answer to become more intuitive. So let’s imagine there is 100 boxes, 1 with the big prize and the other 99 with nothing in them. For argument’s sake, let’s say the big prize is in box #34.

100 boxes with big prize behind door #34

Let’s also say that you select box #29. Monty, knowing where the prize is, starts to reveal boxes that are empty.

You select a box at random and Monty, knowing where the money is, starts to unveil empty boxes.

He unveils 98 boxes that do not contain the prize and now there is 2 left: your box and box #34.

When you were selecting your box, you had a 1/100 chance of selecting the box with the big prize in it. On the other hand, Monty could always unveil 98 boxes with no price in it, whether you have the prize or not.

In one scenario, where you selected the right box, Monty could unveil any 98 of the remaining 99 boxes since you already have the prize. If we ran this game 100 times this situation arises in 1 out of 100 of those cases on average because the probability of this scenario occurring is 1/100 as stated above.

The other scenario is when Monty knows the big prize is not in your box, and so he selects the other 98 boxes that are empty to unveil. This happens in 99 out of 100 cases on average.

So if you ran the game 100 times, you would expect the other box to have the big prize in it 99 times, and only in 1 case on average would you expect it to be your box. In other words, it is 99x more likely that the big prize is in the other box and you should switch.

Bayes’ Rule

For those of you who interact with this world through numbers and symbols let us now derive the same result by using mathematics and statistics.

To do this we will need to use Bayes’ rule:

where we read p(A|B) to be the probability that A occurs given that B has occurred, and similarly p(A) and p(B) are the probability of A and B happening respectively.

Let’s define the possible values of A as {prize, no prize} and B as {98 empty boxes}. In other words, we want to know the probability that we either have the prize given that Monty has shown us 98 empty boxes or that we do not have the prize given that he has shown us 98 empty boxes.

Consider the first probability, where we would like to work out the probability that we have the prize given that Monty has shown us 98 empty boxes. The corresponding probabilities for use in Bayes’ rule are

The first probability, p(B=98 empty|A=prize), is the probability that Monty can show us 98 empty boxes given that we have the prize. We know from the earlier section, that Monty can always show us 98 empty boxes so the probability is simply 1.

The second probability, p(A=prize), is the priory probability that we picked the box with the prize. As stated earlier, this is 1/100.

The third probability, p(B=98 empty boxes), is the prior probability that Monty can show us 98 empty boxes. For the same reasoning as before, he knows before we even select a box that he will be able to show us 98 empty boxes so this probability is also 1. Plugging that back into Bayes’ rule gives:

Just as before when we reasoned by logic, we get that the probability that we have the prize given that Monty has shown us 98 empty boxes is 1/100. Following a similar procedure for p(A = no prize| B = 98 empty) (or even easier p(A = no prize| B = 98 empty) = 1-p(A = prize| B = 98 empty) gives:

We have now shown through use of Bayes’ rule that the prize is 99x more likely to be in the other box than the one that you initially picked.

With a little thought, we can extend these two probabilities to the case where there is N boxes or choices for the ‘trader’. Then the probability that the ‘trader’ has the prize given that N-2 boxes have been opened and are empty is

and similarly, the probability that they do not have the prize is given by

BONUS: when Monty does not know where the prize is

There is a subtlety to the above analysis that produces another counter-intuitive result. The above analysis only holds when Monty knows where the prize is. The fact that he knew where the prize was affects both the prior probability, p(B), and the conditional probability, p(B|A).

Really, to be accurate, earlier we should have written the probabilities as p(A|B,H), p(B|A,H), p(B|H), where H now represents if Monty knows where the prize is or not (p(A) is not affected by Monty’s knowledge so is not modified by the value of H).

Let’s consider only 3 boxes and ask what is p(A=prize|B=empty), i.e. what is the probability that we have the prize given that Monty has by chance revealed an empty box. Remember he did not know that the box he just opened would be empty. Then the probabilities become

For the first probability, p(B=empty| A=prize), this is the probability that the box Monty just opened would be empty given that you have the prize. This is 1 as both boxes are empty if you have the prize.

The second probability, p(A=prize), is the prior probability that you selected the box with the prize which is unmodified from before and is just 1/3.

The final probability, p(B=empty), is the prior probability that the box Monty revealed would be empty, which is 2/3. Bayes’ rule for this case becomes

and similarly, for the probability that we do not have the prize given that Monty has by chance revealed an empty box

Amazingly, Monty’s knowledge, or lack thereof, about the location of the prize actually changes what you should do!

Conclusion

In this article, I have shown two ways of convincing yourself and others of the counter-intuitive solution to the Monty Hall problem. First, we saw by taking the case to an extreme we could reason our way to the logical answer. Secondly, we used Bayes’ Rule to calculate the probability that you do or do not have the prize given the amount of empty boxes you have been shown.

So if you’re ever asked in an interview a question about whether to switch your box or not your answer should be,

“Well it depends,… who knows where the prize is?”

--

--

Shane De Silva
Analytics Vidhya

PhD student interested in the application of statistical learning, DS, ML, and DL to real world problems