# Expected length of time until the mouse reaches the compost heap.

I'm assuming it's a Markov Chain question but I have no idea how to do this. Thanks in advance!

A mouse lives in a mousehole with three exits.

• The first exit leads to a compost heap after 1 minute of scurrying.
• The second exit leads to a tunnel that returns it to the mousehole after three minutes.
• The third exit leads to a tunnel that returns it to the mousehole after four minutes.

Assume the mouse has no memory of previous excursions when it returns to its mousehole, and is always equally likely to choose any one of the exits, what is the expected length of time until the mouse reaches the compost heap?

Hint: Let $$E$$ be the desired expected time. Can you explain why $$E = \frac{1}{3}\cdot 1 + \frac{1}{3}(3+E) + \frac{1}{3}(4+E),$$ and hence deduce the value of $$E$$?
More difficult way! Refer to the table, where $$X$$ is the number of minutes: $$\begin{array}{c|c|c} \text{Excursions (n)}&X&P(X)&XP(X)\\ \hline 1&1&1/3&1\cdot 1/3\\ \hline 2&3+1&1/3^2&(3+1)\cdot 1/3^2\\ 2&4+1&1/3^2&(4+1)\cdot 1/3^2\\ \hline 3&3+3+1&1/3^3&(3+3+1)\cdot 1/3^3\\ 3&3+4+1&1/3^3&(3+4+1)\cdot 1/3^3\\ 3&4+3+1&1/3^3&(4+3+1)\cdot 1/3^3\\ 3&4+4+1&1/3^3&(4+4+1)\cdot 1/3^3\\ \hline 4&3+3+3+1&1/3^4&(3+3+3+1)\cdot 1/3^4 \\ \vdots\end{array}$$ $$\mathbb E(X)=\sum_{n=1}^\infty XP(X)=\sum_{n=1}^\infty ((n-1)\cdot 2^{n-2}\cdot 7+2^{n-1})\cdot \frac1{3^{n}}=8.$$ Wolframalpha answer.