The Monty Hall problem While reading Think Bayes, one of the books by Allen B. Downey, in chapter one, he mentioned an example known by the name The Monty Hall problem :

The Monty Hall problem is based on one of the regular games on the show. If you are on the show, here’s what happens:



*

*
Monty shows you three closed doors and tells you that there is a prize behind each door: one prize is a car, the other two are less valuable prizes like peanut butter and fake finger nails. The prizes are arranged at random.


*
The object of the game is to guess which door has the car. If you guess right, you get to keep the car.


*
You pick a door, which we will call Door A. We’ll call the other doors B and C.


*
Then Monty offers you the option to stick with your original choice or switch to the one remaining unopened door.


*
Before opening the door you chose, Monty increases the suspense by opening either Door B or C, whichever does not have the car. (If the car is actually behind Door A, Monty can safely open B or C, so he chooses one at random.

He then explains the problem, that we are supposed to understand :

To start, we should make a careful statement of the data. In this case, D consists of two parts: Monty chooses Door B and there is no car there.
  Next we define three hypotheses: A, B, and C represent the hypothesis that the car is behind Door A, Door B, or Door C. Again, let’s apply the table method :


Figuring out the likelihoods takes some thought, but with reasonable care we can be confident that we have it right:


*

*If the car is actually behind A, Monty could safely open Doors B or C. So the probability that he chooses B is 1/2. And since the car is actually behind A, the probability that the car is not behind B is 1.

*If the car is actually behind B, Monty has to open door C, so the probability that he opens door B is 0.

*Finally, if the car is behind Door C, Monty opens B with probability 1 and finds no car there with probability 1
What I don't understand is How is p(D|H) = 1 in C? Because Monty could also open door A. So the  p(D|H) should be equal to 1/2 in C. Also, I don't think I fully understand the reasoning behind case A and B either. Can someone explain this in more details ?
 A: 
What I don't understand is How is p(D|H) = 1 in C? Because Monty could also open door A.

p(D|H) is the probability of D ("Monty opens door B") given H ("the car is behind the door specified in that row"). The table you gave gives p(D|H) only for the scenario in which you have picked door A.
Since the column you didn't understand is p(D|H), I'll go through that for each of the three rows:


*

*Row A: The car is behind door A, and you have picked door A. Here the probability that Monty opens door B is 1/2, because he could open door B or door C.

*Row B: The car is behind door B, and you have picked door A. Here the probability that Monty opens door B is 0, he will always open door C since it doesn't have the car behind it.

*Row C: The car is behind door C, and you have picked door A. Here the probability that Monty opens door B is 1 -- he can't open door A because you picked it, and he can't open door C because it has the car behind it.


To give you the FULL table, with all possibilities for where the car is and what door you picked (and here P(D|H) is still the probability of Monty picking door B given that the car is behind the door specified in the "Car" column):

Picked   Car   P(H)   P(D|H)   P(H)*P(D|H)   P(H|D)
A        A     1/3     1/2      1/6           1/9
A        B     1/3     0        0             0    
A        C     1/3     1        1/3           2/9
B        A     1/3     0        0       
B        B     1/3     0        0       
B        C     1/3     0        0       
C        A     1/3     1/2      1/6           1/9
C        B     1/3     0        0             0    
C        C     1/3     1        1/3           2/9

Why is P(H|D) not a number in all three rows where you pick door B? Because Monty can't open door B when you've picked door B, so the probability of him opening door B is always 0 in that scenario. Then when you apply Bayes' theorem, you add together all the P(H)*P(D|H)s, which are all 0s, and you get a 0 in the denominator. You can't divide by 0, so there is no answer for those cells.
A: Only the second column needs explanation (column one is obvious, and, other columns are computed from these two). 
D is defined to be the event that Monty (the game's host) opens the door B and it is empty. 


*

*If the car is behind A, Monty can open either B or C as both of them are empty. So, the probability of D (that is Monty opens B and it is empty) is 1/2. 

*If the car is behind B, Monty has to open C. Hence, he will not open B. So D will not occur.

*If the car is behind C, the game-host has to open B. So D will occur with probability 1. 
By the way, Monty doesn't open the door the player has already chosen. It's part of the game. 
