We can consider each ball to be identifiable, although we are mainly interested in
whether the ball is yellow.
We start with $8$ balls. The first draw chooses $2$ of them.
There are $\binom 82$ possible pairs of balls that we can draw on the first draw.
For each possible pair of balls that we draw first,
there is a set of $6$ balls remaining to draw from.
There are $\binom 62$ possible pairs of balls that can be drawn from this set of $6.$
So, $\binom 82$ possible first pairs, and for each of these, $\binom 62$ possible second
pairs, a total of $\binom 82 \binom 62$ equally likely outcomes of the two draws.
We now count how many of those outcomes had $x$ yellow balls in the first pair
and $y$ yellow balls among all four balls drawn.
The first draw choose $x$ balls from among the $5$ yellow balls, which can happen
in $\binom 5x$ different ways,
and the remaining $2-x$ balls from the other $3$ balls,
which can happen in $\binom 3{2-x}$ ways.
After drawing those $x$ yellow balls and $2-x$ red balls, we have
$5-x$ yellow balls and $1+x$ red balls remaining.
We draw $y-x$ yellow balls from the set of $5-x,$
which can happen in $\binom{5-x}{y-x}$ ways.
Notice that we now have identified $x + (2-x) + (y-x)$ of the $4$ balls that
are drawn; $4 - (x + (2-x) + (y-x)) = 2 + x - y,$ so that is the number of
red balls that must be drawn on the second draw.
There are $\binom{1+x}{2 + x - y}$ ways to draw that number of red balls
from the remaining $1+x$ red balls.
Note that for each way to choose the first $x$ yellow balls, there are the same
number of ways to choose the first $2-x$ red balls, and then the same number
of ways to choose the next $y-x$ yellow balls, and finally for every way we
can get to this point there are the same number of ways to choose the last
$2+x-y$ red balls.
(Note that we are not choosing from the same set of balls in each case in the
last two enumerations of choices, but in each case the number of ways
we can get the desired outcome is the same.)
The total number of ways to draw $x$ yellow balls on the first
draw and $y$ yellow balls total is therefore the product of all the numbers
of options we had for each choice:
$$ \binom 5x \binom 3{2-x} \binom{5-x}{y-x} \binom{1+x}{2 + x - y}.$$
That is the number of "successful" $(x,y)$ outcomes among the
$\binom 82 \binom 62$ equally likely outcomes, so we divide by $\binom 82 \binom 62$
to get the probability.
Let $A, B$ be the events of picking bag $A$ and $B$ respectively, and let $X$ be the event of picking $4$ red balls and $1$ blue ball. We will assume that $\mathbb{P}(A)=\mathbb{P}(B)=\frac{1}{2}$.
We want to find $\mathbb{P}(A|X)$.
Now by Bayes' theorem we have that:
$$\mathbb{P}(A|X)=\frac{\mathbb{P}(X|A)\mathbb{P}(A)}{\mathbb{P}(X)}
$$
But we also have (since $B$ is the complement of $A$):
$$\mathbb{P}(X)=\mathbb{P}(X|A)\mathbb{P}(A)+\mathbb{P}(X|B)\mathbb{P}(B)
$$
Now let's calculate these probabilities.
We have a total of $55$ balls in bag $A$, of which $40$ are red and $15$ are blue, so when we pick one ball the probability that it is red or blue is $\frac{40}{55}$ or $\frac{15}{55}$ respectively. When picking $5$ balls of which $4$ are red and $1$ is blue, the blue ball can appear in five places, so we have:
$$\mathbb{P}(X|A)=\left(\frac{40}{55}\right)^4\cdot \frac{15}{55}\cdot 5
$$
Similarly we get:
$$\mathbb{P}(X|B)=\left(\frac{10}{50}\right)^4\cdot \frac{40}{50}\cdot 5
$$
So we find, filling in our results:
$$\mathbb{P}(A|X)=\frac{\mathbb{P}(X|A)\cdot\frac{1}{2}}{\mathbb{P}(X|A)\cdot\frac{1}{2}+\mathbb{P}(X|B)\cdot\frac{1}{2}}=\frac{\mathbb{P}(X|A)}{\mathbb{P}(X|A)+\mathbb{P}(X|B)}=\frac{9600000}{9761051}\approx 0.9835
$$
Best Answer
Let Bag 1 contain (5R 20Y) and Bag 2 containn (15R, 10Y)
$P(Bag1)*P(Y/Bag1) = 0.6\times\frac{20}{25} = 0.6\times 0.8 = .48$
$P(Bag2)*P(Y/Bag2) = 0.4\times\frac{10}{25} = 0.4\times 0.4 = .16$
Part I :
$P(Y) = 0.48+.16 = 0.64$
$P(Bag1/Y) = \dfrac{P(Bag1)*P(Y/Bag1)}{(P(Bag1)*P(Y/Bag1)+P(Bag2)*P(Y/Bag2)}$
Part II:
$P(Bag1/Y) = \frac{0.48}{0.64} = 0.75$