# Balls into Bins

Consider throwing ${\displaystyle m}$ balls into ${\displaystyle n}$ bins uniformly and independently at random. This is equivalent to a random mapping ${\displaystyle f:[m]\to [n]}$. Needless to say, random mapping is an important random model and may have many applications in Computer Science, e.g. hashing.

We are concerned with the following three questions regarding the balls into bins model:

• birthday problem: the probability that every bin contains at most one ball (the mapping is 1-1);
• coupon collector problem: the probability that every bin contains at least one ball (the mapping is on-to);
• occupancy problem: the maximum load of bins.

## Birthday Problem

There are ${\displaystyle m}$ students in the class. Assume that for each student, his/her birthday is uniformly and independently distributed over the 365 days in a years. We wonder what the probability that no two students share a birthday.

Due to the pigeonhole principle, it is obvious that for ${\displaystyle m>365}$, there must be two students with the same birthday. Surprisingly, for any ${\displaystyle m>57}$ this event occurs with more than 99% probability. This is called the birthday paradox. Despite the name, the birthday paradox is not a real paradox.

We can model this problem as a balls-into-bins problem. ${\displaystyle m}$ different balls (students) are uniformly and independently thrown into 365 bins (days). More generally, let ${\displaystyle n}$ be the number of bins. We ask for the probability of the following event ${\displaystyle {\mathcal {E}}}$

• ${\displaystyle {\mathcal {E}}}$: there is no bin with more than one balls (i.e. no two students share birthday).

We first analyze this by counting. There are totally ${\displaystyle n^{m}}$ ways of assigning ${\displaystyle m}$ balls to ${\displaystyle n}$ bins. The number of assignments that no two balls share a bin is ${\displaystyle {n \choose m}m!}$.

Thus the probability is given by:

{\displaystyle {\begin{aligned}\Pr[{\mathcal {E}}]={\frac {{n \choose m}m!}{n^{m}}}.\end{aligned}}}

Recall that ${\displaystyle {n \choose m}={\frac {n!}{(n-m)!m!}}}$. Then

{\displaystyle {\begin{aligned}\Pr[{\mathcal {E}}]={\frac {{n \choose m}m!}{n^{m}}}={\frac {n!}{n^{m}(n-m)!}}={\frac {n}{n}}\cdot {\frac {n-1}{n}}\cdot {\frac {n-2}{n}}\cdots {\frac {n-(m-1)}{n}}=\prod _{k=1}^{m-1}\left(1-{\frac {k}{n}}\right).\end{aligned}}}

There is also a more "probabilistic" argument for the above equation. Consider again that ${\displaystyle m}$ students are mapped to ${\displaystyle n}$ possible birthdays uniformly at random.

The first student has a birthday for sure. The probability that the second student has a different birthday from the first student is ${\displaystyle \left(1-{\frac {1}{n}}\right)}$. Given that the first two students have different birthdays, the probability that the third student has a different birthday from the first two students is ${\displaystyle \left(1-{\frac {2}{n}}\right)}$. Continuing this on, assuming that the first ${\displaystyle k-1}$ students all have different birthdays, the probability that the ${\displaystyle k}$th student has a different birthday than the first ${\displaystyle k-1}$, is given by ${\displaystyle \left(1-{\frac {k-1}{n}}\right)}$. By the chain rule, the probability that all ${\displaystyle m}$ students have different birthdays is:

{\displaystyle {\begin{aligned}\Pr[{\mathcal {E}}]=\left(1-{\frac {1}{n}}\right)\cdot \left(1-{\frac {2}{n}}\right)\cdots \left(1-{\frac {m-1}{n}}\right)&=\prod _{k=1}^{m-1}\left(1-{\frac {k}{n}}\right),\end{aligned}}}

which is the same as what we got by the counting argument.

There are several ways of analyzing this formular. Here is a convenient one: Due to Taylor's expansion, ${\displaystyle e^{-k/n}\approx 1-k/n}$. Then

