[Math] Conditional expectation: Calculate the variance

probability

A mouse is trapped in a maze. Initialy, it can go right or left. If it goes to the left, it will walk for 3 minutes and will return to the initial position. If it goes to the right, with probability $1/3$ it will get out of the maze after 2 minutes of travel, and with probability $2/3$ it will return to the initial position after 5 minutes. Assuming that the mouse randomly chooses the left or the right, find the variance of the time it remains in the maze.

My attempt

Using that
$$E[X]=E[E[X|Y]]$$

If $X$ represents the time that the mouse remains in the maze and $Y$ the door chose , I could fint the expected time that it remans in the maze. But I couldnt find out how to use it to evaluate $E[X^2]$. Any suggestion?

Thanks!

@Edit:
$$E[X]=E[E[X|Y]] = \frac{1}{2}E[X|Y=right]+\frac{1}{2}E[X|Y=left]$$

NOTE THAT:

$E[X|left]=3+E[X]$

$E[X|right]=1/3(2)+2/3(5+E[X])$

Best Answer

Consider the fate of the mouse after its first cycle. The outcome of the first cycle is either $L$ (went left and came back) with probability $\frac12$, $O$ (went right and exited) with probability $\frac16$, or $R$ (went right and came back) with probability $\frac13$. Thus, $$X=(3+X')\mathbf 1_L+2\mathbf 1_O+(5+X')\mathbf 1_R,$$ where $X'$ is distributed like $X$ and independent of $(L,O,R)$. Taking expectations yields $$E(X)=(3+E(X))P(L)+2P(O)+(5+E(X))P(R),$$ from which, since $P(L)=3P(O)$ and $P(R)=2P(O)$, one deduces that $$E(X)=\frac{3P(L)+2P(O)+5P(R)}{P(O)}=3\cdot3+2+5\cdot2=21.$$ Likewise, $$X^2=(3+X')^2\mathbf 1_L+4\mathbf 1_O+(5+X')^2\mathbf 1_R,$$ hence $$E(X^2)=E((3+X)^2)P(L)+4P(O)+E((5+X)^2)P(R),$$ from which... you might wish to pursue.

Related Question