Skip to content
homeaboutworkprojectsthesiswritingresume
Loading
~/blog/ornstein-uhlenbeck0%dark
  1. home/
  2. writing/
  3. The Ornstein-Uhlenbeck Process

26 May 2026 · 5 min read · updated 13 June 2026

The Ornstein-Uhlenbeck Process

A mean-reverting spread is modelled by the Ornstein-Uhlenbeck diffusion. We solve its linear SDE with an integrating factor, obtain the Gaussian transition density and the stationary law by the Ito isometry, identify the half-life of a deviation, and show that sampling the process at a fixed spacing produces an exact first-order autoregression. The autoregressive reduction makes maximum-likelihood estimation of the mean-reversion speed an ordinary least-squares problem.

  • 8 equations
  • 7 results
  • 8 connections
  • stochastic-processes
  • mean-reversion
  • quantitative-finance
On this page▾
  • The mean-reverting equation
  • Closed form
  • Transition and stationary laws
  • Exact reduction to an autoregression
  • Illustration

5 min left

  • The mean-reverting equation1m
  • Closed form1m
  • Transition and stationary laws1m
  • Exact reduction to an autoregression1m
  • Illustration1m

A spread between cointegrated assets does not wander freely; it is pulled toward a long-run level at a rate proportional to its displacement. The diffusion that captures exactly this behaviour is the Ornstein-Uhlenbeck process, and it is tractable enough that its transition law, stationary law, and discrete-time estimation all follow in closed form.

#The mean-reverting equation

Definition1

The Ornstein-Uhlenbeck process solves the linear stochastic differential equation

dXt=κ (θ−Xt) dt+σ dWt,(1)dX_t=\kappa\,(\theta-X_t)\,dt+\sigma\,dW_t, \tag{1}dXt​=κ(θ−Xt​)dt+σdWt​,(1)

with mean-reversion speed κ>0\kappa>0κ>0, long-run level θ∈R\theta\in\Rθ∈R, volatility σ>0\sigma>0σ>0, and WWW a Brownian motion.

The affine drift κ(θ−Xt)\kappa(\theta-X_t)κ(θ−Xt​) is globally Lipschitz with linear growth, so Equation (1) has a unique strong solution for every square-integrable initial condition [1].

#Closed form

Proposition2

The solution of Equation (1) is

Xt=θ+(X0−θ) e−κt+σ∫0te−κ(t−s) dWs.(2)X_t=\theta+(X_0-\theta)\,e^{-\kappa t}+\sigma\int_0^t e^{-\kappa(t-s)}\,dW_s. \tag{2}Xt​=θ+(X0​−θ)e−κt+σ∫0t​e−κ(t−s)dWs​.(2)
Proof

Apply Ito's formula to Yt=eκtXtY_t=e^{\kappa t}X_tYt​=eκtXt​. Since YYY has no second-order contribution from the finite-variation factor,

dYt=κeκtXt dt+eκt dXt=κeκtθ dt+σeκt dWt,(3)dY_t=\kappa e^{\kappa t}X_t\,dt+e^{\kappa t}\,dX_t=\kappa e^{\kappa t}\theta\,dt+\sigma e^{\kappa t}\,dW_t, \tag{3}dYt​=κeκtXt​dt+eκtdXt​=κeκtθdt+σeκtdWt​,(3)

after substituting Equation (1) and cancelling the κeκtXt\kappa e^{\kappa t}X_tκeκtXt​ terms. Integrating gives Yt=Y0+θ(eκt−1)+σ∫0teκs dWsY_t=Y_0+\theta(e^{\kappa t}-1)+\sigma\int_0^t e^{\kappa s}\,dW_sYt​=Y0​+θ(eκt−1)+σ∫0t​eκsdWs​, and multiplying by e−κte^{-\kappa t}e−κt returns Equation (2).

#Transition and stationary laws

Proposition3

Conditional on X0X_0X0​, the value XtX_tXt​ is Gaussian with

E[Xt∣X0]=θ+(X0−θ) e−κt,Var⁡(Xt∣X0)=σ22κ(1−e−2κt).(4)\E[X_t\mid X_0]=\theta+(X_0-\theta)\,e^{-\kappa t}, \qquad \Var(X_t\mid X_0)=\frac{\sigma^2}{2\kappa}\big(1-e^{-2\kappa t}\big). \tag{4}E[Xt​∣X0​]=θ+(X0​−θ)e−κt,Var(Xt​∣X0​)=2κσ2​(1−e−2κt).(4)

As ttt grows the law converges to the stationary distribution N ⁣(θ,σ2/2κ)\mathcal N\!\big(\theta,\sigma^2/2\kappa\big)N(θ,σ2/2κ), which is invariant under Equation (1).

