Expectation of a stopping time w.r.t Brownian motion 
For a real-valued standard Brownian motion $B= (B_t)_{t\geq 0}$ we define the stopping times
$ \tau_{a} := \inf \left\{  t> 0: B_t \leq a \right\},~a <0$,
$ \tau_{b} := \inf \left\{  t> 0: B_t \geq b \right\},~ b >0$,
$ \tau := \min (\tau_a , \tau_b). $
Prove for every $\lambda \in \mathbb{R}$
$$\mathbb{E} \left[\exp\left\{- \frac{\lambda^2 \tau}{2} \right\} \mathbf{1}_\left\{\tau = \tau_a \right\}\right] = \frac{\sinh (\lambda b)}{\sinh (\lambda(b-a))}. $$

Using Doob's optional sampling theorem, I get
$$ \mathbb{E} \left[ \exp\left(\lambda B_{\tau}- \frac{1}{2}\lambda^2 \tau \right) \right] = 1$$
I'm having trouble with the dependence of $\lambda B_{\tau}$ and $\frac{1}{2}\lambda^2 \tau$. When I use Doob's theorem on $\tau_a$ or $\tau_b$ instead of on $\tau$, I obtain
$$\mathbb{E} \left[\exp\left\{- \frac{\lambda^2 \tau_a}{2} \right\} \right] = \exp(-\lambda a ) \quad \text{and} \quad
\mathbb{E} \left[\exp\left\{- \frac{\lambda^2 \tau_b}{2} \right\} \right] = \exp(-\lambda b ).$$
Im not sure if that helps anything.
From here i don't know how to proceed.
I hope anybody can help me out here.
 A: Clearly,
$$\begin{align*}1&= \mathbb{E} \exp \left( \lambda B_{\tau} - \frac{1}{2} \lambda^2 \tau \right) \\ &= \mathbb{E} \left[ 1_{\{\tau=\tau_a\}} \exp \left( \lambda B_{\tau} - \frac{1}{2} \lambda^2 \tau \right) \right] + \mathbb{E} \left[ 1_{\{\tau=\tau_b\}} \exp \left( \lambda B_{\tau} - \frac{1}{2} \lambda^2 \tau \right) \right] \\ &= \mathbb{E} \left[ 1_{\{\tau=\tau_a\}} \exp \left( \lambda a - \frac{1}{2} \lambda^2 \tau_a \right) \right] + \mathbb{E} \left[ 1_{\{\tau=\tau_b\}} \exp \left( \lambda b - \frac{1}{2} \lambda^2 \tau_b \right) \right] \\ &= e^{\lambda a} \mathbb{E} \left[ 1_{\{\tau=\tau_a\}} \exp \left(- \frac{1}{2} \lambda^2 \tau_a \right) \right] +  e^{\lambda b} \mathbb{E} \left[ 1_{\{\tau=\tau_b\}} \exp \left(- \frac{1}{2} \lambda^2 \tau_b \right) \right]. \tag{1} \end{align*}$$
Replacing $\lambda$ by $-\lambda$ we find
$$1 = e^{-\lambda a} \mathbb{E} \left[ 1_{\{\tau=\tau_a\}} \exp \left(- \frac{1}{2} \lambda^2 \tau_a \right) \right] +  e^{-\lambda b} \mathbb{E} \left[ 1_{\{\tau=\tau_b\}} \exp \left(- \frac{1}{2} \lambda^2 \tau_b \right) \right]. \tag{2}$$
This means that we have a system of linear equations $$\begin{align*} 1&=e^{\lambda a} u + e^{\lambda b} v\\ 1&= e^{-\lambda a} u + e^{-\lambda b} v \end{align*}$$  for the two unknown variables $$ u:=\mathbb{E} \left[ 1_{\{\tau=\tau_a\}} \exp \left(- \frac{1}{2} \lambda^2 \tau_a \right) \right] \quad \text{and} \quad v:= \mathbb{E} \left[ 1_{\{\tau=\tau_b\}} \exp \left(- \frac{1}{2} \lambda^2 \tau_b \right) \right].$$
Solve this linear system and you are done.
