A radar reports that an aircraft is 13 kilometres down-range. Your tracking model, extrapolating from earlier reports, predicted 10 kilometres. The radar’s error has a variance of 1 square kilometre; your prediction’s error has a variance of 4. Where is the aircraft? Not at 13 and not at 10, and not at the midpoint 11.5 either. The best answer is 12.4 kilometres, with an error variance of 0.8 — smaller than either source alone. The rule that produces those two numbers, applied over and over as new reports arrive, is the Kalman filter.

So, what is a Kalman filter? It is a recursive estimator for the hidden state of a linear dynamical system observed through noisy measurements. It alternates two steps: predict, which pushes the current estimate forward through a model of the dynamics and grows its uncertainty, and update, which blends that prediction with a new measurement and shrinks the uncertainty. It carries only a mean and a covariance from one step to the next. Two distinct claims make it important. First, if the dynamics and measurements are linear and every noise term is Gaussian, the filter’s mean and covariance are exactly the Bayesian posterior distribution of the state given all measurements so far. Second, if the noise is merely zero-mean, white and of known covariance but not Gaussian, the same equations are still the best linear unbiased estimator: no estimator that is an affine function of the measurements has smaller mean squared error. The first claim is about all estimators under a strong assumption; the second is about a restricted class of estimators under a weak one.

This article builds the filter from the one-dimensional case, writes out and verifies the full matrix equations, runs a two-dimensional tracking simulation, and then covers steady state, numerical stability, nonlinear extensions and the history.

Combining two Gaussian estimates

Begin with the aircraft. The prediction says the position xx is distributed as N(x^−,σ12)=N(10,4)\mathcal N(\hat x^-, \sigma_1^2) = \mathcal N(10, 4). The radar returns z=13z = 13, and given the true position the reading is distributed as N(x,σ22)\mathcal N(x, \sigma_2^2) with σ22=1\sigma_2^2 = 1. By Bayes’ theorem, the posterior density is proportional to prior times likelihood:

p(x∣z)∝exp⁡ ⁣(−(x−x^−)22σ12)exp⁡ ⁣(−(z−x)22σ22).p(x \mid z) \propto \exp\!\left(-\frac{(x-\hat x^-)^2}{2\sigma_1^2}\right)\exp\!\left(-\frac{(z-x)^2}{2\sigma_2^2}\right).

The exponent is a quadratic in xx. Collect terms:

−12[(1σ12+1σ22)x2−2(x^−σ12+zσ22)x]+const.-\frac12\left[\left(\frac{1}{\sigma_1^2}+\frac{1}{\sigma_2^2}\right)x^2 - 2\left(\frac{\hat x^-}{\sigma_1^2}+\frac{z}{\sigma_2^2}\right)x\right] + \text{const}.

Completing the square turns any expression −12(ax2−2bx)-\tfrac12(a x^2 - 2bx) into −a2(x−b/a)2-\tfrac{a}{2}(x - b/a)^2 plus a constant. So the posterior is Gaussian, with precision (inverse variance) aa and mean b/ab/a:

1σ2=1σ12+1σ22,σ2=σ12σ22σ12+σ22,x^=σ2(x^−σ12+zσ22).\frac{1}{\sigma^2} = \frac{1}{\sigma_1^2}+\frac{1}{\sigma_2^2}, \qquad \sigma^2 = \frac{\sigma_1^2\sigma_2^2}{\sigma_1^2+\sigma_2^2}, \qquad \hat x = \sigma^2\left(\frac{\hat x^-}{\sigma_1^2}+\frac{z}{\sigma_2^2}\right).

That is the whole idea in one line. Precisions add, and the posterior mean is a precision-weighted average of the two estimates. Since the posterior precision is the sum of two positive numbers, the posterior variance is smaller than either input variance: combining information never makes you less certain.

The mean can be rewritten in a form that generalises better. Define the Kalman gain

K=σ12σ12+σ22.K = \frac{\sigma_1^2}{\sigma_1^2+\sigma_2^2}.

Then a few lines of algebra give