Proof

The stochastic integral in Equation (2) is a Wiener integral of a deterministic function, hence Gaussian with zero mean, so the conditional mean is the deterministic part of Equation (2). The Ito isometry gives the variance,

Var⁡(Xt∣X0)=σ2∫0te−2κ(t−s) ds=σ22κ(1−e−2κt).(5)\Var(X_t\mid X_0)=\sigma^2\int_0^t e^{-2\kappa(t-s)}\,ds=\frac{\sigma^2}{2\kappa}\big(1-e^{-2\kappa t}\big). \tag{5}Var(Xt​∣X0​)=σ2∫0t​e−2κ(t−s)ds=2κσ2​(1−e−2κt).(5)

Letting ttt grow, the mean tends to θ\thetaθ and the variance to σ2/2κ\sigma^2/2\kappaσ2/2κ. The solution is a time-homogeneous Markov process, so the law of XtX_tXt​ given X0X_0X0​ is governed by a transition semigroup PtP_tPt​, and μPt\mu P_tμPt​ is the marginal of XtX_tXt​ when X0∼μX_0\sim\muX0​∼μ. If X0X_0X0​ is drawn from μ=N(θ,σ2/2κ)\mu=\mathcal N(\theta,\sigma^2/2\kappa)μ=N(θ,σ2/2κ) independently of WWW, the summands in Equation (2) are independent Gaussians, so XtX_tXt​ has mean θ\thetaθ and variance e−2κt(σ2/2κ)+(σ2/2κ)(1−e−2κt)=σ2/2κe^{-2\kappa t}(\sigma^2/2\kappa)+(\sigma^2/2\kappa)(1-e^{-2\kappa t})=\sigma^2/2\kappae−2κt(σ2/2κ)+(σ2/2κ)(1−e−2κt)=σ2/2κ, hence Xt∼N(θ,σ2/2κ)=μX_t\sim\mathcal N(\theta,\sigma^2/2\kappa)=\muXt​∼N(θ,σ2/2κ)=μ for every ttt. Thus μPt=μ\mu P_t=\muμPt​=μ for all ttt, so μ\muμ is invariant.

A deviation from the mean decays in conditional expectation as e−κte^{-\kappa t}e−κt, so it loses half its size over the half-life

t1/2=ln⁡2κ,(6)t_{1/2}=\frac{\ln 2}{\kappa}, \tag{6}t1/2​=κln2​,(6)

a single scalar summarizing the reversion timescale.

#Exact reduction to an autoregression

Proposition4

Sampled at a fixed spacing Δ\DeltaΔ, the process obeys the exact recursion

X(k+1)Δ=θ(1−φ)+φ XkΔ+εk,φ=e−κΔ,(7)X_{(k+1)\Delta}=\theta(1-\varphi)+\varphi\,X_{k\Delta}+\varepsilon_k, \qquad \varphi=e^{-\kappa\Delta}, \tag{7}X(k+1)Δ​=θ(1−φ)+φXkΔ​+εk​,φ=e−κΔ,(7)

where the εk\varepsilon_kεk​ are independent and N ⁣(0,σ2(1−φ2)/2κ)\mathcal N\!\big(0,\sigma^2(1-\varphi^2)/2\kappa\big)N(0,σ2(1−φ2)/2κ).

Proof

Write Equation (2) from time kΔk\DeltakΔ to (k+1)Δ(k+1)\Delta(k+1)Δ,

X(k+1)Δ=θ+(XkΔ−θ) e−κΔ+σ∫kΔ(k+1)Δe−κ((k+1)Δ−s) dWs.(8)X_{(k+1)\Delta}=\theta+(X_{k\Delta}-\theta)\,e^{-\kappa\Delta}+\sigma\int_{k\Delta}^{(k+1)\Delta} e^{-\kappa((k+1)\Delta-s)}\,dW_s. \tag{8}X(k+1)Δ​=θ+(XkΔ​−θ)e−κΔ+σ∫kΔ(k+1)Δ​e−κ((k+1)Δ−s)dWs​.(8)

The deterministic part rearranges to θ(1−φ)+φXkΔ\theta(1-\varphi)+\varphi X_{k\Delta}θ(1−φ)+φXkΔ​. The stochastic term εk\varepsilon_kεk​ is a Wiener integral over (kΔ,(k+1)Δ](k\Delta,(k+1)\Delta](kΔ,(k+1)Δ], hence Gaussian with mean zero, independent of FkΔ\mathcal F_{k\Delta}FkΔ​ and so of the past increments, and its variance is σ2∫0Δe−2κu du=σ2(1−φ2)/2κ\sigma^2\int_0^\Delta e^{-2\kappa u}\,du=\sigma^2(1-\varphi^2)/2\kappaσ2∫0Δ​e−2κudu=σ2(1−φ2)/2κ by the Ito isometry.

