Solving the Monty Hall Problem with Bayes Theorem
How your intuition can lose you money on gameshows
You’re on a gameshow called “Let’s Make a Deal”. There are 3 closed doors in front of you.
Behind each door is a prize. One door has a car, one door has breath mints, and one door has a bar of soap. You’ll get the prize behind the door you pick, but you don’t know which prize is behind which door. Obviously you want the car!
So you pick door A.
Before opening door A, the host of the show, Monty Hall, now opens door B, revealing a bar of soap. He then asks you if you’d like to change your guess. Should you?
My gut told me it doesn’t matter if I change my guess or not. There are 2 doors so the odds of winning the car with each is 50%. Unfortunately for me, that’s 100% wrong.
This is the famous Monty Hall problem.
By working through Bayes Theorem, we can calculate the actual odds of winning the car if we stick with door A, or switch to door C.
Bayes Theorem
Bayes Theorem describes probabilities related to an event, given another event occurs.
A
= An event.
B
= Another event.
P(A|B)
= posterior = The probability of an event occurring, given another event occurs.
P(B|A)
= likelihood = The probability event B occurs, if event A occurs.
P(A)
= prior = The probability an event occurs, before you know if the other event occurs.
P(B)
= The normalizing constant.
Bayes Theorem + Monty Hall
Note: A, B and C in calculations here are the names of doors, not A and B in Bayes Theorem.
Now let’s calculate the components of Bayes Theorem in the context of the Monty Hall problem.
Let’s assume we pick door A, then Monty opens door B.
Monty wouldn’t open C
if the car was behind C
so we only need to calculate 2 posteriors:
P(door=A|opens=B)
, the probabilityA
is correct if Monty openedB
,P(door=C|opens=B)
, the probabilityC
is correct if Monty openedB
.
Prior: P(A)
The probability of any door being correct before we pick a door is 1/3. Prizes are randomly arranged behind doors and we have no other information. So the prior, P(A)
, of any door being correct is 1/3.
P(door=A)
, the prior probability that doorA
contains the car = 1/3P(door=C)
, the prior probability that doorC
contains the car = 1/3
Likelihood: P(B|A)
If the car is actually behind door A
, then Monty can open door B
or C
. So the probability of opening either is 50%.
If the car is actually behind door C
then monty can only open door B
. He cannot open A
, the door we picked. He also cannot open door C
because it has the car behind it.
P(opens=B|door=A)
, the likelihood Monty opened doorB
if doorA
is correct = 1/2P(opens=B|door=C)
, the likelihood Monty opened doorB
if doorC
is correct = 1
Numerator: P(A) x P(B|A)
P(door=A) x P(opens=B|door=A)
= 1/3 x 1/2 = 1/6P(door=C) x P(opens=B|door=C)
= 1/3 x 1 = 1/3
Normalizing Constant: P(B)
In cases where analyzed events cover all possible options and don’t overlap, we can take the sum of the numerators.
P(B)
= 1/6 + 1/3 = 3/6 = 1/2
Posterior: P(A|B)
Now we just need to do the remaining math.
P(door=A|opens=B)
= (1/6) / (1/2) = 1/3P(door=C|opens=B)
= (1/3) / (1/2) = 2/3
This leaves us with a with a higher probability of winning if we change doors after Monty opens a door.
If this is super counter-intuitive, I think it’s important to remember 2 pieces of information:
- Monty NEEDS to open a door
- He can’t open the door with the car behind it
Conclusion
I found this to be a super interesting case where intuition is at odds with probability.
Try asking people (especially smart people) what they would do if playing the Monty Hall problem. Sometimes it’s fun to see how they answer :)