# $m$ balls into $n$ urns

Assume that there are $m$ balls and $n$ urns with $m\gt n$. Each ball is thrown randomly and uniformly into urns. That is, each ball goes into each urn with probability $\dfrac1n$.

What is the probability that there are exactly $r$ urns with at least one ball in it? In other words, what is the probability that there are $n-r$ empty urns?

( I am Not sure whether it makes any difference whether balls and urns being distinguishable or not. If there is a difference assume that both balls and urns are distinguishable)

-

The result should not depend on whether the ball and urns are distinguishable - only the derivation. Let's assume they are distinguishable.

The number of ways of placing $m$ (distinguishable) balls in $r$ (distinguishable) urns with no empty urn is

$$r! \, S_{m,r}$$

where $S_{m,r}$ is the Stirling number of the second kind. Hence the total number of ways of occupying $r$ urns out of $n$ is

$${n \choose r} r! \, S_{m,r}$$

and the probability then is

$$p= \frac{{n \choose r} r! \, S_{m,r}}{n^m} = \frac{n! \, S_{m,r} }{(n-r)!\, n^m} = {n \choose r} \sum_{j=0}^r (-1)^{r-j} {r \choose j} \left(\frac{j}{n}\right)^m$$

(BTW, this is basically the same as a recent question)

-
Excellent, thank you.Thanks also for providing the similar question. –  Ava Jun 5 '13 at 16:35