JOVANA
Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
All guides

Bell Curves and the Kalman Filter

When uncertainty is a tidy bell curve, the predict–update loop becomes the famous Kalman filter, with a gain that weighs guess against measurement.

A belief you can carry in two numbers

A robot rarely knows exactly where it is. Instead it holds a belief: a whole landscape of "how likely is each possible position?" In general that landscape can be any messy shape, and storing it honestly could take a huge table of numbers. The trick that makes real-time filtering possible is to assume the landscape is a Gaussian — the smooth, symmetric bell curve you have seen on test-score charts.

A bell curve is beautifully cheap to describe. You only need two things: a mean, the peak of the curve, which is your single best guess; and a spread, how wide the curve is, which says how unsure you are. A tall narrow bell means "I am quite confident I am right here." A low wide bell means "it could be anywhere around here."

When the state has several numbers at once — say x, y, and heading — the spread grows into a covariance matrix. Its diagonal holds the uncertainty in each variable on its own; its off-diagonal entries capture how variables lean together. An off-diagonal term saying "x and heading are correlated" means a measurement of one quietly sharpens your knowledge of the other.

Why bell curves give a clean formula

The general recipe for tracking a belief over time is recursive Bayesian estimation: predict the belief forward through the robot's motion, then correct it with each new measurement, looping forever. The catch is that, for an arbitrary belief shape, doing this exactly means computing nasty integrals you cannot solve in closed form on a small robot.

Gaussians have a magical property that rescues us. If your belief is a bell curve, and the robot's motion is linear, and the noise that creeps in is also Gaussian, then the result after predicting is still a bell curve. Multiply a Gaussian belief by a Gaussian measurement and — again — you get a Gaussian. The bell curve is a shape that never breaks under these operations, so the belief never escapes the two numbers you are tracking.

Because the shape is locked in, the integrals collapse into a handful of matrix sums and products. That special, exact closed form of the Bayes filter for the Gaussian-and-linear case is the Kalman filter. It is not a different idea from the general predict–correct loop — it is the same loop, made fast and exact by the assumption that everything stays a bell curve.

Predict, then update

The Kalman filter runs the same two predict and update steps over and over, one round per tick of time. Each round takes the bell curve from the last moment and hands a sharper one to the next.

  1. Predict: push the mean forward using the motion model — "I commanded the wheels forward 10 cm, so my best guess moves 10 cm." Because motion is never perfect, the process noise is added in and the covariance grows. The bell curve slides over and gets wider: prediction always makes you less certain.
  2. Update: a sensor reports something — a beacon distance, a wall seen by LiDAR. Compare what the sensor said with what the prediction expected; the difference is the innovation. Use it to tug the mean toward the measurement, and shrink the covariance. The bell curve pulls over and gets taller: every good measurement makes you more certain.

Notice the rhythm: predict spreads the bell out, update squeezes it back in. A robot that only predicts — pure dead reckoning in spirit — watches its bell curve balloon without bound. A robot that keeps measuring keeps its curve in check. The push and pull between motion and sensors is the whole heartbeat of the filter.

The Kalman gain: a trust dial

How hard should the update tug the mean toward the new measurement? That single decision is the job of the Kalman gain. Think of it as a dial between 0 and 1. Near 0 means "trust my prediction, barely listen to the sensor." Near 1 means "trust the sensor, throw out my old guess."

The filter sets that dial automatically, by comparing the two spreads. If the prediction is uncertain (a wide bell) but the sensor is crisp (small measurement noise), the gain climbs toward 1 and the measurement wins. If the prediction is confident but the sensor is jittery, the gain drops toward 0 and the prediction holds. The gain is just the relative certainty of the two stories, turned into a weight.

# Scalar update for one number (e.g. a 1-D position)
# x  = predicted mean        P = predicted variance (spread^2)
# z  = sensor reading        R = sensor variance (its noise)

K = P / (P + R)            # the gain: 0..1, P vs R decide it
x = x + K * (z - x)        # nudge mean toward the reading
P = (1 - K) * P           # spread always shrinks after a look

# If sensor is perfect (R=0): K=1, x jumps to z, P -> 0
# If sensor is useless (R huge): K~0, x stays, P unchanged
The one-dimensional update in three lines: the gain blends guess and reading, then certainty grows.

Read the middle line as a weighted average you already do in daily life. "z - x" is how surprised you are; multiplying by K decides how much of that surprise to believe. The same three lines, written with matrices instead of single numbers, are exactly the full Kalman update — the scalar case is the whole intuition in miniature.

Where the bell curve assumption bends

The Kalman filter is exact only when motion and measurements are linear. Real robots turn corners, and a heading folds sines and cosines into the math — that is not linear, so a pure bell curve no longer survives the prediction step untouched.

Engineers handle this without abandoning the bell curve. The extended Kalman filter straightens the curved motion into a local straight-line approximation at each step, while the unscented Kalman filter pushes a few carefully chosen sample points through the true curve and refits a Gaussian to where they land. Both keep the cheap two-number belief; they only differ in how they cope with the bend.