# A Bayesian Solution to the Monty Hall Problem

The Monty Hall problem was created by Steve Selvin and is a classic puzzle whose correct answer is counter-intuitive almost to the point of disbelief. As this page explains, even some of the most competent mathematicians of the 20th century refused to accept the correct answer to the Monty Hall problem for a long time.

Here is the statement 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 other two doors are goats. You pick a door, and the host, who knows what’s behind the doors, opens another door, revealing a goat. He then says to you, “Do you want to change your selection?” Is it to your advantage to switch your choice?

What does intuition tell us? After the host opens one door, revealing a goat, we are left with two closed doors, one hiding a car and the other a goat (50% chance of success either way), intuition would lead us to conclude that there is no difference in our chances of success if we switched doors or not.

If only life were that simple………….

I decided to look at the Monty Hall problem through the eyes of Bayes Theorem and see if I could arrive at the right answer. After all, this is exactly the kind of situation that Bayesian reasoning should help us resolve – there is a known prior probability, some new evidence is presented, and we need to calculate the posterior probability.

Lets first recall the expanded formula of Bayes Theorem:-

First I define my hypothesis H -> There is a car behind my door. I call this Hcbmd

Next I see some evidence E -> A goat is revealed behind another door. I call this Egbad

Now I apply Bayes Theorem…………….

What we are looking for is P(H | E) OR P(Hcbmd | Egbad) OR to put it in words, what is the probability that there is a car behind my door given new evidence that has revealed a goat behind another door.

1. First lets calculate the prior probability that H is true. This is the probability that there is a car behind my door before any evidence was presented. Since there are three doors,

it means that P(H) which I write as P(Hcbmd) = 1/3

2. This also implies that before any new evidence was observed, the prior probability that the car was NOT behind my door (meaning my hypothesis is false) = 1 – P(Hcbmd) = 2/3.

So, P(~H) which I write as P(~Hcbmd) = 2/3.

3. Now for the terms P(E | H) and P(E | ~H) in the formula above.

P(E | H) -> This is the probability that we would observe the evidence presented if our hypothesis were indeed true. In our case this is P(Egbad | Hcbmd)

P(E | ~H) -> This is the probability that we would observe the evidence presented if our hypothesis were false. In our case this is P(Egbad | ~Hcbmd)

Here is where it gets a little tricky. If you scroll up to the statement of the problem, you’ll notice that the gameshow host knows whats behind the doors. It would be senseless for the host to open the door that reveals the car, and so he would therefore ALWAYS open a door that was hiding a goat whether or not my door was hiding a car or a goat.

So irrespective whether Hcbmd were true or false, P(Egbad) would always be true.

So P(Egbad | Hcbmd) = 1 and P(Egbad | ~Hcbmd) = 1.

So plugging these values into the Bayes Theorem formula, we get

P(Hcbmd | Egbad) = 1/3 implies that the probability that there is a car behind my door given new evidence (a goat behind another door) = 0.3333

So I stand only 33.33% chance of winning a car if I stick to my chosen door. It follows easily that if I change my choice of door, my chances of success are now 66.66%

This calculation can be verified redoing the problem and modifying our our hypothesis H as the probability that there is a goat behind my door (given the new evidence). This should evaluate to 0.66 or a 66.6% chance that I will win a goat if I stick to my original choice of door. If you are learning Bayes Theorem, this is good exercise to try out.

And thus Bayes Theorem has corrected solved the Monty Hall problem. Just another useful application of the most powerful force in the universe.

## 4 thoughts on “A Bayesian Solution to the Monty Hall Problem”

1. Marley52 on said:

If the hypothesis was instead “There is a car behind the door Monty didn’t open” ,then you still get 1/3 using your analysis.

• vu2aeo on said:

That is an interesting proposition but I disagree with your conclusion.

Heres why…

Suppose I choose Door No. 3 and Monty opens Door No. 2 to reveal a goat.

H -> There is a Car behind the door Monty doesn’t open (Door No. 1)

and the evidence E has revealed a goat behind Door No. 2

From this,

P(H) = Prior probability of H = 0.33 (This is straightforward)

P(~H) = Prior probability of ~H = 0.66 (This is also straightforward)

P(E|H) = Probability that Monty would open Door No. 2 given that there was a car behind Door No.1.
Since Monty would have no choice really since Monty can’t open Door No. 3 (My Door) and he must keep the car’s location hidden, he would have to open Door No.2. So P(E|H) = 1.

The last term is the trickiest….

P(E|~H) = The probability that Monty would open Door 2 (and reveal a goat) given that there was a goat behind Door 1.

Now suppose ~H were true (A goat is behind Door No.1), there are two possibilities (for the car’s location) each with a probability of 0.5…

(a) There is a car behind Door No.2 in which case, the Probability that Monty would open Door No.2, P(E|H)= 0

(b) The car is behind Door No.3 (My Door) in which case Monty could open either Door 1 or Door 2 (Probability 0.5 each way)

So if ~H were true, option (a) has a probability of 0 and option (b) has a probability of 0.25 for Door No.1 and 0.25 for Door No.2.

The evidence E can only arise if out of (a) and (b), if option (b) is true (Probability = 0.5) AND within option (b) Door No.2 is chosen (Probability = 0.5). So the overall Probability that Monty would open Door No.2 (The evidence) given ~H = 0.5 * 0.5 = 0.25

So P(E|~H) = 0.25

and from the above,

P(H) = 0.33
P(~H) = 0.66
P(E|H) = 1

Plugging these into the bayes equation….P(H|E) = (0.33 * 1)/(0.33 * 1 + 0.66 * 0.25) = 0.66667, NOT 0.33 as you concluded.

2. Marley52 on said:

I agree with your response, and if your initial solution had been derived using the same example you would have ended up with 1/3 (as you did): P(H|E) = (0.33 * 1/2)/(0.33*1 + 0.66*0.25) = 1/3.
I think using a specific example (e.g Pick Door3, Monty opens Door2) to calculate a Bayes solution is a better explanation than the generic one you gave which basically just said – (prior) probabilty car is behind my door = 1/3, probability Monty opens a goat door = 1. We know from the rules that the probability Monty will reveal a goat is 1.
The key is that the ‘normalistion constant’ when Monty opens Door2 (say) is 1/2

• vu2aeo on said:

Yes, I concur with your opinion…a more specific example would have been much clearer.

Very nice discussion, though….made my understanding of Bayes Theorem a little more robust! Thanks.