Skip to main content
Contents2 / 6 ▾
II

Chapter two The Kalman filter: the exact case

Suppose the world is kind. Suppose \(f\) and \(h\) are linear, and every noise is Gaussian. Then something remarkable happens: a Gaussian pushed through a linear map is still exactly Gaussian, and the product of two Gaussians is exactly Gaussian. The belief never leaves the family, no approximation is ever made, and the Kalman filter is not a heuristic — it is the exact optimal solution.

You must understand this chapter before the next two, because the EKF and the UKF are both nothing more than "the Kalman filter, but with a trick for handling the curve."

In the linear case the models become matrices:

\[ x_k = F x_{k-1} + B u_k + w_k, \qquad z_k = H x_k + v_k \]
(2.1)

2.1 · Predict

Push the mean through the model, and push the covariance through it twice — once on each side, because covariance is quadratic in the state:

\[ \hat{x}_k^- = F\hat{x}_{k-1} + Bu_k \]
(2.2)
\[ P_k^- = F P_{k-1} F^\top + Q \]
(2.3)

2.2 · Update

Now a measurement arrives. Compute what you expected to see, \(H\hat{x}_k^-\), and subtract it from what you did see. The difference is the innovation, and it is the only new information in the world:

\[ y_k = z_k - H\hat{x}_k^-, \qquad S_k = H P_k^- H^\top + R \]
(2.4)

\(S_k\) is the innovation covariance: how surprised you were entitled to be. The Kalman gain then decides how much of that surprise to believe:

\[ K_k = P_k^- H^\top S_k^{-1} \]
(2.5)
\[ \hat{x}_k = \hat{x}_k^- + K_k y_k, \qquad P_k = (I - K_k H)\,P_k^- \]
(2.6)

Look at (2.5) and read it as a ratio. If \(P^-\) is large (you are lost) and \(R\) is small (the sensor is crisp), \(K\) tends toward \(H^{-1}\) and you snap onto the measurement. If \(P^-\) is tiny and \(R\) is huge, \(K \to 0\) and you ignore the sensor entirely. The gain is an automatic, optimal trust dial, and nobody has to tune it — it falls out of the covariances you declared.

Why this matters for the rest of the book The Kalman filter is exact only because linearity preserves Gaussianity. The moment \(f\) or \(h\) curves, a Gaussian pushed through it comes out lopsided and non-Gaussian, and the whole scheme becomes an approximation. The EKF and the UKF are two different ways of forcing the answer back into a Gaussian.
4