Imaging you are in a game show where you can choose between three identical doors, where behind one door a car is hidden whereas behind the other two goats are hidden. You can now choose which door to open and if you happen to choose the door where the car is, this car is yours. After you made the decision, the showhost stops and doesn't open the door immediately but gives you the chance to reconsider. He encourages you to rethink if you really want to open this door by opening a door where there is for sure a goat hidden behind. The big question you are facing now is: What are my chances of winning the car by keeping my decision or changing to the other closed door?
Intuitively, one would think that the probability for the car being behind each door is one third and by opening the door where there is a goat hidden the probability stays the same. Therefore, it should not matter if the door is changed or not, right? No. Actually, it matters, because the odds for winning when changing the door are two third, whereas the odds when staying with the original decision is one third. How can that be?
One of the easier graspbable methods of determining this solution is by simple counting. It is assumed that the probability of where the car is hidden is uniformly determined, this means that the probability of the car being behind a certain door is one third at the beginning of the game. The game consists not only of one decision but has to be treated as a sequence of decisions to determine the final probabilities. Therefore, we can define a triple (your choice, door opened by host, door with car) to describe one sequence of game playing. As the game is symmetrical, we can investigate one of the cases and extend the result to the others. So if we choose to open door 1 and then the host opens door 2, but the car was hidden behind door 1, this would be the tuple (1, 2, 1). For the symmetrical case, where we start with choosing door one, there are four possible outcomes of the game, those are
(1, 2, 1) (1, 3, 1) (1, 2, 3) (1, 3, 2).
Now we can begin to count: The two last cases, where the car was hidden behind door 3 or door 2, which we both didn't choose in the beginning, we can assign a probability of one third each. Why one third for four cases? Yes, we have to treat the first two cases as separate, because the probability of one third for hiding the car behind door 1 has to be distributed to those two cases. Therefore, these are assign probability of one sixth. To now determine the probability of winning when switching the door, we have to count the cases (1, 2, 3) and (1, 3, 2) and add up their probability, which amounts to two third. The probability for staying with the decision and winning is the probability of the two first cases added, which is one third. Therefore, it is better to change.
Another solution method would be simple and stupid simulation. This means a program plays a lot of games and decides randomly between doors and randomly decides to stay or switch. Then the numbers of winning and loosing for each case are recorded and the average probability can be calculated. In general such a method is called Monte Carlo method.
When I was first encountering the problem a few years ago, I couldn't wrap my head around the solution and couldn't believe this to be true. Therefore, I implemented a simulation of the game in Python. It can be downloaded at my Github page monty-hall-problem.
If you are interested in the Monty Hall problem and its history, as well as a lot of discussion of different solution methods and strategies, I highly recommend the book
J. Rosenhouse. The Monty Hall Problem: The Remarkable Story of Math's Most Contentious Brainteaser, Oxford University Press, new Yord, 2009.
Alternatively, you can also find the basic description of the solution methods and a discussion of strategies on Wikipedia.
One last question remains: Does this help us if we would be actually playing in the game show? Actually, no. The problem posed in the gameshow is different as the show host didn't always open one other door. Also he tried to influence the participants through tricks. Therefore, the real problem is not as rigorous as the theoretical one.