Tutorials › Stochastic Calculus › Deriving the Kalman-Bucy Riccati Equation

Stochastic Filtering and the Kalman-Bucy Filter · Tutorial 548 of 600

Deriving the Kalman-Bucy Riccati Equation

Use the filtering error dynamics and Itô’s formula to obtain and check the deterministic matrix Riccati ODE.

Advanced 12 min read

What You'll Learn

  • Set up linear signal and observation models with compatible state, observation, and noise dimensions.
  • Write the filtering error SDE using the Kalman–Bucy gain.
  • Apply Itô’s product rule to the matrix-valued error covariance.
  • Identify how observation noise contributes to the covariance drift.
  • Derive the Riccati equation and verify the dimensions and symmetry of its terms.
  • Check the equation in scalar and two-dimensional examples.

From Filtering Error to a Covariance Equation

The Kalman–Bucy mean equation describes how the conditional estimate responds to new observations. Its gain depends on the estimation error covariance, so determining that covariance is part of specifying the filter. The key calculation is an Itô product rule: the error has both drift and noise, and the product of its noise increments supplies a covariance correction. The observation noise contributes to this correction as well as to the gain.

Work on a filtered probability space \((\Omega,\mathcal{F},(\mathcal{F}_t)_{t\ge0},\mathbb{P})\) carrying a \((q+m)\)-dimensional Brownian motion \(\mathbf{B}_t=(\mathbf{B}^v_t,\mathbf{B}^o_t)\). Its \(q\)-dimensional signal-noise component \(\mathbf{B}^v\) and \(m\)-dimensional observation-noise component \(\mathbf{B}^o\) are independent. Let the signal \(X_t\) take values in \(\mathbb{R}^n\), and the observation \(Y_t\) in \(\mathbb{R}^m\), with constant-coefficient model

$$ dX_t=A X_t\,dt+G\,d\mathbf{B}^v_t,\qquad dY_t=C X_t\,dt+R^{1/2}\,d\mathbf{B}^o_t. $$

Here \(A\) is \(n\times n\), \(G\) is \(n\times q\), \(C\) is \(m\times n\), and \(R\) is a symmetric positive-definite \(m\times m\) observation-noise covariance matrix. Write \(Q=GG^{\mathsf T}\), the \(n\times n\) signal-noise covariance rate. Assume \(X_0\) is Gaussian with finite second moments and is independent of the Brownian noises. Let \(\mathcal{F}^Y_t\) denote the completed filtration generated by observations up to time \(t\), and set \(\widehat X_t=\mathbb{E}[X_t\mid\mathcal{F}^Y_t]\).

Use the Kalman–Bucy mean equation, in which the gain \(K_t\) is \(n\times m\):

$$ d\widehat X_t=A\widehat X_t\,dt+ K_t\bigl(dY_t-C\widehat X_t\,dt\bigr),\qquad K_t=P_tC^{\mathsf T}R^{-1}. $$

For this linear Gaussian model, Gaussian conditioning gives a conditional error mean of zero and a deterministic conditional error covariance \(P_t\). This is the standard Gaussian-conditioning property used in linear filtering: conditioning a jointly Gaussian state and observation vector changes its mean but gives a covariance that does not depend on the observed values. In continuous time it applies to the observation history by taking limits of finite observation collections. Thus, for \(e_t=X_t-\widehat X_t\),

Definition: The filtering error is \(e_t=X_t-\widehat X_t\), and its conditional covariance is \(P_t=\mathbb{E}[e_te_t^{\mathsf T}\mid\mathcal{F}^Y_t]\). In this model \(P_t\) is deterministic, symmetric, and positive semidefinite; its initial value is \(P_0=\operatorname{Cov}(X_0)\).

The Itô Product Calculation

Subtract the mean equation from the signal equation. Substituting \(dY_t-C\widehat X_tdt=C e_tdt+R^{1/2}d\mathbf{B}^o_t\) gives the error dynamics

$$ de_t=(A-K_tC)e_t\,dt+G\,d\mathbf{B}^v_t-K_tR^{1/2}\,d\mathbf{B}^o_t. $$

The integrals here and below are Itô integrals on the stated filtered space. Their integrands are adapted and progressively measurable; on any finite interval on which \(K_t\) is bounded, the linear error equation has finite second moments and the matrix-valued integrands in the product calculation are square-integrable. Consequently the stochastic-integral terms in the expectation calculation are true martingales: they are square-integrable, and their conditional expectations at earlier times equal their current values. This justifies taking expectations and discarding their zero-mean increments.

