[Math] Solve the problem using linearity of expectation.

discrete mathematicsprobabilitystatistics

A building has $n$ floors numbered $1, 2, \cdots , n,$ plus a ground floor $G$. At the
ground floor, $m$ people get on the elevator together, and each gets off at a uniformly
random one of the $n$ floors (independently of everybody else). What is the expected
number of floors the elevator stops at (not counting the ground floor)?

Best Answer

For $i=1$ to $n$, let $X_i=1$ if the elevator stops at the $i$-th floor, and let $X_i=0$ otherwise. Then $N$, the number of floors stopped at, is given by $$N=X_1+X_2+\cdots+X_n.$$ Thus by the linearity of expectation, we have $$E(N)=E(X_1)+E(X_2)+\cdots +E(X_n).$$ The probability that no one stops at floor $i$ is $\left(\frac{n-1}{n}\right)^m$.

Thus the probability that $X_i=1$ is $1-\left(\frac{n-1}{n}\right)^m$. This is also the expectation of $X_i$.

For $E(N)$, add up over all $i$, that is, multiply by $n$.