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?
Those are not events. Conditioning is an aspect of the probability measure, not the event space. It is not a set operation.
The events of interest are "selecting bucket A", "firstly drawing a blue ball", and "secondly drawing a yellow ball". Designate these as $A$, $B$, and $Y$.
So we have $\mathsf P(B\mid A)=3/4$, and $\mathsf P(B\mid A^\complement)=2/4$. Since the selection of the second ball is conditionally independent of the selection of the first, we also have $\mathsf P(Y\mid A,B)=\mathsf P(Y\mid A) = 1/4$, and $\mathsf P(Y\mid A^\complement,B)=\mathsf P(Y\mid A^\complement) = 2/4$.
For Part 1, Bayes' Rule says :
$$\begin{align}\mathsf P(A\mid B) &=\dfrac{\mathsf P(B\mid A)~\mathsf P(A)}{\mathsf P(B\mid A)~\mathsf P(A)+\mathsf P(B\mid A^\complement)~\mathsf P(A^\complement)}\\&=\dfrac{\tfrac 34\tfrac 12}{\tfrac 34\tfrac12+\tfrac24\tfrac 12}\\&=\dfrac 35\end{align}$$
Part 2 is much the same.
$$\begin{align}\mathsf P(A\mid B, Y) &=\dfrac{\mathsf P(Y\mid A, B)~\mathsf P(A\mid B)}{\mathsf P(Y\mid A, B)~\mathsf P(A\mid B)+\mathsf P(Y\mid A^\complement, B)~\mathsf P(A^\complement\mid B)}\\&=\dfrac{\tfrac 14\tfrac 35}{\tfrac 14\tfrac35+\tfrac24\tfrac 25}\\&=\dfrac 37\end{align}$$