# Expected number of different colors of balls before obtaining the first red ball

Problem $$42$$ , chapter 4 from Introduction to Probability

An urn contains red, green, and blue balls. Balls are chosen randomly with replace- ment (each time, the color is noted and then the ball is put back). Let $$r$$, $$g$$, $$b$$ be the probabilities of drawing a red, green, blue ball, respectively ($$r + g + b = 1$$).

Find the expected number of different colors of balls obtained before getting the first red ball.

Attempt at a solution

Letting $$E$$ represent the expected value,

$$E=2P(2)+P(1)+0P(0)$$

where $$P(x)$$ is the probability of obtaining exactly x different colours before drawing the first red ball.

$$P(0)=r$$

$$P(1)=r(b+b^2+b^3...)+r(g+g^2+g^3...)= \frac {rb}{1-b}+ \frac {rg}{1-g}$$ since any number of balls of either of the other colors could be drawn in this case before the first red ball

$$P(2)=1-P(1)-P(0) =(1-r-rb/(1-b)-rg/(1-g))$$

So, $$E= 2(1-r)-br/(r+g)-gr/(r+b)$$

Is my approach correct?

• Check the geometric distribution. Jul 30, 2020 at 3:37
This is correct, but I think the algebra obscures what is going on. For example, you might find it difficult to extend your method to $$n$$ colors, instead of just $$3$$ colors.
Let $$I_B$$ be the indicator variable for blue (so $$I_B=1$$ if a blue is chosen before the first red and $$0$$ otherwise) and let $$I_G$$ be the indicator variable for green. Then $$E\left[ I_B\right]=\frac b{r+b}\quad \&\quad E\left[ I_G\right]=\frac g{r+g}$$ so the desired result is the sum $$\boxed {\frac b{r+b}+\frac g{r+g}}$$