Solving a recurrence relation with special cases I need help solving the following problem with a recurrence relation.


  A miner is trapped in a mine with three doors. The first door will lead him to safety
  in two hours. The second door leads him back to the same place in three hours. The third door
  leads him to a maze which takes him back to the same place in 5 hours. However, if the miner
  ever travels through the third door again, it takes him only 1 hour to go back to the same place
  as he remembers how to get out of the maze. The three doors look the same and so the miner
  always chooses each of them with equal probability, independent of which door he has taken
  before. What is the expected time until the miner reaches safety?


I am trying to solve it by using Markov chain with 2 states, one which indicates the miner has gone through door 3 already and the other that he has not but I'm somewhat confused. Any help will be appreciated.

P.S. This is not homework but practice for an upcoming midterm.
The state space is on the right track but there are 3 states to consider.

$$S_0\text{ - the initial state}$$
$$S_1\text{ - the original room after passing through the maze}$$
$$S_2\text{ - the exit}$$

With these the transition probabilities and times are straightforward:

$$\begin{align}
P_{00}&amp;=\frac{1}{3}&amp;t=3\\
P_{01}&amp;=\frac{1}{3}&amp;t=2\\
P_{02}&amp;=\frac{1}{3}&amp;t=5\\
P_{10}&amp;=0&amp;t=N/A\\
P_{11}&amp;=\frac{1}{3}&amp;t=2\\
P_{12}&amp;=\frac{2}{3}&amp;t=1\\
P_{20}&amp;=0&amp;t=N/A\\
P_{21}&amp;=0&amp;t=N/A\\
P_{22}&amp;=1&amp;t=0\\
\end{align}$$
The state space is on the right track but there are 3 states to consider.

$$S_0\text{ - the initial state}$$
$$S_1\text{ - the original room after passing through the maze}$$
$$S_2\text{ - the exit}$$

With these the transition probabilities and times are straightforward:

$$\begin{align}
P_{00}&amp;=\frac{1}{3}&amp;t=3\\
P_{01}&amp;=\frac{1}{3}&amp;t=2\\
P_{02}&amp;=\frac{1}{3}&amp;t=5\\
P_{10}&amp;=0&amp;t=N/A\\
P_{11}&amp;=\frac{1}{3}&amp;t=2\\
P_{12}&amp;=\frac{2}{3}&amp;t=1\\
P_{20}&amp;=0&amp;t=N/A\\
P_{21}&amp;=0&amp;t=N/A\\
P_{22}&amp;=1&amp;t=0\\
\end{align}$$