x^=x^−+K (z−x^−),σ2=(1−K) σ12.\hat x = \hat x^- + K\,(z - \hat x^-), \qquad \sigma^2 = (1-K)\,\sigma_1^2.

For the aircraft, K=4/(4+1)=0.8K = 4/(4+1) = 0.8, so x^=10+0.8×3=12.4\hat x = 10 + 0.8 \times 3 = 12.4 and σ2=0.2×4=0.8\sigma^2 = 0.2 \times 4 = 0.8. Check against the symmetric formula: σ2=(4⋅1)/5=0.8\sigma^2 = (4 \cdot 1)/5 = 0.8, and x^=0.8 (10/4+13/1)=0.8×15.5=12.4\hat x = 0.8\,(10/4 + 13/1) = 0.8 \times 15.5 = 12.4. The two forms agree.

One-dimensional Kalman update: prior, measurement and posterior Gaussians46810121416101312.4prior (prediction): mean 10, variance 4measurement likelihood: z = 13, variance 1posterior: mean 12.4, variance 0.8gain K = 4 / (4 + 1) = 0.812.4 = 10 + 0.8 (13 − 10)state x

Figure 1 — The one-dimensional Kalman update. The prediction (grey, mean 10, variance 4) and the measurement likelihood (red, mean 13, variance 1) multiply to give the posterior (blue, mean 12.4, variance 0.8). The posterior lies between the two means, closer to the more precise one, and is narrower than both. Every curve is computed from the Gaussian density.

The form x^−+K(z−x^−)\hat x^- + K(z - \hat x^-) explains what the gain means. The quantity z−x^−z - \hat x^- is the surprise: how far the measurement landed from where the prediction said it would. The filter moves its estimate by a fraction KK of that surprise. KK is the prediction’s share of the total variance, so the filter trusts the measurement in proportion to how uncertain the prediction is. If the prediction is vague (σ12→∞\sigma_1^2 \to \infty), K→1K \to 1 and the estimate jumps to the measurement. If the sensor is useless (σ22→∞\sigma_2^2 \to \infty), K→0K \to 0 and the measurement is ignored. In between, the gain is a precise compromise, and it is always between 0 and 1.

Iterating: estimating a constant

Now suppose the quantity does not move — a constant true value, here 12.0 — and the radar keeps reporting with variance 1. Start from the prior N(10,4)\mathcal N(10, 4) and apply the update eight times. Each posterior becomes the next prior, because nothing changes between readings. The measurements below were drawn from N(12,1)\mathcal N(12, 1) with NumPy’s default_rng(7).

Step kk Measurement zkz_k Gain KkK_k Estimate x^k\hat x_k Variance PkP_k
0 (prior) — — 10.000 4.0000
1 12.001 0.8000 11.601 0.8000
2 12.299 0.4444 11.911 0.4444
3 11.726 0.3077 11.854 0.3077
4 11.109 0.2353 11.679 0.2353
5 11.545 0.1905 11.653 0.1905
6 11.008 0.1600 11.550 0.1600
7 12.060 0.1379 11.621 0.1379
8 13.340 0.1212 11.829 0.1212

Two patterns stand out. The variance follows the closed form Pk=4/(1+4k)P_k = 4/(1+4k): precisions simply accumulate, 1/Pk=1/4+k1/P_k = 1/4 + k. And because the measurement variance is 1 here, the gain equals the variance at every step. The gain falls as the estimate improves, so a wild reading such as 13.34 at step 8 moves the estimate by only 0.12 × 1.51 ≈ 0.18. A filter that has seen eight measurements has little reason to be moved much by a ninth. Notice also that the variance column does not depend on the measurements at all — a feature of the linear-Gaussian filter that matters later.

The state-space model

Real targets move, and usually we cannot measure everything we care about. The Kalman filter’s general setting is the linear state-space model:

xk=F xk−1+wk,wk∼N(0,Q),x_k = F\,x_{k-1} + w_k, \qquad w_k \sim \mathcal N(0, Q), zk=H xk+vk,vk∼N(0,R).z_k = H\,x_k + v_k, \qquad v_k \sim \mathcal N(0, R).

