Solution (source code)

= Solution

A state $i$ is absorbing if $p_{ii}=1$, so once visited it is never left. Condition on the first step and use the <Markov property>: for $i\ne1$, the subsequent probability of ever reaching state one is $h_j$ given $X_1=j$. Hence $h_i=\sum_jp_{ij}h_j$, with $h_1=1$.

In this chain state four is a separate <absorbing state>, so $h_4=0$. The other two equations are
$$
h_2=\tfrac13+\tfrac23h_3,\qquad h_3=\tfrac14h_2.
$$
Solving gives
$$
\boxed{h_2=2/5,\qquad h_3=1/10,\qquad h_4=0}.
$$
Let $t_i$ be the mean time to hit the absorbing set. From either <transient state> the next-step absorption probability is at least $1/3$, so its tail is geometrically bounded and the expectations are finite. <First-step analysis> gives $t_2=1+\tfrac23t_3$ and $t_3=1+\tfrac14t_2$. Thus $t_3=5/4+t_3/6$ and
$$
\boxed{\mathbb E_3\tau_{\{1,4\}}=3/2}.
$$