Imagine you’re in a game show. There are 3 identical doors. One of them has a car behind it (you want the car!), and the other two have goats behind it. You get to open one of the doors and keep what's behind it. In the beginning, you may choose to pick one door. Then, the host will randomly reveal one door that does not have the car behind it. Finally, you have the choice to switch your choice to the other remaining door. Question: Is it better to switch your choice? The answer may seem obvious but it is not.

Solution

It is better to switch. WHAT?! No way right? Even if one door is revealed it is still 50/50 chance to find the one with the car behind it. Right? Right? Nope. Read on for proofs.

Statistical Proof

Check out this. That program goes through the situation 10000 times, always switching when prompted. Run it a couple times and the ratio of wins with switching to losses with switching is about 2:1. Not satisfied? Do it yourself here a couple times. Always switch and you’ll win more, I promise. Looked at the proof? Well it doesn’t seem logical at all. Maybe it’s a problem with the code? I assure you it’s not. If you’re still harboring doubts, read the next section.

Mathematical Proof

Now let’s mathematically prove this. To do this we will need to use Bayes’ Theorem.

What is Bayes’ Theorem?

The theorem says P(A|B) = P(B|A)P(A)/P(B) This seems pretty confusing. Let’s simplify it. Probability of A happening if B is true = Probability of B happening if A is trueProbability of A happening/Probability of B happening

So, let’s start! Take the equation: P(A|B) = P(B|A)P(A)/P(B) and plug the values of B and A in. Let’s assume you choose door 1. First, the value for A will be ‘car at 1’, and the value of B will be ‘2 is opened’ (variable ‘A’ will not change). Now the math: P(car at 1|2 is opened) = P(2 is opened|car at 1)P(car is at 1)/P(2 is opened) =(½)(⅓)/(½)=⅓ The probability that the car is behind door 1, and door 2 is opened is ⅓. Next, the value of A will be ‘car is at 2’, and the value of B will be ‘2 is opened’ (same as before!). Now the math: P(car at 2|2 is opened) = P(2 is opened|car at 2)P(car is at 2)/P(2 is opened) =(0)(⅓)/(½)=0 Note: Remember, this equals to 0 because the host cannot open the door with the car behind it The probability that the car is behind door 2, and door 2 is opened is 0. Finally, the value of A will be ‘car is at 3’, and the value of B will be ‘2 is opened’ (still doesn’t change). Now the math: P(car at 3|2 is opened) = P(2 is opened|car at 3)P(car is at 3)/P(2 is opened) =(1)*(⅓)/(½)=⅔ The probability that the car is behind door 3, and door 2 is opened is 0.

See? If we chose door 1 originally (and assuming door 2 is revealed), then the chance that the car is behind door 1 (chosen door) is ⅓, and the chance that the car is behind door 3 is ⅔. As proved here, switching is twice as likely to give you the car. Cool isn’t it?

Variant

Another variant, Monty Does Not Know, the situation is the same as the Monty Hall Problem, except the host does not know when they reveal the door whether or not the car is behind it. That means the host may accidentally reveal the door with the car behind it. In this case, whether you switch or not doesn’t matter.

Conclusion

The Monty Hall Problem shows a weird seemingly illogical statistical phenomenon. Know any other cool math stuff you want to investigate next? Confused about any of this? Just leave a comment. Also, remember to upvote!!!

https://repl.it/@rediar/Monty-Hall-Does-Not-Know (Rust)

https://repl.it/@rediar/Monty-Hall-Problem (Python)

https://repl.it/@rediar/Monty-Hall-Problem-Data (Python)

## Monty Hall Problem

## Scenario

Imagine you’re in a game show. There are 3 identical doors. One of them has a car behind it (you want the car!), and the other two have goats behind it. You get to open one of the doors and keep what's behind it. In the beginning, you may choose to pick one door. Then, the host will randomly reveal one door that does not have the car behind it. Finally, you have the choice to switch your choice to the other remaining door. Question: Is it better to switch your choice?

The answer may seem obvious but it is not.

## Solution

It is better to switch.WHAT?! No way right? Even if one door is revealed it is still 50/50 chance to find the one with the car behind it. Right? Right?Nope. Read on for proofs.

## Statistical Proof

Check out this. That program goes through the situation 10000 times, always switching when prompted. Run it a couple times and the ratio of wins with switching to losses with switching is about 2:1. Not satisfied? Do it yourself here a couple times. Always switch and you’ll win more, I promise.

Looked at the proof? Well it doesn’t seem logical at all. Maybe it’s a problem with the code? I assure you it’s not. If you’re still harboring doubts, read the next section.

## Mathematical Proof

Now let’s mathematically prove this. To do this we will need to use Bayes’ Theorem.

## What is Bayes’ Theorem?

The theorem says P(A|B) = P(B|A)

P(A)/P(B)Probability of A happening/Probability of B happeningThis seems pretty confusing. Let’s simplify it.

Probability of A happening if B is true = Probability of B happening if A is true

So, let’s start! Take the equation: P(A|B) = P(B|A)

P(A)/P(B) and plug the values of B and A in.P(car is at 1)/P(2 is opened)Let’s assume you choose door 1.

First, the value for A will be ‘car at 1’, and the value of B will be ‘2 is opened’ (variable ‘A’ will not change). Now the math:

P(car at 1|2 is opened) = P(2 is opened|car at 1)

=(½)

(⅓)/(½)=⅓P(car is at 2)/P(2 is opened)The probability that the car is behind door 1, and door 2 is opened is ⅓.

Next, the value of A will be ‘car is at 2’, and the value of B will be ‘2 is opened’ (same as before!). Now the math:

P(car at 2|2 is opened) = P(2 is opened|car at 2)

=(0)

(⅓)/(½)=0

Note: Remember, this equals to 0 because the host cannot open the door with the car behind itP(car is at 3)/P(2 is opened)The probability that the car is behind door 2, and door 2 is opened is 0.

Finally, the value of A will be ‘car is at 3’, and the value of B will be ‘2 is opened’ (still doesn’t change). Now the math:

P(car at 3|2 is opened) = P(2 is opened|car at 3)

=(1)*(⅓)/(½)=⅔

The probability that the car is behind door 3, and door 2 is opened is 0.

See? If we chose door 1 originally (and assuming door 2 is revealed), then the chance that the car is behind door 1 (chosen door) is ⅓, and the chance that the car is behind door 3 is ⅔. As proved here, switching is

twiceas likely to give you the car. Cool isn’t it?## Variant

Another variant, Monty Does Not Know, the situation is the same as the Monty Hall Problem, except

the host does not know when they reveal the door whether or not the car is behind it. That means the host may accidentally reveal the door with the car behind it. In this case, whether you switch or not doesn’t matter.## Conclusion

The Monty Hall Problem shows a weird seemingly illogical statistical phenomenon. Know any other cool math stuff you want to investigate next? Confused about any of this? Just leave a comment.

Also, remember to upvote!!!

Yes, the classic problem that seems to defy statistics, but doesn't...