Apply Itô’s formula to each component \(f_{ij}(e)=e_i e_j\). Its first derivatives are \(\partial_k f_{ij}=\delta_{ik}e_j+\delta_{jk}e_i\); its second derivatives are \(\partial_k\partial_\ell f_{ij}=\delta_{ik}\delta_{j\ell}+\delta_{i\ell}\delta_{jk}\). The resulting matrix product rule is \(d(e_te_t^{\mathsf T})=de_t\,e_t^{\mathsf T}+e_t\,de_t^{\mathsf T}+de_t\,de_t^{\mathsf T}\). The last term is the second-derivative correction. Independence of the two Brownian components and the Itô rules \(d\mathbf{B}^v(d\mathbf{B}^v)^{\mathsf T}=I_qdt\), \(d\mathbf{B}^o(d\mathbf{B}^o)^{\mathsf T}=I_mdt\), and zero cross-covariation give

$$ de_t\,de_t^{\mathsf T} =\bigl(GG^{\mathsf T}+K_tR K_t^{\mathsf T}\bigr)\,dt =\bigl(Q+K_tR K_t^{\mathsf T}\bigr)\,dt. $$

In particular, the observation-noise term is positive in this product calculation. It must be retained before substituting the gain; it is one part of the calculation that produces the negative observation correction in the final equation.

Theorem: Suppose \(P_0\) is the covariance of the Gaussian initial state and the linear Gaussian model above holds. On every finite interval on which the filtering equations are defined, the deterministic conditional error covariance satisfies the matrix Riccati ODE $$ \frac{dP_t}{dt}=A P_t+P_tA^{\mathsf T}+Q-P_tC^{\mathsf T}R^{-1}C P_t. $$

Proof. Put \(F_t=A-K_tC\). The first two terms of the Itô product rule have drift \(F_te_te_t^{\mathsf T}+e_te_t^{\mathsf T}F_t^{\mathsf T}\); the quadratic-variation term has drift \(Q+K_tRK_t^{\mathsf T}\). Take expectations. The stochastic-integral terms have zero expectation by the square-integrability stated above. Since the conditional covariance is deterministic and the conditional mean of \(e_t\) is zero, \(\mathbb{E}[e_te_t^{\mathsf T}]=P_t\). Therefore $$ \frac{dP_t}{dt}=(A-K_tC)P_t+P_t(A-K_tC)^{\mathsf T}+Q+K_tRK_t^{\mathsf T}. $$ Now substitute \(K_t=P_tC^{\mathsf T}R^{-1}\). Symmetry of \(P_t\) and \(R\), and \(R^{-1}R=I_m\), give $$ K_tC P_t=P_tC^{\mathsf T}R^{-1}C P_t,\qquad K_tRK_t^{\mathsf T}=P_tC^{\mathsf T}R^{-1}C P_t. $$ The two negative terms from expanding the first two products are identical, while the positive noise term contributes one copy. Their sum is one negative copy, yielding the stated ODE. \(\square\)

Dimensions and Meaning of the Terms

Each term in the ODE must be an \(n\times n\) matrix, the same size as \(P_t\). The dimensions show how the observation information enters:

TermDimensionsRole
\(A P_t\), \(P_tA^{\mathsf T}\)\((n\times n)(n\times n)\)Propagation of existing error by the signal drift
\(Q=GG^{\mathsf T}\)\((n\times q)(q\times n)\)New uncertainty from signal noise
\(P_tC^{\mathsf T}R^{-1}C P_t\)\((n\times n)(n\times m)(m\times m)(m\times n)(n\times n)\)Reduction from observing the signal with noise covariance \(R\)
\(K_t=P_tC^{\mathsf T}R^{-1}\)\((n\times n)(n\times m)(m\times m)\)Maps the \(m\)-dimensional observation innovation to the \(n\)-dimensional estimate

The negative sign in the last covariance term expresses information gained from the observations. A larger observation-noise covariance weakens that reduction through \(R^{-1}\); it does not remove the positive \(K_tRK_t^{\mathsf T}\) contribution from the error’s observation-noise increment before the gain is substituted.

Worked Example: A Scalar Covariance Drift

Take a scalar signal with \(A=0\), signal-noise variance rate \(Q=1\), observation coefficient \(C=1\), observation-noise variance \(R=1\), and current error variance \(P_t=1\). Find the instantaneous covariance derivative and gain.