Here xk∈Rnx_k \in \mathbb R^n is the hidden state (position and velocity, say), FF is the n×nn \times n transition matrix describing how the state evolves in one step, and wkw_k is process noise, the part of the motion the model does not explain — gusts, unmodelled accelerations — with covariance QQ. The measurement zk∈Rmz_k \in \mathbb R^m is a linear function of the state through the m×nm \times n matrix HH, corrupted by measurement noise vkv_k with covariance RR. The noise sequences are assumed white (independent across time) and independent of each other and of the initial state.

This is a Markov chain on a continuous state space: xkx_k depends on the past only through xk−1x_{k-1}. It is the continuous, Gaussian cousin of the hidden Markov model, and the Kalman filter plays the role that the forward algorithm plays there. The goal is the distribution of xkx_k given every measurement so far, written p(xk∣z1:k)p(x_k \mid z_{1:k}).

The key structural fact is that Gaussians are closed under linear maps, under addition of independent Gaussians, and under conditioning. If p(xk−1∣z1:k−1)p(x_{k-1} \mid z_{1:k-1}) is Gaussian, then p(xk∣z1:k−1)p(x_k \mid z_{1:k-1}) is Gaussian, and so is p(xk∣z1:k)p(x_k \mid z_{1:k}). The whole infinite-dimensional problem of tracking a probability distribution collapses to tracking a mean vector x^k\hat x_k and a covariance matrix PkP_k.

The full equations, verified

Write x^k−\hat x^-_k and Pk−P^-_k for the predicted mean and covariance (before seeing zkz_k), and x^k\hat x_k and PkP_k for the updated ones.

Predict:

x^k−=F x^k−1,Pk−=FPk−1F⊤+Q.\hat x^-_k = F\,\hat x_{k-1}, \qquad P^-_k = F P_{k-1} F^\top + Q.

Update:

Sk=HPk−H⊤+R,Kk=Pk−H⊤Sk−1,S_k = H P^-_k H^\top + R, \qquad K_k = P^-_k H^\top S_k^{-1}, x^k=x^k−+Kk (zk−Hx^k−),Pk=(I−KkH) Pk−.\hat x_k = \hat x^-_k + K_k\,(z_k - H\hat x^-_k), \qquad P_k = (I - K_k H)\,P^-_k.

Each line can be checked directly.

Predicted mean. Taking expectations of xk=Fxk−1+wkx_k = F x_{k-1} + w_k conditioned on z1:k−1z_{1:k-1} gives Fx^k−1+0F\hat x_{k-1} + 0, since wkw_k has zero mean and is independent of past measurements.

Predicted covariance. The prediction error is xk−x^k−=F(xk−1−x^k−1)+wkx_k - \hat x^-_k = F(x_{k-1} - \hat x_{k-1}) + w_k. The two terms are independent, so the covariance is FPk−1F⊤+QF P_{k-1} F^\top + Q, using the rule that Cov⁡(Ae)=ACov⁡(e)A⊤\operatorname{Cov}(Ae) = A \operatorname{Cov}(e) A^\top. Prediction always adds QQ: uncertainty grows when you are not looking. (For why the sandwich A ⋅ A⊤A\,\cdot\,A^\top appears, see what matrices really are.)

Innovation and its covariance. The quantity yk=zk−Hx^k−y_k = z_k - H\hat x^-_k is called the innovation: the part of the new measurement that the prediction did not anticipate. Substituting the measurement model, yk=H(xk−x^k−)+vky_k = H(x_k - \hat x^-_k) + v_k. It has mean zero and, because the prediction error and vkv_k are independent, covariance HPk−H⊤+R=SkH P^-_k H^\top + R = S_k. So SkS_k is the filter’s own forecast of how large its surprises should be. This makes the filter self-checking: if real innovations are consistently larger than SkS_k predicts, the model is wrong, and the normalised innovation yk⊤Sk−1yky_k^\top S_k^{-1} y_k, which should follow a chi-squared distribution with mm degrees of freedom, is the standard diagnostic.

