And now for the exciting conclusion (a couple days later than expected). The solution to the
Monty Hall problem from
Lets Make a Deal, for those of you who didn't already read the wikipedia article, is that it is always better to switch. Many people didn't believe this, nor did I for that matter, until simulations were written proving the chances of winning. So, being as I didn't believe the answer after reading about it, and not having access to the simulations which were described, I decided to write my own in python.
I've been thinking of ways to do this so that people will actually be able to use my code and I've decided to list all required libraries and the versions I'm using. Probably all of my code will be done in python 2.5.4 because a lot of the libraries I use are still only available in that version (
scipy,
numpy,
matplotlib...).
But before I post a bunch of code, I'll explain the thought process. When you look at the Monty Hall problem it all boils down to a couple of important points.
1. Did you originally pick the door that the car is behind?
2. Should you switch doors at the end?
The probability of 1. is easy to calculate. The chance that you picked the right door to begin with is 1/(# of doors). Since, if you did not pick the right door originally then when one door is eliminated before asking to stay or switch, that door will have the car, the chances of the car being behind the other door is (# of doors - 1)/(# of doors).
So, If there are 3 doors and you pick door #1, there is a 1/3 chance you picked the door with the car and a 2/3 chance that you did not. When one of the doors is eliminated, there is still a 2/3 chance that the car is behind the door you didn't pick because the car will never be eliminated according to the rules of the game. So, in staying you only have a 1/3 chance of winning and switching gives a 2/3 chance of winning.
Being as I'm a little short on time, I'll post the python code later.