Solution (source code)

= Solution

For the exit law, the two identified processes have the same argument. Starting at zero, neither can skip $-a$ or $b$: <Brownian motion> is continuous, and the <symmetric Poisson difference process> has unit jumps with integer boundary levels. Therefore $|X_{t\wedge T}|\leq K=\max(a,b)$, and if $T$ is finite, $X_T\in\{-a,b\}$.

To justify finiteness rather than presume it, apply the <optional stopping theorem> to the <martingale> $X_t^2-t$ at the bounded <stopping time> $t\wedge T$:
$$
\mathbb E(t\wedge T)=\mathbb E X_{t\wedge T}^2\leq K^2.
$$
The first boundary <hitting time> is a <stopping time> in both cases: in the continuous case use the continuous-path hitting criterion, and in the jump case inspect the successive jump times. <Monotone convergence> now gives $\mathbb E T\leq K^2$, so $T<\infty$ almost surely. The stopped position tends to $X_T$ as $t\to\infty$ and is bounded, making <dominated convergence> applicable. Stopping $X$ at $t\wedge T$ and taking this limit yields $\mathbb E X_T=0$.

If $\pi=\mathbb P(X_T=-a)$, then $0=-a\pi+b(1-\pi)$. Thus in both cases the entire distribution is
$$
\boxed{\mathbb P(X_T=-a)=\frac{b}{a+b},\qquad
\mathbb P(X_T=b)=\frac{a}{a+b}.}
$$
This is the same balanced <gambler's ruin> law despite the different one-time distributions. As a further consistency check, passing to the limit in the stopped square-martingale identity gives
$$
\mathbb E T=\mathbb E X_T^2=a^2\frac{b}{a+b}+b^2\frac{a}{a+b}=ab.
$$
All uses of an unbounded exit time were obtained by limits of bounded-time sampling with an explicit bound on the stopped position.