Suppose a person is lost in a maze, and there are 3 paths that the person can take with equal chance: path 1 takes 2 minutes and gets the person out. Path 2 takes 3 minutes and leads back to the start. Path 3 takes 4 minutes and leads back to the start. If the person returns to the starting point, they have no memory of which path they chose and will randomly pick a path to go down. Let $X$ be the time it takes to get out. Find $E(X)$ and $Var(X)$
Here is my current attempt: $X|P_1=2, X|P_2=3+M, X|P_3=4+M$, where $M$ is the remaining time to get out of the maze. With this, I have $E(X)=\frac{1}{3}2+\frac{1}{3}(3+E(M))+\frac{1}{3}(4+E(M))=9$. Not sure if this is correct...To proceed, how would I find $Var(X)$? Do I use the formula $Var(X)=E(Var(X|M))+Var(E(X|M))$?
Denote $X_n$ be the time it takes the person out as he starts over for the $n$-th time, $n = 1, 2, \ldots$. In addition, let $P_n$ be the path that the person chose in his $n$-th attempt. It then follows by condition that $X_n$ have the same distribution $X$, $P[P_n = 1] = P[P_n = 2] = P[P_n = 3] = \frac{1}{3}$, $X_{n + 1}$ is independent of $P_n$, and \begin{align} X_n = 2I_{[P_n = 1]} + (3 + X_{n + 1})I_{[P_n = 2]} + (4 + X_{n + 1})I_{[P_n = 3]}. \tag{1}\label{1} \end{align} Taking expectations on both sides of $\eqref{1}$ thus yields: \begin{align} \mu = \frac{2}{3} + 1 + \frac{1}{3}\mu + \frac{4}{3} + \frac{1}{3}\mu, \tag{2}\label{2} \end{align} where $\mu = E[X]$. Solving $\eqref{2}$ gives $\mu = 9$.
To find $\operatorname{Var}(X)$, squaring both sides of $\eqref{1}$ yields (note that because $[P_n = i], i = 1, 2, 3$ are disjoint, the cross-product terms vanish): \begin{align} X_n^2 = 4I_{[P_n = 1]} + (9 + 6X_{n + 1} + X_{n + 1}^2)I_{[P_n = 2]} + (16 + 8X_{n + 1} + X_{n + 1}^2)I_{[P_n = 3]}. \tag{3}\label{3} \end{align} Taking expectations on both sides of $\eqref{3}$ then gives (where $\tau = E[X^2]$), \begin{align} \tau = \frac{4}{3} + 3 + 2\mu + \frac{\tau}{3} + \frac{16}{3} + \frac{8}{3}\mu + \frac{\tau}{3}. \tag{4}\label{4} \end{align} Substituting $\mu = 9$ into $\eqref{4}$ and solving it for $\tau$ gives $\tau = 155$, whence $\operatorname{Var}(X) = \tau - \mu^2 = 155 - 81 = 74$.
The method of iterative expectations/variances should also work (and essentially are the same as the above solution), but its write-up might be messier in my opinion.