# The Monty Hall Problem

## ... and why it may have broken your brain

The first time I encountered the Monty Hall problem, I was absolutely convinced that the person who playfully posited the question "Should you switch doors?" was wrong. They had to be. I'm not a "math person" by any means, but even with my rudimentary understanding of mathematics, this solution didn't even begin to make sense. I initially thought they were having a laugh, that this was just another *hilarious* test of my gullibility. I had, after all, fallen for the oh-so-hilarious Thylarctos plummetus some years before.

After several hours of arguing back and forth with the person who introduced me to the problem, who most likely regretted the decision immediately after making it, drawing out iterations of the problem on paper, and writing a program to run the simulation a ridiculous number of times, I was finally convinced.

I write this post in the hope that it save some other poor soul from questioning their sanity.

For those that don't know what the Monty Hall problem is, the basic gist is this:

"You are given three doors to choose from, one of which contains a car and the other two contain goats. After you’ve chosen one but haven’t opened it, Monty, who knows where everything is, reveals the location of a goat from behind one of the other two doors. Should you stick with your original choice or switch, if you want the car?"[¹]

The answer is that you should switch.

Why?

Let's break it down.

Things we know based on the prompt:

- There are 3 doors.
- Behind 2 doors is a goat, behind 1 door is a car.
- You want the car. (I don't think Monty will let you keep the goat :()
- You start the game not knowing what's behind any of the doors.
- Monty starts the game knowing exactly which door contains the car.
- You choose a door.
- Monty opens one of the other two doors to reveal a goat.
- Monty asks if you want to switch doors.

The parts to emphasize here are parts 5 and 7.

There's a 1/3 probability you'll select the prize door at the beginning of the game. If you select the prize door, Monty has two choices of door to open because the other two doors will reveal a goat and isn't the door you chose. If you don't select the prize door, Monty has only one option -- to reveal the location of the other goat. There is now a 2/3 chance that the door you didn't choose and Monty didn't open is the prize door. It's not terribly intuitive, and it's pretty common to mistakenly interpret the probability as being 50/50. After all, you now only have two choices. The difference here is that Monty (the cheating bastard) knows things you don't... and that gives him an edge (or you an edge, if you switch!).

### You Choose Door 1

Behind Door 1 | Behind Door 2 | Behind Door 3 | Result of Switch |
---|---|---|---|

Car | Goat | Goat | Lose |

Goat | Car | Goat | Win |

Goat | Goat | Car | Win |

### You Choose Door 2

Behind Door 1 | Behind Door 2 | Behind Door 3 | Result of Switch |
---|---|---|---|

Car | Goat | Goat | Win |

Goat | Car | Goat | Lose |

Goat | Goat | Car | Win |

### You Choose Door 3

Behind Door 1 | Behind Door 2 | Behind Door 3 | Result of Switch |
---|---|---|---|

Car | Goat | Goat | Win |

Goat | Car | Goat | Win |

Goat | Goat | Car | Lose |

This isn't to say that you will *always* win by switching -- just that it's always more advantageous to switch than to not switch.

Though as with most things on the internet, there is.... still a pretty active debate in some circles. I ran *so many* iterations of the program I wrote to simulate this. That's actually when I learned that Git Large File Storage was a thing, when I, er.... committed some very large files. After also realizing that one should *maybe* just *maybe* calculate approximately how much data you're going to be writing to a file before, say, writing to the file. **So many lessons learned**.

It's in desperate need of a rewrite, but there's also a silly website I created to simulate the problem in real time (rather than just running 1,000,000 iterations at a time and writing it to a file). Fair warning, I am terrible at animations. Or was. Could still be, but it's been a while, so who knows, maybe I've learned through osmosis.

Hope this helps!

[¹] First published in Parade's "Ask Marilyn" column, a version of it can be found at parade.com/970343/parade/logic-puzzles