Gain and updated covariance. Consider any update of the form x^k=x^k−+Kyk\hat x_k = \hat x^-_k + K y_k. The new error is xk−x^k=(I−KH)(xk−x^k−)−Kvkx_k - \hat x_k = (I - KH)(x_k - \hat x^-_k) - K v_k, so for an arbitrary KK

Pk=(I−KH) Pk− (I−KH)⊤+KRK⊤.P_k = (I - KH)\,P^-_k\,(I - KH)^\top + K R K^\top.

Expanding, Pk=Pk−−KHPk−−Pk−H⊤K⊤+KSkK⊤P_k = P^-_k - K H P^-_k - P^-_k H^\top K^\top + K S_k K^\top. The mean squared error is the trace of PkP_k; setting its derivative with respect to KK to zero gives −2Pk−H⊤+2KSk=0-2P^-_k H^\top + 2 K S_k = 0, that is K=Pk−H⊤Sk−1K = P^-_k H^\top S_k^{-1}, the Kalman gain. Substituting back, KSkK⊤=Pk−H⊤K⊤K S_k K^\top = P^-_k H^\top K^\top, which cancels the third term and leaves Pk=Pk−−KHPk−=(I−KH)Pk−P_k = P^-_k - K H P^-_k = (I - KH)P^-_k.

One-dimensional sanity check. With n=m=1n = m = 1 and F=H=1F = H = 1, the gain is K=P−/(P−+R)K = P^-/(P^- + R) and the variance is (1−K)P−(1-K)P^- — exactly the formulas of the first section with σ12=P−\sigma_1^2 = P^- and σ22=R\sigma_2^2 = R.

This derivation minimises mean squared error over gains of a fixed linear form, and it used only means and covariances, never the Gaussian shape. That is the source of the best-linear-unbiased claim. The stronger claim — that x^k\hat x_k is the exact posterior mean and PkP_k the exact posterior covariance — comes from the Gaussian conditioning formula: for jointly Gaussian (x,z)(x, z), the conditional mean is E[x]+Cov⁡(x,z)Cov⁡(z)−1(z−E[z])\mathbb E[x] + \operatorname{Cov}(x,z)\operatorname{Cov}(z)^{-1}(z - \mathbb E[z]), and with Cov⁡(xk,zk)=Pk−H⊤\operatorname{Cov}(x_k, z_k) = P^-_k H^\top and Cov⁡(zk)=Sk\operatorname{Cov}(z_k) = S_k this is precisely the update above.

A two-dimensional example: constant-velocity tracking

The one-dimensional case hides the filter’s most useful trick: it can estimate quantities that are never measured. Track an object moving along a line, with state x=(position,velocity)⊤x = (\text{position}, \text{velocity})^\top, sampled once per second, and measure position only. With time step Δt=1\Delta t = 1,

F=(1Δt01),H=(10),Q=q(Δt3/3Δt2/2Δt2/2Δt),R=σz2.F = \begin{pmatrix} 1 & \Delta t \\ 0 & 1 \end{pmatrix}, \qquad H = \begin{pmatrix} 1 & 0 \end{pmatrix}, \qquad Q = q\begin{pmatrix} \Delta t^3/3 & \Delta t^2/2 \\ \Delta t^2/2 & \Delta t \end{pmatrix}, \qquad R = \sigma_z^2.

The matrix QQ is the standard discretisation of a random acceleration that is white noise in continuous time with intensity qq — a Brownian velocity. The example uses q=0.05q = 0.05 and a position-sensor standard deviation of σz=4\sigma_z = 4 metres, so R=16R = 16.

A short Python script (NumPy, default_rng(2026)) simulated a true trajectory for 100 steps starting from velocity 1 m/s, adding process noise drawn from N(0,Q)\mathcal N(0, Q) at each step, and generated measurements by adding N(0,16)\mathcal N(0, 16) noise to the true position. The filter was initialised from the first measurement with zero velocity and a deliberately loose covariance, x^0=(z0,0)⊤\hat x_0 = (z_0, 0)^\top and P0=diag⁡(16,100)P_0 = \operatorname{diag}(16, 100), then run over steps 1 to 99.

