Calculators
Home › Calculators › Covariance Calculator

Covariance Calculator

Do the two variables move together? Covariance gives the direction; correlation gives the strength.

Calculate covariance

Two paired datasets of equal length, in matching order.

Quick answer: Positive covariance means the variables rise together; negative means one falls as the other rises. Divide by both standard deviations to get the unit-free correlation.

How to use this covariance calculator

Enter two paired datasets, the same length, in matching order (each X with its own Y), and press Calculate. You get sample and population covariance, plus the correlation coefficient that makes the result interpretable.

What covariance measures

Covariance watches two variables move and asks: when one is above its mean, is the other usually above its mean too? If yes, covariance is positive. If one rises as the other falls, negative. If there is no pattern, near zero. It is the raw ingredient of correlation, portfolio risk and regression slopes.

Worked example

Study hours vs marks for five students: hours 2, 3, 4, 5, 6; marks 50, 55, 60, 68, 72. Sample covariance = 14.25: positive, as expected. But 14.25 what? Its units (hour·marks) are uninterpretable, which is why the same screen shows r ≈ 0.995: a near-perfect positive linear relationship, stated in units anyone can compare.

Covariance's fatal flaw: and its famous child

Rescale marks to percentages of 100 (halving them) and the covariance halves too, though the relationship did not change at all. Covariance's magnitude is unit-contaminated; only its sign is portable. Divide it by both standard deviations and you get Pearson's correlation, bounded between −1 and +1, unit-free, and the statistic covariance is mostly used to build.

Common mistake: reading a large covariance as a strong relationship. Strength lives in the correlation. A covariance of 14.25 or 14,250 can describe the identical relationship in different units.

Frequently asked questions

What does a positive covariance mean?

The two variables tend to move together: above-average values of one pair with above-average values of the other. Negative covariance means they move in opposite directions.

What is the difference between covariance and correlation?

Correlation is covariance divided by both standard deviations, which bounds it between −1 and +1 and removes the units. Covariance keeps the units and can be any size.

Can covariance be zero for related variables?

Yes, if the relationship is non-linear (for example a perfect U-shape), covariance can be ~0 despite a strong relationship. It only detects linear co-movement.