# How many people have the same exact number of hairs?

Assume we look at $$n\in\mathbb N$$ people that can have anywhere between $$1$$ to $$k\in\mathbb N$$ hairs on their head.

Formally, I look at $$n$$ independent (in fact, this is not really true in real life because of inheritance etc., but bear with me) uniformly (might also not be true in real life) distributed random variables $$X_1, X_2, \dots, X_n \sim \text{Uniform}(\{1, 2, 3, \dots, k\}).$$

My question: How many people am I expected to be able to find that have the same number of hairs? Formally, what is, where $$\lvert\cdot\rvert$$ denotes cardinality,

$$\mathsf E\left(\max_{i\in\{1, 2, \dots, k\}} \lvert\{j\in\{1,2,\dots, n\}: X_j = i\}\rvert\right).$$

Remark. According to the Pigeonhole Principle, we have $$\max_{i\in\{1, 2, \dots, k\}} \lvert\{j\in\{1,2,\dots, n\}: X_j = i\}\rvert\geq\frac nk.$$

For example, if we assume that there are $$n=82$$ million people living in Germany, and everyone has at most $$k=1$$ million hairs, then we can always find at least $$82$$ people that have the exact same number of hair. (Note that the Pigeonhole Principle doesn't need the uniform distribution nor the independence of the $$X_j$$ !)

Note that the random variables $$\lvert\{j\in\{1,2,\dots, n\}: X_j = i\}\rvert$$ for $$i\in\{1,2,\dots, k\}$$ are not independent.

• You are asking in the wrong forum. Mar 26, 2021 at 20:33
• In my experience, this is not uniformly distributed. Most people have full heads of hair, except for those with certain patterns of baldness, so there will be peaks in the distribution. Mar 26, 2021 at 21:41
• @Gerald Should it be migrated to MSE? Mar 26, 2021 at 21:45
• @Ben, would those peaks be Widow's peaks? en.wikipedia.org/wiki/Widow%27s_peak#Definition Mar 26, 2021 at 23:52
• @GeraldEdgar why? Looks ok here for me. Mar 27, 2021 at 5:27

This question has been studied extensively in the computer science literature under the name "balls in bins"; see [1] which gives quite tight bounds in Theorem 1, page 161 and also describes prior work before 1999.

[1] Raab, Martin, and Angelika Steger. "“Balls into bins”—A simple and tight analysis." In International Workshop on Randomization and Approximation Techniques in Computer Science, pp. 159-170. Springer, Berlin, Heidelberg, 1998. Available on page 159 of https://link.springer.com/content/pdf/10.1007%2F3-540-49543-6.pdf

• Exactly. To clarify, each $X_i$ is a ball that is thrown uniformly into bins $1,\dots,$ or $k$; we look at the number of balls in the max-loaded bin.
– usul
Mar 27, 2021 at 1:12
• For completeness: The result is, loosely stated: If $n> k\ln(k)$, then the my expectation looks like $\frac{n}{k} +\Theta\left(\sqrt{\frac{n\ln(k)}k}\right)$ and if $n<\frac{k}{\ln(k)}$, it is of the form $\Theta\left(\frac{\ln k}{\ln(k/n)}\right)$. In my case, $n>k \ln(k)$, but $\frac{n}{k} +\Theta\left(\sqrt{\frac{n\ln(k)}k}\right)$ is not much better than $\frac nk$. Mar 29, 2021 at 10:40

We need to estimate $$EN$$, where $$$$N:=\max_{j\in[k]}N_j,\quad N_j:=\sum_{i\in[n]}1(X_i=j),$$$$ the $$X_i$$'s are iid uniform in $$[k]:=\{1,\dots,k\}$$.

We have $$$$EN=\int_0^\infty dt\,P(N\ge t)$$$$ and $$$$P(N\ge t)\le\sum_{j\in[k]}P(N_j\ge t)=kP(N_1\ge t)\le ke^{-2(t-np)^2/n}$$$$ for $$t\ge np$$ and $$p:=1/k$$, by Hoeffding's inequality. Also, $$P(N\ge t)\le1$$. So, for $$$$t_*:=np+\sqrt{\frac n2\ln k},$$$$ $$$$EN\le t_*+I,$$$$ where \begin{align*} I&:=k\int_{t_*}^\infty dt\,e^{-2(t-np)^2/n} \\ &=\frac k2\,\sqrt n\,\int_{\sqrt{2\ln k}}^\infty dz\,e^{-z^2/2} \\ &<\frac k2\,\sqrt n\,\int_{\sqrt{2\ln k}}^\infty dz\,\frac z{\sqrt{2\ln k}}\,e^{-z^2/2} \\ &=\frac k2\sqrt n\, e^{-\ln k} \frac1{\sqrt{2\ln k}} =\frac12\sqrt{\frac n{2\ln k}}. \end{align*}

So, $$$$EN\le U_{n,k}:=\frac nk+\sqrt{\frac n2\,\ln k}+\frac12\sqrt{\frac n{2\ln k}}.$$$$ On the other hand, $$$$EN\ge L_{n,k}:=EN_1=\frac nk.$$$$ We see that the upper and lower bounds $$U_{n,k}$$ and $$L_{n,k}$$ are asymptotic to each other if $$k^2\ln k=o(n)$$.

This does not seem to work that well when, say, $$n=82\times10^6$$ and $$k=10^6$$ or even $$k=10^5$$, which latter seems to be closer to the usual number of human hairs on the head.

However, as noted in the comment by Ben McKay, the actual distribution of the number of hairs is far from uniform -- which may make an effective dimension of the random vector $$(N_1,\dots,N_k)$$ much less than $$k$$, and which may then bring the upper and lower bounds closer to each other.

• Thank you, very interesting asymptotic behavior. I will not accept the answer yet though because I am hoping for a lower bound that is sharper in the case considered here 🙂. Mar 26, 2021 at 22:08