Selected steps from the run:

Step True position Measured Filtered position True velocity Filtered velocity Gain (K1,K2)(K_1, K_2)
1 1.95 0.78 −0.12 1.22 5.66 (0.879, 0.758)
2 3.13 2.06 2.76 1.19 4.05 (0.796, 0.463)
3 4.29 6.34 6.49 1.23 3.91 (0.687, 0.292)
5 6.63 8.82 9.83 1.04 2.76 (0.523, 0.145)
10 12.36 15.70 13.74 1.34 1.55 (0.339, 0.059)
20 33.04 29.17 30.03 2.63 1.65 (0.284, 0.047)
50 97.28 96.86 99.87 1.79 2.32 (0.284, 0.047)
99 167.38 168.45 166.97 2.34 1.44 (0.284, 0.047)

The measured results:

  • Raw measurements: root-mean-square position error 4.33 m over steps 1–99, consistent with the sensor’s 4 m standard deviation.
  • Filtered position: RMS error 2.49 m over the same steps — a reduction of about 42 per cent. After the start-up transient (steps 20–99) the figures are 4.64 m raw against 2.67 m filtered.
  • Velocity, never measured: RMS error 0.84 m/s over steps 1–99 and 0.51 m/s over steps 20–99, while the true velocity wandered between 0.50 and 2.93 m/s. The naive alternative of differencing consecutive measurements gives an RMS velocity error of 6.17 m/s on steps 20–99, worse than useless.

The filter also reports its own expected accuracy. After about 20 steps its covariance settles at a position standard deviation of 2.13 m and a velocity standard deviation of 0.52 m/s. The single run’s 2.67 m position error is somewhat above that. To check whether this is bad luck or a bug, the experiment was repeated over 500 seeds (0–499). The pooled RMS errors on steps 20–99 were 2.134 m for position and 0.525 m/s for velocity, matching the filter’s predictions to three digits. Individual runs scatter; the covariance is honest on average.

How does velocity appear from position-only data? Through the off-diagonal entries of PP. The prediction step FPF⊤F P F^\top correlates position error with velocity error — if the velocity estimate is too high, the predicted position will be too far ahead. So when a measurement reveals that the predicted position is too far ahead, the gain’s second component K2K_2 converts part of that innovation into a downward velocity correction. In the table, the gain vector (K1,K2)(K_1, K_2) starts large, because the initial velocity guess of zero was declared highly uncertain, and settles to (0.284,0.047)(0.284, 0.047).

Steady state and the Riccati equation

Look again at the covariance recursion. It involves FF, HH, QQ and RR, but not the measurements. For a time-invariant system the sequence PkP_k can therefore be computed in advance, and under mild conditions — roughly, every unstable mode of the state must be visible through HH (detectability) and excited by the process noise (stabilisability) — it converges to a unique limit. Combining predict and update into one recursion for the predicted covariance gives

Pk+1−=FPk−F⊤−FPk−H⊤(HPk−H⊤+R)−1HPk−F⊤+Q,P^-_{k+1} = F P^-_k F^\top - F P^-_k H^\top \left(H P^-_k H^\top + R\right)^{-1} H P^-_k F^\top + Q,

and the limit P∞P_\infty is the solution of the same equation with Pk+1−=Pk−=P∞P^-_{k+1} = P^-_k = P_\infty: the discrete algebraic Riccati equation. Once PP has converged, the gain K∞=P∞H⊤(HP∞H⊤+R)−1K_\infty = P_\infty H^\top (H P_\infty H^\top + R)^{-1} is a constant matrix, and the filter becomes a fixed linear recursion with no matrix inversions at run time. Many embedded implementations use exactly this steady-state filter.

The scalar case shows the structure cleanly. Take a value that drifts as a random walk, F=H=1F = H = 1, with process variance Q=1Q = 1 and measurement variance R=1R = 1. The predicted variance obeys p=pR/(p+R)+Qp = pR/(p+R) + Q, which rearranges to p2−Qp−QR=0p^2 - Qp - QR = 0, so

