# (Urn problem) What is the probability the first ball drawn was red, given that the second ball was black?

The following question is taken from Mark Joshi's quant job interview.

Urn A contains 5 white balls and 2 red balls. Urn B contains 4 red balls and 4 black balls. You randomly pick an urn and draw a ball (without replacement). You then repeat the process of selecting an urn and drawing out a ball. What is the probability the first ball drawn was red, given that the second ball was black?

This looks like a Bayesian question. Let $$X_1$$ and $$X_2$$ be the colour of ball picked in first and second respectively. Then $$P(X_1 = red | X_2 = Black) = \frac{P(X_2 = Black | X_1 = red) P(X_1 = red)}{P(X_2 = Black)}.$$ Note that $$P(X_1 = red) = \frac{1}{2}\times \frac{4}{8} \quad \text{and} \quad P(X_2 = Black | X_1 = red) = \frac{1}{2}\times \frac{2}{7} + \frac{1}{2} \times \frac{4}{7}.$$ However, I do not know how to calculate $$P(X_2 = Black).$$

• You overlooked the possibility that a red ball could be selected from Urn A in the first selection. Feb 15, 2020 at 11:56
• @N.F.Taussig More precisely which probability are you discussing? Feb 15, 2020 at 12:01
• As well as the colour of the balls picked, you need to consider which urn they were selected from in each round. Feb 15, 2020 at 12:08
• Let $Y_1,Y_2$ identify which urn was selected each round. $$\mathsf P(X_1=\textsf{red}, Y_1=\textsf{urnA})=\tfrac 12\times \tfrac 27\\\mathsf P(X_1=\textsf{red}, Y_1=\textsf{urnB})=\tfrac 12\times \tfrac 48$$, et cetera Feb 15, 2020 at 12:21

$$\Pr(X_1 = \text{red} \mid X_2 = \text{Black}) = \frac{ \Pr\{\text{X_1 is red and X_2 is black}\} }{ \Pr\{X_2 ~\text{is black}\} } ~.$$
$$\renewcommand{\bg}[1]{ \bigl( #1 \bigr) }$$I shall denote the outcomes of $$(X_1,X_2)$$ using "$$\text{URN} \otimes {\text{color}}$$". For example, $$(B \otimes r,A \otimes w)$$ means the drawing a red ball from urn $$B$$ first, then getting a white ball from urn $$A$$.
It's not explicitly specified in the question statement, but presumably randomly pick an urn means the two drawings are independent and with identical probability $$p = 1/2$$ of selecting urn $$A$$. Namely, the chance of picking urn $$B$$ is $$1-p$$.
The event in the denominator yields: \{X_2 ~\text{is black}\} = \left\{\begin{aligned} &~~(A \otimes w, B \otimes b) \\ \text{or} & ~~(A \otimes r, B \otimes b) \\ \text{or} & ~~(B \otimes r, B \otimes b) \\ \text{or} &~~(B \otimes b, B \otimes b)\end{aligned} \right. \implies \Pr\{X_2 ~\text{is black}\} = \left\{\begin{aligned} &\hphantom{{}+{}}p \frac57\cdot (1-p)\frac48 \\ & + p \frac27\cdot (1-p)\frac48 \\ & + (1-p) \frac48\cdot (1-p)\frac47 \\ & + (1-p) \frac48\cdot (1-p)\frac37\end{aligned} \right.\\ \implies \Pr\{X_2 ~\text{is black}\} = \frac{1-p}{56}\bg{ 20p+ \color{red}{8p+16(1-p)}+12(1-p)} = \frac{1-p}2 = \frac14
The event in the numerator is (in fact the $$\color{red}{\text{middle two terms}}$$ of the denominator): \{\text{X_1 is red and X_2 is black}\} = \left\{\begin{aligned} & ~~(A \otimes r, B \otimes b) \\ \text{or} & ~~(B \otimes r, B \otimes b) \end{aligned} \right. \\ \implies \Pr\{\text{X_1 is red and X_2 is black}\} = \frac{1-p}{56}\bg{ \color{red}{8p+16(1-p)}} = \frac{(1-p)(2-p)}7 = \frac3{28} Notice that at $$p = \frac{1-p}2 = \frac12$$ one only needs to look at the coefficients to calculate the desired conditional probability: $$\frac{ \Pr\{\text{X_1 is red and X_2 is black}\} }{ \Pr\{X_2 ~\text{is black}\} } = \frac{ 8+16 }{ 20+8+16+12 } = \frac{24}{56} = \frac37$$ Formally, it is $$\frac{ \Pr\{\text{X_1 is red and X_2 is black}\} }{ \Pr\{X_2 ~\text{is black}\} } = \frac{(1-p)(2-p)/7}{(1-p)/2} = \frac{2(2-p)}7 = \frac{ 3/28 }{ 1/4 } = \frac37$$