The Kalman Filter

Summary

The Kalman filter is the closed-form solution to the Bayesian filtering equations for a linear-Gaussian state-space model. Every distribution stays Gaussian, so the filter propagates only a mean and covariance through a two-step recursion: a prediction step that pushes the state forward through the dynamics, and an update step that corrects it with the new measurement via the Kalman gain and the innovation . It runs at constant cost per time step and is the forward pass feeding both The RTS Smoother and the marginal likelihood.

Overview

Bayesian filtering computes the filtering distribution — the posterior of the current state given all measurements up to now. The general recursion (Särkkä Thm. 4.1) alternates a Chapman–Kolmogorov prediction and a Bayes-rule update. For linear-Gaussian models these reduce to matrix algebra on .

Main Content

Theorem: Bayesian filtering equations (Särkkä Thm. 4.1)

Starting from the prior , the predicted and filtering distributions obey, for :

  • Prediction step (Chapman–Kolmogorov equation):
  • Update step (Bayes’ rule):

The normalizer is the one-step predictive density of the data — the building block of the marginal likelihood.

Theorem: Kalman filter (Särkkä Thm. 4.2)

For the linear-Gaussian model , , the filtering distributions are Gaussian,

computed by the following recursion, started from .

Prediction step:

Update step:

Reading the equations

  • are the predicted (“prior”) mean and covariance before seeing ; the superscript marks “one step ahead, no current measurement.” are the updated (“posterior”) quantities after .
  • The innovation is what the measurement tells you beyond the prediction; is its covariance.
  • The Kalman gain is the optimal weight on the innovation: large when the prediction is uncertain ( large) or the measurement is precise ( small), small otherwise.
  • The update always reduces covariance: . An equivalent “information” form is .
  • Derivation (Särkkä §4.3): apply the Gaussian joint/conditioning lemmas (Lemmas A.1–A.2) to for the prediction and to for the update.

Algorithm (per time step)

given m_{k-1}, P_{k-1}:
  # predict
  m⁻ = A m_{k-1}
  P⁻ = A P_{k-1} Aᵀ + Q
  # update with y_k
  v  = y_k − H m⁻
  S  = H P⁻ Hᵀ + R
  K  = P⁻ Hᵀ S⁻¹
  m_k = m⁻ + K v
  P_k = P⁻ − K S Kᵀ

Cost is constant per step (a few / products and one inverse) — the key practical advantage of the recursive form over batch Bayes.

Examples

Kalman filter for the Gaussian random walk (Särkkä Ex. 4.2)

For the local-level model (, , scalar ) the recursion collapses to scalars:

The scalar gain interpolates between trusting the prediction ( large ) and trusting the measurement ( small ). This same filter is smoothed in The RTS Smoother.

Kalman filter for car tracking (Särkkä Ex. 4.3)

Running the 4-D constant-velocity model (see Linear-Gaussian State-Space Models) on noisy position measurements recovers the full position+velocity trajectory. In Särkkä’s simulation the position RMSE drops from (raw measurements) to (filter estimate) — the filter exploits the dynamics to denoise. The RTS smoother lowers it further to .

Connections

See Also