# Solving a SDE and finding its related moments

I am attempting to answer this multi-part question, and hope you can provide any feedback on any of my workings. My apologies for the length and thank you in advance for any help!

i) Let $g$ be a continuous, deterministic function. Consider the SDE $$dX(t) = -g(t)X(t)dt + \sigma dB(t), X(0)=x$$ where $\sigma$ is a constant. Let $G(t) = \int_{0}^{t} g(s)\ ds$ so that $G'(t)= g(t)$. By letting $Y(t) = e^{G(t)}X(t)$ or otherwise solve the SDE.

Using Ito's Lemma, I obtained: $$X(t) = xe^{-G(t)} + \sigma \int_{0}^{t} e^{G(s) - G(t)}\ dB(s)$$

ii) Calculate $E[X(t)]$ I have the stochastic integral portion of $X(t)$ satisfying a martingale, leaving the deterministic function as the mean.

$$E[X(t)] = xe^{-G(t)}$$

iii) Let $\int_{0}^{t} e^{2G(s)} = D(t)$. Find $Var[X(t)]$ in terms of $D(t)$ for this process

$$var[X(t)]= E\left[ \left(xe^{-G(t)} + \sigma \int_{0}^{t} e^{G(s) - G(t)}\ dB(s) - xe^{-G(t)}\right)^2 \right]$$ Using Isometry property: $$=\sigma^2 e^{-2G(t)} \int_{0}^{t} E[e^{2G(s)}] ds = \sigma^2 e^{-2G(t)} D(t)$$

iv) Find the moment generating function $E[e^{sX(t)}]$ for $X$:

Using moments previously found $$= exp \left\{ sxe^{-G(t)} + \frac{1}{2}s^2 \sigma^2 e^{-2G(t)} D(t) \right\}$$

v) Calculate $E[X(t)e^{X(t)}]$ $$= E[X(t)]E[e^{X(t)}] = xe^{-G(t)} \times exp\left\{ xe^{-G(t)} + \frac{1}{2}\sigma^2e^{-G(t)}D(t) \right\}$$

-