[Math] How to solve bins-and-balls problems

balls-in-binsbirthdayprobability

Below is the problem that I wanted to solve

When there are $m$ balls and $n$ bins, balls are thrown into bins where each ball is thrown into a bin uniformly at random. What is the expected number of bins that contain strictly more than 1 ball?

What I am understanding so far is that, each ball toss will be independent, and expected number of balls in each basket will be $m/n$. But this does not seem to help me solving the problem.

I heard this is very similar to the birthday problem, but with different number of bins and arbitrary number of balls.

How should I approach solving this problem?

Best Answer

When trying to find the expectation of a "complicated" random variable, you can try using the very useful technique of writing the complicated variable as a sum of simpler variables and using the fact that the expectation of a sum of random variables is the sum of the individual expectations (note this is true of any sum, independence is not needed).

Here, for each $i=1$, $2$, $\ldots\,$, $n$, define the random variable
$$X_i=\cases{1,& if the $i^{\rm th}$ bin contains 2 or more balls,\cr0,&otherwise.}$$

Now let $X$ be the total number of bins that contain two or more balls. Note that $X=\sum\limits_{i=1}^n X_i$.

Using the linearity of expectation: $$ \Bbb E(X)=\sum_{i=1}^n \Bbb E(X_i). $$

Note each $X_i$ is a Bernoulli variable, so $\Bbb E(X_i)=P[X_i=1]$ for each $i$. Moreover, this quantity is independent of $i$.

So, all you have left to do is to find the probability that a particular bin has two or more balls (here, I'd calculate the probability of the complement of this event and subtract from 1).

Related Question