Compute expectation of stopped Brownian motion Let $B_t$ be a standard Brownian motion starting from $0$. Let $\tau_a$ be the hitting time of Brownian motion hitting $a$ and $a>0$. I want to calculate $E[X_T] = E[B_{T \wedge \tau_a}]$ with $X_t$ defined as $B_{t \wedge \tau_a}$. $T$ is some positive number.
Let $v_a(t)$ denote the density function of $\tau_a$, namely $v_a(t) = \frac{a}{\sqrt{2\pi}t^{\frac{3}{2}}}e^{-\frac{a^2}{2t}}$. 
I am not quite sure about the condition of optional stopping theorem here. And, since this theorem is not introduced in my class, our professor suggests that the following equation holds:
$$
\frac{d}{dt}E[X_t]=av_a(t) + \int_{-\infty}^a x\frac{\partial}{\partial t}u(t,x)\ dx
$$
where $u(t,x) = \frac{1}{\sqrt{2\pi t}}e^{-\frac{x^2}{2t}}$ is the density of $B_t$.
I don't know how this works and how to get this hint. Could anyone explain a little bit? Thank you for any help!
 A: Since $t \wedge \tau_a$ is a bounded stopping time, a direct application of the optional stopping theorem shows that $\mathbb{E}(B_{t \wedge \tau_a}) = \mathbb{E}(B_0)=0$, i.e. $\mathbb{E}(X_t)=0$ for all $t \geq 0$.
If you do not want to use the optional stopping theorem, then there are several possibilities to compute the expectation but as far as I can see the hint, which you were given, does not work. As
$$X_t = B_{t \wedge \tau_a} = a 1_{\{\tau_a \leq t\}} + B_t 1_{\{\tau_a>t\}}$$
we have
$$\mathbb{E}(X_t) = a \mathbb{P}(\tau_a \leq t) + \mathbb{E}(B_t 1_{\{\tau_a>t\}}). $$
Using that $\{\tau_a>t\} = \{M_t < a\}$ for $M_t := \sup_{s \leq t} B_s$, we get
$$\mathbb{E}(X_t) = a \mathbb{P}(\tau_a \leq t) + \mathbb{E}(B_t 1_{\{M_t < a\}}). \tag{1}$$
If we could replace the second term on the right-hand side by $\mathbb{E}(B_t 1_{\{B_t<a\}})$, then we could differentiate this identity with respect to $t$ to get the equation which you were given as a hint. However, I don't see why it should possible to replace the second term. Here are two alternative approaches:
Approach 1 via strong Markov property
As $\mathbb{E}(B_t)=0$ for all $t \geq 0$, we have
$$\mathbb{E}(B_t 1_{\{M_t<a\}}) = - \mathbb{E}(B_t 1_{\{M_t \geq a\}})$$
and so
$$\mathbb{E}(B_t 1_{\{M_t<a\}}) = - \mathbb{E}(B_t 1_{\{\tau_a \leq t\}}).$$
Using the tower property of conditional expectation and the strong Markov property of Brownian motion, we get
$$\begin{align*} \mathbb{E}(B_t 1_{\{M_t<a\}})&= - \mathbb{E} \bigg( \mathbb{E}(B_t 1_{\{\tau_a \leq t\}} \mid \mathcal{F}_{\tau}) \bigg) = - \mathbb{E} \bigg( 1_{\{\tau_a \leq t\}} \mathbb{E}^{B_{\tau_a}}(B_{t-s}) \big|_{s=\tau_a} \bigg). \tag{2} \end{align*}$$
Since $$\mathbb{E}^{B_{\tau_a}}(B_r) =\mathbb{E}^a(B_r) = \mathbb{E}(a+B_r) = a$$
for any $r \geq 0$, we conclude from $(2)$ that
$$\mathbb{E}(B_t 1_{\{M_t<a\}}) =- a \mathbb{P}(\tau_a \leq t). $$
Plugging this into $(1)$ we infer that $\mathbb{E}(X_t)=0$.
Approach 2 via joint density of $(B_t,M_t)$
It is known that the joint density of $(B_t,M_t)$ equals
$$q_t(x,y) = 1_{\{x<y\}} \frac{2(2y-x)}{\sqrt{2\pi t^3}} \exp \left(- \frac{(2y-x)^2}{2t} \right),$$
and therefore the second term on the right-hand side of $(1)$ equals
$$\begin{align*} \mathbb{E}(B_t 1_{\{M_t<a\}}) &=\frac{2}{\sqrt{2\pi t^3}} \int_{-\infty}^a \int_{-\infty}^y x (2y-x) \exp \left( - \frac{(2y-x)^2}{2t} \right) \, dx \, dy \\ &\stackrel{\text{Fubini}}{=} \frac{2}{\sqrt{2\pi t^3}} \int_{-\infty}^a x \int_{x}^a (2y-x) \exp \left( - \frac{(2y-x)^2}{2t} \right) \, dy \, dx. \end{align*}$$
The inner integral can be computed easily and we get
$$\begin{align*} \mathbb{E}(B_t 1_{\{M_t<a\}}) &= \frac{1}{\sqrt{2\pi t}} \int_{-\infty}^a x \left( \exp \left[ - \frac{x^2}{2t} \right] - \exp \left[ - \frac{(2a-x)^2}{2t} \right] \right) \, dx. \end{align*}$$
If we denote by $p_t$ the density of $B_t$ then we obtain
$$\begin{align*} \mathbb{E}(B_t 1_{\{M_t<a\}}) &= \int_{-\infty}^a x p_t(x) \, dx - 2a \int_{-\infty}^a p_t(2a-x) \, dx + \int_{-\infty}^a (2a-x) p_t(2a-x) \, dx. \end{align*}$$
Performing a simple change of variables ($z=2a-x$) we conclude that
$$\begin{align*} \mathbb{E}(B_t 1_{\{M_t<a\}}) &= \underbrace{\int_{-\infty}^{\infty} x p_t(x) \, dx}_{0} - 2a \int_{a}^{\infty} p_t(z) \, dz = - a \mathbb{P}(|B_t| > a). \end{align*}$$
By the reflection principle, we have $\mathbb{P}(|B_t| \geq a) = \mathbb{P}(M_t \geq a)$, and therefore our computation entails that the terms on the right-hand side of $(1)$ cancel each other, i.e. $\mathbb{E}(X_t)=0$.
