# Expected value of sums of a RV

Suppose that $10$ balls are put into $5$ boxes, with each ball independently being put in box $i$ with probability $p_i, \sum_{i=1}^{5} p_i = 1$

A) Find the expected number of boxes that do not have any balls.

Attempt: Let $X$ denote the number of boxes without balls. This means $$EX = \sum_{x=0}^{4} x P(X=x)$$ Since we know each ball must go into at least one box, we cannot have 5 empty boxes, so that is why I sum to 4. I then said $P(X=j) = P(j{}\,\text{boxes with no balls})= {5 \choose j}(1-p_i)^{10}$ So $$EX = 0 + \sum_{j=1}^{4} j{5 \choose j}(1-p_i)^{10}$$ Is it ok?

-
No. It makes no sense since it contains a free index $i$. – joriki Dec 6 '12 at 15:55

The probability that box $i$ remains empty is $(1-p_i)^{10}$. By linearity of expectation, the expected number of boxes that remain empty is $\sum_i(1-p_i)^{10}$.
Is there a way to get the right answer using my method? Instead of finding the prob that a particular box was empty, I found the prob that $i$ boxes was empty. – CAF Dec 6 '12 at 16:21
@CAF: You can certainly do what you describe in this comment, but that's pretty far from what you write in the question. You can't use $\binom5j$ because you'd have to multiply that with some probability that's the same for all selections of $j$ empty boxes, but the boxes all have different probabilities of being empty. So if you want to do it as you describe in the comment, you have to add up all the individual contributions; doing that and then bring that into the simple form $\sum_i(1-p_i)^{10}$ is going to be quite a pain. – joriki Dec 6 '12 at 16:42
Ok, thanks. The next question was find the expected number of boxes with 1 ball in it. So the prob that one box has one ball in it is ${10 \choose 1} (p_i) (1-p_i)^9$ so then I just sum this from 1 to 5? – CAF Dec 6 '12 at 16:51
@CAF: Exactly. Note that if you also do this for $2,\dotsc,10$ balls per box and take the sum of all these expected numbers, you can then swap the two sums and evaluate the inner sum to $1$, and then the outer sum yields $5$ as it must. – joriki Dec 6 '12 at 17:28