Example 8.1 (Monty Hall problem) Suppose you are on Monty Hall’s TV show. There are three doors. One of them has a car behind it. The other two doors have goats. Monty knows which one has the car. Monty now asks you to pick one door. You will win whatever is behind the door. After you pick one door. Monty opens another door that shows a goat. Monty then asks you if you want to switch. Is it optimal to switch?
We present two solutions to the problem. The first one is using the law of total probability. Let \(S\): succeed assuming switch; \(D_{j}\): door \(j\) has the car, \(j\in1,2,3\). Without loss of generality, assume the initial pick is Door 1. Monty will always open the door with a goat. By the law of total probability, \[\begin{aligned}P(S)= & \underbrace{P(S|D_{1})}_{\textrm{switch from initial pick}}P(D_{1})+\underbrace{P(S|D_{2})}_{\textrm{Monty opens door 3}}P(D_{2})+\underbrace{P(S|D_{3})}_{\textrm{Monty opens door 2}}P(D_{3})\\
= & 0+1\times\frac{1}{3}+1\times\frac{1}{3}=\frac{2}{3}.
\end{aligned}\]
The problem can also be solved using the Bayes’ rule. Let \(D_{j}\): door \(j\) has the car; \(M_{j}\): Monty opens door \(j\), \(j\in1,2,3\). Assume the initial pick is Door 1. If Monty opens door 3, the probability of winning the car assuming switching is \[\begin{aligned}P(D_{2}|M_{3})= & \frac{P(M_{3}|D_{2})P(D_{2})}{P(M_{3})}\\
= & \frac{P(M_{3}|D_{2})P(D_{2})}{P(M_{3}|D_{1})P(D_{1})+P(M_{3}|D_{2})P(D_{2})+P(M_{3}|D_{3})P(D_{3})}\\
= & \frac{1\times\frac{1}{3}}{\frac{1}{2}\times\frac{1}{3}+1\times\frac{1}{3}+0}=\frac{2}{3}.
\end{aligned}\]
Note that, if door 1 has the car, Monty will open door 2 and 3 with equal probability, thus \(P(M_{3}|D_{1})=\frac{1}{2}\). And Monty will never open the door with the car, therefore \(P(M_{3}|D_{3})=0\). Similarly, if Monty opens door 2, we have \(P(D_{3}|M_{2})=\frac{2}{3}\). Therefore, the optimal choice is always to switch. Intuitively, because Monty knows which door has the car, the fact that he always opens the door without the car gives additional information regarding the choice of the door.
R simulation
# Number of simulationsN <-1000# Number of total winsW <-0# Prizes offeredprizes <-c('Car', 'Goat 1', 'Goat 2')for (i in1:N) {# Prizes are in random order behind the doors doors <-sample(prizes, 3)# Guest picks a random door pick <-sample(doors, 1)# Monty opens the door that is not picked by the guest # nor does it has the Car behind it open <-sample(setdiff(doors, c(pick, 'Car')), 1)# If the Guest swithes, he chooses the door that is not# his initial pick nor the one opened by Montyswitch<-setdiff(doors, c(pick, open))# The guest wins if his final choice has the Car win <-switch=='Car'# Increase the winning counter W <- W + win}# Frequency of winning the game if always switchingW/N