What is the difference between covariance and correlation?

The Problem: Two small datasets each come with their sample covariance: ad spend versus weekly sales gives 342,500, and temperature versus ice cream cones gives 2.16. Does the much larger number mean the first pair has the stronger relationship, and what would you compute to compare them fairly?
Answer
Both measure how two variables move together. Covariance is the raw co-movement, expressed in the product of the two variables’ units: positive when the variables tend to sit above their means together, negative when one runs high while the other runs low. Correlation (Pearson’s ) is covariance divided by both standard deviations, which strips the units and bounds the result to
, so strengths become comparable across datasets. Neither proves causation, and both capture only linear association: a perfect parabola scores zero correlation despite being fully determined.
(1) Units: covariance keeps the product of the units (dollars times kilograms); correlation is unitless and bounded, so rescaling a variable changes the covariance but leaves the correlation untouched.
(2) Sign vs Strength: covariance tells you the direction of co-movement; only correlation tells you a comparable strength, since vs
means the same thing for any pair of variables.
(3) Linear Only: both are second-moment statistics of linear association. Zero correlation does not imply independence: on symmetric data has
while
fully determines
.

Figure 1: Correlation reads linear co-movement: positive (top left), negative (top right), zero with independence (bottom left), and the trap case, zero correlation with complete dependence on a parabola (bottom right). The first three have matching covariance signs; the fourth shows why a second-moment statistic can miss structure.
Mathematical Formulation:
Where:
are random variables with means
and standard deviations
.
is expectation over the joint distribution; in practice both quantities are estimated by sample averages.
lies in
by the Cauchy-Schwarz inequality, with
meaning an exact linear relationship.
| Feature | Covariance | Correlation |
|---|---|---|
| Definition | Mean product of centered values | Covariance divided by both |
| Units | Product of the variables’ units | Unitless |
| Range | Unbounded | |
| Scale Invariance | No: rescaling a variable rescales it | Yes: unchanged by a positive affine rescaling (a negative scale flips the sign) |
| Typical Use | Portfolio variance, covariance matrices, PCA | Comparing association strength, feature screening |









