Setup

With

$$ T=\inf\{t\ge 0:B_t=-a \text{ or } B_t=b\}, $$

we want $\mathbb E[T]$.

Martingale used

Use the martingale

$$ B_t^2-t. $$

Applying OST gives

$$ \mathbb E[B_T^2-T]=0, $$

so

$$ \mathbb E[T]=\mathbb E[B_T^2]. $$

Compute the value

Using the exit probabilities,

$$ \mathbb E[B_T^2]

b^2\cdot \frac{a}{a+b} + a^2\cdot \frac{b}{a+b} =ab. $$

Therefore

$$ \mathbb E[T]=ab. $$