Exercise Problem 43, Chapter 4, Intro to Probability, Blitzstein and Hwang

I am self-learning basic undergrad calculus-based probability. I would like someone to verify if my solution to the below exercise problem on the mathematical expectation of a random variable is correct.

[BH 4.43] A building has $n$ floors labelled $1,2,\ldots,n$. At the first floor, $k$ people enter the elevator, which is going up and is empty before they enter. Independently, each decides which of the floors $2,3,\ldots,n$ to go to and press that button (unless someone has already pressed it.)

a) Assume for this part alone that the probabilities for floors $2,3,\ldots,n$ are equal. Find the expected number of steps the elevator makes on floors $2,3,\ldots,n$.

b) Generalize (a) to the case that floors $2,3,\ldots,n$ have probabilities $p_2,\ldots,p_n$ respectively, you can leave your answer as a finite sum.

Solution. (My attempt)

a) As each person presses buttons from $\{2,3,\ldots,n\}$, we are essentially sampling from this population with replacement $k$ times.

Let $A_j$ be the event that the floor $j$ is included in the floor list and let $I_{A_j}$ be its indicator function.

\begin{align*} P(A_j) = \frac{(n-1)^{k-1}}{(n-1)^k} = \frac{1}{n - 1} \end{align*}

Let $X$ be the total number of floors that the elevator stops at. Then,

\begin{align*} X &= \sum_{j=2}^{n} I_{A_j}\\ E(X) &= \sum_{j=2}^{n-1}E(I_{A_j}) = 1 \end{align*}

b) In this case, $P(A_j) = p_j$, so $E(X) = \sum_{j=2}^{n-1}p_j$.


You write $\begin{align*} P(A_j) = \frac{(n-1)^{k-1}}{(n-1)^k} = \frac{1}{n - 1} \end{align*}$. But that is not correct. It can be any of the persons or more who choose floor $j$. In other words, you cannot fix a specific person to choose floor $j$. So the right approach will be to first find the probability that nobody chooses floor $j$, That is given by,

$\displaystyle \left(\frac{n-2}{n-1}\right)^k$

So, $ \displaystyle P(A_j) = 1 - \left(\frac{n-2}{n-1}\right)^k$

$E[X] = (n-1) \left[1 - \left(\frac{n-2}{n-1}\right)^k\right]$

You can follow the same approach for $(b)$ but the probability for each floor is different.