Solution (source code)

= Solution

Normalizing the invariant distribution found in part (i) gives
$$
1=\pi_0\left(1+\frac{q^2p}{q-1}\right),
\qquad
\pi_1=\frac{qp(q-1)}{q-1+q^2p}.
$$
The <mean recurrence time> formula now yields
$$
\boxed{
\mathbb E_1T_1^+
=\frac1{\pi_1}
=\frac{q-1+q^2p}{qp(q-1)}
}.
$$