Solving a linear backward stochastic differential equation Let $W=\{W_t\}_{t\in[0;T]}$ be a real-valued Brownian motion, $\{F_t\}_{t\in [0;T]}$ the filtration generated by $W$, augmented with the nullsets, let $\{B_t\}_{t\in[0;T]}$ be an adapted process and let $X$ be an $\mathcal F_T$-measurable real-valued random variable. According to my source, under some regularity conditions,
$$
X_t := \mathbb E\bigg( X \exp\bigg(\int^T_t B_u \mathrm du\bigg) \,\Big|\, \mathcal F_t \bigg)
$$
is a solution to the backward stochastic differential equation (BSDE)
$$
- \mathrm dX_t
=
B_t X_t \mathrm dt
+ Z_t \mathrm dW_t,
\quad
X_T = X.
$$
How can I prove that? I thought to prove that the so constructed $\mathrm dX_t + B_t X_t \mathrm dt$ is a martingale, i.e. that for all $s \le t$,
$$
0
\overset{!}{=}
\mathbb E\bigg( X_t - X_s + \int^t_s B_u X_u \mathrm du \,\Big|\, \mathcal F_s \bigg)
$$
But how can I approach the last summand? Under some good conditions, probably,
$$
\begin{align*}
\mathbb E\bigg( \int^t_s B_u X_u \mathrm du \,\Big|\, \mathcal F_s \bigg) &= \int^t_s \mathbb E\big( B_u X_u \,|\, \mathcal F_s\big) \mathrm du \\
&= \int^t_s \mathbb E\bigg( B_u \mathbb E\bigg( X \exp\bigg(\int^T_u B_v \mathrm dv\bigg) \,\Big|\, \mathcal F_u \bigg) \,\Big|\, \mathcal F_s\bigg) \mathrm du.
\end{align*}$$
However, I don't see the next step. Or is my approach completely wrong?
 A: Define the dual process $\Gamma_t$ as the solution to the pathwise ODE: $$d\Gamma_t = \Gamma_t B_tdt \qquad \Gamma_0 = 1$$ so that $\Gamma_t = \exp\left( \int_0^t B_s ds \right)$. Now, consider the process $M_t = \Gamma_t X_t$. Itô's product rule tells us that:
$$dM_t = - \Gamma_t Z_t dW_t$$
and $M_0 = \Gamma_0 X_0 = X_0$, so that $M_t$ is a local martingale. Under some regularity conditions (e.g. if $B$ is bounded), one has $\mathbb{E}(\sup_t |\Gamma_t|^2) <\infty$, so that the Burkholder-Davis-Gundy inequality gives us: $$\mathbb{E} \left[ \left( \int_0^T \Gamma_s^2Z_s^2 ds \right)^{1/2} \right] < \infty$$
so that in fact $(M_t)_{t \in [0,T]}$ is a uniformly integrable martingale. Since $$M_T = X_T \Gamma_T = X \exp\left( \int_0^T B_s ds \right)$$ it follows that:
$$
\begin{align*}
M_t &= \mathbb{E}(M_T | \mathcal{F}_t) \\
&= \mathbb{E}\left(X \exp\left( \int_0^T B_s ds \right) | \mathcal{F}_t\right) \\
&= \mathbb{E}\left(X \exp\left( \int_t^T B_s ds \right) | \mathcal{F}_t\right)\exp\left( \int_0^t B_s ds\right)
\end{align*}$$
where the last equality follows since $\exp\left( \int_0^t B_s ds \right)$ is $\mathcal{F}_t$-measurable. Finally,
$$X_t = \Gamma_t^{-1}M_t =\mathbb{E}\left(X \exp\left( \int_t^T B_s ds \right) | \mathcal{F}_t\right)$$
as desired.
A: Now I saw a direct way to prove that. Let
$$
Y_t := \mathbb E\bigg( X \exp\bigg( \int^T_0 B_s \mathrm ds \bigg) \,\Big|\, \mathcal F_t\bigg).
$$
If e.g. $B$ is bounded, this is a martingale, i.e. $\mathrm dY_t = Z^Y_t \mathrm dW_t$. Then
$$
X_t = Y_t \exp\bigg( -\int^t_0 B_s \mathrm ds \bigg) 
$$
and hence
$$
\mathrm dX_t
\\
=
Y_t \cdot (-B_t) \exp\bigg( -\int^t_0 B_s \mathrm ds \bigg) \mathrm dt
+ \exp\bigg( -\int^t_0 B_s \mathrm ds \bigg) \mathrm dY_t
\\
=
- B_t X_t \mathrm dt + (\ldots) \mathrm dW_t.
$$
Thanks for your inspiration.
