Solution (source code)

= Solution

Condition on the fair coin choosing the initial chamber. The <law of total probability> gives $\mathbb P(\text{reach }k)=(p_1+p_2)/2$. With $r=(1-p)/p$, substituting the <biased gambler's ruin probability> gives
$$
\boxed{\mathbb P(\text{reach }k)=
\begin{cases}
\displaystyle\frac{2-r-r^2}{2(1-r^k)},&p\ne\tfrac12,\\[5pt]
\displaystyle\frac3{2k},&p=\tfrac12.
\end{cases}}
$$
Both numerator and denominator in the first case have the same sign. Its limit as $r\to1$ is the fair-walk value, since the ratio of their first <derivatives> is $3/(2k)$. The averaging is over initial locations, not over the transition <probabilities>.