You can access a significantly larger sample of the platform's content for free by logging in with your Gmail account. Sign in now to explore.

A typical group of interview questions involves some sort of revealing prior information that affects the posterior probability in a counterintuitive way. If you understand the famous Monty Hall problem, you will be able to apply similar logic to the whole family of these questions.

The Monty Hall problem goes as follows: Assume there are three curtains, A,B,C. One of these curtains has a prize. You are given the chance to pick a curtain, and let’s assume that you pick A. Then, curtain B opens, and you can see that there is no prize behind curtain B. You have the option to change your initial choice: **do you switch to C or do you stay with A?**

Before we dive into the solution, let us borrow perhaps the greatest intuitive explanation we have seen for this problem from Murphy (2022). Instead of having 3 curtains, imagine you actually had 100. You pick one in the beginning, and then the curtains open sequentially until there are only left 2 curtains: your initial choice, and one more. Is it more likely that the prize is hidden behind your initial choice (with initial probability of 1/100) or behind the curtain that was left at the end? When you think about the problem this way, it becomes clear intuitively that you should change your initial choice and switch to the only other left curtain. Let’s see the math behind this intuition:

The probability for the price to be behind any of the 3 curtains is 1/3:

\[ \Pr(\text{Prize in A}) = \Pr(\text{Prize in B}) = \Pr(\text{Prize in C}) = 1/3 \]

Once we chose curtain A, then the probability of B and C to be revealed is 1/2:

\[ \Pr(\text{B Revealed | Chose A}) = \Pr(\text{C Revealed | Chose A}) = 1/2 \]

Given that B is revealed, we want to estimate the conditional \(\Pr(\text{Prize in C | B Revealed, Chose A})\). If this probability is greater than 1/3, then we should switch to C. Using the Bays rule we can decompose this probability as follows:

\[ \Pr(\text{Prize in C | B Revealed, Chose A}) = \frac{\Pr(\text{B Revealed, Chose A| Prize in C}) * \Pr(\text{ Prize in C})}{\Pr(\text{B Revealed, Chose A})} \] The \(\Pr(\text{B Revealed, Chose A| Prize in C})\) can be estimated as follows:

\[ \begin{align} \Pr(\text{B Revealed, Chose A| Prize in C}) &= \Pr(\text{B Revealed | Chose A, Prize in C}) * \Pr(\text{Chose A}) \\ &= 1 * 1/3 = 1/3 \end{align} \]

The denominator of the above is:

\[ \Pr(\text{B Revealed, Chose A}) = \Pr(\text{B Revealed | Chose A}) * \Pr(\text{Chose A}) = 1/3 * 1/2 = 1/6 \]

Hence, the wanted probability becomes:

\[ \Pr(\text{Prize in C | B Revealed, Chose A}) = \frac{ 1/3 * 1/3}{1/6} = 2/3 \]

As a result, once B is revealed, the probability for the prize to be in C becomes 1/2, and hence **we should switch our selection from A to C**.

These types of problems are fairly common in data-related interviews. While getting the exact version of Monty Hall is unlikely, getting variations of this problem is very likely. You can find variations of this problem by searching for prior evidence at https://www.madinterview.com.

Bayes rule, Conditional independence, Prior evidence

- Two children I Easy (Prior evidence)
- Documents edited by AI Easy (Bayes rule, Conditional probability)
- Games between two players Medium (Recursive relationship)
- Unfair coin probability Easy (Bayes rule, Conditional probability)
- Paths to destination Easy (Counting, Combinations)