- Every reading is truth plus noise. The Kalman filter fuses noisy sources by predicting, then correcting.
- Mean μ = centre. Variance σ² = the true spread; from samples we estimate it with s², the average squared distance from the mean. σ = √σ².
- Gaussians: 68% within ±1σ, 95% within ±2σ. Independent sums: means add, variances add. Var(a x) = a² Var(x).
- Small variance = trustworthy sensor. Fusion leans toward it with gain K, and the fused variance is smaller than both.
- What the filter is. A data-fusion algorithm. Every sensor reports truth plus noise. The filter predicts from the measured motion, then corrects with each new reading. It flew Apollo and runs in drones, robots, cars and phones.
- Random variables. A reading is one sample of a random variable. From samples: μ is their average, the sample variance s² is the average of (zᵢ − μ)² (our estimate of the true σ²), and s is its square root, in the same units as the readings.
- The Gaussian. N(μ, σ²) is set by two numbers. About 68% of samples land within ±1σ, about 95% within ±2σ. For independent variables, means and variances add, and scaling by a multiplies the variance by a².
- Sensor quality. z = x + e with e ~ N(0, σ²). A small σ² means a tall, narrow bell and a sensor to trust. Averaging n readings divides the variance by n, but it cannot remove a bias.
- Data fusion. x̂ = z₁ + K (z₂ − z₁) with K = σ₁² / (σ₁² + σ₂²). The fused variance σ₁² σ₂² / (σ₁² + σ₂²) is smaller than both, because precisions add: 1/σ̂² = 1/σ₁² + 1/σ₂².
Next lesson: the one-dimensional Kalman filter
A robot on a line with a wheel encoder and a GPS. The encoder's step becomes the predict step (means add, variances add). The GPS reading becomes the correct step, with the very same gain K. You will run the full filter and watch it beat both sensors.
Read along
Roger Labbe's free book Kalman and Bayesian Filters in Python covers the same ground in its chapters on Gaussians and probabilities (on GitHub). The original paper is R. E. Kalman, "A New Approach to Linear Filtering and Prediction Problems" (1960).
Examples
Example 1
Find the mean, variance and standard deviation of the readings 12, 15 and 9.
Show solutionHide solution
μ = 36 / 3 = 12. Distances: 0, +3, −3. Squares: 0, 9, 9.
s² = 18 / 3 = 6 and s = √6 ≈ 2.45.
Example 2
x ~ N(10, 3) and y ~ N(2, 1) are independent. Find the distribution of 2(x + y).
Show solutionHide solution
First the sum: x + y ~ N(12, 4).
Then scale by a = 2: the mean becomes 24 and the variance 2² · 4 = 16. So 2(x + y) ~ N(24, 16), with σ = 4.
Example 3
Sensor 1 reads 8 with variance 3. Sensor 2 reads 12 with variance 1. Fuse them.
Show solutionHide solution
K = 3 / (3 + 1) = 0.75. x̂ = 8 + 0.75 · (12 − 8) = 11.
σ̂² = 3 · 1 / 4 = 0.75, below both 3 and 1. Check: 1/3 + 1/1 = 4/3, and 1 / (4/3) = 0.75 ✓

Questions and comments
Stuck on something, or found a mistake? Ask here and I'll answer. You sign in with GitHub.