top of page

The Monty Hall Problem



Any math enthusiast has delved into the Monty Hall problem before.

This is my take on it.


For the uninitiated, the problem goes like this (lifted from Wikipedia):

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?" Is it to your advantage to switch your choice?

Spoiler alert; you should always switch your choice.


If you work out the scenarios, switching your choice always gives you a higher probability of selecting the reward. In fact, switching your choice gives you a 66% probability of selecting the reward, as compared to the 33% if you don't switch. So in a sense, your choice of switching seemingly doubles your odds of selecting the reward. This seems unimaginable and mathematically counterintuitive.


There are tons of explanations by others (who are more well versed in mathematics) on this topic:

Despite all these, I set out to create a visualisation for myself so that I can play with the specific conditions of this problem.


Here's the thing - I actually didn't want something super rigorous (like Monte Carlo or Python??). I wanted something that the average layperson could understand easily, and I wanted to break down the problem into smaller parts. So it was decided that the rudimentary (but still heckin' powerful!) Microsoft Excel should be used.


So in Excel, I wanted to show 20 parallel attempts at once. This involved some random number generation where one of three cells was selected to have a car (reward) placed in it, as indicated by the red "1" on the right hand side.

Each of the 20 scenarios has an independent configuration. After generating the 3 random numbers between 0 and 1, the cell with the highest value was selected as the one with the car.

Next, we have to simulate random selection. This is where, in each of the 20 scenarios, a player selects one door out of three available options.

This is done with the same concept. Highest value indicates that the cell was selected. I changed the formatting to use a solid bordered cell to indicate that the cell has been selected.


And, with these two sections set up, we can already simulate what would happen if the player decided not to switch for all the scenarios:

So a third section, "non-switch coincide" can be setup, taking the intersection of the previous two sections. This new section shows the scenarios where a randomly placed car was indeed randomly selected.

As you can see, the success rate for this is 35%, which means 7 out of 20 scenarios got a hit. For scenario 5, a car was randomly placed in the second cell, and the second cell was randomly selected, producing a success.


With Excel, we can press F9 to recalculate this, and while it is technically possible to get a 100% hit rate, where all cells with cars just happen to be randomly selected as well, the average probability of success hovers around 33%.


We can then start to model how it would look like if we reveal a door/cell without the reward.

The "O" in the fourth section indicates that the cell has been revealed to not contain the reward. This is done by a logic formula, yielding a cell that:

  • Did not contain the car

  • Was not selected by the player

So an interesting point to take note here is that: if the player has selected a non car-containing cell (which is more likely), the host is forced to reveal the only other cell without the car.

This is perhaps the most pivotal point behind this problem, and it makes everything a bit more intuitive.


After revealing the non-car, we can then simulate what would happen if players choose the switch their selection:

For the switching step, notice that the player only has one option. The three cells consist of:

  1. Initial selected door

  2. Revealed door without reward (you can't / won't switch to this door)

  3. The door you can potentially switch to

This is true for all scenarios no matter where the reward is. As a result, this logic is relatively easier to model.


As such, we can model the scenarios where a switch was made and the result was a success:

For example, in scenario 1, the first cell contains the car. The second cell was selected, and the third cell was revealed. If a switch is performed, the first cell would be selected, and hence a success would occur.


Playing with this for a bit, it becomes clear that for every scenario where the player selects the non car-containing cell to begin with, AND SWITCHES AFTER, they are guaranteed to switch to the car-containing cell and end up with a success. Check out scenarios 1 - 4 for example.


One of the other conclusions of this is that the outcomes are mutually exclusive. In any given scenario, the player can either choose to switch, or not switch. There are no other possible options. As such, the success probabilities of (non-switch) and (switch) add up to 100%. As can be seen here, 35% + 65% = 100%.


Pressing F9 to recalculate reveals another random configuration:

And again:

This was one of the rarer cases where only one out of 20 scenarios produced a success on a non-switch. As such, the success probability of non-switch was 5%, which makes the success probability of switching 95%.


It is also possible to get scenarios where non-switch probabilities are higher than 50%. As such, the success probability of switching is actually lower than 50%:


This means that the set of 20 scenarios just happens to show that switching is a bad idea.

However, when averaged out over many scenarios, the probabilities of non-switch and switch tend towards 33% and 66% respectively.


In fact, you should try it out for yourself. Play with the Excel file here:

Enjoy the Messy Workings :)












Comments


Featured Review
Tag Cloud
No tags yet.
bottom of page