Bayes’ theorem selecting balls

bayes-theoremprobability

I'm trying to understand the solution of the problem defined here. The problem statement is:

Part 1 For example, suppose we have 2 buckets A and B. In bucket A we have 30 blue balls and 10 yellow balls, while in bucket B we have 20 blue and 20 yellow balls. We are required to choose one ball. What is the chance that we choose bucket A given that a blue ball was chosen?

Part 2 We put back the ball chosen in Part 1. We choose another ball again, this time it turns out to be yellow. What is the probability that both times we choose the ball from bucket A?

I do not understand the solution of Part 2.

Solution for Part 1

Let $A,B$ be the events of selecting bucket A and B respectively. Let $Blue,Yellow$ be the events of selecting Blue and Yellow balls. We are asked to find $P(A|Blue)$. By Bayes' theorem

$$
\begin{aligned}
P(A|Blue) &= \frac{P(Blue|A)P(A)}{P(Blue)} = \frac{\frac{3}{4}\frac{1}{2}}{P(Blue|A)P(A)+P(Blue|B)P(B)} \\
&= \frac{\frac{3}{4}\frac{1}{2}}{\frac{3}{4}\frac{1}{2}+\frac{1}{2}\frac{1}{2}}
=0.6
\end{aligned}
$$

Similarly we can get
$$
P(B|Blue) = 0.4 \qquad P(A|Yellow) = \frac{1}{3} \qquad P(B|Yellow) = \frac{2}{3}
$$

My attempt at solving Part 2

It seems to me that we have two events.

Event $C$: $A$ | $Yellow$,       that is: Ball comes from Bucket A given ball is Yellow

Event $D$: $A$ | $Blue$,      that is: Ball comes from Bucket A given ball is Blue

It seems that we are looking for $P(C|D)$, the probability that the yellow ball is chosen from bucket A, given that first we have chosen blue ball from bucket A. So we are looking for

$$
P(C|D) = \frac{P(D|C)P(C)}{P(D)}
$$

And I have no idea what to do with the $P(D|C)$ term. The other two are calculated before.

In the solution they have provided, it seems they are doing

$$
\begin{align}
P(C|D) &= P(A|Yellow\Big{|}A|Blue)\\
&= \frac{P(Yellow|A)P(A|Blue)}{P(Yellow)}\\
&= \frac{0.25*0.6}{P(Yellow|A)P(A|Blue)+P(Yellow|B)P(B|Blue)}\\
&= \frac{0.15}{0.25*0.6+0.5*0.4} \\
&= 0.4285
\end{align}
$$

But I can find no logic in this argument.

Could someone please explain how I can solve part 2?

Best Answer

For part 2, I had trouble understanding both your attempted solution as well as the offered solution. My trouble with the offered solution might be caused by my misinterpreting the problem.

Let $R$ denote the event that the ball(s) came from bucket $A$.

Let $S$ denote the event that the ball(s) came from bucket $B$.

Let $T$ denote the event that the first ball chosen was blue.

Let $U$ denote the event that the first ball chosen was blue and that the second ball chosen was yellow.

The way that I read part (2), which might not represent the intent of the problem composer, is that you are supposed to assume that both balls came from the same bucket.

In part (1), you are trying to calculate $p(R|T)$.

The way that I interpret part (2), you are trying to calulate $p(R|U)$, where it is to be assumed that both balls were chosen from the same bucket.

So, $\displaystyle p(R|U) = \frac{p(R ~\text{and} ~U)}{p(U)}.$

To calculate $p(U)$, you have to consider two possibilities:

  • Bucket $A$ was chosen, the first ball selected was blue, then the next ball selected was yellow.
    Probability of this happening is
    $\displaystyle \frac{1}{2} \times \frac{30}{40} \times \frac{10}{40} = \frac{3}{32}.$

  • Bucket $B$ was chosen, the first ball selected was blue, then the next ball selected was yellow.
    Probability of this happening is
    $\displaystyle \frac{1}{2} \times \frac{20}{40} \times \frac{20}{40} = \frac{1}{8} = \frac{4}{32}.$

Therefore,

$$\frac{p(R ~\text{and} ~U)}{p(U)} = \frac{\frac{3}{32}}{\frac{3}{32} + \frac{4}{32}} = \frac{3}{7}.$$

As it turns out, my answer happens to agree with the offered solution, so it looks like I interpreted the question correctly. However, I am (still) unable to decipher the posted analysis to the solution.


Addendum
Actually, I have now figured out how to reverse-engineer the offered analysis.

You are supposed to use part 1 to conclude that the chances of bucket $A$ rather than bucket $B$ being chosen has changed from $(1/2)$ to $(3/5) = 0.6.$ This is a valid but somewhat sophisticated approach. For students fairly new to Bayes Theorem, I would not post a solution that uses this type of analysis. However, the analysis is valid.

You are then supposed to compute

$$p(A|\text{yellow}) = \frac{p(A ~\text{and yellow})}{p(\text{yellow})} = \frac{\frac{3}{5} \times \frac{1}{4}}{\left[\frac{3}{5} \times \frac{1}{4}\right] + \left[\frac{2}{5} \times \frac{1}{2}\right]} = \frac{3}{7}.$$