The Monty Hall Problem is an interesting Maths Puzzle – with a hotly disputed answer. Monty Hall is a well known American TV Show presenter, and this particular maths puzzle gained some notoriety on his TV Show – hence the name “Monty Hall Problem”. The puzzle is quite simple to understand, but as is so often the case it is a little more tricky (and fun) to figure out the answer.

World famous mathematicians have gone to their grave disputing the answer. But I’ll explain it in easy to understand language, and demonstrate a proof using a computer simulation I wrote which played no less than 70 million games. The source code for the simulation is available here Alan Cowap GitHub so you can review it yourself 🙂

Get my free Monty Hall Game on Google Play.

# Show Me The Monty Hall Problem Puzzle!

Monty shows you 3 doors which are closed. You are told that behind one of the doors is a car, behind the other 2 doors lies a Goat. If you choose the correct door you win the car. The doors are labelled 1, 2, and 3. Let’s say you choose Door 1. In an unexpected twist Monty opens say Door 3 – behind which stands a goat! Monty then asks you “Do you want to stick with Door 1, or do you want to choose Door 2 instead?”.

So do you stick or twist? You can stick with Door 1 or try your luck with Door 2. Monty is waiting. Your heart is racing. The crowd are shouting in equal measure “Door 1” and “Door 2”, some jokers are even shouting “Door 3” ]:> 😀

# Show Me The Monty Hall Problem Answer.

Not so fast. The fun is figuring out the correct answer – if there is a correct answer. What I’m going to do is put forward an answer and explanation, then I’ll write a software program to simulate this scenario 70,000,000 (70 million) times and see if it agrees with my proposed answer. Is it better to stick or to twist – or does it make any difference? I’ll share the results (and the code) of this simulation with you. In the meantime, you can try to solve the puzzle by yourself. But before that, I’ll propose an answer – spoiler alert – don’t read the next paragraph if you don’t want to see the proposed answer.

# The Monty Hall Problem Answer (**SPOILER ALERT**)

Ok then, you’ve racked your brains and thought through all sorts of statistical slight-of-hand and complex combinations and permutations and convinced yourself you have the correct answer. Stick or twist? Well , it turns out you should have …

changed to Door 2 – by doing so you will have doubled your chances of winning the car. If you got it right well done, if not sorry it looks like you’re getting the bus home!

# The Explanation

As odd or counter-intuitive as this may seem the explanation is relatively straightforward. Each door had a 1/3 chance of being the correct door. You chose Door 1 – which had a 1/3 chance of being correct; however, jointly Door 2 and Door 3 have a 2/3 chance of being correct.

Once you discover that Door 3 is incorrect (when Monty opens it and the Goat is there) the odds for Door 2 and Door 3 being correct still remains at 2/3. But since Door 3 is ruled out that means Door 2 alone retains that 2/3 chance of being correct. Door 1 also retains it’s 1/3 chance of being correct. Therefore, sticking with Door 1 gives you 1/3 chance, while changing to Door 2 gives you a 2/3 chance.

If you find that hard to believe, and you think it’s a 1/2 (50:50) chance I can understand that. And you’re in good company, some world class mathematicians are with you. But I’m going to demonstrate that you should have changed to double your chances of winning!

# Statistics Remember History?

You might be thinking that Door 1 and Door 2 now have a 1/2 chance each, but that would be ignoring history (a perilous endeavour in any part of life). Statistical trends will tend to be correct over a larger sample (number of samples, time, etc.) but statistics don’t always apply well to individual cases. Let’s look at an example: if you sample 100 families and find between them they have a total of 240 children, then statistically the average family has 2.4 children. Clearly this statistic can’t be applied to an individual family because no-one will have 0.4 of a child! However, as you increase the sample size you will find the statistic is reasonably accurate.

Another hypothetical example of statistics “remembering history” is this. You walk into a room and someone is about to roll a die (note that *die* is singular of *dice*) and they ask you to guess what number will be rolled. You know that each number has a 1/6 chance of being rolled, right? But then the person tells you “I’ve already rolled the die 5 times, and I rolled, 1,2,4,5,6”. Will this change your thinking of which number to pick. Will you now pick 3? Has knowing the history or the roll changed what the die is going to do? Knowing previous behaviour can be a predictor for future behaviour.

# Let’s Write that Computer Simulation and see if this 2/3 hullabaloo holds up!

Like any scientist I propose that it’s critical to test a thesis against empirical data, thus we can either validate or invalidate the thesis. After all, we’re interested in verifiable, reproducible knowledge. So will we see the 1/3 to 2/3 distribution?

Umm, yes! First time running the computer simulation and the numbers were uncannily as expected. After 10 million simulations of the game the ratio was pretty precise at 1/3 (**33.33%**) vs 2/3 (**66.66%**) in favour of changing door. I ran the 10 million simulations 7 times and here are the results of those 70 million simulated games.

Doors in Game: 3 Unchanged Wins: 3332705, Changed Wins: 6667295Unchanged Wins: 33.33%, Changed Wins: 66.67%Unchanged Wins: 3335814, Changed Wins: 6664186Unchanged Wins: 33.36%, Changed Wins: 66.64%Unchanged Wins: 3334332, Changed Wins: 6665668Unchanged Wins: 33.34%, Changed Wins: 66.66%Unchanged Wins: 3333829, Changed Wins: 6666171Unchanged Wins: 33.34%, Changed Wins: 66.66%Unchanged Wins: 3333535, Changed Wins: 6666465Unchanged Wins: 33.34%, Changed Wins: 66.66%Unchanged Wins: 3331383, Changed Wins: 6668617Unchanged Wins: 33.31%, Changed Wins: 66.69%Unchanged Wins: 3331153, Changed Wins: 6668847Unchanged Wins: 33.31%, Changed Wins: 66.69%

Whaaaat! Having written the program I can see how these results are kind of inevitable*, so I decided to see if the results held up for different numbers of doors. That required a bit more flexibility in the code so no problems there w00t! ¯\_(ツ)_/¯

* it’s not possible to programmatically do anything “randomly”, we can only do pseudo-random. Indeed t’s a longstanding philosophical argument (which also persists in Physics) about whether things can happen “randomly” or whether things are causal and even deterministic. Schrödinger’s Cat vs Copenhagen Interpretation anyone meoow!

# What’s Next?

If you want to see some more cool work I did on this puzzle check out the follow on post Monty Hall Solution – Advanced! including having more than 3 doors (actually up to 9 doors and more)!! So many doors, so few cars (so many goats).

Questions or comments welcome below, and contributions to the code are welcome too, it is available here Alan Cowap Github 🙂

P.S. Nod to Cepheus~commonswiki for the images.