{\displaystyle {\begin{aligned}\prod _{k=1}^{m-1}\left(1-{\frac {k}{n}}\right)&\approx \prod _{k=1}^{m-1}e^{-{\frac {k}{n}}}\\&=\exp \left(-\sum _{k=1}^{m-1}{\frac {k}{n}}\right)\\&=e^{-m(m-1)/2n}\\&\approx e^{-m^{2}/2n}.\end{aligned}}}

The quality of this approximation is shown in the Figure.

Therefore, for ${\displaystyle m={\sqrt {2n\ln {\frac {1}{\epsilon }}}}}$, the probability that ${\displaystyle \Pr[{\mathcal {E}}]\approx \epsilon }$.

## Coupon Collector

Suppose that a chocolate company releases ${\displaystyle n}$ different types of coupons. Each box of chocolates contains one coupon with a uniformly random type. Once you have collected all ${\displaystyle n}$ types of coupons, you will get a prize. So how many boxes of chocolates you are expected to buy to win the prize?

The coupon collector problem can be described in the balls-into-bins model as follows. We keep throwing balls one-by-one into ${\displaystyle n}$ bins (coupons), such that each ball is thrown into a bin uniformly and independently at random. Each ball corresponds to a box of chocolate, and each bin corresponds to a type of coupon. Thus, the number of boxes bought to collect ${\displaystyle n}$ coupons is just the number of balls thrown until none of the ${\displaystyle n}$ bins is empty.

 Theorem Let ${\displaystyle X}$ be the number of balls thrown uniformly and independently to ${\displaystyle n}$ bins until no bin is empty. Then ${\displaystyle \mathbf {E} [X]=nH(n)}$, where ${\displaystyle H(n)}$ is the ${\displaystyle n}$th harmonic number.
Proof.
 Let ${\displaystyle X_{i}}$ be the number of balls thrown while there are exactly ${\displaystyle i-1}$ nonempty bins, then clearly ${\displaystyle X=\sum _{i=1}^{n}X_{i}}$. When there are exactly ${\displaystyle i-1}$ nonempty bins, throwing a ball, the probability that the number of nonempty bins increases (i.e. the ball is thrown to an empty bin) is ${\displaystyle p_{i}=1-{\frac {i-1}{n}}.}$ ${\displaystyle X_{i}}$ is the number of balls thrown to make the number of nonempty bins increases from ${\displaystyle i-1}$ to ${\displaystyle i}$, i.e. the number of balls thrown until a ball is thrown to a current empty bin. Thus, ${\displaystyle X_{i}}$ follows the geometric distribution, such that ${\displaystyle \Pr[X_{i}=k]=(1-p_{i})^{k-1}p_{i}}$ For a geometric random variable, ${\displaystyle \mathbf {E} [X_{i}]={\frac {1}{p_{i}}}={\frac {n}{n-i+1}}}$. Applying the linearity of expectations, {\displaystyle {\begin{aligned}\mathbf {E} [X]&=\mathbf {E} \left[\sum _{i=1}^{n}X_{i}\right]\\&=\sum _{i=1}^{n}\mathbf {E} \left[X_{i}\right]\\&=\sum _{i=1}^{n}{\frac {n}{n-i+1}}\\&=n\sum _{i=1}^{n}{\frac {1}{i}}\\&=nH(n),\end{aligned}}} where ${\displaystyle H(n)}$ is the ${\displaystyle n}$th Harmonic number, and ${\displaystyle H(n)=\ln n+O(1)}$. Thus, for the coupon collectors problem, the expected number of coupons required to obtain all ${\displaystyle n}$ types of coupons is ${\displaystyle n\ln n+O(n)}$.
${\displaystyle \square }$

