Core inference · Association
Covariance Calculator
Do two variables move together? Paste paired x and y values to get the sample and population covariance — the average product of their deviations from their means — with the correlation, the deviation-by-deviation working and a scatter plot. Covariance gives you the direction of the relationship; its size, though, is the thing people misread.
Each x must be paired with a y in the same position (here, study hours against an exam score). Extra unpaired values are ignored.
Result
In plain English
Covariance measures whether two variables tend to rise and fall together. For each data point you take how far x is from its mean and how far y is from its mean, multiply the two, and average the results. When high-x points tend to be high-y, those products are positive and the covariance is positive; when they pull opposite ways, it is negative. What it cannot tell you is how strong the relationship is, because the number is in the product of x’s and y’s units — change the units and the covariance changes too.
- covariance, Cov(x, y)
- The average product of paired deviations from the means: Σ(x − x̄)(y − ȳ) divided by n − 1 (sample) or n (population). Positive = move together, negative = move oppositely, near zero = no linear link.
- sample vs population
- Divide by n − 1 for a sample (the usual case), or by n for a whole population. The two converge as the dataset grows.
- why the size is misleading
- Covariance carries the units of x times y, so its magnitude depends entirely on scale. A covariance of 40 is not “bigger” than one of 0.4 in any meaningful sense.
- correlation = standardised covariance
- Divide the covariance by the two standard deviations and you get the correlation r, a unit-free number from −1 to +1 that can be compared. That is why correlation, not covariance, is usually reported.
- linear only
- Covariance and correlation see straight-line association. A strong curved relationship can still have a covariance near zero.
Frequently asked
What is the difference between covariance and correlation?
They measure the same thing — whether two variables move together — but covariance keeps the original units, so its size depends on scale and cannot be compared across different pairs of variables. Correlation is covariance divided by the two standard deviations, which cancels the units and pins the result between −1 and +1. So covariance tells you the direction of a linear relationship; correlation tells you the direction and the strength on a standard scale.
Can covariance be negative?
Yes. A negative covariance means the variables tend to move in opposite directions — when one is above its mean, the other tends to be below its mean (think hours of exercise versus resting heart rate). A positive covariance means they move together, and a covariance near zero means there is no consistent linear relationship. Only the sign is safe to read directly; the magnitude needs standardising first.
Why can't I interpret the size of a covariance?
Because it is measured in the product of the two variables’ units — “hour-marks”, “pound-kilograms”, whatever they happen to be. Rescale either variable (say, measure height in centimetres instead of metres) and the covariance changes by that factor, even though the relationship is identical. So a large covariance might just mean large units. To judge strength, convert it to a correlation.
What does a covariance of zero mean?
That there is no linear tendency for the variables to move together — high-x points are no more likely to be high-y than low-y. It does not mean the variables are unrelated: a strong non-linear pattern (a U-shape, say) can produce a covariance of almost exactly zero. Zero covariance rules out a straight-line link, not every link, which is why plotting the data still matters.