## The Problem

The **Monty Hall problem** originates from the TV game show *Let's Make a Deal*, named after its host Monty Hall and the three doors used in the game. The rules are as follows:

Many people believe that it doesn't matter if they switch because the probability of winning the car 🚗 is fifty-fifty. They reason as follows:

When I choose a door and Monty shows me another door with a goat 🐐 behind it, there are only two unopened doors left. One hides a goat 🐐 and the other hides the car 🚗. Therefore, the probability that the car 🚗 is behind my chosen door is 50/50, and the probability that it is behind the other door is also 50/50. So, it doesn't matter whether I switch or not; I might as well stick with my initial choice.

While this reasoning seems logical and many people think this way, it is **completely incorrect**. The key to solving this problem is understanding that **the contents behind the initially chosen door do not change based on whether Monty Hall opens another door**. Initially, the probability of the car 🚗 being behind the chosen door is $\frac{1}{3}$. When Monty Hall eliminates one wrong option, switching to the other door increases the probability of finding the car 🚗 to $\frac{2}{3}$.

## Enumerating Possibilities

If the above explanation isn't convincing, let's enumerate (explicitly calculate) the possible arrangements of the goats 🐐 and car 🚗 behind the doors and analyze the outcomes if we switch in each scenario.

Note that the placement of items doesn't matter since all choices are made randomly; whether the car is behind "Door 1", "Door 2", or "Door 3", the results are the same: we still have a $\frac{1}{3}$ chance of picking the door with the car. Thus, without loss of generality, let's assume the car is behind "Door 1" and the goats are behind "Door 2" and "Door 3".

Door 1 | Door 2 | Door 3 |
---|---|---|

Car | Goat | Goat |

Under this arrangement, we can enumerate the outcomes of switching and not switching for each choice:

Our Choice | Host Shows | Switch Result | No Switch Result |
---|---|---|---|

Door 1 | Door 2 or Door 3 | Goat | Car |

Door 2 | Door 3 | Car | Goat |

Door 3 | Door 2 | Car | Goat |

From the table, we see that only in the first case does switching result in getting a goat, whereas in the other two cases, switching results in getting the car. The probability of winning the car by not switching is $\frac{1}{3}$, while the probability of winning by switching is $\frac{2}{3}$.

It is worth noting that if our initial choice is a door without the car (i.e., Door 2 or Door 3), host cannot randomly open another door; he must avoid the door with the car and open the other door with a goat. This process effectively helps us by eliminating one wrong option, thereby increasing the probability of winning the car by switching.

## Applying Bayes' Theorem

The Monty Hall problem can also be approached using Bayes' theorem.

### What is Bayes' Theorem

Bayes' theorem is expressed as

$$

P(A \mid B) = \frac{P(B \mid A)P(A)}{P(B)}

$$

where

- $P(A)$ is Prior: The probability distribution of the parameter independently from any evidence.
- $P(B)$ is Evidence: The probability distribution of the observed Evidence independently any parameter value.
- $P(B \mid A)$ is Likelihood: The probability distribution of the observed evidence given a parameter value.
- $P(A \mid B)$ is Posterior: The probability distribution of the parameter $A$ given the evidence.

Bayes' theorem can be easily proven, as demonstrated in the following steps:

$$

\begin{align*}

P(A \mid B) &= \frac{P(A \cap B)}{P(B)} \\

&= \frac{P(A)}{P(B)}\frac{P(A \cap B)}{P(A)} \\

&= \frac{P(A)}{P(B)}P(B \mid A) \\

&= \frac{P(B \mid A)P(A)}{P(B)}

\end{align*}

$$

### The Monty Hall problem from a Bayesian perspective

Let's define the prior probability of the car being behind door 1 as $P(D_1)$, behind door 2 as $P(D_2)$, and behind door 3 as $P(D_3)$. Clearly, we have

$$P(D_1) = P(D_2) = P(D_3) = \frac{1}{3}$$

Next, let's simulate the game scenario. Without loss of generality, let's assume the player picks door 1, and the host opens door 2. Now, we need to compare the posterior probabilities of the car being behind door 1 versus door 3, after the host opens door 2.

