Lets assume that Brownian Motion starts from some point $x$ for which $a<x<b$ holds. Let $\tau=\inf\{t:B_t\not\in [a,b]\}$ be a stopping time. Now I want to prove that for $\theta>0$ ,an appropriate martingale and the Optional Sampling Theorem the following holds; $$\mathbb E[\exp(-\frac{1}{2}\theta^2\tau)|B_0=x]=\frac{\cosh(\theta(x-(a+b)/2))}{\cosh(\theta(b-a)/2)}$$
My first idea was to rewrite the RHS using $\exp$ expressions instead of $\cosh$ expressions but this is only a formal thing.
My second thought was that it has something to with the result presented here: The Laplace transform of the first hitting time of Brownian motion
So we use $M_t=\exp(\theta B_t-\frac{1}{2}\theta^2 t)$ as the "appropriate integral" and the Laplace transform of $H_a=\inf\{t: B_t>a\}$ but I do not see how these things should be connected, may you have some idea.