Martingale property of a stochastic process Suppose $(X_t)_{t\ge0}$ follows $dX_t=dt+X_t\,dW_t$ and $X_0=x\ge0$. It's not too hard to see that $\mathbb{E}[X_t]-x=t$ because the Ito integral of $X_t\,dW_t$ averages out to zero. How would I go about finding $\mathbb{E}[X_t^2]$? Is it true that the Ito integral of $X_t^2\,dW_t$ averages out to zero as well?
This question is related to this one.
 A: There is the following well-known statement which you can find in (almost) any book on stochastic differential equations:

Let $\sigma$ and $b$ be two globally Lipschitz continuous functions. Then there exists a unique (strong) solution to the SDE $$dX_t = b(X_t) \, dt + \sigma(X_t) \, dW_t$$ for any (square-integrable) initial distribution and, moreover, $$\mathbb{E} \left( \sup_{s \leq t} |X_s|^2 \right)<\infty \qquad \text{for all $t \geq 0$.} \tag{$\star$}$$

Applying this result we find that the solution $(X_t)_{t \geq 0}$ to the given SDE is square integrable (in the sense of $(\star$)). Since this gives
$$\int_0^t \mathbb{E}(X_s^2) \, ds < \infty$$
for any $t \geq 0$, we get that the stochastic integral $\int_0^t X_s^2 \, dW_s$ is a martingale.

Regarding the calculation of $\mathbb{E}(X_t^2)$: It follows from Itô's formula that
$$X_t^2-X_0^2 = 2 \int_0^t X_s \, dX_s + \langle X \rangle_t$$
where $\langle X \rangle_t$ denotes the angle bracket:
$$\langle X \rangle_t = \int_0^t X_s^2 \, ds.$$
Using that
$$dX_t = \, dt + X_t \, dW_t$$
we get
$$X_t^2-x^2 = 2 \int_0^t X_s^2 \, dW_s + 2 \int_0^t X_s \, ds + \int_0^t X_s^2 \, ds. \tag{1}$$
The stochastic integral
$$M_t := \int_0^t X_s^2 \, dW_s$$
is a martingale (see the first part of this answer), and therefore we have in particular $\mathbb{E}(M_t) = \mathbb{E}(M_0)=0$. Consequently, $(1)$ gives
$$\mathbb{E}(X_t^2)-x^2 = 2 \int_0^t \mathbb{E}(X_s) \, ds+ \int_0^t \mathbb{E}(X_s^2) \, ds.$$
As $\mathbb{E}(X_s) = x+s$, we get
$$\mathbb{E}(X_t^2)-x^2 = 2xt + t^2 + \int_0^t \mathbb{E}(X_s^2) \, ds$$
which shows that $\varphi(t) := \mathbb{E}(X_t^2)$ solves the ODE
$$\varphi'(t) = 2(x+t) + \varphi(t), \qquad \varphi(0)=x^2.$$
The solution is given by
$$\mathbb{E}(X_t^2) =\varphi(t) = -2(x+t+1)+e^{t} (x^2+2x+2).$$
