Intuition What this page is for
The parent note gave you the five predict/update equations. Here we stress-test them against every kind of input a real filter meets : equal trust, extreme trust, zero trust, a degenerate zero-uncertainty case, a limiting steady state, a vector fusion, and a full word problem. If a scenario is missing from this page, you'll meet it in flight and panic. So we cover them all.
Before anything, one promise about notation. Every symbol below was defined in the parent note. To be safe, here is the pocket dictionary you will reuse in EVERY example:
Recall The quantities in plain words
x ^ − (x-hat-minus) ::: our prediction of the hidden state, made before looking at the new measurement. The minus means "prior".
P − ::: how uncertain that prediction is (a variance; bigger = shakier). The minus again means "prior".
z ::: the measurement the sensor just handed us.
R ::: how noisy the sensor is (variance of its error).
H ::: the dial that converts "state" into "what the sensor would read". If the sensor reads the state directly, H = 1 .
F (state-transition) ::: the physics step — the rule that pushes the state forward one tick in time (e.g. "position += velocity × time"). If nothing moves, F = 1 .
Q (process noise) ::: how wrong the physics model itself is per step (a variance you add during predict). Bigger Q = you trust your own model less.
K (gain) ::: the blend weight — a number between 0 and 1 (in 1-D) saying how much of the surprise to believe.
y = z − H x ^ − ::: the innovation (surprise): measurement minus prediction.
Every Kalman problem is one (or a mix) of the cells below. Each example is tagged with the cell it hits.
Cell
What makes it special
Where K lands
Example
A. Equal trust
P − = R
K = 0.5 (exact midpoint)
Ex 1
B. Great sensor
R ≪ P −
K → 1 (adopt measurement)
Ex 2
C. Great prediction
P − ≪ R
K → 0 (ignore measurement)
Ex 3
D. Degenerate: perfect sensor
R = 0
K = 1/ H exactly, P → 0
Ex 4
E. Degenerate: perfect prior
P − = 0
K = 0 , measurement rejected
Ex 5
F. Predict grows uncertainty
run predict, watch P swell
(no K ; time update)
Ex 6
G. Vector / correlated states
2 × 2 matrices, off-diagonal
K is a matrix
Ex 7
H. Limiting: steady state
iterate to convergence
K stops changing
Ex 8
I. Word problem (sensor fusion)
real GPS + IMU numbers
worked end-to-end
Ex 9
J. Exam twist: H = 1
measurement is scaled state
gain must undo H
Ex 10
Prerequisites if any cell feels shaky: Covariance matrices and Gaussian distributions , State-space representation .
Worked example Ex 1 — prior and sensor equally uncertain (
P − = R )
Prior x ^ − = 10 m, P − = 4 m². Measurement z = 14 m, R = 4 m², H = 1 .
Forecast: with equal variances, where should the blended estimate land — nearer 10, nearer 14, or exactly halfway? Guess before reading.
Innovation. y = z − H x ^ − = 14 − 10 = 4 m.
Why this step? The filter only ever reacts to the surprise , not the raw measurement — that's the only computable error.
Innovation covariance. S = H P − H ⊤ + R = 4 + 4 = 8 m².
Why this step? S is the total uncertainty of the surprise: prior wobble plus sensor wobble.
Gain. K = P − H ⊤ S − 1 = 4/8 = 0.5 .
Why this step? K = (prior uncertainty)/(total uncertainty). Equal shares → exactly 0.5 .
Estimate. x ^ = 10 + 0.5 ⋅ 4 = 12 m.
Why this step? old + gain × surprise. Moving halfway from 10 toward 14 lands on 12.
Covariance. P = ( 1 − K ) P − = 0.5 ⋅ 4 = 2 m².
Why this step? Fusing two independent estimates always beats either alone — 2 < 4 .
Verify: halfway between 10 and 14 is 12 ✔. Final variance 2 < 4 , so we are more confident than before ✔. Units stay in m and m² throughout ✔.
Worked example Ex 2 — a great sensor (Cell B,
R ≪ P − )
Prior x ^ − = 0 , P − = 100 . Measurement z = 50 , R = 1 , H = 1 .
Forecast: should the estimate jump nearly all the way to 50, or barely move?
y = 50 − 0 = 50 . Why: the surprise is large — our prediction was near-useless (P − = 100 ).
S = 100 + 1 = 101 . Why: dominated by the shaky prior.
K = 100/101 ≈ 0.990 . Why: almost all weight on the measurement.
x ^ = 0 + 0.990 ⋅ 50 ≈ 49.5 . Why: we adopt the sensor almost entirely.
P = ( 1 − 0.990 ) ⋅ 100 ≈ 0.990 . Why: uncertainty collapses to roughly the sensor's own R = 1 .
Verify: K → 1 as R → 0 ✔. Posterior P ≈ 0.99 ≈ R — the estimate is now as sharp as the sensor ✔.
Worked example Ex 3 — a great prediction (Cell C,
P − ≪ R )
Prior x ^ − = 0 , P − = 1 . Measurement z = 50 , R = 100 , H = 1 . (Sensor is junk.)
Forecast: the sensor screams "50!" but we barely trust it. Does the estimate move much?
y = 50 − 0 = 50 . Why: same big surprise as Ex 2, but now the sensor is the shaky one.
S = 1 + 100 = 101 . Why: dominated by the noisy sensor.
K = 1/101 ≈ 0.0099 . Why: almost no weight on the measurement.
x ^ = 0 + 0.0099 ⋅ 50 ≈ 0.495 . Why: we nudge only slightly toward the noisy reading.
P = ( 1 − 0.0099 ) ⋅ 1 ≈ 0.990 . Why: we barely learned anything, so P stays near 1 .
Verify: K → 0 as R → ∞ ✔. Estimate stayed near the trusted prior (0), not the junk reading (50) ✔. Compare with Ex 2: same z , opposite behaviour — the variances decide, not the numbers ✔.
These are the "divide by zero" traps. Show them once and you'll never fear them.
Worked example Ex 4 — a PERFECT sensor (Cell D,
R = 0 )
Prior x ^ − = 10 , P − = 4 . Measurement z = 14 , R = 0 , H = 1 .
Forecast: a noiseless sensor. How much of our own prediction survives?
y = 14 − 10 = 4 . Why this step? Even with a perfect sensor we still compare it to our prediction first — the surprise (4) is what drives the correction.
S = 4 + 0 = 4 . Why: the surprise carries only prior uncertainty now.
K = 4/4 = 1 . Why: R = 0 forces K = P − / P − = 1 (or in general K = H − 1 = 1 ). We fully believe the sensor.
x ^ = 10 + 1 ⋅ 4 = 14 . Why: we snap exactly onto the measurement.
P = ( 1 − 1 ) ⋅ 4 = 0 . Why: a perfect measurement removes ALL uncertainty.
Verify: x ^ = z = 14 ✔ (perfect sensor overrides prediction). P = 0 ✔ (zero doubt). No division by zero occurred because S = P − = 0 ✔.
Worked example Ex 5 — a PERFECT prior (Cell E,
P − = 0 )
Prior x ^ − = 10 , P − = 0 (we are certain ). Measurement z = 14 , R = 4 , H = 1 .
Forecast: if we already know the answer perfectly, can any measurement change our mind?
y = 14 − 10 = 4 . Why: still a surprise, but…
S = 0 + 4 = 4 .
K = 0/4 = 0 . Why: zero prior uncertainty → zero blend weight.
x ^ = 10 + 0 ⋅ 4 = 10 . Why: certainty cannot be moved.
P = ( 1 − 0 ) ⋅ 0 = 0 . Why: stays perfectly certain.
Verify: estimate unchanged at 10 ✔. P stays 0 ✔. This is exactly why Q = 0 forever is dangerous (see the parent note's mistake box): once P hits 0 , the filter goes deaf ✔.
Worked example Ex 6 — coasting forward, no measurement
1-D constant position, F = 1 , no control. Start x ^ = 7 , P = 3 , process noise Q = 2 .
Forecast: with no new data and an imperfect model, does confidence go up or down?
x ^ − = F x ^ = 1 ⋅ 7 = 7 . Why: nothing pushes the mean; a stationary model (F = 1 ) leaves position where it was.
P − = F P F ⊤ + Q = 1 ⋅ 3 ⋅ 1 + 2 = 5 . Why: the model is imperfect (Q = 2 ), so uncertainty can only grow.
Verify: mean unchanged (7 ) ✔. P grew 3 → 5 ✔ — predicting without measuring always makes you less sure. This is the counterweight to Ex 4/5 where measuring shrank P .
Worked example Ex 7 — 2-D predict, then a position-only measurement
State x = [ p v ] , Δ t = 1 s, F = [ 1 0 1 1 ] (position += velocity, velocity unchanged), no control, Q = 0 .
Start x ^ = [ 0 2 ] , P = [ 1 0 0 1 ] .
Then a GPS gives position only : z = 2.5 m, R = 1 , so H = [ 1 0 ] .
Forecast: two questions. (a) After predict, does an off-diagonal (correlation) term appear? (b) When we measure position only, does the gain K correct velocity too?
x ^ − = F x ^ = [ 0 + 2 2 ] = [ 2 2 ] . Why: moved 2 m in 1 s at 2 m/s.
F P = [ 1 0 1 1 ] [ 1 0 0 1 ] = [ 1 0 1 1 ] . Why: first half of the sandwich F P F ⊤ .
P − = ( F P ) F ⊤ = [ 1 0 1 1 ] [ 1 1 0 1 ] = [ 2 1 1 1 ] . Why: complete the sandwich; the off-diagonal 1 means an uncertain velocity now feeds forward into position — they are correlated . See the figure.
Innovation covariance (scalar here). S = H P − H ⊤ + R = [ 1 0 ] [ 2 1 1 1 ] [ 1 0 ] + 1 = 2 + 1 = 3 . Why: H P − H ⊤ picks out the top-left position-variance (2 ), then add sensor noise.
Matrix gain. K = P − H ⊤ S − 1 = [ 2 1 1 1 ] [ 1 0 ] ⋅ 3 1 = [ 2 1 ] ⋅ 3 1 = [ 2/3 1/3 ] . Why: the velocity entry 1/3 is non-zero even though we never measured velocity — the correlation from step 3 lets a position measurement fix velocity too. This is the magic of the vector filter.
Innovation & update. y = z − H x ^ − = 2.5 − 2 = 0.5 . Then x ^ = x ^ − + K y = [ 2 2 ] + [ 2/3 1/3 ] ( 0.5 ) = [ 2.333 2.167 ] . Why: position AND velocity both shift toward consistency with the reading.
Covariance. P = ( I − K H ) P − = ( [ 1 0 0 1 ] − [ 2/3 1/3 ] [ 1 0 ] ) [ 2 1 1 1 ] = [ 2/3 1/3 1/3 2/3 ] . Why: every entry shrank — even velocity variance dropped from 1 to 2/3 , thanks to the correlation.
Verify: P − symmetric with off-diagonal 0 → 1 ✔. Gain's velocity entry 1/3 = 0 ✔ (position measurement corrects velocity). Posterior velocity variance 2/3 < 1 ✔. See State-space representation for why F has that shape, and IMU and GPS sensor fusion for the multi-sensor version.
Worked example Ex 8 — iterate predict+update until
K stops moving
1-D constant position, F = 1 , H = 1 , Q = 1 , R = 1 . Start with a large prior P 0 = 100 .
Run predict then update, repeatedly. Where does the gain settle?
Forecast: does K keep changing forever, or lock onto one value?
Each cycle: predict P − = P + Q = P + 1 ; then K = P − + 1 P − , update P = ( 1 − K ) P − .
Step 1: P − = 100 + 1 = 101 , K = 101/102 ≈ 0.9902 , P = ( 1 − K ) ⋅ 101 ≈ 0.9902 . Why this step? Predict adds Q = 1 ; then with a huge prior the measurement dominates (K ≈ 1 ), and P collapses toward the sensor's R = 1 .
Step 2: P − = 0.9902 + 1 = 1.9902 , K = 1.9902/2.9902 ≈ 0.6656 , P ≈ 0.6656 . Why this step? Now the prior is already sharp, so predict's + Q is a big relative bump; the gain drops well below 1 — we start trusting our own prediction more.
Step 3: P − = 0.6656 + 1 = 1.6656 , K = 1.6656/2.6656 ≈ 0.6248 , P ≈ 0.6248 . Why this step? The numbers are barely moving now — each cycle nudges K a little lower toward its balance point.
Keep going… P approaches the fixed point P ∞ solving P = ( 1 − K ) ( P + 1 ) with K = P + 2 P + 1 . Why this step? At steady state the incoming uncertainty from predict (+ Q ) exactly balances the shrink from update. Solving gives P ∞ = 2 − 1 + 5 ≈ 0.618 , and K ∞ = P ∞ + 2 P ∞ + 1 ≈ 0.618 .
Verify: the golden ratio ϕ − 1 = 0.618 pops out ✔. K converges to ≈ 0.618 regardless of the huge P 0 = 100 ✔ — this is why the parent note's mistake ("K is a fixed tuning knob") is subtly wrong: K does become constant, but only as an emergent limit, not a hand-picked value.
Worked example Ex 9 — fusing GPS with an IMU dead-reckon
A drone's IMU dead-reckons its east position to x ^ − = 120.0 m with P − = 9.0 m² (drift-prone). A GPS fix arrives: z = 123.0 m with R = 4.0 m². The GPS reads position directly, so H = 1 .
Forecast: GPS is sharper here (R < P − ). Should the fused estimate lean toward 123?
y = 123.0 − 120.0 = 3.0 m. Why: the GPS says we drifted 3 m east of the IMU guess.
S = 9.0 + 4.0 = 13.0 m². Why: combined wobble of IMU + GPS.
K = 9.0/13.0 ≈ 0.6923 . Why: GPS gets the larger share (> 0.5 ) because it is the more precise of the two.
x ^ = 120.0 + 0.6923 ⋅ 3.0 ≈ 122.08 m. Why: lands closer to GPS's 123 than to IMU's 120, as trust dictates.
P = ( 1 − 0.6923 ) ⋅ 9.0 ≈ 2.769 m². Why: fused uncertainty (2.77 ) beats both inputs (9 and 4) — fusion always wins.
Verify: estimate 122.08 lies between 120 and 123, biased toward the sharper GPS ✔. 2.77 < 4 < 9 ✔. See IMU and GPS sensor fusion for the multi-axis version.
Worked example Ex 10 — the sensor reports
twice the state
A gauge outputs z = 2 x + noise , so H = 2 . Prior x ^ − = 5 , P − = 3 , measurement z = 12 , R = 1 .
Forecast: since the sensor doubles the state, the raw reading 12 "means" x = 6 . Does the gain automatically undo the factor of 2?
y = z − H x ^ − = 12 − 2 ⋅ 5 = 12 − 10 = 2 . Why: compare the reading to what the sensor should have read for our prediction, which is 2 × 5 = 10 .
S = H P − H ⊤ + R = 2 ⋅ 3 ⋅ 2 + 1 = 12 + 1 = 13 . Why: H scales the prior uncertainty by H 2 = 4 before adding sensor noise.
K = P − H ⊤ S − 1 = 3 ⋅ 2/13 = 6/13 ≈ 0.4615 . Why: the gain carries a factor of H so it can convert measurement-space surprise back into state-space correction.
x ^ = 5 + 0.4615 ⋅ 2 ≈ 5.923 . Why: nudged up toward the value the sensor implies (x ≈ 6 ), not toward 12.
P = ( 1 − K H ) P − = ( 1 − 0.4615 ⋅ 2 ) ⋅ 3 = ( 1 − 0.9231 ) ⋅ 3 ≈ 0.2308 . Why: note it is ( 1 − K H ) , not ( 1 − K ) — the H must reappear here too.
Verify: estimate 5.92 sits between prior 5 and the implied measurement 6 ✔. Posterior 0.231 < 3 ✔. Forgetting the H in step 5 (writing ( 1 − K ) P − ) would give a wrong, larger P — the classic exam trap ✔.
Mnemonic One line to carry all ten cells
Small variance = loud voice. Whoever (prior or sensor) has the smaller variance dominates the blend; K is just "prior's share of the total wobble," scaled by H when the sensor speaks in different units.
Recall Self-test
In Ex 3 the sensor shouted "50" and we barely moved — why? ::: Because its variance R = 100 was huge; the trusted prior (P − = 1 ) kept the estimate near 0. Variances, not values, set the blend.
Why does P grow in Ex 6 but shrink in Ex 1? ::: Predict adds Q (uncertainty grows with no data); update multiplies by ( 1 − K H ) < 1 (a measurement removes uncertainty).
In Ex 7 we measured position only — why did velocity get corrected? ::: Predict made position and velocity correlated (off-diagonal 1 in P − ), so the gain carries a non-zero velocity entry.
What single fact makes Ex 5 dangerous long-term? ::: P − = 0 ⇒ K = 0 forever after; the filter ignores all future data (divergence).
Related: Recursive Least Squares , Bayesian inference , Extended Kalman Filter (EKF) , Unscented Kalman Filter (UKF) .