In one dimension the matrix equation becomes \(P'=2AP+Q-P^2C^2/R\). Substitution gives \(2\cdot0\cdot1+1-(1^2\cdot1^2)/1=0\). The gain is \(K=PC/R=1\).

Check: use the uncombined error-covariance drift. Here \(A-KC=-1\), so its drift contribution is \(2(-1)(1)=-2\). The two noise contributions are \(Q=1\) and \(KRK=1\). Thus \(-2+1+1=0\), agreeing with the Riccati equation.

Worked Example: A Two-Dimensional Matrix Calculation

Let \(A=\begin{pmatrix}0&1\\0&0\end{pmatrix}\), \(Q=I_2\), \(C=\begin{pmatrix}1&0\end{pmatrix}\), \(R=1\), and \(P_t=\begin{pmatrix}2&0\\0&3\end{pmatrix}\). Compute the gain and covariance derivative.

First, \(P_tC^{\mathsf T}=\begin{pmatrix}2\\0\end{pmatrix}\), so \(K_t=\begin{pmatrix}2\\0\end{pmatrix}\). Next, \(AP_t=\begin{pmatrix}0&3\\0&0\end{pmatrix}\) and \(P_tA^{\mathsf T}=\begin{pmatrix}0&0\\3&0\end{pmatrix}\). The observation correction is \(P_tC^{\mathsf T}R^{-1}C P_t =\begin{pmatrix}2\\0\end{pmatrix}\begin{pmatrix}1&0\end{pmatrix}\begin{pmatrix}2&0\\0&3\end{pmatrix} =\begin{pmatrix}4&0\\0&0\end{pmatrix}\). Therefore

$$ \frac{dP_t}{dt} =\begin{pmatrix}0&3\\0&0\end{pmatrix} +\begin{pmatrix}0&0\\3&0\end{pmatrix} +\begin{pmatrix}1&0\\0&1\end{pmatrix} -\begin{pmatrix}4&0\\0&0\end{pmatrix} =\begin{pmatrix}-3&3\\3&1\end{pmatrix}. $$

Check: every summand is \(2\times2\), and the derivative is symmetric, as a covariance derivative must be. Directly, \(A-KC=\begin{pmatrix}-2&1\\0&0\end{pmatrix}\). Thus \((A-KC)P_t=\begin{pmatrix}-4&3\\0&0\end{pmatrix}\), \(P_t(A-KC)^{\mathsf T}=\begin{pmatrix}-4&0\\3&0\end{pmatrix}\), and \(Q+K_tRK_t^{\mathsf T}=\begin{pmatrix}5&0\\0&1\end{pmatrix}\). Adding gives \(\begin{pmatrix}-3&3\\3&1\end{pmatrix}\), the same result.

Worked Example: Observation Noise and the Correction Term

In the scalar case take \(A=-1\), \(Q=2\), \(C=3\), \(R=4\), and current covariance \(P_t=2\). Compute the gain and the two equivalent covariance drifts.

The gain is \(K_t=P_tC/R=2\cdot3/4=3/2\). The Riccati expression is \(2AP_t+Q-P_t^2C^2/R=2(-1)(2)+2-(2^2\cdot3^2)/4=-4+2-9=-11\).

For the direct check, \(A-K_tC=-1-(3/2)3=-11/2\). The drift contribution is \(2(A-K_tC)P_t=2(-11/2)2=-22\). The noise contribution is \(Q+K_t^2R=2+(9/4)4=11\). The sum is \(-22+11=-11\). The observation-noise contribution is \(9\) here; keeping it is essential to obtaining the correct cancellation when the gain is substituted.

What the Riccati Equation Does—and a Common Mistake

The equation is deterministic even though the estimate \(\widehat X_t\) and the observations are random. Its initial condition \(P_0\), the model matrices, and the observation-noise covariance determine the covariance trajectory and hence the gain \(K_t=P_tC^{\mathsf T}R^{-1}\). The equation describes the balance between uncertainty generated by signal noise and drift, and uncertainty reduced by observations. It is a matrix Riccati ODE because its observation term is quadratic in \(P_t\).

Common mistake: omit the observation-noise quadratic variation. In the scalar example with \(A=0\), \(Q=C=R=P_t=1\), keeping only the signal-noise contribution in \(de_t\,de_t\) gives the incorrect drift \(2(A-KC)P+Q=-2+1=-1\). The missing term is \(K^2R=1\), so the correct uncombined drift is \(-2+1+1=0\). Substitution into the Riccati form confirms \(2AP+Q-P^2C^2/R=0+1-1=0\). The observation noise cannot be dropped merely because the observation is used to update the estimate: it is present in the error SDE itself.

Takeaway: Derive the covariance drift before substituting the gain. The signal noise contributes \(Q\), observation noise contributes \(KRK^{\mathsf T}\), and combining these with the gain-dependent drift terms yields the single correction \(-P_tC^{\mathsf T}R^{-1}C P_t\).

Check Your Understanding

Use the Itô product calculation and the dimension checks to answer these questions.

  1. For \(n=3\), \(m=2\), and \(q=4\), state the dimensions of \(K_t\), \(Q\), and \(P_tC^{\mathsf T}R^{-1}C P_t\).
  2. In the scalar equation, set \(A=1\), \(Q=0\), \(C=2\), \(R=2\), and \(P_t=1\). What are the gain and instantaneous covariance derivative?
  3. Explain why \(de_t\,de_t^{\mathsf T}\) contains \(K_tRK_t^{\mathsf T}dt\) in addition to \(Qdt\).
  4. For the two-dimensional example, verify that the off-diagonal entries of \(dP_t/dt\) agree.
  5. If the observation-noise covariance \(R\) increases while the other scalar parameters stay fixed, how does the magnitude of the negative observation correction change?