Let $B$ be a standard Brownian motion. What's the probability that in the time interval $[0,t]$ the trajectory crosses $y=a$ and $y=-a$ ($a>0$) at least once and $B_{t} \in [-a,a]$?
This didn't sound too difficult, since I know that the distribution of $(S_t,B_t)$ is $p(x,y)=\frac{2(2x-y)e^{-(2x-y)^2/(2t)}}{\sqrt{2\pi t^3}}1_{x>0,y<x}$, where $S_t$ is $\sup_{[0,t]}B$.
Consider one of the path I'm interested in. By symmetry, I'm going to assume it hits $y=a$ for the first time before it hits $y=-a$. The other scenario happens with the same probability and everything works the same so it doesn't matter.
My idea to use the density $p$ is to wait until the Brownian motion hits $y=a$ for the first time, then reflect the Brownian motion that follows across this line $y=a$ to find a bijection between the trajectories I'm interested in, and the trajectories such that $S_{t} \geq 3a$ and $3a \geq B_{t}\geq a$ (by reflection the corresponding trajectories by the bijection are equiprobable), so the probability I'm looking for should be
$$\int_{x=3a}^{x=+\infty}\int_{y=a}^{y=3a} p(x,y)dxdy$$
However, I'm getting different results using Matlab. I don't know which one is wrong : my analytical solution or my numerical solution. Could somebody confirm that my reasoning is sound?