Finding $E[X]$ with the Law of total expectation

90 Views Asked by At

Question: Prisoner locked in a cell with $n$ doors. Only one door leads to freedom, and all the other doors lead to a dungeon where the prisoner is forced to stay $a_{i} $ days for $i=2,....n$ when $i$ is the selected door (the first door can be set as the door that leads to freedom, so that $a_{1}=0$). The prisoner chooses a random door with equal probability to all doors and passes through it. If he did not choose the door that leads to freedom, after staying in the dungeon $i$ (when $i \neq 1$) he returns to the cell and picks again a random door. Suppose the prisoner remembers which doors he has already checked. Let $X$ be the number of days till the prisoner gets to freedom. Calculate $\mathbb{E}[X]$.

My attempt to solve: Let be $Y$ be the indictor for the door that was open so:
$$ E[X|Y=i]=\begin{cases} 0& \ i=1 \\ E[X]+ a_{i}& i=2,3.....,n \end{cases} $$ I used the Law of total expectation and got:

$$ E[X]=E[E[X|Y=i]]=\sum_{i=2}^{n}E[X|Y=i]\cdot P(Y=i) $$ $$ E[X]=\sum_{i=2}^{n}(E[X|]+ a_{i})\cdot \sum_{k=1}^{n-1}\frac{1}{n-k} $$ $$ E[X]=\sum_{i=2}^{n} (a_{i})\cdot \sum_{k=1}^{n-1}(\frac{1}{n-k})+ (n-1)E[X] $$

This answer is wrong.

The right answer is: $ E[X]=\sum_{i=2}^{n} \left(\frac{a_{i}}{n}\right)\cdot \sum_{k=1}^{n}\left(\frac{k-1}{n-1}\right) $

But I can’t understand how they can to this expression.

1

There are 1 best solutions below

8
On BEST ANSWER

The answer is just $\frac 12\times \sum_{i=1}^n a_i$.

Each losing door has a $\frac 12$ chance of being selected prior to the winning door, so each of the losing doors contributes half of its days to the expected number of days.

Note: The official answer simplifies to this since $$\sum_{k=1}^n\frac {k-1}{n-1}=\frac 1{n-1}\times \sum_{k=0}^{n-1}k=\frac 1{n-1}\times \frac {n(n-1)}2=\frac n2$$

thus $$\sum_{i=1}^n\frac {a_i}n\times \sum_{k=1}^n\frac {k-1}{n-1}=\frac 1n\times \sum_{i=1}^na_i\times \frac n2=\frac 12\times \sum_{i=1}^na_i$$

To be clear: since $a_1=0$ there is no difference between $\sum_{i=1}^na_i$ and $\sum_{i=2}^na_i$.