# Calculate $\mathbb{E}(\tau^2)$ for an exit time $\tau$ of Brownian motion

I'm doing an exercise of Advanced Probability and I have some problem.

Given $a,b \in \mathbb{R}$ and let be $(B_t)_{t \ge 0}$ a Brownian motion, and let be $\tau$ the first time of exit of $B_t$ from $[-a,b]$ Show that $\mathbb{E}[\tau^2]=\frac13ab(a^2+3ab+b^2)$

I showed that

$$(B^3_t-3tB_t)_{t \ge 0}, \hspace{1cm} (B^4_t-6tB^2_t+3t^2)_{t \ge 0}$$ are martingales, and I obtain a form of $\mathbb{E}[\tau^2]$ from the second one martingale but i don't know how to continue.

Could someone help me please? Thanks.

First of all, note that it follows from the continuity of the sample paths of Brownian motion that $B_{\tau} \in \{-a,b\}$. Since $(B_t)_{t \geq 0}$ is a martingale, the optional stopping theorem shows that $(B_{t \wedge \tau})_{t \geq 0}$ is a martingale, and therefore we have in particular

$$\mathbb{E}(B_{t \wedge \tau}) = \mathbb{E}(B_0) =0.$$

As $|B_{t \wedge \tau}| \leq \max\{a,b\}$ we can apply the dominated convergence theorem to let $t \to \infty$:

$$\mathbb{E}(B_{\tau}) = 0,$$

which means that

$$-a \mathbb{P}(B_{\tau}=-a) + b \mathbb{P}(B_{\tau}=b)=0.$$

On the other hand, we know that

$$\mathbb{P}(B_{\tau}=-a) + \mathbb{P}(B_{\tau}=b)=1.$$

Solving this linear system we get

$$\mathbb{P}(B_{\tau}=-a) = \frac{b}{b+a} \qquad \mathbb{P}(B_{\tau}=b) = \frac{a}{a+b}. \tag{1}$$

Using a similar reasoning as in the first part of the proof and the fact that $(B_t^3-3tB_t)_{t \geq 0}$ is a martingale, we find from the optional stopping theorem that

$$\mathbb{E}(B_{\tau}^3) = 3 \mathbb{E}(B_{\tau} \tau).$$

By $(1)$, this means that

$$\mathbb{E}(B_{\tau} \tau) = \frac{(-a)^3}{3} \frac{b}{a+b} + \frac{b^3}{3} \frac{a}{a+b},$$

i.e.

$$(-a) \mathbb{E}(\tau 1_{\{B_{\tau}=-a\}}) + b \mathbb{E}(\tau 1_{\{B_{\tau}=b\}}) = \frac{ab}{3(a+b)} \left(-a^2+b^2 \right). \tag{2}$$

On the other hand, we have

$$\mathbb{E}(B_{\tau}^2) = \mathbb{E}(\tau)$$

(apply optional stopping to $(B_t^2-t)_{t \geq 0}$) and so

$$a^2 \frac{b}{a+b} + b^2 \frac{a}{a+b} = \mathbb{E}(\tau) = \mathbb{E}(\tau 1_{\{B_{\tau}=-a\}}) + \mathbb{E}(\tau 1_{\{B_{\tau}=b\}}). \tag{3}$$

Equation $(2)$ and $(3)$ are a system of linear equations for

$$x:= \mathbb{E}(\tau 1_{\{B_{\tau}=-a\}}) \quad \text{and} \quad y := \mathbb{E}(\tau 1_{\{B_{\tau}=b\}})$$

which I leave to you to solve; using this information you can calculate $\mathbb{E}(\tau B_{\tau}^2)$. Finally, by another application of the optional stopping theorem,

$$\mathbb{E}(\tau^2) = - \frac{1}{3} \mathbb{E}(B_{\tau}^4) + 2 \mathbb{E}(\tau B_{\tau}^2).$$

Since $(1)$ gives $\mathbb{E}(B_{\tau}^4)$ and we have already calculated $\mathbb{E}(B_{\tau} \tau^2)$, we can finally compute $\mathbb{E}(\tau^2)$.

Note first that, by homogeneity and invariance by translation of the Brownian motion, the exit time of $[-a,b]$ starting from $0$ is distributed like $(a+b)^2$ times the hitting time of $[0,1]$ starting from $x=\frac{a}{a+b}$, hence it suffices to solve the case $a=0$, $b=1$, $x$ in $(0,1)$, which we assume now, to deduce the general case $a>0$, $b>0$, $x=0$.

We first compute $$u(x)=E_x(\tau)$$ For every $0<h<\min\{x,1-x\}$, consider the exit time $\sigma_h$ of $[x-h,x+h]$. Using the martingale $$M_t=(B_t-x)^2-t$$ one sees that $E_x(M_{\sigma_h})=E_x(M_0)=0$ hence $E_x(\sigma_h)=h^2$. The Markov property at time $\sigma_h$ then yields $$u(x)=E_x(\sigma_h)+\frac12(u(x-h)+u(x+h))$$ that is, $$u(x-h)+u(x+h)-2u(x)=-2h^2$$ When $h\to0$, this shows that $$u''(x)=-2$$ Since $u(0)=u(1)=0$, one gets $$u(x)=x(1-x)$$ for every $x$ in $[0,1]$.

Likewise, let $$v(x)=E_x(\tau^2)$$ Then, using the martingale $$K_t=(B_t-x)^4-6t(B_t-x)^2+3t^2$$ one sees that $E_x(K_{\sigma_h})=E_x(K_0)=0$ hence $$h^4-6h^2E_x(\sigma_h)+3E_x(\sigma_h^2)=0$$ that is, $E_x(\sigma_h^2)=\frac53h^4$. Then, the Markov property at time $\sigma_h$ yields $$v(x)=E_x(\sigma_h^2)+2E_x(\sigma_h)\frac12(u(x+h)+u(x-h))+\frac12(v(x-h)+v(x+h))$$ that is, $$v(x-h)+v(x+h)-2v(x)=-2h^2(u(x+h)+u(x-h))+o(h^2)$$ When $h\to0$, this shows that $$v''(x)=-4u(x)$$ Since $v(0)=v(1)=0$, one gets $$v(x)=\frac13x(1-x)(1+x(1-x))$$ for every $x$ in $[0,1]$.

Returning to the general case of the interval $[-a,b]$, one uses the formula for the exit time of $[0,1]$ starting at $$x=\frac{a}{a+b}$$ hence $$x(1-x)=\frac{ab}{(a+b)^2}$$ Then $$E_0(\tau)=(a+b)^2\frac{ab}{(a+b)^2}=ab$$ and $$E_0(\tau^2)=(a+b)^4\frac13\frac{ab}{(a+b)^2}\left(1+\frac{ab}{(a+b)^2}\right)=\frac13ab((a+b)^2+ab)$$