Let's denote the probability of the host opening door 2 as $P(O_2)$. Thus, the posterior probability described above can be written as:

$$

\begin{align*}

P(D_1 \mid O_2) = \frac{P(O_2 \mid D_1)P(D_1)}{P(O_2)}\\

P(D_3 \mid O_2) = \frac{P(O_2 \mid D_3)P(D_3)}{P(O_2)}

\end{align*}

$$

Let's take a moment to explain what each term in the above formula represents.

- $P(D_1 \mid O_2)$ is a posterior probability, indicating the probability that a car is behind door 1 after the host has opened door 2.
- $P(D_3 \mid O_2)$ is the other posterior probability, indicating the probability that a car is behind door 3 after the host has opened door 2.
- $P(O_2 \mid D_1)$ represents the likelihood that the host will open door 2, assuming the car is behind door 1.
- $P(O_2 \mid D_3)$ represents the likelihood that the host will open door 2, assuming the car is behind door 3.
- $P(D_1)$ represents the prior probability that the car is behind door 1. We have known it's $\frac{1}{3}$.
- $P(D_3)$ represents the prior probability that the car is behind door 3. We have known it's $\frac{1}{3}$ as well.
- $P(O_2)$ represents the prior probability that the host chooses to open door 2.

In order to calculate $P(D_1 \mid O_2)$ and $P(D_3 \mid O_2)$, we have to find the value of $P(O_2 \mid D_1)$, $P(O_2 \mid D_3)$ and $P(O_2)$. Let's do it.

According to the meaning of $P(O_2 \mid D_1)$, if the car is behind door 1, the host has options to randomly open either door 2 or door 3. Consequently, the probability of opening door 2 is $\frac{1}{2}$.

Similarly, according to the definition of $P(O_2 \mid D_3)$, if the car is behind door 3, the host is restricted to opening door 2 (because door 1 is the player's choice and door 3 hides the car, neither doors can be opened). Thus, the probability of opening door 2 is $1$.

Calculating $P(O2)$ is a bit more intricate and involves applying the Law of Total Probability.

The law of total probability states that, if $\{𝐵_𝑛 : 𝑛=1,2,3, \dots\}$ is a finite or countably infinite set of mutually exclusive and collectively exhaustive events, then for any event $𝐴$:

$$

P(A) = \sum_{n} P(A \mid B_n)P(B_n)

$$

Obviously, $P(D_1)$, $P(D_2)$ and $P(D_3)$ are mutually exclusive and collectively exhaustive events. Therefore, we can express $P(O_2)$ as

$$

P(O_2) = P(O_2 \mid D_1)P(D_1) + P(O_2 \mid D_2)P(D_2) + P(O_2 \mid D_3)P(D_3)

$$

In the formula above, the only unknown term is $P(O_2 \mid D_2)$. This term represents the probability that the host opens door 2 when the car is behind door 2. Clearly, this probability is $0$. Therefore,

$$

\begin{align*}

P(O_2) &= P(O_2 \mid D_1)P(D_1) + P(O_2 \mid D_2)P(D_2) + P(O_2 \mid D_3)P(D_3) \\

&= \frac{1}{2} \cdot \frac{1}{3} + 0 \cdot \frac{1}{3} + 1 \cdot \frac{1}{3} \\

&= \frac{1}{2}

\end{align*}

$$

Now, we can determine the probability of a car being behind door 1 or door 3 once the host has opened door 2.

$$

\begin{align*}

P(D_1 \mid O_2) = \frac{P(O_2 \mid D_1)P(D_1)}{P(O_2)} = \frac{\frac{1}{2} \cdot \frac{1}{3}}{\frac{1}{2}} = \frac{1}{3}\\

P(D_3 \mid O_2) = \frac{P(O_2 \mid D_3)P(D_3)}{P(O_2)} = \frac{1 \cdot \frac{1}{3}}{\frac{1}{2}} = \frac{2}{3}

\end{align*}

$$

Look, we obtained the same results as enumerating possibilities.

Therefore, in the The Monty Hall Problem, the optimal strategy is always to switch to the other door. By switching, the chances of winning the car are twice as high compared to sticking with the initial choice.