3.5.21 · D5Guidance, Navigation & Control (GNC)

Question bank — Kalman filter derivation — predict step, update step

2,035 words9 min readBack to topic

Before we start, a quick vocabulary refresher so every symbol below is earned:

Recall What each symbol means (unfold if rusty)
  • ::: the true state at step — the hidden quantity (position, velocity, attitude) we want to estimate.
  • ::: the state-transition matrix — the linear rule that pushes the state forward one step, (see State-space representation).
  • ::: the control-input matrix — maps a known command into its effect on the state.
  • ::: the control vector — the known command applied at step (e.g. thruster firing), so the deterministic push is .
  • ::: the process-noise vector — a random, zero-mean kick added each step because the dynamics model is imperfect; it appears as and has covariance .
  • ::: the measurement vector — the noisy sensor reading at step .
  • ::: the observation matrix — maps the state into what the sensor sees, .
  • ::: the measurement-noise vector — a random, zero-mean corruption on each sensor reading; it appears as and has covariance .
  • ::: the prior (predicted) estimate — what physics alone says before seeing the new measurement.
  • ::: the posterior estimate — after fusing in the measurement.
  • ::: the previous-step posterior, the current prior, and the current posterior covariance — the filter's own uncertainty about its estimate (see Covariance matrices and Gaussian distributions).
  • ::: process-noise covariance — how wrong the dynamics model is (the covariance of ).
  • ::: measurement-noise covariance — how noisy the sensor is (the covariance of ).
  • ::: the Kalman gain — the weight given to the measurement's surprise.
  • ::: the innovation — measurement minus prediction.
  • ::: the innovation covariance — uncertainty of that surprise.

Two pictures anchor the whole page. First, what a covariance looks like and how predict vs. update reshape it:

Figure — Kalman filter derivation — predict step, update step

Second, what the innovation means geometrically — the gap between where the sensor lands and where physics predicted it would:

Figure — Kalman filter derivation — predict step, update step

True or false — justify

