Suppose you’re on a game show, and you’re given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what’s behind the doors, opens another door, say No. 3, which has a goat. He then says to you, “Do you want to pick door No. 2?” Would you want to switch your choice?

Answer

It might appear that there is no advantage to switch your choice, but with switching choice you will have 67% probability of winning the car, while without switching choice you will have only 33% probability of winning the car.

A very simple explanation of this is that in the beginning you have 33% probability of choosing the door with the car and 67% probability of choosing door with a goat. After the host opens a door with goat, you can switch the your chances. Since its 67% probability that you would have picked a wrong door, by switching doors you will have 67% probability of picking the right door.

The same conclusion can also be drawn mathematically. Let’s assume you choose door No. 1. If car is behind door No. 1, the host can open any of the doors- No. 2, No. 3 with equal probability. If car is behind No. 2 (No. 3), the host will open door No. 3 (No. 2).

So the probability of your winning, without switching door, is-

p = 1/3 * 1 + 1/3 * 0 + 1/3 * 0 = 1/3

Probability of your winning, after switching door, is-

p = 1/3 * 0 + 1/3 * 1 + 1/3 * 1 = 2/3

The solution will be more intuitive with 1,000,000 doors rather than 3. In this case, there are 999,999 doors with goats behind them and one door with a prize. After the player picks a door, the host opens 999,998 of the remaining doors. In this case you will have 99.9999% chances of winning the car by switching your choice.

A simulation of the problem can be performed by the following python code-

import numpy as np
import matplotlib.pyplot as plt

N_EXPERIMENTS = 5000 # number of experiments
N_TRIALS = 1500 # number of trials, to get probability of winning

sample_estimate = []
for i in range(N_EXPERIMENTS): 
    counter = 0
    for j in range(N_TRIALS):
        correctDoor = np.random.choice(3)
        choosenDoor = np.random.choice(3)
        unchoosenDoor_Goat = set([0, 1, 2]) - set([correctDoor, choosenDoor])
        openedDoor = np.random.choice(list(unchoosenDoor_Goat))
        doorAfterSwap = list(set([0, 1, 2]) - set([choosenDoor, openedDoor]))[0]
        if correctDoor == doorAfterSwap:
            counter += 1
    sample_estimate.append(1.0*counter/N_TRIALS)

plt.figure()
plt.hist(sample_estimate, bins=20)
plt.xlabel('Probability')
plt.ylabel('Frequency')
plt.show()

Make sure you sign up at Prepleaf for regular quant and puzzle updates. Click here for more exciting puzzles.

Here is a list of top 100 puzzle blogs, created by Feedspot.

Leave a Reply

Your email address will not be published. Required fields are marked *