- The diagonal holds the variances: how much each variable spreads on its own.
- The off-diagonal holds the covariance: how the pair moves together.
- The matrix is symmetric, because cov(x, y) = cov(y, x).
- The correlation ρ = σₓᵧ / (σₓσᵧ) is the covariance on a fixed scale from −1 to 1.
- The 2σ ellipse is the picture of P: its width is set by the diagonal, its tilt by the off-diagonal.
Three numbers in one box
Track two numbers at once, for example a robot's x and y position. Three things describe the uncertainty: the variance of x, the variance of y, and their covariance. We put them in a matrix:
A note on writing: the pictures below print P on one line as [a b; c d]. The semicolon starts a new row, so [4 0; 0 1] has rows 4, 0 and 0, 1. In the same style, [p; v] is a column, p on top of v.
The diagonal (top left to bottom right) holds the variances. The off-diagonal holds the covariance. Since cov(x, y) and cov(y, x) are the same product of deviations, σₓᵧ = σᵧₓ and the matrix is symmetric: it equals its own transpose (rows and columns swapped).
The café from slide 1, temperature and ice cream:
Now stack the two numbers into one vector, x = (x, y). We write x ~ N(μ, P) to say: the vector x follows a Gaussian with mean vector μ and covariance matrix P. It is the 2D version of the bell curve N(μ, σ²) from lesson 1. The Kalman filter calls this matrix P, the same letter as the 1D variance.
Correlation: covariance on a fixed scale
The size of a covariance depends on units. Measure x in centimetres instead of metres and it grows 100 times. To compare links fairly, divide by the two standard deviations:
This is the correlation coefficient, written ρ (the Greek letter "rho"). It always lies between −1 and 1. At ρ = 1 the points sit on a rising line. At ρ = −1 they sit on a falling line. At ρ = 0 the points don't lean along any tilted line. Going back is easy: σₓᵧ = ρ σₓ σᵧ.
That gives a quick validity test. If |σₓᵧ| is bigger than σₓσᵧ, the matrix claims |ρ| > 1, which is impossible. It is not a real covariance matrix. If you have met determinants (ad − bc for a 2 by 2 matrix), here is the same test in another form: σₓ²σᵧ² − σₓᵧ² is never negative for a real covariance matrix. You can skip this if determinants are new to you.
The 2σ ellipse
In 1D we drew a band of ±2σ around the estimate. In 2D the band becomes an ellipse: the 2σ ellipse is the curve that fences in the most likely points, about 86% of them, the 2D version of "within 2σ of the mean". With no covariance, the ellipse reaches 2σₓ to the left and right of the mean and 2σᵧ above and below it, with its axes along x and y.
Covariance tilts it. Even when it tilts, its furthest left and right points are still 2σₓ from the mean, and its highest and lowest points are still 2σᵧ from it.
About 86% of samples land inside the 2σ ellipse (no need to derive this number). Why fewer than the 95% inside the 1D band? A point must now be close in both directions at once. Being near in x is not enough if it is far off in y.
Read the ellipse like this. A wide ellipse means x is uncertain. A tall one means y is uncertain. A round one with no tilt means equal spread and no correlation. A tilt up to the right means positive covariance: if x is too big, y is probably too big as well. A tilt down to the right means negative covariance.
The lab under this slide draws the same picture, with three sliders under the picture for the entries of P: P11 = σₓ² (top left), P22 = σᵧ² (bottom right) and P12 = σₓᵧ (the off-diagonal).
Keep reading with the full course
Finish lesson 3 and you will be able to: track position and velocity in 2D with the matrix Kalman filter.
Still locked here:
- The rest of this explanation
- 3 more examples with step-by-step solutions
- Five extra members-only problems with worked solutions
$20 once, lifetime access. Lessons 1 and 2 stay free.
Examples
Example 1 · Build P from spreads and correlation
σₓ = 2, σᵧ = 1.4, ρ = 0.6 (the numbers in the lab).
Show solutionHide solution
Positive covariance: the ellipse is wider than tall and tilts up to the right.
Example 2 · Read a matrix
P = 9−6−616. What does it say?
Show solutionHide solution
y spreads more than x, so the ellipse is taller than wide. The negative sign tilts it down to the right: when x is high, y tends to be low.

Questions and comments
Stuck on something, or found a mistake? Ask here and I'll answer. You sign in with GitHub.