Fooled by probability – Monty Hall Problem

“You made a mistake, but look at the positive side. If all those Ph.D.’s were wrong, the country would be in some very serious trouble.”

Everett Harman, Ph.D. U.S. Army Research Institute

Probability is a terrible branch of science, I know of no other branch where intution and “common sense” can bite you so badly as in probability. That’s probably (!) why I find probability theory so interesting….!

One of my favorite examples of intuition leading you astray is the Monty Hall Problem which basically goes like this (for the real Monty Hall setup, google it):

Imagine you are dealt 3 cards face down, and told that one of the cards is an Ace. Your job is to point to the card you believe is the Ace.

What’s the probability for you having picked the Ace…? Well, with one “success” out of three it is 1/3, right…? That is, in the long run, you should be able to “win” about 33% of the games played.

Now, in the Monty Hall problem, there’s a twist to make things more interesting (and for the most of us, really confusing wrt probability):

After you have put your finger on the card you believe is the Ace, the dealer turns one of the other two cards face up, showing that that card is not the Ace. So, now the Ace is either the card that you’ve picked, or the third card on the table.

What’s the probability now that you have picked the correct card (the one your finger is still placed over)…?

At this point, it’s easy to believe that since there’s now two possibilities – the card you are pointing to, and the third card still face down – the probability of you having picked the correct card is 1/2, right…?

Now the dealer presents you with the opportunity to switch your choice from the card you are pointing to, to the third card. The question is, should you do it ?

For most people it intuitively seems that since we now have a 50:50 situation, with two unknown cards of which one is the “win”, there’s no point in switching.

And should you think that, you’d be wrong, but in very good company, since even professional mathematicians, Nobel price laureates and other experts also typically get this wrong!

Instead, it turns out that you should always switch, despite your intuition. The probability of winning if you don’t switch is still 1/3, while the probability of winning if you switch is 2/3 !

The simplest way (for me) to see this is by running a Monte Carlo Simulation (code below), but an intuition goes something like follows:

Initially, you have 1/3 probability of selecting the correct card. That means that there’s 2/3 probability that the Ace sits in either of the two other cards. Now imagine the 3 cards on the table being “split” and placed into two boxes, with the card you’ve chosen in the left box, and the other two cards in the right box . It’s still true that the probability of the card in the left box – the one you’ve chosen – being the Ace is 1/3, while the probability of the winning card sitting in the other box, the one with two cards is 2/3.

Now, the dealer reveals that one of the cards in the box with two cards is not the Ace. Does that change the probability of that box containing the winning card from 2/3…? Nope. So, the probability of the box containing the two cards, the one revealed by the dealer, and the one still face down, containing the Ace is still 2/3, and you should always switch to it, since there’s now only one unknown card in it, and the probability of that card being the Ace is 2/3, while the probability of you having picked the correct card at the start is still 1/3.

The code below runs a simple simulation to demonstate this fact empirically:

import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd

sns.set()

def round_of_game():
    
    ### Monty Hall Problem : 3 doors, one car, two goats ###
    
    car_loc = np.random.randint(0,3)
    guess = np.random.randint(0,3)
    
    ### figure out which door is available for host to open and suggest switch ###
    
    taken = np.unique(np.array([car_loc,guess])) # doors already taken, not avail. for host #
    
    # find door available for host to open by random search until the door is not in taken #
    host_open = np.random.randint(0,3)
    
    while host_open in taken:
        host_open = np.random.randint(0,3)
    
    # find remaining door (available for switching to) # 
    switch_taken = np.unique(np.array([guess,host_open]))
    
    switch_to = np.random.randint(0,3)
    
    while switch_to in switch_taken:
        switch_to = np.random.randint(0,3)
        
    return car_loc,guess,host_open,switch_to
    

iterations = 100000

game_list = []

for i in range(iterations):
    game_list.append(round_of_game())
    
df = pd.DataFrame(game_list,columns=['car_loc','guess_loc','host_open','switch_to'])
df['success_no_switch'] = df['car_loc'] == df['guess_loc']    
df['success_switch'] = df['car_loc'] == df['switch_to']

print ('win no switch : ' , df['success_no_switch'].sum() / df['success_no_switch'].count())
print ('win switch : ', df['success_switch'].sum() / df['success_switch'].count())

Output of this code:

win no switch :  0.33249
win switch :  0.66751

About swdevperestroika

High tech industry veteran, avid hacker reluctantly transformed to mgmt consultant.
This entry was posted in Data Analytics and tagged , , , , , . Bookmark the permalink.

3 Responses to Fooled by probability – Monty Hall Problem

  1. This is such an interesting mathematical experiment. It was published in a leading Dutch newspaper some 10 years ago and some nation wide debate was initiated in which (light weight) mathematical experts argued that it was useless to change your choice. The layman explanation that was the most insightful to me (because it was the most simple one and the most ‘intuitive’) goes as follows:

    Just change the numbers. Imagine not 3 boxes, but 100. And you had to take a guess… everyone intuitively ‘feels’ that the change to pick out the right one, 1/100 is very low. Now imagine the dealer to open up 98 of the remaining boxes and showing the content: not the winning card. And asks you if you want to reconsider your initial choice. Are you (still) going to consider it 50/50? Probably the most of us intuitively feel that – this time – the change you choose right the first time…. is way less than the chance you were wrong. Put differently, the only way the ‘other’ box contains the win is when you chose right the first time: giving you the probability of 99% win when you switch and only 1% when you don’t.

    Hope you and your readers enjoy this explanation!
    Kind regards,
    Stefan

    • Hi Stefan, yes the ”extend the number of boxes” is helpful for intuition. Also interesting is the power of intuition: I first encountered Monty Hall many years ago, and have not thought about it much since then, until I recently saw it in a book. Eventhough I understood it way back then, I now had to think very carefully again to get passed the seeming paradox. Moral of the story is that whenever dealing with probabilities, extreme care must be taken to avoid the intuition pitfalls.

      Best,
      T

      • Very true. Intuition can be deceptive. I liked to watch and bought the book “Irrational Behavior” by Prof. Dan Ariely who elaborates on this interesting subject, at a (again, for me apparently essential :)) pretty accessible level of complexity.

        Cheers!
        Stefan

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s