The famous Monty Hall show where a contestant has a chance to win a car that is placed behind one of three closed doors have given rise to the so called Monty Hall problem. What is the problem? Let us discuss the setup before delving into the problem statement. The show Lets Make a Deal works in short as follows. The contestant is lead in to the show where three closed doors are placed, behind one of the closed doors is a luxury car and behind the others a goat. The contestant gets to pick one door. The door is not yet opened, Monty Hall then walks in and opens **one of the other two doors**, of course Monty **knows where the car is placed so he opens a door which he knows has a goat behind it**. Monty then offers the contestant a deal, the contestant is allowed to switch door to the other unopened door if he/she wants to. The Monty Hall problem is; should the contestant switch doors? Most people intuitively thinks it does not matter, that it is a fifty-fifty chance now (there are two closed doors), and most (probably due to the Endowment effect) does not want to switch. There are many intricate twists, variations and additional considerations to this problem, but we will here only discuss the simple setup as stated above.

We model the problem in the following probabilistic way:

The random variable C can take on three values C=1 or C=2 or C=3 and means respectively, the car is behind door 1, door 2 or door 3.

The random variable X can take on three values X=1 or X=2 or X=3 and means respectively, the contestant picked door 1, door 2 or door 3.

The random variable Y can take on three values Y=1 or Y=2 or Y=3 and means respectively, Monty opened door 1, door 2 or door 3.

Lets now assume that the car is behind door 3 and that the contestant (of course not knowing the car is behind door 3) randomly picks door 1. This leaves Monty no choice but to open door 2 (According to the image above, courtesy Wikipedia), now the question is, should the contestant switch to door 3? To solve the Monty Hall problem we would like to calculate the probability that the car is behind door 1 and 3 respectively, **given that Monty opened door 2!**

Lets start by calculating the probability that the car is behind door three. If we know this probability, then, by the laws of probability we also know the probability that the car is behind door one, since this is just 1 minus the probability that the car is behind door three (since Monty has opened door two and we know the car is not there).

With the above information we can formulate the above problem mathematically according to the following formula:

$$p(C=3|X=1,Y=2)$$ We call this equation Eq 1.

Which means:

(What is) the probability that the car is behind door three (C=3) given that the contestant picked door one (X=1) and that Monty opened door two (Y=2)?

Eq 1 can be re-expressed by Bayes rule as:

$$p(C=3|X=1,Y=2) = \frac{p(X=1,Y=2|C=3)p(C=3)}{p(X=1,Y=2)}$$

We call this equation Eq 2. Which should be read as:

the probability that the car is behind door 3 given that the contestant picked door 1 and that Monty opened door 2,

is the same as, the likelihood that the contestant picked door 1 and Monty opened door 2 given that the car was behind door 3, times theprior probabilitythat the car was behind door 3, all of this divided by the marginal probability that contestant picked door 1 and Monty opened door 2

This mathematical equivalence was proven by reverend Thomas Bayes and later also Laplace.

Eq 2 has three components on the right side of the equation, let’s look at them separately:

$p(X=1,Y=2|C=3)$ This is the part that says:

the probability that the contestant picked door 1 and Monty opened door 2 given that the car was behind door 3

What is this likelihood? Well, if the car is behind door three (C=3) which was given (we know this, but not the contestant), Monty will definitely not open that door (the contestant would obviously switch to that door then ). Monty will also not open the door that the contestant picked, so Y is in this case completely controlled by which door the contestant picks (the variables are not independent, i.e they are dependent). If the contestant picks door 1, Monty will definitely open door 2 since he knows (it was given in the setup of the example) that the car is behind door 3. So what is the probability that the contestant picks door 1 given that we know, but not the contestant, that the car is behind door 3? Well, the contestant does not know anything so he/she supposedly just picks one door by random chance, so picking door 1 has a one in three chance (1/3). So $p(X=1,Y=2|C=3) = 1/3$.

The equation:

$$p(X=1,Y=2|C=3)$$

can further be expanded via the rules of probability as follows:

$$p(X=1,Y=2|C=3) = p(Y=2|C=3,X=1) * p(X=1)$$

Which is a pure mathematical fact. This reformulation may actually make this case more clear. It is expressed in language as

the probability that Monty opens door 2 given that the contestant picked door 1 and that the car is behind door 3, times the prior probability that the contestant picks door 1

And what is this probability? Well if the contestant picked door 1 and the car is behind door 3, Monty has no choice but to open door 2, so this probability is one (1). The prior probability that the contestant picks door 1 is again one in three (1/3). This is another way to show that part one of the right hand side of Eq 2 equals 1/3.

$$p(X=1,Y=2|C=3) = p(Y=2|C=3,X=1) * p(X=1) = 1 * 1/3 = 1/3$$

Let’s then look at the next part of Eq 2 p(C=3). What is this probability? Well, we must assume that the game show randomly picks a position for the car, so this probability is one in three (1/3).

$$p(C=3) = 1/3$$

Now there is only one part of Eq 2 left and that is the denominator:

$$p(X=1,Y=2)$$

Which is perhaps a bit tricky to think about. This says:

The probability that the contestant picks door 1 and that Monty opens door 2,

irrespective of where the car is!That is, in this part it isnotgiven that the car is behind door 3!

What is this probability then? Well, the contestant has a one in three chance of picking door 1, and in that case Monty can only open door 2 or door 3, so the probability of Monty opening door 2 is then one in two (1/2). Remember, in this case he does not know where the car is, but he knows the contestant picked door 1, so he can only choose door 2 or 3. This gives $1/3 * 1/2 = 1/6$. Also this part can be further expanded by the rules of probability as:

$$p(X=1,Y=2) = p(Y=2|X=1)p(X=1)$$

Where p(Y=2|X=1) = 1/2 (if the contestant picks door 1 there is a fifty-fifty chance that Monty opens door 2 (again, since he does not know where the car is located in this part of the formula). And p(X=1) is one in three (1/3) as usual, which equals $1/2 * 1/3 = 1/6$. So now we have all the parts we need to calculate our final answer for what the probability that the car is behind door 3 is, given that the contestant picked door 1 and Monty opened door 2.

$$p(X=1,Y=2|C=3) = 1/3$$

$$p(C=3) = 1/3$$

$$p(X=1,Y=2) = 1/6$$

Which means that:

$$p(C=3|X=1,Y=2) = \frac{p(X=1,Y=2|C=3)p(C=3)}{p(X=1,Y=2)} = \frac{1/3 * 1/3}{1/6} = \frac{1/9}{1/6} = \frac{6}{9} = \frac{2}{3}$$

So the probability that the car is behind door 3 is 2/3, this in turn means that the probability that the car is behind door 1 is 1 – 2/3 = 1/3. For the concreteness of this discussion we picked some doors and placed the car and the contestants choices, but the calculations are the same for any placement so hopefully now you should be convinced (but I’m sure some of you are not) that the contestant should always switch doors, since there is a 2/3 chance that the car is behind the door that he/she did not originally pick!

I hasten to add that, of course this means that sometimes (in 1/3 of the cases) the contestant will be switching to a loosing door!