TactivergeLite

Lite / Independent Engineering Research / Week 13

The conjugate normal update

Your map says the crater is 20 m away (± 3 m). The lidar says 24 m (± 2 m). Where is it, and how sure are you now?

About 40 min · 3 goals · Checked by automated tests · Full interactive version

Why should I care?

When everything is Gaussian, Bayes' rule collapses to two lines of arithmetic. Those two lines are the heart of every Kalman filter flying today. Derive them once and the filter will never be a black box.

Predict

Prior N(20, 3²) and measurement 24 with σ = 2. The posterior mean is…

  1. 22, halfway
  2. About 22.8, nearer the measurement
  3. 24, trust the sensor
  4. About 21.2, nearer the prior
Guess first, then reveal

Weights go with precision 1/σ²: the measurement has 1/4, the prior 1/9. Posterior mean = 20 + (9/13)(4) ≈ 22.77 m, posterior σ = √(36/13) ≈ 1.66 m: smaller than both.

Discover

Treat sensor 1 as the prior (z₁ = 20, σ₁ = 3) and sensor 2 as the lidar (z₂ = 24, σ₂ = 2). Snap w to the optimum: the fused curve is the posterior. Check the readout against 22.77 m and 1.66 m.

What the interactive shows (text version)

The fusion diagram plots two normal curves and their optimal combination; the readout states the fused mean and σ, which equal the posterior here (22.77 m and 1.66 m for the suggested values).

You can also open the interactive on the full site when you have a faster connection.

Watch (optional)

Watch for: Watch for the moment the prediction and measurement distributions are multiplied: the product is narrower than either.

Shows the Kalman filter as the product of two probability distributions, the prediction and the measurement, which is exactly our inverse-variance derivation.

“Optimal State Estimator | Understanding Kalman Filters, Part 3” by MATLAB (opens YouTube; streaming video uses a lot of data)

The video is optional. Everything you need is in this lesson's text.

Understand

Precisions add

Precision is 1/σ². After the update, posterior precision = prior precision + measurement precision. The posterior σ is therefore always smaller than both σ₀ and σ: information never hurts, if the models are right.

Precision-weighted mean

The posterior mean is the average of μ₀ and z weighted by their precisions. Equivalently, start at the prior and move a fraction K = σ₀²/(σ₀² + σ²) of the way towards the measurement. z − μ₀ is the innovation: the surprise the measurement brought.

Conjugacy

A prior is conjugate to a likelihood when the posterior has the same family as the prior. Normal–normal is the most useful case: a Gaussian belief stays Gaussian after every update, so a filter only ever stores a mean and a variance.

Explain it another way

Intuitive

Two people guess where the crater is. One is usually within 3 m, the other within 2 m. You trust the better one more, but not completely, and combining them makes you more confident than either alone.

Technical

This is the same mathematics as inverse-variance weighting of two measurements (week 16). In Bayesian language the prior plays the role of the first measurement.

Mathematical

μ₀ = 20, σ₀ = 3, z = 24, σ = 2: K = 9/13 ≈ 0.692, μ₁ ≈ 22.77, σ₁² = 4 × 9/13 = 36/13, σ₁ ≈ 1.66.

Applied

Spacecraft orbit determination folds each new radio-tracking pass into the existing orbit estimate this way (in many dimensions): the covariance shrinks with every pass.

Derivation: Product of two Gaussians
  1. Prior ∝ exp(−(x − μ₀)²/(2σ₀²)); likelihood ∝ exp(−(z − x)²/(2σ²)).

  2. Posterior ∝ exp(−½[(x − μ₀)²/σ₀² + (x − z)²/σ²]). The exponent is quadratic in x, so the posterior is Gaussian.

  3. Collect x² terms: coefficient 1/σ₀² + 1/σ² = 1/σ₁². So 1/σ₁² = 1/σ₀² + 1/σ²: precisions add.

  4. Collect x terms: μ₁/σ₁² = μ₀/σ₀² + z/σ². So μ₁ = σ₁²(μ₀/σ₀² + z/σ²).

  5. Rewrite with K = σ₀²/(σ₀² + σ²): μ₁ = μ₀ + K(z − μ₀), σ₁² = (1 − K)σ₀². This is exactly the Kalman update.

Worked example 1

Prior N(100, 4²), measurement 106 with σ = 4. Posterior?

Equal precisions: K = 0.5. μ₁ = 103, σ₁² = 8, σ₁ ≈ 2.83 (σ/√2).

Common mix-ups

Practice

Practice, not a test. Answers are checked on our server; a wrong answer gets a hint and another try. Nothing is saved.

m

m

Practice 3. If the measurement is far noisier than the prior (σ ≫ σ₀), the update…

Apply it

A rover's prior on a landmark distance is N(15, 2²). Three independent lidar readings arrive: 16.1, 15.7, 16.4 m, each σ = 1 m. Update one at a time, then all at once using their mean (σ = 1/√3). Show both routes agree.

Reflect

What would go wrong if the lidar actually had σ = 4 m but your filter believed σ = 1 m?

Write your answer on paper or in your own notes. Lite never stores what you write.

← Updating a belief on a gridState-space form: x[k+1] = A·x[k] + B·u[k] + w[k] →