A simulation of the Monty Hall problem

The Monty Hall problem can be stated as follows: A gameshow host displays three closed doors. Behind one of the doors is a car. The other two doors have goats behind them. You are then asked to choose a door. After you have made your choice, one of the remaining two doors is then opened by the host (who knows what's behind the doors), revealing a goat. Will switching your initial guess to the remaining door increase your chances of guessing the door with the car?

The answer is yes. I did a simulation of this problem in the following manner:

  1. Randomly assign the car to be behind one of the three doors. The other two doors will be assigned goats.
  2. Randomly pick one of the three doors.
  3. Open one of the two remaining doors to reveal a goat:
  4. Pick whether to switch or stay with the choice made in (2) randomly.
  5. Compare the final door choice to the answer.

I did the above sequence of steps a billion times. Here're the results:

Number of times I stayed with the choice in step (2): 499990387
Number of times I chose to switch: 500009613
Number of times I was right when I stayed: 166585940
Number of times I was right when I switched: 333391697
Fraction right when I stayed: 0.333
Fraction right when I switched: 0.666

Even though the simulation says that the chances of you being right when you switch increases to 2/3, I find this solution highly counter-intiutive.

Let's analyse why this is. At the beginning, the probability of you being right when you choose a door is 1/3, since that's what the random assignment is based on. It should therefore be obvious that whatever you or the game show host do, that probability will not change unless the car is reassigned. This is the result that is seen in the "staying" choice.

Now, let's consider the probability of your answer being in any one of remaining doors. Without the host opening the doors, the probability of the car being behind in the door you selected is 1/3, and the total probability for being in either of the two doors is 2/3. This should be obvious, but one way of looking at it is to first observe that all the probabilities must sum up to 1. Therefore, the total probability of being in either of the two other doors is one minus the probability of being in the first door (which is 1 - 1/3 = 2/3). When the host opens the door, he gives you the amount of information that was present in the door he opened, which is 1/3, and thus the probability of you being right increases by that much.

The intiutive answer (to some people anyways) is that the probability of being right whether you stay or switch is 1/2. That can never happen since we assign the car with a probability of 1/3, and this has to be the probability of staying with the first choice. So a blind invocation of the probability law (that the probabilities should all sum to one) is enough to account for the probability of being right when you switch (which is equal to 2/3 in the above game).

Ramdom access || Ram Samudrala || me@ram.org