Exercises — Kalman filter derivation — predict step, update step
Reminder of the five equations you will use (all defined in the parent):
Level 1 — Recognition
Exercise 1.1
State, in words, what each of the five filter equations does. Which two belong to predict and which three to update?
Recall Solution
- — predict mean: coast the estimate forward through the physics, plus the effect of any known command .
- — predict covariance: propagate uncertainty and grow it by .
- — innovation: measurement minus what we expected to measure.
- — gain: the optimal blend weight, prior-uncertainty over total-uncertainty.
- and — update mean & covariance: correct the estimate and shrink the uncertainty. First two = predict; last three (innovation + gain + correction) = update.
Exercise 1.2
1-D scalar filter, . Prior , measurement noise . Compute the innovation covariance .
Recall Solution
. Why: is the total uncertainty of the surprise: the prior uncertainty seen through the sensor () plus the sensor's own noise ().
Exercise 1.3
Same numbers (, , ). Compute the gain . Is it bigger or smaller than , and what does that tell you?
Recall Solution
. : the prior is more uncertain () than the sensor (), so we lean toward the measurement. A perfectly-trusted-equally case would give exactly .
Level 2 — Application
Exercise 2.1
1-D constant-position filter. Prior , . Measurement , , . Run one full update: find , , , , .
Recall Solution
- .
- .
- .
- .
- . Read it: we moved most of the way toward (gain ) and our uncertainty dropped from to — measuring rewarded us with confidence.
Exercise 2.2
Two-step predict only, constant velocity, , , (no command), . Start , . Predict once, then again. Give and after each.
Recall Solution
Step 1 mean: . Step 1 covariance: . First , then times : Step 2 mean: . Step 2 covariance: with , , times : (Carefully: row 1 of is ; dotting with the columns of gives and . Row 2 is : and .) Why the growth? With the model is "perfect", yet uncertainty still grows: an uncertain velocity keeps corrupting position, and the position variance (top-left) climbs each step.
Exercise 2.3
Show the "collapse" limits of the gain. For scalar : what is as ? As ? And as ? Give the resulting in each case.
Recall Solution
.
- (perfect sensor): , so . Adopt the measurement fully.
- (perfect prior): , so . Ignore the measurement.
- (useless, infinitely noisy sensor): , so again and . The measurement is discarded and uncertainty does not shrink — a garbage reading correctly changes nothing. These three cases are the anchors every gain lives between: rides between and , driven by the ratio of prior to sensor uncertainty.
Level 3 — Analysis
Exercise 3.1
For a scalar constant-position filter with no process noise (), , constant , prove the posterior variance obeys the recursion (precisions add). Then find after identical measurements starting from prior .
Recall Solution
Constant position, ⇒ predict does nothing: . Update: , and . Take the reciprocal: . ∎ After steps: each measurement adds to the precision, so , giving Read it: exactly like averaging samples — variance falls like once the prior is swamped. Ties directly to Recursive Least Squares.
Exercise 3.2
Numeric: prior , , , constant position. Using Ex 3.1, compute (three measurements). Then argue why and what real-world danger that hides.
Recall Solution
. As , : the filter becomes infinitely confident. Danger: with the gain , so the filter stops listening to new data. If the true state ever drifts (it always does in reality), the filter cannot react — filter divergence. This is precisely why real filters keep .
Exercise 3.3 — figure
A scalar update fuses prior with measurement likelihood . Predict where the posterior mean sits (closer to or ?) and whether its peak is taller than both. Then compute and to confirm.

Recall Solution
Prediction from the picture: the measurement is much sharper (variance vs ), so the posterior should sit near and be taller/narrower than both. Compute: ; ; . is indeed close to , and — narrower than both inputs. Figure description (greyscale-safe): three bell curves on a "density vs state " plot. A wide, short bell centred at is the prior. A narrow, tall bell centred at is the measurement. The tallest, narrowest bell, centred at (between the two but hugging the sharp measurement), is the posterior — visually confirming that the confident input dominates and the fused peak beats both.
Level 4 — Synthesis
Exercise 4.1
Full predict + update cycle, constant velocity. , , . We measure position only: , . Start , . A position measurement arrives after one predict. Compute .
Recall Solution
Predict mean: . Predict cov: (as in the parent Example 2). Innovation: , so . : . Here , so . Gain: . (first column), so . Corrected mean: . Covariance: . Here , so ; multiplying by : The magic: we measured position only, yet the velocity estimate also changed () and its variance dropped (). The off-diagonal correlation from the predict step let a position measurement inform velocity. This is IMU and GPS sensor fusion in miniature.
Exercise 4.2
Verify the Joseph form gives the same as the short form when is optimal, using the scalar numbers of Ex 2.1 ().
Recall Solution
Short form: . Joseph: . ✔ They agree because is the optimal gain; the cross-terms cancel exactly. For any non-optimal they would differ, and only Joseph stays correct.
Level 5 — Mastery
Exercise 5.1
A designer sets for a constant-position filter and is puzzled that after many GPS fixes the estimate stops tracking a slowly drifting true position. Using your Ex 3.1/3.2 results, explain the mechanism precisely and propose the smallest fix.
Recall Solution
Mechanism: with , . Then , so : incoming measurements are multiplied by nearly zero and ignored. The filter is certain of an out-of-date value — divergence. Fix: set . This adds a floor to every predict step, keeping from collapsing to , so the filter stays responsive to drift. encodes "the model may be slightly wrong" — exactly the humility a real system needs. (Formally this connects to Bayesian inference: re-inflates the prior each step.)
Exercise 5.2
Steady state for the scalar constant-position filter with process noise . Predict is ; update is with . At steady state is constant. Find the fixed point for .
Recall Solution
Combine: , then . At steady state let : Multiply out: With : . Read it: unlike the case (), here settles at a positive constant . The filter reaches a stable, non-zero confidence — exactly what keeps it alive and tracking.
Exercise 5.3 — figure
Sketch/argue how the scalar gain evolves over time from a large initial down to steady state (Ex 5.2 setup). Is monotone? Where does it settle?

Recall Solution
Start large: big ⇒ first near (trust the sensor almost fully while blind). As measurements pour in, falls toward , so falls and settles at where , giving . Figure description (greyscale-safe): a "gain vs update step " plot. The main curve (circles) for starts high near , drops steeply over the first few steps, then flattens onto a horizontal dotted line at — monotone decreasing to a positive floor, never reaching . A second dashed curve (squares) for keeps sagging toward , illustrating the dead, unresponsive filter. The positive floor is the gift of .