Consider the Cox-Ingersoll-Ross (CIR) interest rate model: $\displaystyle d r_t = \kappa (\theta - r_t) \, d t + \sigma \sqrt{r_t} \,d W_t$ where $\kappa$, $\theta$, $\sigma$ are positive constants and $W_t$ is a standard Brownian motion.
A solution to the CIR stochastic differential equation is given by: $$ r_t = \theta + (r_0 - \theta) e^{-\kappa t} + \sigma e^{-\kappa t} \int_0^t e^{\kappa u} \sqrt{r_u} \,d W_u.$$
Since $\displaystyle d W_u \sim N(0, du)$ it is easy to derive that:
$$\mathrm{E}\left[r_t\right] = \theta + (r_0 - \theta) e^{-\kappa t}.$$
However, I am stuck on deriving the variance. I got as far as below. Anyone know how to solve for the variance?
Thanks.
My derivation so far:
$$ \operatorname{Var}\left[r_t\right] = \mathrm{E}\left[\left\{r_t - \mathrm{E}\left(r_t\right)\right\}^2\right] = \sigma^2 e^{-2 \kappa t} \mathrm{E}\left[\left\{\int_0^t e^{\kappa u} \sqrt{r_u} d W_u\right\}^2\right].$$
What to do with the square of that integral? The solution I found states:
$$ \sigma^2 e^{-2 \kappa t} \mathrm{E}\left[\left\{\int_0^t e^{\kappa u} \sqrt{r_u} \,d W_u\right\}^2\right] = \sigma^2 e^{-2 \kappa t} \int_0^t e^{2 \kappa u} \mathrm{E}\left(r_u\right) \,d u$$
and continues onwards from here. But I don't get how you can take the square inside the integral.