P∞=Q+Q2+4QR2=1+52≈1.618,K∞=P∞P∞+R=1φ≈0.618,P_\infty = \frac{Q + \sqrt{Q^2 + 4QR}}{2} = \frac{1 + \sqrt 5}{2} \approx 1.618, \qquad K_\infty = \frac{P_\infty}{P_\infty + R} = \frac{1}{\varphi} \approx 0.618,

where φ\varphi is the golden ratio (using φ+1=φ2\varphi + 1 = \varphi^2). Starting from the prior variance 4 of the first section, the iteration converges quickly:

Step Predicted variance Pk−P^-_k Gain KkK_k Updated variance PkP_k
1 5.00000 0.83333 0.83333
2 1.83333 0.64706 0.64706
3 1.64706 0.62222 0.62222
4 1.62222 0.61864 0.61864
5 1.61864 0.61812 0.61812
6 1.61812 0.61805 0.61805
8 1.61804 0.61803 0.61803

By step 8 the gain agrees with 1/φ=0.61803401/\varphi = 0.6180340 to five decimal places. Contrast this with the constant-value problem of the first section, where Q=0Q = 0 and the gain decays to zero: with no process noise the filter eventually stops listening, while with process noise it settles at a fixed level of attention that balances how fast the truth drifts against how noisy the sensor is. In the two-dimensional tracker, the same convergence happened by step 20, at K∞=(0.2842,0.0473)⊤K_\infty = (0.2842, 0.0473)^\top.

The Joseph form and numerical issues

The update Pk=(I−KH)Pk−P_k = (I - KH)P^-_k is correct only when KK is exactly the optimal gain, and it computes a covariance by subtracting one large matrix from another. In floating point, both facts can cause trouble. Rounding can leave PkP_k slightly non-symmetric, and the subtraction can cancel almost all significant digits, producing a matrix with zero or negative eigenvalues. A covariance with a negative eigenvalue claims negative uncertainty in some direction; the next gain computed from it is wrong, and the filter can diverge.

The remedy is the expression derived above for an arbitrary gain, known as the Joseph stabilised form:

Pk=(I−KH) Pk− (I−KH)⊤+KRK⊤.P_k = (I - K H)\,P^-_k\,(I - K H)^\top + K R K^\top.

It is a sum of a congruence of a positive semi-definite matrix and another positive semi-definite matrix, so in exact arithmetic it is symmetric positive semi-definite for any KK, and its symmetric structure survives rounding far better. Both properties are easy to check numerically.

Robustness to a wrong gain. At the tracker’s steady state, the simple and Joseph forms agree to machine precision with the optimal gain (largest difference 0). Inflating the gain by 20 per cent, the true error covariance (which the Joseph form computes) has position variance 4.620, but the simple form reports 4.186 — it understates the error, because it silently assumes the gain is optimal.

Robustness to rounding. Take a single update in 32-bit floating point with a predicted covariance whose position and velocity errors are almost perfectly correlated, P−=(10499.9999.991)P^- = \begin{pmatrix} 10^4 & 99.99 \\ 99.99 & 1 \end{pmatrix}, and a very precise position sensor, R=10−4R = 10^{-4}. The exact updated position variance is 1.0×10−41.0 \times 10^{-4}. The simple form returns a position variance of exactly 0 and a singular matrix, as if the position were known perfectly. The Joseph form returns 1.0×10−41.0 \times 10^{-4}, with eigenvalues matching the double-precision answer to three significant figures.

Beyond the Joseph form, production filters often propagate a matrix square root of PP (square-root and UD-factorised filters) so that positive definiteness is guaranteed by construction. These matter most on hardware with short word lengths — which was the situation for the first flight implementations.

Nonlinear systems: extended and unscented filters

Most real systems are not linear. A radar measures range and bearing, h(x)=(px2+py2,atan2⁡(py,px))h(x) = (\sqrt{p_x^2 + p_y^2}, \operatorname{atan2}(p_y, p_x)), and a satellite’s orbit obeys an inverse-square law. Write the model as xk=f(xk−1)+wkx_k = f(x_{k-1}) + w_k, zk=h(xk)+vkz_k = h(x_k) + v_k.