Only knowing the expectation is not good enough. We would like to know how fast the probability decrease as a random variable deviates from its mean value.

 Theorem Let ${\displaystyle X}$ be the number of balls thrown uniformly and independently to ${\displaystyle n}$ bins until no bin is empty. Then ${\displaystyle \Pr[X\geq n\ln n+cn] for any ${\displaystyle c>0}$.
Proof.
 For any particular bin ${\displaystyle i}$, the probability that bin ${\displaystyle i}$ is empty after throwing ${\displaystyle n\ln n+cn}$ balls is ${\displaystyle \left(1-{\frac {1}{n}}\right)^{n\ln n+cn} By the union bound, the probability that there exists an empty bin after throwing ${\displaystyle n\ln n+cn}$ balls is ${\displaystyle \Pr[X\geq n\ln n+cn]
${\displaystyle \square }$

## Occupancy Problem

Now we ask about the loads of bins. Assuming that ${\displaystyle m}$ balls are uniformly and independently assigned to ${\displaystyle n}$ bins, for ${\displaystyle 1\leq i\leq n}$, let ${\displaystyle X_{i}}$ be the load of the ${\displaystyle i}$th bin, i.e. the number of balls in the ${\displaystyle i}$th bin.

An easy analysis shows that for every bin ${\displaystyle i}$, the expected load ${\displaystyle \mathbf {E} [X_{i}]}$ is equal to the average load ${\displaystyle m/n}$.

Because there are totally ${\displaystyle m}$ balls, it is always true that ${\displaystyle \sum _{i=1}^{n}X_{i}=m}$.

Therefore, due to the linearity of expectations,

{\displaystyle {\begin{aligned}\sum _{i=1}^{n}\mathbf {E} [X_{i}]&=\mathbf {E} \left[\sum _{i=1}^{n}X_{i}\right]=\mathbf {E} \left[m\right]=m.\end{aligned}}}

Because for each ball, the bin to which the ball is assigned is uniformly and independently chosen, the distributions of the loads of bins are identical. Thus ${\displaystyle \mathbf {E} [X_{i}]}$ is the same for each ${\displaystyle i}$. Combining with the above equation, it holds that for every ${\displaystyle 1\leq i\leq m}$, ${\displaystyle \mathbf {E} [X_{i}]={\frac {m}{n}}}$. So the average is indeed the average!

Next we analyze the distribution of the maximum load. We show that when ${\displaystyle m=n}$, i.e. ${\displaystyle n}$ balls are uniformly and independently thrown into ${\displaystyle n}$ bins, the maximum load is ${\displaystyle O\left({\frac {\log n}{\log \log n}}\right)}$ with high probability.

 Theorem Suppose that ${\displaystyle n}$ balls are thrown independently and uniformly at random into ${\displaystyle n}$ bins. For ${\displaystyle 1\leq i\leq n}$, let ${\displaystyle X_{i}}$ be the random variable denoting the number of balls in the ${\displaystyle i}$th bin. Then ${\displaystyle \Pr \left[\max _{1\leq i\leq n}X_{i}\geq {\frac {3\ln n}{\ln \ln n}}\right]<{\frac {1}{n}}.}$
Proof.
 Let ${\displaystyle M}$ be an integer. Take bin 1. For any particular ${\displaystyle M}$ balls, these ${\displaystyle M}$ balls are all thrown to bin 1 with probability ${\displaystyle (1/n)^{M}}$, and there are totally ${\displaystyle {n \choose M}}$ distinct sets of ${\displaystyle M}$ balls. Therefore, applying the union bound, {\displaystyle {\begin{aligned}\Pr \left[X_{1}\geq M\right]&\leq {n \choose M}\left({\frac {1}{n}}\right)^{M}\\&={\frac {n!}{M!(n-M)!n^{M}}}\\&={\frac {1}{M!}}\cdot {\frac {n(n-1)(n-2)\cdots (n-M+1)}{n^{M}}}\\&={\frac {1}{M!}}\cdot \prod _{i=0}^{M-1}\left(1-{\frac {i}{n}}\right)\\&\leq {\frac {1}{M!}}.\end{aligned}}} According to Stirling's approximation, ${\displaystyle M!\approx {\sqrt {2\pi M}}\left({\frac {M}{e}}\right)^{M}}$, thus ${\displaystyle {\frac {1}{M!}}\leq \left({\frac {e}{M}}\right)^{M}.}$ Figure 1 Due to the symmetry. All ${\displaystyle X_{i}}$ have the same distribution. Apply the union bound again, {\displaystyle {\begin{aligned}\Pr \left[\max _{1\leq i\leq n}X_{i}\geq M\right]&=\Pr \left[(X_{1}\geq M)\vee (X_{2}\geq M)\vee \cdots \vee (X_{n}\geq M)\right]\\&\leq n\Pr[X_{1}\geq M]\\&\leq n\left({\frac {e}{M}}\right)^{M}.\end{aligned}}} When ${\displaystyle M=3\ln n/\ln \ln n}$, {\displaystyle {\begin{aligned}\left({\frac {e}{M}}\right)^{M}&=\left({\frac {e\ln \ln n}{3\ln n}}\right)^{3\ln n/\ln \ln n}\\&<\left({\frac {\ln \ln n}{\ln n}}\right)^{3\ln n/\ln \ln n}\\&=e^{3(\ln \ln \ln n-\ln \ln n)\ln n/\ln \ln n}\\&=e^{-3\ln n+3\ln \ln \ln n\ln n/\ln \ln n}\\&\leq e^{-2\ln n}\\&={\frac {1}{n^{2}}}.\end{aligned}}} Therefore, {\displaystyle {\begin{aligned}\Pr \left[\max _{1\leq i\leq n}X_{i}\geq {\frac {3\ln n}{\ln \ln n}}\right]&\leq n\left({\frac {e}{M}}\right)^{M}&<{\frac {1}{n}}.\end{aligned}}}
${\displaystyle \square }$

When ${\displaystyle m>n}$, Figure 1 illustrates the results of several random experiments, which show that the distribution of the loads of bins becomes more even as the number of balls grows larger than the number of bins.

Formally, it can be proved that for ${\displaystyle m=\Omega (n\log n)}$, with high probability, the maximum load is within ${\displaystyle O\left({\frac {m}{n}}\right)}$, which is asymptotically equal to the average load.

# The Chernoff Bound

Suppose that we have a fair coin. If we toss it once, then the outcome is completely unpredictable. But if we toss it, say for 1000 times, then the number of HEADs is very likely to be around 500. This striking phenomenon, illustrated in the right figure, is called the concentration. The Chernoff bound captures the concentration of independent trials.

The Chernoff bound is also a tail bound for the sum of independent random variables which may give us exponentially sharp bounds.

Before proving the Chernoff bound, we should talk about the moment generating functions.

## Moment generating functions

The more we know about the moments of a random variable ${\displaystyle X}$, the more information we would have about ${\displaystyle X}$. There is a so-called moment generating function, which "packs" all the information about the moments of ${\displaystyle X}$ into one function.

 Definition The moment generating function of a random variable ${\displaystyle X}$ is defined as ${\displaystyle \mathbf {E} \left[\mathrm {e} ^{\lambda X}\right]}$ where ${\displaystyle \lambda }$ is the parameter of the function.

By Taylor's expansion and the linearity of expectations,

{\displaystyle {\begin{aligned}\mathbf {E} \left[\mathrm {e} ^{\lambda X}\right]&=\mathbf {E} \left[\sum _{k=0}^{\infty }{\frac {\lambda ^{k}}{k!}}X^{k}\right]\\&=\sum _{k=0}^{\infty }{\frac {\lambda ^{k}}{k!}}\mathbf {E} \left[X^{k}\right]\end{aligned}}}

The moment generating function ${\displaystyle \mathbf {E} \left[\mathrm {e} ^{\lambda X}\right]}$ is a function of ${\displaystyle \lambda }$.

## The Chernoff bound

The Chernoff bounds are exponentially sharp tail inequalities for the sum of independent trials. The bounds are obtained by applying Markov's inequality to the moment generating function of the sum of independent trials, with some appropriate choice of the parameter ${\displaystyle \lambda }$.

 Chernoff bound (the upper tail) Let ${\displaystyle X=\sum _{i=1}^{n}X_{i}}$, where ${\displaystyle X_{1},X_{2},\ldots ,X_{n}}$ are independent Poisson trials. Let ${\displaystyle \mu =\mathbf {E} [X]}$. Then for any ${\displaystyle \delta >0}$, ${\displaystyle \Pr[X\geq (1+\delta )\mu ]\leq \left({\frac {e^{\delta }}{(1+\delta )^{(1+\delta )}}}\right)^{\mu }.}$
Proof.
 For any ${\displaystyle \lambda >0}$, ${\displaystyle X\geq (1+\delta )\mu }$ is equivalent to that ${\displaystyle e^{\lambda X}\geq e^{\lambda (1+\delta )\mu }}$, thus {\displaystyle {\begin{aligned}\Pr[X\geq (1+\delta )\mu ]&=\Pr \left[e^{\lambda X}\geq e^{\lambda (1+\delta )\mu }\right]\\&\leq {\frac {\mathbf {E} \left[e^{\lambda X}\right]}{e^{\lambda (1+\delta )\mu }}},\end{aligned}}} where the last step follows by Markov's inequality. Computing the moment generating function ${\displaystyle \mathbf {E} [e^{\lambda X}]}$: {\displaystyle {\begin{aligned}\mathbf {E} \left[e^{\lambda X}\right]&=\mathbf {E} \left[e^{\lambda \sum _{i=1}^{n}X_{i}}\right]\\&=\mathbf {E} \left[\prod _{i=1}^{n}e^{\lambda X_{i}}\right]\\&=\prod _{i=1}^{n}\mathbf {E} \left[e^{\lambda X_{i}}\right].&({\mbox{for independent random variables}})\end{aligned}}} Let ${\displaystyle p_{i}=\Pr[X_{i}=1]}$ for ${\displaystyle i=1,2,\ldots ,n}$. Then, ${\displaystyle \mu =\mathbf {E} [X]=\mathbf {E} \left[\sum _{i=1}^{n}X_{i}\right]=\sum _{i=1}^{n}\mathbf {E} [X_{i}]=\sum _{i=1}^{n}p_{i}}$. We bound the moment generating function for each individual ${\displaystyle X_{i}}$ as follows. {\displaystyle {\begin{aligned}\mathbf {E} \left[e^{\lambda X_{i}}\right]&=p_{i}\cdot e^{\lambda \cdot 1}+(1-p_{i})\cdot e^{\lambda \cdot 0}\\&=1+p_{i}(e^{\lambda }-1)\\&\leq e^{p_{i}(e^{\lambda }-1)},\end{aligned}}} where in the last step we apply the Taylor's expansion so that ${\displaystyle e^{y}\geq 1+y}$ where ${\displaystyle y=p_{i}(e^{\lambda }-1)\geq 0}$. (By doing this, we can transform the product to the sum of ${\displaystyle p_{i}}$, which is ${\displaystyle \mu }$.) Therefore, {\displaystyle {\begin{aligned}\mathbf {E} \left[e^{\lambda X}\right]&=\prod _{i=1}^{n}\mathbf {E} \left[e^{\lambda X_{i}}\right]\\&\leq \prod _{i=1}^{n}e^{p_{i}(e^{\lambda }-1)}\\&=\exp \left(\sum _{i=1}^{n}p_{i}(e^{\lambda }-1)\right)\\&=e^{(e^{\lambda }-1)\mu }.\end{aligned}}} Thus, we have shown that for any ${\displaystyle \lambda >0}$, {\displaystyle {\begin{aligned}\Pr[X\geq (1+\delta )\mu ]&\leq {\frac {\mathbf {E} \left[e^{\lambda X}\right]}{e^{\lambda (1+\delta )\mu }}}\\&\leq {\frac {e^{(e^{\lambda }-1)\mu }}{e^{\lambda (1+\delta )\mu }}}\\&=\left({\frac {e^{(e^{\lambda }-1)}}{e^{\lambda (1+\delta )}}}\right)^{\mu }\end{aligned}}}. For any ${\displaystyle \delta >0}$, we can let ${\displaystyle \lambda =\ln(1+\delta )>0}$ to get ${\displaystyle \Pr[X\geq (1+\delta )\mu ]\leq \left({\frac {e^{\delta }}{(1+\delta )^{(1+\delta )}}}\right)^{\mu }.}$
${\displaystyle \square }$

The idea of the proof is actually quite clear: we apply Markov's inequality to ${\displaystyle e^{\lambda X}}$ and for the rest, we just estimate the moment generating function ${\displaystyle \mathbf {E} [e^{\lambda X}]}$. To make the bound as tight as possible, we minimized the ${\displaystyle {\frac {e^{(e^{\lambda }-1)}}{e^{\lambda (1+\delta )}}}}$ by setting ${\displaystyle \lambda =\ln(1+\delta )}$, which can be justified by taking derivatives of ${\displaystyle {\frac {e^{(e^{\lambda }-1)}}{e^{\lambda (1+\delta )}}}}$.

We then proceed to the lower tail, the probability that the random variable deviates below the mean value:

 Chernoff bound (the lower tail) Let ${\displaystyle X=\sum _{i=1}^{n}X_{i}}$, where ${\displaystyle X_{1},X_{2},\ldots ,X_{n}}$ are independent Poisson trials. Let ${\displaystyle \mu =\mathbf {E} [X]}$. Then for any ${\displaystyle 0<\delta <1}$, ${\displaystyle \Pr[X\leq (1-\delta )\mu ]\leq \left({\frac {e^{-\delta }}{(1-\delta )^{(1-\delta )}}}\right)^{\mu }.}$
Proof.
 For any ${\displaystyle \lambda <0}$, by the same analysis as in the upper tail version, {\displaystyle {\begin{aligned}\Pr[X\leq (1-\delta )\mu ]&=\Pr \left[e^{\lambda X}\geq e^{\lambda (1-\delta )\mu }\right]\\&\leq {\frac {\mathbf {E} \left[e^{\lambda X}\right]}{e^{\lambda (1-\delta )\mu }}}\\&\leq \left({\frac {e^{(e^{\lambda }-1)}}{e^{\lambda (1-\delta )}}}\right)^{\mu }.\end{aligned}}} For any ${\displaystyle 0<\delta <1}$, we can let ${\displaystyle \lambda =\ln(1-\delta )<0}$ to get ${\displaystyle \Pr[X\geq (1-\delta )\mu ]\leq \left({\frac {e^{-\delta }}{(1-\delta )^{(1-\delta )}}}\right)^{\mu }.}$
${\displaystyle \square }$

## Useful forms of the Chernoff bounds

Some useful special forms of the bounds can be derived directly from the above general forms of the bounds. We now know better why we say that the bounds are exponentially sharp.

 Useful forms of the Chernoff bound Let ${\displaystyle X=\sum _{i=1}^{n}X_{i}}$, where ${\displaystyle X_{1},X_{2},\ldots ,X_{n}}$ are independent Poisson trials. Let ${\displaystyle \mu =\mathbf {E} [X]}$. Then 1. for ${\displaystyle 0<\delta \leq 1}$, ${\displaystyle \Pr[X\geq (1+\delta )\mu ]<\exp \left(-{\frac {\mu \delta ^{2}}{3}}\right);}$ ${\displaystyle \Pr[X\leq (1-\delta )\mu ]<\exp \left(-{\frac {\mu \delta ^{2}}{2}}\right);}$ 2. for ${\displaystyle t\geq 2e\mu }$, ${\displaystyle \Pr[X\geq t]\leq 2^{-t}.}$
Proof.
 To obtain the bounds in (1), we need to show that for ${\displaystyle 0<\delta <1}$, ${\displaystyle {\frac {e^{\delta }}{(1+\delta )^{(1+\delta )}}}\leq e^{-\delta ^{2}/3}}$ and ${\displaystyle {\frac {e^{-\delta }}{(1-\delta )^{(1-\delta )}}}\leq e^{-\delta ^{2}/2}}$. We can verify both inequalities by standard analysis techniques. To obtain the bound in (2), let ${\displaystyle t=(1+\delta )\mu }$. Then ${\displaystyle \delta =t/\mu -1\geq 2e-1}$. Hence, {\displaystyle {\begin{aligned}\Pr[X\geq (1+\delta )\mu ]&\leq \left({\frac {e^{\delta }}{(1+\delta )^{(1+\delta )}}}\right)^{\mu }\\&\leq \left({\frac {e}{1+\delta }}\right)^{(1+\delta )\mu }\\&\leq \left({\frac {e}{2e}}\right)^{t}\\&\leq 2^{-t}\end{aligned}}}
${\displaystyle \square }$

## Applications to balls-into-bins

Throwing ${\displaystyle m}$ balls uniformly and independently to ${\displaystyle n}$ bins, what is the maximum load of all bins with high probability? In the last class, we gave an analysis of this problem by using a counting argument.

Now we give a more "advanced" analysis by using Chernoff bounds.

For any ${\displaystyle i\in [n]}$ and ${\displaystyle j\in [m]}$, let ${\displaystyle X_{ij}}$ be the indicator variable for the event that ball ${\displaystyle j}$ is thrown to bin ${\displaystyle i}$. Obviously

${\displaystyle \mathbf {E} [X_{ij}]=\Pr[{\mbox{ball }}j{\mbox{ is thrown to bin }}i]={\frac {1}{n}}}$

Let ${\displaystyle Y_{i}=\sum _{j\in [m]}X_{ij}}$ be the load of bin ${\displaystyle i}$.

Then the expected load of bin ${\displaystyle i}$ is

${\displaystyle (*)\qquad \mu =\mathbf {E} [Y_{i}]=\mathbf {E} \left[\sum _{j\in [m]}X_{ij}\right]=\sum _{j\in [m]}\mathbf {E} [X_{ij}]=m/n.}$

For the case ${\displaystyle m=n}$, it holds that ${\displaystyle \mu =1}$

Note that ${\displaystyle Y_{i}}$ is a sum of ${\displaystyle m}$ mutually independent indicator variable. Applying Chernoff bound, for any particular bin ${\displaystyle i\in [n]}$,

${\displaystyle \Pr[Y_{i}>(1+\delta )\mu ]\leq \left({\frac {e^{\delta }}{(1+\delta )^{1+\delta }}}\right)^{\mu }.}$

### The ${\displaystyle m=n}$ case

When ${\displaystyle m=n}$, ${\displaystyle \mu =1}$. Write ${\displaystyle c=1+\delta }$. The above bound can be written as

${\displaystyle \Pr[Y_{i}>c]\leq {\frac {e^{c-1}}{c^{c}}}.}$

Let ${\displaystyle c={\frac {e\ln n}{\ln \ln n}}}$, we evaluate ${\displaystyle {\frac {e^{c-1}}{c^{c}}}}$ by taking logarithm to its reciprocal.

{\displaystyle {\begin{aligned}\ln \left({\frac {c^{c}}{e^{c-1}}}\right)&=c\ln c-c+1\\&=c(\ln c-1)+1\\&={\frac {e\ln n}{\ln \ln n}}\left(\ln \ln n-\ln \ln \ln n\right)+1\\&\geq {\frac {e\ln n}{\ln \ln n}}\cdot {\frac {2}{e}}\ln \ln n+1\\&\geq 2\ln n.\end{aligned}}}

Thus,

${\displaystyle \Pr \left[Y_{i}>{\frac {e\ln n}{\ln \ln n}}\right]\leq {\frac {1}{n^{2}}}.}$

Applying the union bound, the probability that there exists a bin with load ${\displaystyle >12\ln n}$ is

${\displaystyle n\cdot \Pr \left[Y_{1}>{\frac {e\ln n}{\ln \ln n}}\right]\leq {\frac {1}{n}}}$.

Therefore, for ${\displaystyle m=n}$, with high probability, the maximum load is ${\displaystyle O\left({\frac {e\ln n}{\ln \ln n}}\right)}$.

### The ${\displaystyle m>\ln n}$ case

When ${\displaystyle m\geq n\ln n}$, then according to ${\displaystyle (*)}$, ${\displaystyle \mu ={\frac {m}{n}}\geq \ln n}$

We can apply an easier form of the Chernoff bounds,

${\displaystyle \Pr[Y_{i}\geq 2e\mu ]\leq 2^{-2e\mu }\leq 2^{-2e\ln n}<{\frac {1}{n^{2}}}.}$

By the union bound, the probability that there exists a bin with load ${\displaystyle \geq 2e{\frac {m}{n}}}$ is,

${\displaystyle n\cdot \Pr \left[Y_{1}>2e{\frac {m}{n}}\right]=n\cdot \Pr \left[Y_{1}>2e\mu \right]\leq {\frac {1}{n}}}$.

Therefore, for ${\displaystyle m\geq n\ln n}$, with high probability, the maximum load is ${\displaystyle O\left({\frac {m}{n}}\right)}$.