# Solving this SDE $dX_t = aX_tdt + bdW_t$, $X_0 = x$ to find $E[X_t^2]$

slightly related:Is there a specific term for this SDE?

Using $f(x_t, t ) = x_te^{at}$, then $df(x_t,t) = ax_te^{at} + e^{at}dx_t$

We can plug in the original question, $dX_t = aX_tdt + bdW_t$ which results in

$df(x_t,t) = be^{-at}dW_t$ then I get, $x_te^{-at} = \int_0^t{x_te^{-rt}dW_t}$

From here, I am unsure of how to get to $x_t = x_0e^{at}+be^{at}\int_0^t{e^{-at}dW_s}$ which is the final solution.

I also want to use the $x_t$ to find $E[x_t^2]$. I know that $E[x_t] = x_0e^{at}$ but don't know how to to do it when x is squared.

By application of Ito's lemma, we have $$d(e^{-at}X_t)=-a e^{at}X_t dt+e^{at}dX_t+\underbrace{d[e^{at},X_t]}_0 =e^{at}b dW_t$$ thus $$X_t=e^{-at}X_0+b\int_{0}^{t} e^{-a(t-s)}dW_s.$$ As a result $$\text{Var}(X_t)=b^2\text{Var}\left(\int_{0}^{t} e^{-a(t-s)}dW_t\right)=b^2\mathbb{E}\left[\left(\int_{0}^{t} e^{-a(t-s)}dW_s\right)^2\right]$$ By application of Ito's isometry formula, $$\text{Var}(X_t)=b^2\mathbb{E}\left[\int_{0}^{t} e^{-2a(t-s)}ds\right]=b^2\int_{0}^{t} e^{-2a(t-s)}ds=\frac{b^2}{2a}(1-e^{-2at})$$ Finally we have $$\mathbb{E}[X_t^2]=Var(X_t)+\mathbb{E}[X_t]^2$$

• So using my $E[x_t]^2$ equation, $E[X_t^2] = \frac{b^2}{2a}(1-e^{2at}) + (X_0e^{at})^2$? Commented Dec 16, 2016 at 12:19
• $$E[X_t]=X_0e^{-at}$$ Commented Dec 16, 2016 at 12:21
• ah I see thank you so much! I could understand this so much easier than I probably would have if I were on my own. Commented Dec 16, 2016 at 12:22
• How did you use Ito's formula in the first line to get $d(e^{-at}X_t) = e^{at}bdW_t$? I keep getting $d(e^{-at}X_t) = e^{-at}bdW_t$ Commented May 16, 2018 at 0:28
• @user2139 You are correct. There is a problem in sign in this answer. $X_{t}=X_{0}e^{at}+\int_{0}^{t}be^{(t-s)}dB_{s}$ . Commented Apr 28 at 12:01

This question is old but there are errors in signs and many typos in the accepted answer above. The answer is also has many upvotes (and rightfully so). But still, it posseses an issue for a reader.

By Applying Ito's product rule we get,

$$d(e^{-at}X_{t})=-ae^{-at}X_{t}dt+e^{-at}dX_{t}$$ which by using the original SDE, gives us that

$$d(e^{-at}X_{t})=e^{-at}b\cdot dW_{t}$$

This gives us that $$e^{-at}X_{t}=X_{0}+\int_{0}^{t}be^{-as}dW_{s}$$ and hence

$$X_{t}=X_{0}e^{at}+\int_{0}^{t}be^{a(t-s)}dW_{s}$$

Now, we can use that $$E(X_{t})=e^{at}E(X_{0})$$

And by Ito's Isometry, $$\text{Var}(X_{t})=e^{2at}\text{Var}(X_{0})+E\bigg(\int_{0}^{t}b^{2}e^{2a(t-s)}ds\bigg)$$

Which gives us that $$\text{Var}(X_{t})=e^{2at}Var(X_{0})+\frac{b^{2}(e^{2at}-1)}{2a}$$

Thus, $$\displaystyle E(X_{t}^{2})=E(X_{0}^{2})e^{2at}+\frac{b^{2}(e^{2at}-1)}{2a}$$

This also agrees with my answer here.