The extended Kalman filter (EKF) linearises at each step. It propagates the mean through the true functions, x^k−=f(x^k−1)\hat x^-_k = f(\hat x_{k-1}), and predicts the measurement as h(x^k−)h(\hat x^-_k), but for the covariance and the gain it replaces FF and HH by Jacobian matrices — the first-order Taylor approximations

Fk=∂f∂x∣x^k−1,Hk=∂h∂x∣x^k−.F_k = \left.\frac{\partial f}{\partial x}\right\rvert_{\hat x_{k-1}}, \qquad H_k = \left.\frac{\partial h}{\partial x}\right\rvert_{\hat x^-_k}.

The EKF is simple and widely used, but it gives up both of the guarantees of the linear filter. A nonlinear function of a Gaussian is not Gaussian, so the posterior is no longer described by a mean and covariance, and the linearisation is taken at an estimate that may itself be wrong. If the error is large relative to the curvature of ff or hh, the Jacobians point the wrong way, the reported covariance becomes overconfident, the filter discounts the measurements that could correct it, and it diverges. Careful tuning of QQ — deliberately overstating process noise — is a common practical defence.

The unscented Kalman filter (UKF), introduced by Simon Julier and Jeffrey Uhlmann in “A New Extension of the Kalman Filter to Nonlinear Systems” (Proceedings of SPIE, vol. 3068, 1997), avoids derivatives. It chooses a small deterministic set of 2n+12n+1 sigma points whose sample mean and covariance match the current estimate, pushes each point through the exact nonlinear function, and recomputes a mean and covariance from the transformed points. This captures the mean and covariance of the transformed distribution more accurately than first-order linearisation, at a similar computational cost and without Jacobians. A fuller treatment by Julier, Uhlmann and Durrant-Whyte appeared in IEEE Transactions on Automatic Control in 2000.

When the posterior is strongly non-Gaussian — multimodal, for example, when a robot could be in one of two similar corridors — no mean-and-covariance filter is adequate. Particle filters represent the distribution by a large weighted sample and apply Bayes’ rule by reweighting and resampling, trading the Kalman filter’s closed form for Monte Carlo approximation.

History

Rudolf E. Kálmán published “A New Approach to Linear Filtering and Prediction Problems” in the Transactions of the ASME, Journal of Basic Engineering, volume 82, Series D, pages 35–45, in March 1960. The paper gave a recursive solution to the discrete-time linear filtering problem in state-space form, derived the difference equation for the error covariance, and showed that the filtering problem is the dual of a deterministic control problem — a connection that made the Riccati equation central to both fields. It replaced the frequency-domain approach of Norbert Wiener, which required stationary signals and solving an integral equation, with a time-domain recursion that a digital computer could run.

The continuous-time version followed in Kalman and Richard Bucy’s “New Results in Linear Filtering and Prediction Theory,” Journal of Basic Engineering, volume 83, 1961; it is now called the Kalman–Bucy filter.

Kalman was not alone. Peter Swerling, working at RAND on satellite orbit determination, described a closely related recursive estimation scheme in a 1958 RAND memorandum and later argued for priority in print. The Soviet mathematician Ruslan Stratonovich developed a general nonlinear filtering theory around 1959–1960, of which the linear-Gaussian filter is a special case, and for that reason the filter is sometimes called the Stratonovich–Kalman–Bucy filter. Kalman’s formulation won out because it was complete, state-space based and immediately computable.

Its first prominent practical use came at NASA’s Ames Research Center. Stanley F. Schmidt, chief of the Dynamic Analysis Branch there, saw early in the 1960s that Kalman’s filter could serve the navigation problem in feasibility studies for the Apollo circumlunar mission. Schmidt’s specific contribution was to make it work for nonlinear navigation equations: his group’s adaptation, which linearised the nonlinear equations about the current estimate, became known as the extended Kalman filter. Schmidt and Leonard McGee recounted this in the 1985 NASA Technical Memorandum 86847, “Discovery of the Kalman Filter as a Practical Tool for Aerospace and Industry.” The filter that flew in the Apollo onboard navigation software was implemented at the MIT Instrumentation Laboratory, which developed the Apollo guidance computer; it is fair to say the Ames work established that a Kalman-type filter was practical for the job, not that Schmidt wrote the flight code.

