Friday, 7 August 2015

The Monty Hall puzzle

In a game show there are three doors. Behind two doors is a goat and behind the other door is a car. As a contestant, you want to win the car. Now, the hosts asks you to choose a door. Then the host goes ahead and opens one of the other two doors  which has a goat behind it. Now, he gives you an option to switch your choice. Should you switch?

It is important to mention that the host:  1) never opens the chosen door 2) always opens the door which has a goat behind it. 

Initially we have no information about the winning door. All the doors have equal 1/3 probability of being the winning door. Once, the host opens a door which has a goat behind we get more information. The inference we can draw based on the nature of the host is that the door which was left unopened is likely to have the car behind it, otherwise the host could have chosen that door instead. It is more clear from an extension of this question, where say there are 1000 doors with 999 having goat behind them. The host this time opens all except the chosen and one other door. Think, why would the host leave just this one door from the 999 possible doors. There are two possibilities 1) You chose the right door initially but chances of that are rather low .001, considering your choice is uniform random initially.  In this case the host could have chosen any door and switching will make you lose. 2) You chose the wrong door initially, the chances of which are 0 .999. In this case host has no choice but to leave the door with car behind untouched, In this case, switching will make you win. So, notice that if you do 1000 random runs, then in expectation 999 times you will make the wrong choice initially and switching will make you win, 999/1000 times. On the other hand, 1/1000 switching will make you lose. For three doors, it is the same argument for 3 doors: switching will make you win 2/3 times. 

We can make this analysis more rigorous, by defining some random variables. Let 1,2,3 denote the door numbers. Following are random variables for this process: Your initial choice (YC), host's choice (HC) and the door with car behind it (DC). Note, YC, HC and DC \in {1,2,3). Let's say that the car is deterministically behind door 1 i.e.
P(DC=1) = 1
 Considering the initial choice of player to be uniform random 
P(YC=1) = P(YC=2)=P(YC=3)= 1/3
As host's choice depends on player's choice HC is not independent of YC.  If you choose door 1 i.e. the winning door, host can choose any of  the other two doors with equal probability.
P(HC=2|YC=1) = P(HC=3|YC=1) = 1/2
Based on nature of the host we know:
1) The host will never choose the door with the car behind it:
P(HC=1|YC=*) = 0
2) The host will never choose the door that you have chosen:
                                                                  P(HC=x|YC=x) = 0
If you choose the wrong door, the host has no choice
P(HC=3|YC=2) = 1 and P(HC=2|YC=3) = 1

Let's calcualte, P(YC=DC|HC) which is the probability of your initial choice being the winner given the hosts choice. For our simplified case we have assumed DC=1 deterministically, hence we need to compute P(YC=1|HC). As these are not independent, P(YC=1|HC) \neq P(YC=1) staraight away. But by bayes rule, 
P(YC=1|HC) = P(HC|YC=1)P(YC=1)/(P(HC|YC=1)P(YC=1)+...+P(HC|YC=3)P(YC=3))
From previous computation of conditionals, P(YC=1|HC=1)  = 0.  
                                               P(YC=1|HC=2) = 1/2*1/3/(1/3*(1+1/2))  = 1/3 
This is the probability of winning without switching. You will win on switching if your initial choice was wrong i.e. P(YC\neqDC|HC) = P(YC=2|HC)+P(YC=3|HC). For HC = 2, this is just
                                               P(YC=3|HC=2) = 1*1/3/(1/3*3/2) = 2/3
For HC = 3,
                                              P(YC=2|HC=3) = 1*1/3/(1/3*3/2) = 2/3

No comments:

Post a Comment