TITLE: how to find the expected number of boxes with no balls
QUESTION [18 upvotes]: If you have 10 balls and 5 boxes what is the expected number of boxes with no balls. The probability that each ball goes independently into box $i$ is $p_i$ with the $\sum_{i=1}^5 p_i =1$. Also, what is the expected number of boxes that have exactly one ball. For part 1, isn't the answer related to the number of solutions to the equation $x_1+x_2+x_3+x_4+x_5 = 10$ where all the $x$s can take on nonnegative integers? And for the second part, isn't it the number of only positive solutions?

REPLY [2 votes]: Here's a more intuitive perspective using induction/recursion (it also solves the general problem with $m$ balls and $n$ boxes).
There are 5 boxes. You want to know the expected number of empty boxes when there are 10 balls. Key insight: If you knew the answer for $(\text{balls}, \text{boxes}) = (9, 5)$, then you'd be done! Why? Let $$E_m = \text{expected number of empty boxes for $m$ balls and $5$ boxes}.$$ On average, $E_9$ boxes will be empty after you've placed the first nine balls. Now, the last ball must be placed in an empty box or a non-empty box. The probability of placing it in an empty box is $E_9/5$ because, well, there are $E_9$ empty boxes out of the $5$. Thus, $E_9/5$ of the time, you'll have $E_9 - 1$ empty boxes; the rest of the time, you'll have $E_9$ empty boxes, that is, $$E_{10} = \frac{E_9}5(E_9-1) + \left(1-\frac{E_9}5\right) E_9 = \frac45E_9.$$ Another way to say the same thing: After placing the first nine balls, you have $E_9$ empty boxes; there's a $E_9/5$ chance you'll have one fewer empty box after placing the last ball: $$E_{10} = E_9 + \frac{E_9}5(-1) = \frac45E_9.$$
There's, of course, nothing special about $10$ or $9$; the same argument yields $$E_m = \frac45E_{m-1}.$$ Since $E_0 = 5$ (this is trivial; or if you prefer, $E_1 = 4$ is also trivial), we conclude that $$E_m = \left(\frac45\right)^m5.$$ Obviously, there's nothing special about $5$ either. For $m$ balls and $n$ boxes, we have $$E_{m,n} = \text{expected number of empty boxes for $m$ balls and $n$ boxes} = \left(\frac{n-1}n\right)^mn.$$