DEV Community

Cover image for SWITCH your guess! | Monty hall problem explained
Omi
Omi

Posted on

3 1 1 1 2

SWITCH your guess! | Monty hall problem explained

Introduction

Every engineering student who learns probability and statistics has encountered this famous problem. You can refer to this link for the problem statement. (But don't look at the answers yet!)

The Common Misconception

Many people assume:

"The probability of getting a car behind either of the remaining two doors is 1/2, since one has a goat and the other has a car."

But this is incorrect.


Correct Solution Approach

Step 1: Define the Events

Notation Meaning
Hx Host places a car behind door x
Py Player initially selects door y

Possible event space

Host P1 P2 P3
H1 (H1 and P1) (H1 and P2) (H1 and P3)
H2 (H2 and P1) (H2 and P2) (H2 and P3)
H3 (H3 and P1) (H3 and P2) (H3 and P3)

Each event is equally likely, meaning each has a probability of 1/9.

Step 2: Categorizing the Event Space

Let's break this event space into two cases:

Case 1: Player initially selects the door with the car (x = y)

  • Events: (H1, P1), (H2, P2), (H3, P3)
  • Probability:

P([x=y]) = 1/9 + 1/9 + 1/9
= 3/9
= 1/3

Case 2: Player initially selects a door with a goat (x β‰  y)

  • Events: (H1, P2), (H1, P3), (H2, P1), (H2, P3), (H3, P1), (H3, P2)
  • Probability:

P([x!=y]) = 1 - P([x=y])
= 1 - 1/3
= 2/3


Step 3: What Happens After Switching?

Case 1: Player Initially Chose the Car (x = y)

  • The host opens a door with a goat.
  • The player switches, he lose.
  • Probability of winning after switching: 0.

Case 2: Player Initially Chose a Goat (x β‰  y)

  • The host reveals the remaining goat.
  • The player switches, he wins. πŸŽ‰
  • Probability of winning after switching: 1. This case is important, so let me give you an example: _ H1 and P2, then host reveals door 3 (neither door 1 nor 2 because 1 has a car and 2 was chosen by the player). So, the player switches to door 1. The only option. Which is a win!_

Hence, [x!=y] events followed by a switch will always win.
P(win after switch | [x!=y]) = 1.

Thus, the overall probability of winning after switching is:

P(win after switch) = P([x!=y])*P(win after switch | [x!=y])
+ P([x=y])*P(win after switch | x=y)
= 1*2/3 + 0*1/3
= 2/3

Conclusion: Always Switch!

If you always switch, you double your chances of winning (from 1/3 to 2/3).

Strategy Probability of Winning
Staying with original choice 1/3 (33.33%)
Switching doors 2/3 (66.67%)

Just imagine a game, you can win 66.67% times!

Image description

Intuition

  • If your first pick was a goat (which happens 2/3 of the time), switching gives you the car.
  • If your first pick was a car (1/3 of the time), switching makes you lose.
  • Since getting a goat first is more likely, switching is the best strategy.

🎯 Key Takeaway: Pay attention to what information is getting revealed and there is a reason why the host revealed a door.


Follow-up Question

If a player plays 100 rounds of this game, what should be their strategy to maximize their wins?


References:

1) Wikipedia
2) A good friends circle
3) Cover image picked up from here: https://images.app.goo.gl/Mz6LWWvJyxxXsQyT8

Top comments (1)

Collapse
 
deep_gandhi_4070895b20965 profile image
Deep Gandhi β€’

2nd Reference - Approved by Batman πŸ¦‡

πŸ‘‹ Kindness is contagious

If you found this article helpful, please give a ❀️ or share a friendly comment!

Got it