There may be a more elegant way than this, but here's one way.
First, write down all of the color distributions that are not terminating, but could terminate on the next draw. This means that you need to have drawn at least one color twice. I'll designate the colors $1-4$ and not worry about order:
- $2$ balls: $11$
- $3$ balls: $112$
- $4$ balls: $1122, 1123$
- $5$ balls: $11223, 11234$
- $6$ balls: $112233, 112234$
- $7$ balls: $1122334$
- $8$ balls: $11223344$
Next, for each of these color distributions, calculate the number of ways to arrange the digits. This can be done with multinomials. For example, the number of ways to arrange $11223$ is
$$\frac{5!}{2!2!1!} = 30.$$
Next, observe that, for a given set of colors, the probability of drawing those colors is independent of the order. For example,
$$BBGGP = \frac{3}{20} \frac{2}{19} \frac{8}{18} \frac{7}{17} \frac{4}{16},$$
but
$$PGBGB = \frac{4}{20} \frac{8}{19} \frac{3}{18} \frac{7}{17} \frac{2}{16},$$
which is exactly the same value. All that happened was that the numerators got rearranged.
Now comes the somewhat tedious part, which is to calculate the individual probabilities for each substitution of colors. We can at least be a little smart about it, and calculate the numerator part for each color:
$$B = 3, BB = 6, P = 4, PP = 12, O = 5, OO=20, G = 8, GG = 56.$$
Let's do the case for drawing three blue balls, and drawing the blue on the fifth ball. We assign $BB$ to $11$ in the combination, and then write down all the others: $$BBPP, BBOO, BBGG, BBPO, BBPG, BBOG.$$
(The first three are $1122$ types, and the last three are $1123$ types.)
To calculate the probability of getting each one of these, we multiply the probability of getting them in the stated order with the number of ways to rearrange them. So,
$$P(BBPP) = \frac{6 \cdot 12}{20 \cdot 19 \cdot 18 \cdot 17}\cdot \frac{4!}{2!2!}.$$
Now, to find the probability of ending on the next turn with blue, given that you have two blues and two purples (drawn in any order), multiply by $1/16$.
Then it's just a lot of rinse/repeat. Do the same calculation for the rest of the four-ball colors. Then do all of the other numbers of balls, for all of the applicable color combinations each time.
And that's just the first part of a four-part problem!
You can possibly reuse some of the calculations you did before if you keep track.
lets model out how transfer from b1 to b2 can take place :
case 1) b1 transfers two blue balls to b2 , prob = 0.1
case 2) b1 transfers two red balls to b2 ,prob = 0.3
case 3) b1 transfers a red and a blue ball to b2 , prob = 0.6
lets model the picking of balls from b2 :
case 1.1) picking different colour balls from b2(4b,1r) after case 1 :
prob = 0.4 * 0.1 = 0.04
case 1.2) picking same colour balls from b2(4b,1r) after case 1 :
prob = 0.6 * 0.1 = 0.06
case 2.1) picking different colour balls from b2(2b,3r) after case 2 :
prob = 0.6 * 0.3 = 0.18
case 2.2) picking same colour balls from b2(2b,3r) after case 2 :
prob = 0.4 * 0.3 = 0.12
case 3.1) picking different colour balls from b2(3b,2r) after case 1 :
prob = 0.6 * 0.6 = 0.36
case 3.2) picking same colour balls from b2(3b,2r) after case 1 :
prob = 0.4 * 0.6 = 0.24
given that the balls selected from b2 are different , cases 1.1 , 2.1 , 3.1 apply .
Out of these cases case 1 and 2 had same color transfer from b1 to b2 , case 3 had different colour transfer from b1 to b2 :
prob ( same color transfer from b1 to b2 | differnt colour selection from b2 )
= ( case 1.1 + case 2.1 ) / (case 1.1 + case 2.1 + case 3.1 )
= (0.04+0.18)/(0.04+0.18+0.36) = 0.38
or if you prefer formulas :
$$P(\frac{same:b1->b2}{diff:b2})*p(diff:b2) = P(\frac{diff:b2}{same:b1->b2})*P(same:b1->b2)$$
$$P(\frac{same:b1->b2}{diff:b2}) = \frac{P(\frac{diff:b2}{same:b1->b2})*P(same:b1->b2)}{P(diff:b2)}$$
$$P(\frac{diff:b2}{same:b1->b2})*P(same:b1->b2) = case 1.1 + case 1.2$$
$$P(diff:b2) = case 1.1 + case 2.1 + case 3.1$$
$$P(\frac{same:b1->b2}{diff:b2}) = \frac{case 1.1 + case 1.2}{case 1.1 + case 2.1 + case 3.1}$$
$$P(\frac{same:b1->b2}{diff:b2}) = \frac{(0.04+0.18)}{(0.04+0.18+0.36)} = 0.38$$
Best Answer
$$P(B|A)=\frac{P(B\cap A)}{P(A)}=\frac{\frac{3}{9}\times \frac{2}{8}}{3\times\frac{3}{9}\times\frac{2}{8}}$$
$P(A)$ is the probability of two balls are same color
$P(B)$ is the probability of two balls are blue