# Expected value of selection with replacement

Problem: A box contains a red ball, an orange ball, a yellow ball, a green ball, a blue ball and an indigo ball. Billy randomly selects 7 balls from the box (with replacement). What is the expected value for the number of distinct colored balls Billy will select?

My strategy was like thus. Let $X_i = 1$ if the $i$th drawing is unique. Let $X_i = 0$ if it's a repeat. If we compute the expected value this way, we'll get the expected number of unique selections.

The first drawing is guaranteed to be unique, so it has a trivial probability of 1. The second drawing has a 5/6 chance of being unique: we're good as long as we don't pick the same color as we did in the first drawing.

Now is where it gets tricky. The 3rd drawing doesn't have a 4/6 chance of being unique, because it's possible that the 2nd drawing wasn't unique. If the 2nd drawing was not unique, the 3rd drawing would have a 5/6 chance of being unique since only 1 color will have been used in drawings #1 and #2.

So probability of the 3rd ball being unique would be $(\frac{5}{6})(\frac{4}{6}) + (\frac{1}{6})(\frac{5}{6}) = \frac{25}{36}$.

You could do this for all 6 balls, and then add the probability of each ball to get the expected value. Of course, the 7th drawing has a 0 chance of being unique. But this seems really complicated and inelegant. I feel like I must be missing an obvious observation.

## 2 Answers

Your approach is correct, but the way you use it, is not. Define $X_i = 1$ if $i$th color was drawn and $0$ otherwise. Then $$E[X] = \sum_{k=1}^6 E[X_i] = 6\Big(1-\frac{5^7}{6^7}\Big).$$

• I'm not sure how you got the $\left(1-\dfrac{5^7}{6^7}\right)$ term. – King Henry V Feb 28 '16 at 17:57
• @KingHenryV, it is $E[X_i]$. Try to understand where this expression comes from. – zhoraster Feb 28 '16 at 18:05
• Well, of course it's $E[X_i]$! Based on the summation you gave that much was apparent. I'm just not sure why. Does $\left(1- \dfrac{5^7}{6^7} \right)$ represent the probability that a particular color will not be drawn? – King Henry V Feb 28 '16 at 18:23
• @KingHenryV, read carefully what is $X_i$. – zhoraster Feb 28 '16 at 18:31
• Ah, so the probability that you'll never pick a particular color is $(\frac{5}{6})^n$, so the chance it will appear at least once is $1-(\frac{5}{6})^n$. – King Henry V Feb 29 '16 at 6:20

Here is another strategy.

Let $P(i), 0<i<7$ be the probability of having $i$ distinct balls after drawing $7$ balls.

Knowing that each possible sequence of $7$ drawings has the probability $(\frac{1}{6})^7$, $P(1)$ would be $\binom {6}{1}(\frac{1}{6})^7$ (because we have 6 possibilities here).

The general formula would be

$P(i)=\binom{6}{i}(\frac{1}{6})^{7} (i^7-\sum_{k=1}^{i-1} \binom{i}{i-k}((i-k)^7-(i-k)))$

So, every sequence have the same probability and you just need to find the possible combinations for each case.

After this step, the formula to calculate the expected value is straight forward. However, it should be a bit tedious to do the calculation without a calculator.