# How do you find variance of a sde?

I know how to find the mean of an SDE: write it on integral form, take derivative, solve a simple ODE.

But what to do when we want a variance?

In my case, $$X_{T + \delta t} = X_T + \int_T^{T + \delta t} \lambda ( 1 -X)dt + \int_T^{T + \delta t} \sigma \sqrt{X} dW$$ and I want the variance, conditional on $X_T$.

Is there a simple approach?

## 1 Answer

Here are two approaches that you could take to compute the variance of $X_t$. I am not making the conditioning explicit as it just complicates the notation but doesn't really add any additional insights.

1. Compute $\mathbb{E} \left[ X_t \right]$ and $\mathbb{E} \left[ X_t^2 \right]$. You can then you use that

$$\text{Var} \left( X_t \right) = \mathbb{E} \left[ X_t^2 \right] - \mathbb{E} \left[ X_t \right]^2.$$

2. Compute the cumulant generating function

$$\psi_{X_t}(\omega) = \ln \left( \mathbb{E} \left[ e^{\mathrm{i} \omega X_t} \right] \right).$$

Then use that the $n$-th cumulant is linked to the $n$-th derivative of the cumulant generating function at $\omega = 0$

$$c_n \left( X_t \right) = \frac{1}{\mathrm{i}^n} \frac{\partial^n}{\partial \omega^n} \psi_{X_t}(0).$$

The first two cumulants are equal to the mean and variance, respectively.

In what follows, I am working out the first approach. In your case, the dynamics of $X$ are given by

$$\mathrm{d}X_t = \lambda \left( 1 - X_t \right) \mathrm{d}t + \sigma \sqrt{X}_t \mathrm{d}W_t.$$

Note that this is a special case of a square-root process with mean reversion speed $\lambda$ and a long-term mean of one. The solution here is thus a special case of the more general solution given e.g. in the context of the Cox-Ingersoll-Ross interest rate model or the Heston stochastic volatility model.

First, we remove the geometric drift term $-\lambda X_t \mathrm{d}t$ by setting $Y_t = e^{\lambda t} X_t$. Its differential is given by

\begin{eqnarray} \mathrm{d}Y_t & = & \lambda e^{\lambda t} X_t \mathrm{d}t + e^{\lambda t} \mathrm{d}X_t\\ & = & \lambda e^{\lambda t} \mathrm{d}t + \sigma e^{\lambda t} \sqrt{X_t} \mathrm{d}W_t\\ & = & \lambda e^{\lambda t} \mathrm{d}t + \sigma e^{\lambda t / 2} \sqrt{Y_t} \mathrm{d}W_t. \end{eqnarray}

Integrating yields

\begin{eqnarray} Y_t & = & Y_0 + \lambda \int_0^t e^{\lambda u} \mathrm{d}u + \sigma \int_0^t e^{\lambda u / 2} \sqrt{Y_u} \mathrm{d}W_u\\ & = & Y_0 + e^{\lambda t} - 1 + \sigma \int_0^t e^{\lambda u / 2} \sqrt{Y_u} \mathrm{d}W_u. \end{eqnarray}

Since $\mathbb{E} \left[ X_t \right] = e^{-\lambda t} \mathbb{E} \left[ Y_t \right]$, we conclude that

$$\mathbb{E} \left[ X_t \right] = e^{-\lambda t} X_0 + \left( 1 - e^{-\lambda t} \right).$$

Next, we compute the differential of $Y_t^2$ and get

\begin{eqnarray} \mathrm{d} Y_t^2 & = & 2 Y_t \mathrm{d}Y_t + \mathrm{d} \langle Y \rangle_t\\ & = & 2 \lambda e^{\lambda t} Y_t \mathrm{d}t + 2 \sigma e^{\lambda t / 2} Y_t \sqrt{Y_t} \mathrm{d}W_t + \sigma^2 e^{\lambda t} Y_t \mathrm{d}t. \end{eqnarray}

Integrating again gives

$$Y_t^2 = Y_0^2 + \left( 2 \lambda + \sigma^2 \right) \int_0^t e^{\lambda u} Y_u \mathrm{d}u + 2 \sigma \int_0^t e^{\lambda u / 2} Y_u \sqrt{Y_u} \mathrm{d}W_u.$$

The expectated value is

\begin{eqnarray} \mathbb{E} \left[ Y_t^2 \right] & = & Y_0^2 + \left( 2 \lambda + \sigma^2 \right) \int_0^t e^{\lambda u} \mathbb{E} \left[ Y_u \right] \mathrm{d}u\\ & = & Y_0^2 + \left( 2 \lambda + \sigma^2 \right) \int_0^t e^{\lambda u} \left( Y_0 + e^{\lambda u} - 1 \right) \mathrm{d}u\\ & = & Y_0^2 + \left( 2 \lambda + \sigma^2 \right) \left( \frac{1}{\lambda} \left( Y_0 - 1 \right) \left( e^{\lambda t} - 1 \right) + \frac{1}{2 \lambda} \left( e^{2 \lambda t} - 1 \right) \right) \end{eqnarray}

Since $\mathbb{E} \left[ X_t^2 \right] = e^{-2 \lambda t} \mathbb{E} \left[ Y_t^2 \right]$, we get

\begin{eqnarray} \mathbb{E} \left[ X_t^2 \right] & = & e^{-2 \lambda t} X_0^2 + \left( 2 \lambda + \sigma^2 \right) \left( \frac{1}{\lambda} \left( X_0 - 1 \right) \left( e^{-\lambda t} - e^{-2 \lambda t} \right) + \frac{1}{2 \lambda} \left( 1 - e^{-2 \lambda t} \right) \right)\\ & = & e^{-2 \lambda t} X_0^2 + 2 X_0 \left( e^{-\lambda t} - e^{-2 \lambda t} \right) + \frac{\sigma^2}{\lambda} X_0 \left( e^{-\lambda t} - e^{-2 \lambda t} \right)\\ & & + \left( 1 - e^{-\lambda t} \right)^2 + \frac{\sigma^2}{2 \lambda} \left( 1 - e^{-\lambda t} \right)^2. \end{eqnarray}

Since

\begin{eqnarray} \left( \mathbb{E} \left[ X_t \right] \right)^2 = e^{-2 \lambda t} X_0^2 + 2 X_0 \left( e^{-\lambda t} - e^{-2 \lambda t} \right) + \left( 1 - e^{-\lambda t} \right)^2, \end{eqnarray}

it follows that the variance of $X_t$ is given by

$$\text{Var} \left( X_t \right) = \frac{\sigma^2}{\lambda} X_0 \left( e^{-\lambda t} - e^{-2 \lambda t} \right) + \frac{\sigma^2}{2 \lambda} \left( 1 - e^{-\lambda t} \right)^2.$$