Intuition What this page is for
The parent note built the formula . This page exercises it in every direction — big sensor noise, tiny sensor noise, zero prior uncertainty, a perfect sensor, correlated vector states, a real navigation word problem, and an exam twist. If a scenario can happen in the Kalman Filter — Update Step , there is a cell for it below and a worked example that lands in that cell.
Before we start, one reminder of every symbol so nobody is lost:
Definition The seven quantities in one place
P − — prior covariance : how uncertain our prediction is (bigger = less sure). A single number in the scalar case; a matrix when the state is a vector.
H — measurement map : turns "state" into "what the sensor would read." If the sensor reads the state directly, H = 1 .
R — sensor-noise covariance : how blurry the measurement is (bigger = blurrier).
v — sensor noise : the random error the sensor adds each reading, so z = H x + v . It has zero mean (E [ v ] = 0 , no systematic bias) and covariance E [ v v ⊤ ] = R ; it is uncorrelated with the state error. Bigger R = wider spread of v .
S = H P − H ⊤ + R — innovation covariance : total spread of the surprise, prior-uncertainty-mapped-into-sensor-space plus sensor noise.
K = P − H ⊤ S − 1 — the Kalman gain , the dial from "trust prediction" to "trust measurement."
P + = ( I − K H ) P − — posterior covariance at the optimum (how sure we are after fusing). I is the identity ("multiply-by-1" matrix).
Intuition The two update formulas, once, so every example can just cite them
Fused estimate: x ^ + = x ^ − + K ( z − H x ^ − ) . In words: start from the prediction, then nudge it by the gain times the surprise. K is exactly the fraction of the surprise we believe.
Posterior covariance: P + = ( I − K H ) P − . In words: the correction removes the fraction K H of the prior uncertainty; whatever fraction ( I − K H ) is left is our new, smaller uncertainty. (Only valid at the optimal gain — for any gain use the Joseph form, introduced and used in Ex 10.)
Every cell below is a kind of situation the Kalman gain must handle. Each row is covered by at least one worked example.
Cell
Situation
Distinguishing feature
Example
A
Balanced scalar
P − and R comparable
Ex 1
B
Sensor much better
R ≪ P −
Ex 2
C
Sensor much worse
R ≫ P −
Ex 3
D
Degenerate prior
P − = 0 (already certain)
Ex 4
E
Non-unit map
H = 1 (units/scaling)
Ex 5
F
Perfect sensor
R = 0 (boundary limit)
Ex 6
G
Vector state, diagonal
2 × 2 diagonal P − , one sensor
Ex 7
H
Vector state, correlated
off-diagonal P − , one sensor
Ex 8
I
Real navigation word problem
altitude fusion
Ex 9
J
Exam twist: gain vs. trace curve
prove the U-shape numerically
Ex 10
Intuition How to read the dial figure below
Figure s01 is a number line for the gain K from 0 (trust prediction) to 1 (trust measurement). It plants a labelled arrow at the K that each scalar cell A–D produces. Watch the amber/cyan dots slide: cell A sits mid-line, cell B jumps toward 1 , cell C hugs 0 , and cell D pins to exactly 0 . The picture is the story of how the same formula answers four opposite situations.
The Kalman gain as a slider: each scenario cell drops its computed K onto the 0 → 1 line.
Worked example Ex 1 — comparable uncertainties
Prediction of a temperature: x ^ − = 20 , with P − = 3 . Sensor reads z = 26 , noise R = 3 , and H = 1 . Find K , the fused estimate x ^ + , and P + .
Forecast: the two sources are equally trustworthy (P − = R ). Guess: the answer should land exactly halfway — K = 0.5 , estimate = 23 .
Innovation covariance. S = H P − H ⊤ + R = 1 ⋅ 3 ⋅ 1 + 3 = 6 .
Why this step? S is the total spread of the surprise; every gain divides by it.
Gain. K = P − H ⊤ S − 1 = 3/6 = 0.5 .
Why this step? K is prior-confidence over total spread.
Innovation (the surprise). z − H x ^ − = 26 − 20 = 6 .
Why this step? This is how far the sensor disagrees with the prediction.
Fused estimate. x ^ + = 20 + 0.5 ⋅ 6 = 23 .
Why this step? We apply x ^ + = x ^ − + K ( surprise ) : take the 0.5 fraction of the 6 surprise and add it to the prediction — half-trusting each source.
Posterior covariance. P + = ( 1 − K ) P − = ( 1 − 0.5 ) ⋅ 3 = 1.5 .
Why this step? P + = ( I − K H ) P − says the correction stripped the fraction K H = 0.5 off the prior uncertainty; the remaining half is our new spread.
Verify: P + = 1.5 is below both P − = 3 and R = 3 — fusion made us more certain than either source. And the estimate sits exactly midway, matching the forecast. ✅
Worked example Ex 2 — trust the measurement
P − = 10 (shaky prediction), R = 0.1 (crisp sensor), H = 1 , x ^ − = 5 , z = 8 .
Forecast: sensor far sharper, so K should be near 1 and the estimate should hug z = 8 .
S = 10 + 0.1 = 10.1 . Why: total spread dominated by the shaky prior.
K = 10/10.1 ≈ 0.990099 . Why: prior dwarfs sensor, so we lean almost fully on the sensor.
Innovation = 8 − 5 = 3 . Why: how far the sensor disagrees with the prediction.
x ^ + = 5 + 0.990099 ⋅ 3 ≈ 7.970297 .
Why: the update x ^ − + K ( surprise ) folds in ~99% of the surprise, so the estimate lands almost on z = 8 .
P + = ( 1 − 0.990099 ) ⋅ 10 ≈ 0.099010 .
Why: ( 1 − K H ) leaves only ~1% of the prior spread — the sharp sensor removed almost all prediction uncertainty.
Verify: K ≈ 0.99 (near 1), estimate ≈ 7.97 (near z = 8 ), and P + ≈ 0.099 — essentially R , because the sensor now dictates our certainty. ✅
Worked example Ex 3 — trust the prediction
P − = 0.1 (confident prediction), R = 10 (noisy sensor), H = 1 , x ^ − = 5 , z = 8 .
Forecast: mirror image of Ex 2. K near 0 , estimate hugs the prediction 5 .
S = 0.1 + 10 = 10.1 .
K = 0.1/10.1 ≈ 0.009901 . Why: tiny prior, huge sensor noise ⇒ barely nudge.
Innovation = 3 . Why: the sensor–prediction disagreement.
x ^ + = 5 + 0.009901 ⋅ 3 ≈ 5.029703 .
Why: the update adds under 1% of the surprise, so the estimate barely leaves the prediction.
P + = ( 1 − 0.009901 ) ⋅ 0.1 ≈ 0.099010 .
Why: ( 1 − K H ) leaves ~99% of the prior spread — a noisy sensor removes almost nothing.
Verify: K ≈ 0.0099 (near 0), estimate ≈ 5.03 (near prediction), and P + ≈ 0.099 — barely improved over P − = 0.1 , because a bad sensor gives little new information. ✅
Worked example Ex 4 — already certain
P − = 0 : our prediction has zero uncertainty (a boundary case — mathematically we already "know" the state). R = 2 , H = 1 , z = 9 .
Forecast: if we're already perfectly sure, no sensor should move us. Expect K = 0 , P + = 0 .
S = 1 ⋅ 0 ⋅ 1 + 2 = 2 . Why: S stays finite because sensor noise is still there.
K = 0 ⋅ 1/2 = 0 . Why: zero prior confidence-times-nothing ⇒ zero numerator.
x ^ + = x ^ − + 0 ⋅ ( z − x ^ − ) = x ^ − — unchanged.
Why: the update multiplies the surprise by K = 0 , so nothing is added — a certain state is never nudged.
P + = ( 1 − 0 ) ⋅ 0 = 0 .
Why: ( 1 − K H ) P − = 1 ⋅ 0 = 0 — a state known exactly stays known exactly.
Verify: K = 0 , P + = 0 . A perfectly known state can never be improved or corrupted by a sensor — the filter correctly ignores the measurement. This is the exact mirror of the perfect-sensor case in Ex 6. ✅
Worked example Ex 5 — the sensor scales the state
Our state is a distance in metres , but the sensor reports in a scaled unit so that z = 2 x + v . Here H = 2 (the scaling), and v is the sensor noise — a zero-mean random error with variance R added to each reading. Take P − = 5 , R = 4 , x ^ − = 3 , z = 8 .
Forecast: because H = 2 magnifies, a bit of the sensor goes a long way. Expect K < 1 and the estimate to move up toward the value implied by z .
S = H P − H ⊤ + R = 2 ⋅ 5 ⋅ 2 + 4 = 24 . Why: mapping the prior through H scales it by H 2 = 4 ; adding R accounts for the noise v .
K = P − H ⊤ S − 1 = 5 ⋅ 2/24 = 10/24 ≈ 0.416667 . Why: the H factor appears in the numerator too, converting sensor-space back to state-space.
Predicted measurement H x ^ − = 2 ⋅ 3 = 6 ; innovation = 8 − 6 = 2 .
Why: we must compare z against what the sensor would read, not against x ^ − directly.
x ^ + = 3 + 0.416667 ⋅ 2 ≈ 3.833333 .
Why: the update x ^ − + K ( surprise ) works entirely in state-space — K already contains the H − 1 -like conversion, so we add a state-space nudge to the state-space prediction.
P + = ( 1 − K H ) P − = ( 1 − 0.416667 ⋅ 2 ) ⋅ 5 = ( 1 − 0.833333 ) ⋅ 5 ≈ 0.833333 .
Why: here the removed fraction is K H = 0.833 , not K ; the map H amplifies how much uncertainty each unit of gain strips away.
Verify: note K H = 0.8 3 < 1 , so ( 1 − K H ) stays positive and P + > 0 — no illegal negative variance. P + ≈ 0.833 < P − = 5 : certainty improved. ✅
z with x ^ − directly when H = 1
Why it feels right: both are "the value we care about." The fix: the sensor lives in measurement space ; you must map the estimate forward with H first — the innovation is z − H x ^ − , not z − x ^ − .
Worked example Ex 6 — the sensor is exact
Boundary limit opposite to Ex 4: now the sensor is flawless, R = 0 , while the prediction is uncertain. P − = 4 , H = 1 , x ^ − = 10 , z = 13 .
Forecast: a flawless sensor should be believed completely. Expect K = 1 , estimate = z = 13 , and P + = 0 (we now know the state exactly).
S = 1 ⋅ 4 ⋅ 1 + 0 = 4 . Why: with R = 0 the only spread left is the mapped prior.
K = P − H ⊤ S − 1 = 4/4 = 1 . Why: a noiseless sensor earns full trust — the dial hits its maximum.
Innovation = z − H x ^ − = 13 − 10 = 3 .
x ^ + = 10 + 1 ⋅ 3 = 13 .
Why: the update adds the entire surprise, so the estimate lands exactly on the measurement — the prediction is fully overwritten.
P + = ( 1 − K H ) P − = ( 1 − 1 ) ⋅ 4 = 0 .
Why: ( 1 − K H ) = 0 removes all prior uncertainty — an exact reading collapses our spread to zero.
Verify: K = 1 , x ^ + = z = 13 , P + = 0 — exactly the promised limit R → 0 , and the perfect mirror image of Ex 4's perfect-prior case. ✅
Worked example Ex 7 — position–velocity, uncorrelated
State is [ position velocity ] with
P − = [ 4 0 0 1 ] , H = [ 1 0 ] , R = 2.
The sensor sees position only . Find the gain vector K and P + .
Forecast: the sensor touches position directly, so it should shrink the position variance a lot and the velocity variance not at all (they're uncorrelated here).
H P − H ⊤ = [ 1 0 ] [ 4 0 0 1 ] [ 1 0 ] = 4 .
Why: pick out the position variance the sensor actually sees.
S = 4 + 2 = 6 (a scalar — one sensor).
P − H ⊤ = [ 4 0 0 1 ] [ 1 0 ] = [ 4 0 ] .
K = P − H ⊤ S − 1 = [ 4 0 ] /6 = [ 2/3 0 ] .
Why: the zero second entry says "this measurement can't directly correct velocity."
P + = ( I − K H ) P − . Here K H = [ 2/3 0 ] [ 1 0 ] = [ 2/3 0 0 0 ] , so I − K H = [ 1/3 0 0 1 ] .
Why: ( I − K H ) removes gain-weighted uncertainty; the velocity row is untouched because K 's velocity entry is 0 .
P + = [ 1/3 0 0 1 ] [ 4 0 0 1 ] = [ 4/3 0 0 1 ] .
Why: posterior uncertainty; the diagonal ( I − K H ) P − shrinks position, leaves velocity.
Verify: position variance dropped 4 → 4/3 ≈ 1.333 ; velocity variance stayed 1 — exactly the forecast, since the states were uncorrelated. ✅
Worked example Ex 8 — off-diagonal terms let one sensor fix two states
Same position sensor H = [ 1 0 ] , R = 2 , but now position and velocity are correlated :
P − = [ 4 2 2 3 ] .
The off-diagonal 2 means position and velocity errors tend to move together. Find K and P + , and watch the velocity variance improve even though the sensor never touches velocity.
Forecast: because the states are linked, a position measurement should also sharpen velocity — the velocity variance should drop below 3 , unlike in Ex 7.
H P − H ⊤ = [ 1 0 ] P − [ 1 0 ] = 4 . Why: still the top-left entry — the position variance the sensor reads.
S = 4 + 2 = 6 . Why: mapped prior variance plus sensor noise, a scalar since there is one sensor.
P − H ⊤ = [ 4 2 2 3 ] [ 1 0 ] = [ 4 2 ] .
Why: the second entry is now 2 , not 0 — the correlation makes velocity respond to a position reading.
K = P − H ⊤ S − 1 = [ 4 2 ] /6 = [ 2/3 1/3 ] .
Why: a nonzero velocity gain — the filter will correct velocity via the shared uncertainty. Here S − 1 = 1/6 because S is a 1 × 1 scalar.
K H = [ 2/3 1/3 ] [ 1 0 ] = [ 2/3 1/3 0 0 ] , so I − K H = [ 1/3 − 1/3 0 1 ] .
Why: ( I − K H ) is the operator that strips gain-weighted uncertainty; the − 1/3 entry is where the position correction bleeds into velocity.
P + = ( I − K H ) P − = [ 1/3 − 1/3 0 1 ] [ 4 2 2 3 ] = [ 4/3 2/3 2/3 7/3 ] .
Why: posterior covariance; the correlation channelled information from position into velocity, so both diagonal entries shrink.
Verify: velocity variance dropped 3 → 7/3 ≈ 2.333 — strictly below the 3 it would have kept if uncorrelated (Ex 7). The off-diagonal term did real work: one sensor sharpened two states. Position variance also dropped 4 → 4/3 . ✅
Intuition The lesson of Ex 7 vs Ex 8
With a diagonal prior a position sensor helps only position. With correlation , the shared uncertainty acts like a hidden wire: measuring one end tightens the other. This is why real GNC filters (Sensor Fusion in Navigation ) keep full covariance matrices, not just diagonals.
Worked example Ex 9 — fusing barometer altitude into a GNC estimate
A drone's navigation filter predicts altitude x ^ − = 100 m with variance P − = 9 m 2 (so ± 3 m one-sigma). A barometer reads z = 106 m with noise variance R = 16 m 2 (± 4 m). H = 1 . What altitude do we report, and how sure are we?
Forecast: the prediction (± 3 m) is a bit tighter than the sensor (± 4 m), so K < 0.5 ; the answer should stay closer to 100 than to 106 .
S = 9 + 16 = 25 m 2 . Why: add the two uncertainties in the same space.
K = 9/25 = 0.36 (dimensionless). Why: prediction contributes 9/25 of the total spread.
Innovation = 106 − 100 = 6 m . Why: the barometer–prediction disagreement.
x ^ + = 100 + 0.36 ⋅ 6 = 102.16 m .
Why: the update nudges the predicted altitude by 36% of the 6 m surprise — a partial move toward the barometer.
P + = ( 1 − 0.36 ) ⋅ 9 = 5.76 m 2 , i.e. ± 2.4 m.
Why: ( 1 − K H ) keeps 64% of the prior variance; fusing a decent sensor shaved the rest off.
Verify: units: K dimensionless, estimate in metres, P + in m 2 . The reported 102.16 m lies nearer 100 than 106 (forecast ✓), and ± 2.4 m beats both ± 3 and ± 4 — fusion tightened the estimate. ✅
Intuition How to read the U-valley figure below
Figure s02 plots the posterior trace tr ( P + ) as a curve against the gain K , using the Joseph form so it's valid for every K — not just the optimum. The curve is a parabola (a valley). The amber dot marks its lowest point; that K is the Kalman gain. Sample points at K = 0.6 and K = 1.0 sit higher on both walls, proving the middle is best. The picture turns "the gain minimizes the trace" into something you can literally see bottoming out.
Definition The Joseph form (general posterior covariance)
The formula P + = ( I − K H ) P − only holds at the optimal gain. For an arbitrary gain K the correct posterior covariance is the Joseph form
P + = ( I − K H ) P − ( I − K H ) ⊤ + K R K ⊤ .
Its first term is what survives of the prediction; the second, K R K ⊤ , is the sensor noise the gain lets in. In the scalar case with H = 1 this reads P + = ( 1 − K ) 2 P − + K 2 R — a quadratic (parabola) in K , which is exactly why the trace has a single valley.
Worked example Ex 10 — is the Kalman gain really the minimum?
With P − = 4 , H = 1 , R = 1 (the scalar case from the parent, optimal K ⋆ = 0.8 ), evaluate tr ( P + ) using the Joseph form at K = 0.6 , K = 0.8 , and K = 1.0 . Show the middle one is smallest.
Forecast: the trace is a parabola in K ; the bottom is at K = 0.8 , so the middle value should be lowest.
Joseph form (valid for any K ): P + = ( 1 − K ) 2 P − + K 2 R = 4 ( 1 − K ) 2 + K 2 .
Why this step? below the optimum we cannot use P + = ( 1 − K ) P − ; that shortcut only holds at K ⋆ . The Joseph form is safe everywhere.
K = 0.6 : 4 ( 0.4 ) 2 + ( 0.6 ) 2 = 4 ⋅ 0.16 + 0.36 = 0.64 + 0.36 = 1.00 .
Why: evaluate on the left wall of the valley.
K = 0.8 : 4 ( 0.2 ) 2 + ( 0.8 ) 2 = 4 ⋅ 0.04 + 0.64 = 0.16 + 0.64 = 0.80 .
Why: evaluate at the predicted optimum K ⋆ = 0.8 .
K = 1.0 : 4 ( 0 ) 2 + ( 1 ) 2 = 0 + 1 = 1.00 .
Why: evaluate on the right wall (full trust in sensor).
Verify: values 1.00 , 0.80 , 1.00 — a clean valley bottoming at K = 0.8 , and 0.80 matches the parent's optimal P + . The Joseph result at K ⋆ equals the simplified ( 1 − K ) P − = 0.2 ⋅ 4 = 0.8 . ✅
The trace of P + is a U-shaped valley in K ; its floor is the optimal Kalman gain.
Line the ten cells up as one sentence: balanced → sensor-wins → prediction-wins → already-sure → rescale → perfect-sensor → vectorize → correlate → fly it → check the valley. Same formula K = P − H ⊤ S − 1 every single time.
Recall Quick self-test
In Ex 1, why did K come out exactly 0.5 ? ::: Because P − = R , so prior and sensor spreads are equal; the dial sits at the midpoint.
In Ex 4, why is the sensor ignored? ::: P − = 0 makes the numerator P − H ⊤ = 0 , so K = 0 and the measurement can't move the already-certain estimate.
In Ex 5, what is the innovation, and what is v ? ::: Innovation = z − H x ^ − = 8 − 2 ⋅ 3 = 2 , using the mapped prediction; v is the zero-mean sensor noise with variance R added to each reading.
In Ex 6, why does P + = 0 ? ::: A perfect sensor (R = 0 ) gives K = 1 so ( 1 − K H ) = 0 removes all prior uncertainty — we now know the state exactly.
In Ex 8, why does velocity variance improve even though the sensor never sees velocity? ::: The off-diagonal (correlation) term makes K 's velocity entry nonzero, so a position reading corrects velocity through the shared uncertainty.
In Ex 10, why can't we use P + = ( 1 − K ) P − at K = 0.6 ? ::: That simplification only holds at the optimal gain; for arbitrary K use the Joseph form ( 1 − K ) 2 P − + K 2 R .
Intuition What the flowchart says
The chain below is the reading order of this page: each box is one scenario cell, and the arrows mean "next harder case." It shows the deliberate escalation — start with a balanced scalar, push the dial to each extreme, hit the two degenerate boundaries, then climb into vectors (first uncorrelated, then correlated), apply it to a real flight, and finally prove the optimum. Following the arrows left to right walks you through every example on this page in the order it builds understanding.