Equation Equation (7) is a first-order autoregression. Because the innovations are i.i.d. N(0,s2)\mathcal N(0,s^2)N(0,s2) with s2=σ2(1−φ2)/2κs^2=\sigma^2(1-\varphi^2)/2\kappas2=σ2(1−φ2)/2κ constant in kkk (homoskedastic), the conditional log-likelihood is ∑k[−12log⁡(2πs2)−(X(k+1)Δ−θ(1−φ)−φXkΔ)2/(2s2)]\sum_k\big[-\tfrac12\log(2\pi s^2)- (X_{(k+1)\Delta}-\theta(1-\varphi)-\varphi X_{k\Delta})^2/(2s^2)\big]∑k​[−21​log(2πs2)−(X(k+1)Δ​−θ(1−φ)−φXkΔ​)2/(2s2)]. For fixed s2s^2s2 the maximiser over (θ(1−φ),φ)(\theta(1-\varphi),\varphi)(θ(1−φ),φ) minimises the residual sum of squares, independent of the value of s2s^2s2, and so is exactly the ordinary least-squares regression of X(k+1)ΔX_{(k+1)\Delta}X(k+1)Δ​ on XkΔX_{k\Delta}XkΔ​ (the profile over s2s^2s2 being the residual variance). The slope estimates φ\varphiφ, from which κ=−ln⁡φ/Δ\kappa=-\ln\varphi/\Deltaκ=−lnφ/Δ and the half-life of Equation (6) follow.

#Illustration

Simulating the exact recursion Equation (7), regressing successive samples, and recovering the half-life shows the estimator at work.

import numpy as np
from numpy.random import Generator


def simulate_ou(
    kappa: float, theta: float, sigma: float, dt: float, n: int, rng: Generator
) -> np.ndarray:
    """Simulate an Ornstein-Uhlenbeck path by its exact discretization.

    Args:
        kappa: Mean-reversion speed.
        theta: Long-run level.
        sigma: Volatility.
        dt: Sampling spacing.
        n: Number of steps.
        rng: Seeded generator for reproducibility.

    Returns:
        The sampled path of length n + 1. It starts at path[0] = theta, the
        stationary mean, and converges to the stationary law N(theta,
        sigma^2 / (2 kappa)) after a transient initial segment.
    """
    phi = np.exp(-kappa * dt)
    innovation_sd = sigma * np.sqrt((1.0 - phi**2) / (2.0 * kappa))
    noise = rng.normal(0.0, innovation_sd, size=n)
    path = np.empty(n + 1)
    path[0] = theta
    for k in range(n):
        path[k + 1] = theta * (1.0 - phi) + phi * path[k] + noise[k]
    return path


def estimate_half_life(path: np.ndarray, dt: float) -> float:
    """Estimate the mean-reversion half-life by least squares on the AR(1) form.

    Args:
        path: A sampled Ornstein-Uhlenbeck trajectory.
        dt: The sampling spacing used to generate the path.

    Returns:
        The estimated half-life ln(2) / kappa.
    """
    lagged = path[:-1]
    nextval = path[1:]
    design = np.vstack([np.ones_like(lagged), lagged]).T
    slope = np.linalg.lstsq(design, nextval, rcond=None)[0][1]
    kappa = -np.log(slope) / dt
    return float(np.log(2.0) / kappa)


rng = np.random.default_rng(0)
path = simulate_ou(kappa=1.5, theta=0.0, sigma=0.3, dt=1.0 / 252.0, n=50_000, rng=rng)
half_life = estimate_half_life(path, dt=1.0 / 252.0)

The closed form Equation (2), the stationary law of Proposition 3, and the autoregressive reduction Equation (7) give the Ornstein-Uhlenbeck process closed-form transition, stationary, and estimation theory.

[1]
B. Øksendal, Stochastic Differential Equations: An Introduction with Applications, 6th ed. Springer, 2003.

Part 8 of 8 in Stochastic Calculus

← previousStochastic Differential Equations

Explore connections

see in the atlas →

related

  • Statistical Arbitrage
  • The Construction of Brownian Motion
  • The Stochastic Integral

referenced by (2)

  • Stochastic Differential Equations
  • The Construction of Brownian Motion
cite
@misc{ornstein-uhlenbeck,
  author = {Zac Kienzle},
  title  = {The Ornstein-Uhlenbeck Process},
  year   = {2026},
  month  = {05},
  url    = {https://zackienzle.com/blog/ornstein-uhlenbeck}
}