# SDE Integration: Normal-Mean Reverting Process - Question

I am trying to figure out how a particular SDE can be integrated. The SDE is the normal mean-reverting model:

$dX_t = \theta(\mu - X_t)dt + \sigma dW_t$ (1)

Where $W_t - N(0,t)$. So far, I have found the solution of:

$X_t = X_0e^{-\theta t} + \mu(1-e^{-\theta t}) + e^{-\theta t} \int^t_0 \sigma e^{\theta s} dW_s$ (2)

This is standard and easy enough to find. However, I am looking to decompose this solution into the form.

$X_T = X_0 + (\mu - X_0)(1 - e^{-\theta t})+\sigma \sqrt{\frac{1-e^{-2\theta t}}{2 \theta}}W_t$ (3)

I have found that adding to the right-hand side of (2), $X_0 - X_0$, is a nice trick to get the two left terms on the right-hand side of (3). I am also confident that one needs to find the variance and mean of the integral term in (2) to get the solution for (3). However, I am not sure how to go about doing this.

If anyone can help, I'd be very appreciative. Thanks.

There is a closed solution formula for SDEs of the form $dX_t = (a_t+c_tX_t)dt+(b_t+d_tX_t)dW_t, \, X_0 = \bar{X}$. The solution is $X_t = \mu_t H_t$ with $\mu_t = \bar{X} + \int_0^t \frac{1}{H_s} (a_s-b_sd_s)ds + \int_0^t \frac{1}{H_s} b_s dW_s$
$H_t = \exp\left(\int_0^t (c_s -\frac{1}{2} d_s^2)ds + \int_0^t d_s dW_s \right)$.
Edit: Sorry I got your question wrong, this step you've already done. To obtain the desired form of the solution you have to calculate $\int_0^t e^{\theta t}dW_s$ and for this you can use the folowing, well known variance result on stochastic integrals: $\mathbb{E}\left[ \left( \int_a^b f(s,\cdot) dW_s \right)^2 \right] = \int_a^b \mathbb{E}[(f(s,\cdot)^2]ds$ which follows from the Ito - isometry for $f\in L^2_{\omega}([a,b])$. By that you get $(\int_0^t e^{\theta s} dW_s)^2 = \int_0^t e^{2\theta s}$, hence $\int_0^t e^{\theta s} dW_s = \sqrt{\frac{1}{2\theta}(e^{2\theta t}-1)}$ and by that you're done.