Bayes’ rule, made recursive and closed-form

Strip away the matrices and the Kalman filter is the Bayesian update — prior times likelihood, normalised — performed again at every time step, with the dynamics model supplying each new prior. What makes it special is not the logic, which applies to any model, but the fact that for linear-Gaussian models every step can be done exactly, in closed form, with a fixed amount of arithmetic. In general, Bayesian filtering means carrying an entire probability distribution forward in time, which is usually impossible without approximation. Here it is not, because Gaussians stay Gaussian under linear maps and under conditioning. The whole posterior is a mean and a variance per dimension, plus the covariances that link them.

That is why it fit on a spacecraft computer in the 1960s and why it runs in every phone’s location stack today. The aircraft example at the start is the entire algorithm in miniature: a prediction at 10 with variance 4, a measurement at 13 with variance 1, a gain of 0.8, and a posterior at 12.4 with variance 0.8 — repeated, with matrices, for as long as the measurements keep coming.


Related topics: Bayesian Inference: How Beliefs Should Update, Hidden Markov Models, What Is a Normal Distribution?, Markov Chains: Probability With No Memory, Brownian Motion, How Does Linear Regression Work?, What Matrices Really Are, Eigenvalues and Eigenvectors, Taylor Series, How Markov Chain Monte Carlo Works

Frequently asked

What is a Kalman filter?

A Kalman filter is a recursive algorithm that estimates the hidden state of a linear dynamical system from a sequence of noisy measurements. At each time step it predicts the state forward using a model of the dynamics, then corrects that prediction with the new measurement, weighting the two by their uncertainties. It carries only a mean vector and a covariance matrix from step to step. When the dynamics and measurements are linear and all noise is Gaussian, that mean and covariance describe the exact Bayesian posterior; without the Gaussian assumption, the filter is still the minimum-variance estimator among all estimators that are linear in the measurements.

What is the Kalman gain?

The Kalman gain K is the weight the filter gives to the new measurement when correcting its prediction: new estimate = prediction + K times (measurement minus predicted measurement). In one dimension K equals the prediction variance divided by the sum of the prediction variance and the measurement variance, so it lies between 0 and 1. A very uncertain prediction gives K close to 1, meaning trust the sensor; a very noisy sensor gives K close to 0, meaning trust the model. In the matrix case K = P H^T S^-1, where S is the covariance of the innovation.

Why does the Kalman filter assume Gaussian noise?

Because Gaussians stay Gaussian. A linear map of a Gaussian is Gaussian, and conditioning one jointly Gaussian variable on another gives a Gaussian. So if the initial belief and all noise terms are Gaussian, every prediction and every posterior is Gaussian and is described exactly by a mean and a covariance, which the filter updates in closed form. The assumption is what makes the filter the exact Bayesian answer. Without it the same equations are still the best linear unbiased estimator, but a nonlinear estimator may do better.

What is the difference between the Kalman filter and the extended Kalman filter?

The standard Kalman filter requires linear dynamics and a linear measurement model. The extended Kalman filter handles nonlinear models by linearising them at every step: it propagates the estimate through the true nonlinear functions but propagates the covariance using their Jacobian matrices evaluated at the current estimate. This makes it widely usable, but it loses the optimality guarantee, and when the nonlinearity is strong or the estimate is poor the linearisation can be wrong enough that the filter diverges.

Where is the Kalman filter used?

Anywhere a quantity must be tracked from imperfect sensors in real time: GPS receivers and inertial navigation systems in aircraft, ships, phones and spacecraft; radar and sonar target tracking; robot localisation and self-driving cars; attitude estimation in drones; econometric state-space models; and, through ensemble variants, weather forecasting data assimilation. Its first major practical use was spacecraft navigation in the Apollo programme era.