# The Monty Hall problem

The Monty Hall problem is a well known math problem, famous among nerds around the world who have studied math and computer science. It has garnered somewhat of an infamous reputation, stemming from the fact that although the problem itself is simplistic and straightforward in nature, the correct solution is anything but. In fact, the right answer is so unintuitive, that when the problem was first introduced to the general populace via a 1990 Parade Magazine “Ask Marilyn” column, many reacted with vitriolic letters expressing their disagreement and disbelief. I know that when I first introduced to the problem in my Discrete Mathematics class, I had a hard time wrapping my head around the professor’s explanation. I would end up second guessing myself all the time anytime I worked on homework involving probability and proofs (although to be fair, all my math and computer science courses did that.)

Here is the gist of the problem: You are a contestant on a game show. In front of you are three doors. For storytelling sake, let’s say that behind one of these doors is the grand prize of one million dollars and behind the other two doors is a whole lot of Monopoly money. All you need to do to win is simply pick the door that contains the grand prize. Simple right? But wait, there’s a twist! After you have made your selection, the host, Monty Hall, opens one of the doors which does not contain the grand prize. He then gives you the option of switching doors.

So the question is, what should you do? Stick with your original choice or pick the other door instead? Does it even matter? A lot of people will argue that it doesn’t matter which door you pick at this point, because it’s a 50/50 chance that either door is a winner. Well, it turns out this is not true. In fact, by switching doors, you more than double your chances of winning! As you can imagine, many people have a hard time accepting this.

There are quite a number of proofs floating around the Internet that explain why switching is the right choice. There’s even one proof that involves using Bayes theorem that I could probably still understand, but only if I dusted off my probability textbooks. However, I’m but a mere mortal, so I prefer simpler explanations. The probability that you picked the correct door initially is 1/3. The probability that you picked the wrong door is 2/3. If you picked the wrong door initially, then switching after Monty Hall reveals a door means that you’ve won. Here’s the part that can tend to trip people up. Because you have a 2/3 chance of picking incorrectly, then there is a 2/3 chance that the remaining door is the winning door.

To illustrate this more clearly, it helps to look at an extreme version of the problem. Let’s say there are one hundred doors, and after you make your initial selection, the host opens 98 of the other doors that do not contain the winning prize. The probability you chose the correct door initially is 1/100. Are you really willing to stick with this initial shot in the dark? The chance that you picked correctly does not increase as the host starts opening doors. This is because you guessed blindly, whereas the host knows which doors do not contain the prize. The probability you chose the incorrect door is 99/100. In ninety nine cases out of one hundred, by switching to the remaining door, you will win.

Of course, some people may still vehemently disagree with this simple explanation and spend all their time looking for a flaw in the argument. Another recourse is good old fashioned empirical evidence. One can simply run an experiment where they simulate the game with a friend, with simple setups such as three playing cards or three cups (one of which hides a toy prize). The law of large numbers means that by running a large number of tests, the actual percentage of games won will mirror the actual probability of winning a game via switching. In other words, 2/3 of the games will be won by always switching, given a large enough sample size. Try it for yourself below and see (and feel free to view page source to make sure there’s no funny business going on, this really is an accurate rendition of the game):

Select a door:

Score:
Games played:

0

Games won:

0

Games won switching:

0

Games switched:

0

Games won switching %:

0%

Games won staying with original choice:

0

Games staying with original:

0

Games won staying with original choice %:

0%

For those without patience, they can run multiple tests via a computer simulation. I wrote one myself for fun. This one lets you modify the number of doors as well as the number of total test runs. As stated previously, in a setup with n doors where the host then reveals n-2 incorrect doors after you have made your initial selection, the probability of winning by switching is (n – 1) / n. Again, feel free to view page source to make sure there are no smoke and mirrors being used to alter the results. Granted, random number generators aren’t technically random, and instead use fancy pants algorithms such as a linear congruential generator to simulate randomness. The javascript RNG is no different. But for purposes of this simulation however, it will suffice.

Please enter in a value between 10 and 1000 for the number of times to run simulation (invalid values will be replaced by default of 1000) :

Please enter in a value between 3 and 100 inclusive for the number of doors (invalid values will be replaced by default of 3):

* A special thank you to my sunshine Mary, for suggesting the idea of writing a javascript version of the Monty Hall game 🙂