My transition matrix differs from that provided by the author. As this problem is part of my homework I would appreciate some help to see why my solution doesn't work. This is exercise 17-29 from the book Operations research by Hamdy A. Taha.
This is the solution given by the author:
This is my solution:
My matrix is the same for the 4 first rows but it differs in row number 5 with that given in the solutions section. For me there are two options for it. In the first one I think the mouse can go in either direction from 5, including the exit, which connects to state 1. So the probability for each path is $\frac{1}{4}$. This would be the matrix:
\begin{pmatrix} 0&\frac{1}{3}& \frac{1}{3}&\frac{1}{3}&0\\ \frac{1}{3}&0 &\frac{1}{3}& 0 &\frac{1}{3}\\ \frac{1}{3}& \frac{1}{3}& 0 & 0&\frac{1}{3}\\ \frac{1}{2} & 0 & 0 & 0 & \frac{1}{2}\\ \frac{1}{4} & \frac{1}{4}& \frac{1}{4}&\frac{1}{4} &0 \end{pmatrix}
For the second alternative I think the mouse gets out and pass to state 1 as soon as he gets the exit, so the probability of passing to state 1 is 1 and 0 for the other paths. The matrix would be
\begin{pmatrix} 0&\frac{1}{3}& \frac{1}{3}&\frac{1}{3}&0\\ \frac{1}{3}&0 &\frac{1}{3}& 0 &\frac{1}{3}\\ \frac{1}{3}& \frac{1}{3}& 0 & 0&\frac{1}{3}\\ \frac{1}{2} & 0 & 0 & 0 & \frac{1}{2}\\ 1 & 0& 0&0 &0 \end{pmatrix}
As you can see both alternatives differ from the answer given by the author and the truth is I don't see the logic behind that answer. It seems contradictory to me that you can go to states 2, 3, and 4 with probabilities of $\frac{1}{3}$ each while being forced to pass to state 1 giving probability of 0. It would be very helpful to see any comments and insights about it.



Notice that the claimed answer has its fifth row the same as the first.
I think the author, in writing this, is concluding "well, they started at state $5$, but we will thus move them to state $1$, and thus they have the same options available there." Think of it like if the mouse starts on state $5$, they are immediately warped to state $1$, before making their choice.
Honestly, I'm not sure if this is the best way to handle this, but it's not one I can immediately declare invalid. My main gripe with it is that it foregoes the transitory period between states $5$ and $1$ and accounts for it none; if you interpret subsequent changes of state to be done with some time interval in-between, and consider that a critical aspect of your analysis, perhaps this needs to be accounted for (by, say, your second hypothetical answer).
I would not say your hypothetical first answer works, though, because from state $5$ the mouse can go nowhere but state $1$, by the design of the experiment.