Properties of a SDE Consider the SDE
$$
      d X_t = a X_t d t + b X_t d W_t, \  
        X_0 = x_0,
$$
$X_t\in [0,\infty)$, where $a$, $b$, $x_0$ are all positive constants.
(a) I want to show that
$$
  \frac{d}{d t}\mathbb{E}[ X_t] = a\mathbb{E}[X_t], 
\\
 \frac{d}{d t}\mathbb{E}\big[X^2_t\big] = 
\big(2a + b^2\big)\mathbb{E}\big[X^2_t\big],
\\
\text{Var}[X_t] = x_0^2 e^{2at}\left(e^{b^2t}-1\right).
$$
and
$$
           \mathbb{E}\big[ X_s X_{\tau}\big],
$$
where $0\le s\le \tau$. Suppose $X_{t}=g(t,W_{t})$, by Ito's formula, we have
$$
X_{T}-X_{0}=\int_{0}^{T}g_{x}(t,x)\, d W_{t}+\int_{0}^{T}g_{t}(t,x)\, d t+\frac {1}{2}\int_{0}^{T}g_{xx}(t,x)\, d t.
$$
To solve this SDE, we need to find a function $g$ satisfying:
$$
\partial_{x}g(t,x)=bx\quad\text{and}\quad \frac {1}{2}\partial_{xx}g(t,x)+\partial_{t}g(t,x)=ax.
$$
By solving the above two equations, we get $g(t,x)=x_{0}\text{exp}\left(\left(a-\frac {1}{2}b^2\right)t+bx\right)$. Therefore, we conclude that $X_{t}=x_{0}\text{exp}\left(\left(a-\frac {1}{2}b^2\right)t+bW_{t}\right)$ solves this SDE. Since $W_{t}\sim$N($0,t$), we have
$$
\mathbb {E}\left[X_{t}\right]=x_{0}e^{\left(a-\frac {1}{2}b^2\right)t}.
$$
However,
$$
\frac{d}{d t}\mathbb{E}[ X_t] =\left(a-\frac {1}{2}b^{2}\right)x_{0}e^{\left(a-\frac {1}{2}b^2\right)t}\neq a\mathbb{E}[X_t].
$$
I wonder what's the issue here.
 A: The mistake lies in the penultimate step. You have $X_t =x_0 e^{\left(a-\frac{b^2}{2}\right)t +b W_t}$. It follows then that
\begin{align}
\mathbb{E}(X_t) = x_0e^{\left(a-\frac{b^2}{2}\right)t} \int_{\mathbb{R}} e^{bx}\mathrm{d}\mu_t(x) \, ,
\end{align}
where $\mu_t=\mathcal{N}(0,t)$. We can simplify this as follows
\begin{align}
\mathbb{E}(X_t) =& x_0e^{\left(a-\frac{b^2}{2}\right)t} \int_{\mathbb{R}} e^{\frac{b^2}{2}t}\frac{1}{\sqrt{2\pi t}}e^{-\frac{(x-bt)^2}{2 t}} \, \mathrm{d}x\, , \\
=&x_0 e^{at} \, .
\end{align}
Differentiate and you will have your answer.
Edit: For the second part set $g(t,x)=x^2$. Then, by Itô's formula, we have
\begin{align}
d g(t,X_t) = a g'(t,X_t) X_t\,  \mathrm{d}t + \frac{b^2}{2}g''(t,X_t) X_t^2 \, \mathrm{d}t + b g'(t,X_t)X_t \, dW_t \, .
\end{align}
Plugging in the values of $g,g',g''$, we obtain
\begin{align}
dX_t^2 = 2a X_t^2 \,  \mathrm{d}t + b^2 X_t^2 \, \mathrm{d}t + 2 b X_t^2 \, dW_t \, .
\end{align}
Take expectation and you will have your result.
