At a party N men throw their hats into the center of a room. The hats are mixed up and each man randomly selects one. Find the expected number of men who select their own hats.
Letting X denote the number of men that select their own hats, we can best compute E[X] by noting that
X=X_{1}+X_{2}+\cdot\cdot\cdot+X_{N}where
X_{i}=\begin{cases} 1, & \text{if the ith man selects his own hat}\\ 0, & \text{ otherwise}\end{cases}Now, because the ith man is equally likely to select any of the N hats, it follows that
P\{X_{i}=1\} = P{ith man selects his own hat} = \frac{1}{N}
and so
E[X_{i}]=1P\{X_{i}=1\}+0P\{X_{i}=0\}={\frac{1}{N}}Hence, from Equation (2.11)
E[a_{1}X_{1}+a_{2}X_{2}+\cdot\cdot\cdot+a_{n}X_{n}]=a_{1}E[X_{1}]+a_{2}E[X_{2}]+\cdot\cdot\cdot+a_{n}E[X_{n}] (2.11)
we obtain
E[X]=E[X_{1}]+\cdot\cdot\cdot+E[X_{N}]=\left({\frac{1}{N}}\right)N=1Hence, no matter how many people are at the party, on the average exactly one of the men will select his own hat.