Solution (source code)

= Solution

The function $z\mapsto\log|z|$ is a <harmonic function> on the <annulus> $r_1<|z|<r_2$. The <Itô formula> therefore makes $\log|B_{t\wedge\tau}|$ a bounded <martingale>. The <optional sampling theorem for a supermartingale> gives
$$
\log r=\mathbb E[\log|B_\tau|]=p\log r_1+(1-p)\log r_2,
$$
where $p=\mathbb P(|B_\tau|=r_1)$. Solving this <linear equation> yields the <planar Brownian annulus hitting probability>
$$
p=\frac{\log r_2-\log r}{\log r_2-\log r_1}.
$$