# Probability Question on Bayes' Theorem

Urn 1, Urn 2, …, Urn 5 each contain p white and q black balls. One randomly chosen ball is transferred from Urn 1 to Urn 2, next one randomly chosen ball is transferred from Urn 2 to Urn 3, and so on till finally one randomly chosen ball is transferred from Urn 4 to Urn 5. If the ball transferred from Urn 1 to Urn 2 is white, what is the probability the ball transferred from Urn 4 to Urn 5 is white?

I have arrived at a complicated expression for the aforementioned probability and am unsure regarding the methods I used to arrive at the result and the result itself and hence, any answers would be highly appreciated.

Method used: Since, it's given that the ball transferred from urn 1 to 2 is a white one, we simply have to consider all the different ways through which we can land a white ball into the fifth urn from the fourth. One way is that we get a white ball from urn 2 to urn 3 and another white ball from urn 3 to urn 4 and finally a white ball from urn 4 to urn 5 which the question demands. The probability of such an event would be ((p+1)/(p+q+1))^3. There would be three of more such possibilities wherein the transfers from 2 to 3 and the transfer from 3 to 4 would be white and black, black and white and ultimately, black and black, respectively, all ending at a white ball transferred from urn 4 to 5. We find the probabilities for the remaining three possibilities the same way as we did for the first one and sum all four of them to get our answer.

• What is the method you used? We cannot critique what we cannot see. – Graham Kemp Jan 31 '18 at 22:19
• I have edited the question with the method. – Subhanjan Saha Jan 31 '18 at 22:30
• Yes. Given that you placed an extra white ball in urn-2, transfered balls in and out of urn 3, what is the probabiliy that you remove a white ball from urn 4. Zoli's hint is splendid. – Graham Kemp Feb 1 '18 at 0:16

HINT

If there are only $3$ urns then the four possible outcomes are the following ball configurations in he third urn:

$$(p+2,q), 2\times(p+1,q+1), (p,q+2).$$

These configurations come true if

• For $(p+2,q)$: First, we select a white ball then we select a white ball again. The probabilty of this event is $$\frac p{p+q}\times\frac{p+1}{p+q+1}.\tag 1$$
• For $(p+1,q+1)$: There are two possibilities; first we select a white ball then we select a black ball, or, first, we select a black ball and then a white ball. The probability is

$$\frac{p}{p+q}\times\frac{q}{p+q+1}+\frac{q}{p+q}\times\frac{p}{p+q+1}=2\frac{pq}{(p+q)(p+q+1)}.$$

• For $(p,q+2)$: First we select a black ball than again a black ball. The probability of this even is

$$\frac q{p+q}\times\frac{q+1}{p+q+1}.$$

Now, we can ask the question: What is the probability that the second time we select a white ball given that we selected a white ball the first time?

We need the probability that we selected a white ball first and a white ball again. This probability is given by $(1)$. The we need tha probability that we select a white ball the second time. The corresponding probability is

$$\frac{q}{p+q}\times\frac{p}{p+q+1}+\frac p{p+q}\times\frac{p+1}{p+q+1}.$$ So the conditional probability sought for is

$$\frac{\frac p{p+q}\times\frac{p+1}{p+q+1}}{\frac{q}{p+q}\times\frac{p}{p+q+1}+\frac p{p+q}\times\frac{p+1}{p+q+1}}=\frac{p+1}{q+p+1}.$$

To answer the original question you have to do the same with the possible $16$ outcomes.

EDIT: Oh yes 😃

The OP suggested another (better) method which can be completed. If one selects a white ball first then the configuration in the second urn will be

$$(p+1,q).\tag 2$$

So we have only four urns and we start with config $(2)$. We select balls three time so there are eight possibilities. We don't even have to deal with all of them but with only those in the case of which the third choice is a white ball. There are only four such possibilities. These all can be listed easily like I did when I described my cumbersom solution.

For instance:

We select first (from the second urn) a black ball then a black ball again and finally a white one. The corresponding probability is

$$\frac {q}{p+q+1}\times \frac {q+1}{p+q+2}\times\frac {p+1}{p+q+3}.$$

