Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, either immediately opens your door or opens another door, say No. 3, which might have the car or a goat. If the host opens door No. 3 and it has a goat behind it, he then offers you the choice, "Do you want to pick door No. 2?" Is it to your advantage to switch your choice?
We will now play the game using the assumptions:
It is also typically presumed that the car is initially hidden randomly behind the doors and that, if the player initially picks door D, then the host's choice of which door to open is represented by a conditional probability matrix Ph
Ph = [ p_11 p_12 p_13 p_21 p_22 p_23 p_31 p_32 p_33 ]
In the above matrix, p_ij represents the probability that the host opens door j given that the car is behind door i.
Interpreting the matrix in terms of the assumptions implies that all elements p_ij of the conditional probability matrix can be nonzero with the constraint that
p_i1 + p_i2 + p_i3 = 1 i.e. the host must always open a door to reveal the car or a goat.
On the game show, you have initially chosen door D and the host, Monty Hall, opened door H, using the conditional probability Ph.
What is the probability Pws that you will win the car by switching your choice to the door remaining?
If switching option is not available (i.e. host opens a door with the car behind it) return NaN.