InfyCalculator
📊

Covariance Calculator

Calculate the sample and population covariance between two paired lists of numbers, with the means and correlation for context.

X values
Y values
Loading calculator…

How it works

Sample cov = Σ(x − x̄)(y − ȳ) ÷ (n − 1) · Population cov = Σ(x − x̄)(y − ȳ) ÷ n

Covariance measures whether two variables move in the same direction: it is the average product of their deviations from their own means. A positive value means above-average X tends to pair with above-average Y, a negative value means the opposite, and zero means no linear co-movement. Its size depends on the units of the data, which is why dividing by the two standard deviations to get correlation makes it comparable across data sets.

Worked example

For X = 2, 4, 6, 8, 10 and Y = 1, 3, 2, 5, 4, the means are x̄ = 6 and ȳ = 3. The deviation products sum to 20, so the population covariance is 20 ÷ 5 = 4 and the sample covariance is 20 ÷ 4 = 5 — both positive, so the pair moves together.

Sources: Covariance — Wikipedia

Frequently asked questions

Should I use the sample or population covariance?

Use the sample version (divide by n − 1) when your data is a sample drawn from a larger group and you want an unbiased estimate. Use the population version (divide by n) only when your data is the entire population of interest.

How is covariance different from correlation?

Correlation is covariance standardised by the two standard deviations, so it always sits between −1 and 1 and has no units. Covariance keeps the original units and can be any size, which makes its raw value hard to interpret on its own.

What does a covariance of zero mean?

It means there is no linear co-movement between the variables. They can still be related in a non-linear way — covariance, like correlation, only captures straight-line association.

Related calculators

For education — check the assumptions (sample size, independence, distribution) before using these statistics in real decisions.