The remaining three cases can easily be dealt with. The conditional probability sought for is the sum of four probabilities to be calculated.

I agree that just computing the probability directly by looking at the event tree and multiplying/adding the appropriate probabilities is probably the fastest way to do this problem. However, if you have more urns than 5, this strategy will get unwieldy fast.

You can solve the problem for an arbitrary amount of urns using recursion. The fact that the problem looks very much like it starts over each time you choose a new ball from a new urn should be a clue that recursion might be a good idea.

Before you write down any equations, I would start off by drawing a few levels of the event tree so you can see how to write your equations properly. Now, let $A_n$ be the event that the $n^{th}$ ball is white. We would like to find $P(A_n|A_1)$, so using the law of total probability: \begin{align*} P(A_n|A_1) &= P(A_n|A_1, A_2)P(A_2|A_1)+P(A_n|A_1, A_2^c)P(A_2^c|A_1) \\ &= P(A_{n-1}|A_1)P(A_2|A_1)+P(A_{n-1}|A_1^c)P(A_2^c|A_1), \end{align*} where, in the second line, I have used the standard recursion strategy. This is fine to do since the original problem is to calculate the probability of $A_n$ given that there are $p+1$ white and $q$ black balls in urn 2. The term $P(A_n|A_1, A_2)$ represents the probability of $A_n$ given the there are $p+1$ white and $q$ black balls in urn 3. Thus we see that the problem starts over at just 1 step into the future. As for the second term, I have employed the same recursive strategy.

Since we have the term, $P(A_{n-1}|A_1^c)$, we see that we will need to write down another recursive equation to solve for this. I use the same exact strategy as above, but now assume that the first ball was black: \begin{align*} P(A_n|A_1^c) &= P(A_n|A_1^c, A_2)P(A_2|A_1^c)+P(A_n|A_1^c, A_2^c)P(A_2^c|A_1^c) \\ &= P(A_{n-1}|A_1)P(A_2|A_1^c)+P(A_{n-1}|A_1^c)P(A_2^c|A_1^c). \end{align*}

It is not difficult to compute the probabilities $P(A_2|A_1), \ldots$. For example, $P(A_2|A_1)$ is the probability of picking white from an urn with $p+1$ white and $q$ black, so that $P(A_2|A_1)=(p+1)/(p+1+q)$. Solving all of these terms, and expressing the previous equations in somewhat more readable notation ($p_n = P(A_n|A_1)$, $p_n^c = P(A_n|A_1^c)$), I have the following coupled equations: $$\begin{cases} p_n = p_{n-1}\left(\frac{p+1}{p+1+q}\right)+p_{n-1}^c\left(\frac{q}{p+1+q}\right) \\ p_n^c = p_{n-1}\left(\frac{p}{p+1+q}\right)+p_{n-1}^c\left(\frac{q+1}{p+1+q}\right). \end{cases}$$ This can be turned into a single recursive equation in $p_n$ by solving for $p_{n-1}^c$ from the first and plugging this into the second. I then have: $$p_n = p_{n-1}\left( \frac{p+2+q}{p+1+q}\right )-p_{n-2}\left( \frac{1}{p+1+q}\right ).$$ This is a second order linear homogenous recursive equation, which can be solved for in the standard way by solving for the roots of the characteristic equation and using the following 2 boundary conditions: $p_1=P(A_1|A_1)=1$, $p_2=P(A_2|A_1)=(p+1)/(p+1+q)$. Solving this equation, I find that the general solution for the $n^{th}$ ball (i.e., with $n+1$ urns) is: \begin{equation*} p_n = \frac{p}{p+q}+\frac{q(p+1+q)^{1-n}}{p+q}. \end{equation*} For your case, we have five urns (and 4 balls), so just plug $n=4$ into this equation and you have your answer.

• actually, now that i'm looking at this equation, I'm a little uncertain as to whether I solved it properly or not. For example, this does not reduce down to 1/2 when p = q. Maybe I made a mistake solving the recursive equation. Maybe someone else can solve it properly. – Doug Rubin Feb 1 '18 at 19:39