Solution
= Solution
Let $m_j$ be the expected remaining time when the walk is at $j$. The first-step recurrence for <gambler's ruin> is
$$
m_j=1+\frac12m_{j-1}+\frac12m_{j+1},
\qquad -a<j<b,
$$
with $m_{-a}=m_b=0$. The quadratic
$$
m_j=(j+a)(b-j)
$$
satisfies both the recurrence and the <boundary conditions>, and their finite linear system has a unique solution. Starting from zero therefore gives
$$
\boxed{\mathbb E(T)=m_0=ab}.
$$