Presenting Kalman filter equations and gain intuition
The Kalman filter predicts the state and covariance, then updates them using measurements:
Predict:
(\hat{x}{k|k-1} = F \hat{x}{k-1|k-1} + B u_k)
(P_{k|k-1} = F P_{k-1|k-1} F^T + Q)
Update:
(y_k = z_k - H \hat{x}{k|k-1}) (innovation)
(S_k = H P{k|k-1} H^T + R) (innovation covariance)
(K_k = P_{k|k-1} H^T S_k^{-1}) (Kalman gain)
(\hat{x}{k|k} = \hat{x}{k|k-1} + K_k y_k)
(P_{k|k} = (I - K_k H) P_{k|k-1})
The Kalman gain (K_k) balances trust in the prediction versus the measurement by weighting their uncertainties: it increases when the predicted covariance (P_{k|k-1}) is large (model uncertainty) or when measurement noise covariance (R) is small (reliable measurements), and decreases if measurements are noisy ((R) large) or the prediction is confident ((P_{k|k-1}) small). This gain is derived to minimize the posterior estimation error covariance, optimally blending model and measurement information.
A standard discrete–time linear Gaussian state–space model can be written as
[
x_k = F,x_{k-1} + B,u_{k-1} + w_{k-1},\qquad w_{k-1}\sim\mathcal{N}(0,Q),
]
[
z_k = H,x_k + v_k,\qquad v_k\sim\mathcal{N}(0,R),
]
where (x_k) is the state, (u_k) is a known input, (z_k) is the measurement, (F,B,H) are known matrices, and (Q,R) are the process and measurement noise covariances.
The Kalman filter proceeds in two stages:
Predict (time update):
[
\hat{x}{k|k-1} = F,\hat{x}{k-1|k-1} + B,u_{k-1},
]
[
P_{k|k-1} = F,P_{k-1|k-1},F^\top + Q,
]
where (\hat{x}{k|k-1}) and (P{k|k-1}) are the predicted state and its covariance.
Update (measurement correction):
[
y_k = z_k - H,\hat{x}{k|k-1} \quad\text{(innovation)},
]
[
S_k = H,P{k|k-1},H^\top + R \quad\text{(innovation covariance)},
]
[
K_k = P_{k|k-1},H^\top,S_k^{-1} \quad\text{(Kalman gain)},
]
[
\hat{x}{k|k} = \hat{x}{k|k-1} + K_k,y_k,
]
[
P_{k|k} = \bigl(I - K_k H\bigr),P_{k|k-1}.
]
The gain (K_k) determines how much the new measurement influences the estimate. It is computed to minimise the posterior error covariance (P_{k|k}), and effectively weights the innovation by the relative uncertainties. If the predicted covariance (P_{k|k-1}) is large (high model uncertainty) or the measurement noise covariance (R) is small (reliable measurements), the term (H P_{k|k-1} H^\top) dominates (S_k) and (K_k) becomes large, so the filter trusts the measurement more. If (R) is large or (P_{k|k-1}) is small, (K_k) is small, and the filter sticks closer to the model prediction.