For a linear backward stochastic differential equation (BSDE): for any given $\xi \in L^2(\mathscr{F}_T)$, $$-dY_s = (a_s Y_s + b_s Z_s +c_s)ds-Z_sdB_s$$ Where $a_t,b_t,c_t \in L^2_\mathscr{F}(0,T;R)$, $a_t, b_t$ are bounded, with the terminal condition $Y_T = \xi$.
It is easy to check this BSDE has a unique solution (by the theorem of existence and uniqueness of BSDE). One way to find the solution is to use SDE: $$dX_s = a_s X_s ds + b_s X_s dB_s$$ With $X_t = 1$. We then calculate $d(X_sY_s)$ which we wish is a martingale, so we can use the conditional expectation to find out $X_sY_s$.
Here comes the problem. When I calculate the $d(X_sY_s)$, the result shows it is not a martingale. The following is my step.
$$ \begin{align} d(X_sY_s) &= X_sdY_s+Y_sdX_s + dX_sdY_s \\ &=X_s[-(a_sY_s+b_sZ_s+c_s)ds+Z_sdB_s]+Y_S(a_sX_sds+b_sX_sdB_s)+dX_sdY_s \end{align} $$
Since we know $dX_sdY_s$ is a quadratic variation, we have:
$$d(X_sY_s) = X_sc_sds + X_sZ_sdB_s + bsY_sX_sdB_s$$
I think there’s something wrong and I really have no idea about how to solve it.