TF1. "The Kalman filter needs to store the entire history of past measurements to be optimal."
False — it is recursive: is a complete summary of all past data, so one step forward carries all the information (this is why it's linked to Recursive Least Squares).
TF2. "Setting gives the most accurate filter because it removes noise."
False claims the model is perfect, so shrinks toward zero, , and the filter stops listening to measurements and diverges.
TF3. "In the predict step the covariance can only grow or stay the same."
False in general — although the term (which is positive-semidefinite, being a real covariance) can only add uncertainty, the term can shrink when the dynamics are contracting — meaning every direction gets multiplied by a factor smaller than 1 each step, so errors decay toward zero (formally, 's largest eigenvalue-magnitude is below 1). It only "can only grow" when the dynamics are not contracting.
TF4. "In the update step (with the optimal gain) the covariance can only shrink or stay the same."
True — write . Because is a covariance it is symmetric positive-semidefinite, and one can show with also positive-semidefinite; so the difference is PSD, meaning — observing removes uncertainty, never adds it.
TF5. "The Kalman gain is a constant you tune once, like a PID gain."
False is recomputed every step from the current and ; it starts large (unsure prior) and settles toward a steady-state value.
TF6. "If the measurement noise is huge, the filter basically ignores the sensor."
True — large makes large and small, so the correction is tiny and the filter coasts on its prediction.
TF7. "The posterior estimate always lies between the prior and the measurement."
True only in 1-D — there with is a genuine convex blend that never overshoots either input. In multiple dimensions the update is a matrix-weighted combination , so the result need not sit on the line "between" prior and measurement — components can move in directions neither input points to, because correlations in redistribute the correction.
TF8. "The Kalman filter assumes noises are Gaussian."
Partly — it is the optimal linear estimator for any noise with the given covariances, but it is the overall optimal estimator only when the noise is Gaussian (see Bayesian inference).
TF9. "Fusing two independent estimates always makes you more confident than either one alone."
True — precisions (inverse variances) add, so ; the fused variance is smaller than both.

Spot the error

SE1. "Innovation ."
Wrong — you never know the true ; the innovation uses the prediction: , the only computable version.
SE2. " works for any gain you pick."
Wrong — that shortcut is valid only for the optimal ; for any other gain you must use the Joseph form or may become non-symmetric or indefinite.
SE3. "The gain is ."
Wrong — the is missing; the denominator is the innovation covariance , and dropping would blindly trust a noisy sensor.
SE4. "Predict updates the mean but leaves covariance alone."
Wrong — predict also propagates covariance: ; forgetting this makes the filter overconfident and it will reject good measurements.
SE5. "Because is a covariance we can just divide by it as a number."
Wrong — in vector form is a matrix, so we multiply by its inverse ; treating it as scalar division only makes sense in the 1-D case.
SE6. "After the update, throw away — only the estimate carries forward."
Wrong is the memory of your confidence; the next predict step needs it to compute , and without it the recursion cannot continue.
SE7. " is a source of noise, so include it in ."
Wrong is a known control input (a deterministic push); it moves the mean and adds no uncertainty, while (the covariance of the random kick ) is the unknown modelling error.

Why questions

WHY1. Why does the off-diagonal of become non-zero after predicting a position–velocity state?
Because uncertain velocity feeds into future position, so their errors become correlated; the filter records that a velocity error today causes a position error tomorrow.
WHY2. Why is the fused variance smaller than the smaller of the two input variances?
Two independent readings each carry partial information, and combining information can only sharpen the estimate — precisions add, so the total precision exceeds either alone.
WHY3. Why do we minimise the trace of rather than itself?
You cannot "minimise a matrix", but the trace is the total (summed) mean-squared error across all state components, a single scalar cost that yields the optimal gain when differentiated.
WHY4. Why does the term cancel when we plug the optimal into the Joseph form?
Expand the Joseph form . The optimal satisfies , so , which exactly cancels the term and leaves .
WHY5. Why is called the innovation covariance and not just ?
The surprise inherits uncertainty from both the noisy sensor () and the uncertain prediction pushed through (), so sums both sources.
WHY6. Why does the Kalman filter track a covariance at all, instead of just a best guess?
Without it could not know how much to trust the next measurement; the gain depends entirely on , so uncertainty bookkeeping is the whole engine.
WHY7. Why does a linear filter need an Extended Kalman Filter (EKF) or Unscented Kalman Filter (UKF) for real vehicles?
Real dynamics and sensors (attitude, range, bearing) are nonlinear, so and aren't constant matrices; EKF linearises and UKF samples sigma points to handle the curvature.

Edge cases

EC1. What happens to when the sensor is perfect () in 1-D with ?
, so the filter fully adopts the measurement and discards its own prediction — with a flawless sensor, that's exactly right.
EC2. What happens to when the prior is perfect ()?
, so the correction vanishes and the measurement is ignored — if you're already certain, new noisy data adds nothing.
EC3. What is the innovation if the measurement exactly matches the prediction ()?
, so (mean unchanged), yet still shrinks — even a "no-surprise" measurement confirms the estimate and boosts confidence.
EC4. What if two independent measurements arrive in the same timestep?
Apply the update step twice in sequence, each time treating the latest posterior as the new prior. The order doesn't change the result because, in information form, each measurement simply adds its precision to the running information matrix and to the running information vector — and addition commutes, so which one you add first cannot matter.
EC5. What happens if is set far too small (over-trusting a noisy sensor)?
becomes large, the estimate chases every noise spike, and the filter becomes jittery — the classic symptom of an under-tuned .
EC6. What if there is no measurement at all in a given step (sensor dropout)?
Run only the predict step; the estimate coasts on physics and grows via , correctly reflecting rising uncertainty until a measurement returns (central to IMU and GPS sensor fusion where GPS drops out).
EC7. In steady state, why does stop changing?
The predict growth () and update shrinkage reach a balance where repeats each cycle, so its gain — computed from that fixed — also becomes constant.
EC8. What if observes only part of the state (e.g. position but not velocity)?
The update still improves velocity indirectly through the off-diagonal correlations in ; the measured position pulls the correlated velocity along even though never touches it directly (see State-space representation).
Recall One-line self-test before you leave

The Kalman gain answers which single question? ::: "Given how uncertain I am versus how noisy the sensor is, how much of the surprise should I actually believe?"