Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

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

Posted on

     

SWITCH your guess! | Monty hall problem explained

Introduction

Every engineering student who learns probability and statistics has encountered this famous problem. You can refer tothis 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

NotationMeaning
HxHost places a car behind door x
PyPlayer initially selects door y

Possible event space

HostP1P2P3
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 isequally likely, meaning each has a probability of1/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, helose.
  • Probability of winning after switching:0.

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

  • The host reveals the remaining goat.
  • The player switches, hewins. 🎉
  • 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 youalways switch, youdouble your chances of winning (from1/3 to2/3).

StrategyProbability of Winning
Staying with original choice1/3 (33.33%)
Switching doors2/3 (66.67%)

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

Image description

Intuition

  • If your first pick was a goat (which happens2/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 plays100 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)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
deep_gandhi_4070895b20965 profile image
Deep Gandhi
  • Joined

2nd Reference - Approved by Batman 🦇

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Software EngineerI am always curious, how developers make developers life easy! My favorite thing to do is, dive deep into a popular technology and get to know the "why" and "how" of it.
  • Location
    Surat, Gujarat, India
  • Education
    B.Tech - ICT
  • Work
    Software Engineer | Technical writer
  • Joined

Trending onDEV CommunityHot

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp