Homeโ€บGlossaryโ€บCovariance

Covariance

General

Statistical Covariance

A measure of how two variables change together, where the sign indicates the direction of the relationship โ€” positive means they move together, negative means they move oppositely.

Definition

Covariance is a measure of how two variables change together. If both variables tend to be above their respective means at the same time (and below their means at the same time), the covariance is positive. If one variable tends to be above its mean when the other is below its mean, the covariance is negative. A covariance near zero suggests little to no linear relationship between the variables. The Covariance Calculator computes this value directly from a dataset of paired observations.

Covariance is the foundation for the correlation coefficient, which rescales covariance into a standardized, unitless value between -1 and 1 so relationships can be compared across variables measured in completely different units. Because raw covariance is expressed in the product of the two variables' units (for example, dollars ร— years), it can be difficult to interpret magnitude directly โ€” this is why analysts typically move to the Correlation Coefficient, calculated with the Correlation Coefficient Calculator, when they need to judge the strength of a relationship rather than just its direction.

In finance, covariance between asset returns is a critical building block of modern portfolio theory โ€” it determines how combining two assets affects overall portfolio risk, independent of each asset's individual volatility.

Formula

For a sample of paired observations (x, y):

Cov(X, Y) = ฮฃ[(xแตข โˆ’ xฬ„)(yแตข โˆ’ ศณ)] รท (n โˆ’ 1)

Where xฬ„ and ศณ are the means of X and Y, and n is the number of paired observations.

Worked Example

Consider 4 paired observations of advertising spend (X, in $1,000s) and sales (Y, in $1,000s):

X Y
2 20
4 30
6 35
8 45

Mean of X (xฬ„) = 5, Mean of Y (ศณ) = 32.5

Deviations and products: (2โˆ’5)(20โˆ’32.5) = 37.5, (4โˆ’5)(30โˆ’32.5) = 2.5, (6โˆ’5)(35โˆ’32.5) = 2.5, (8โˆ’5)(45โˆ’32.5) = 37.5

Sum = 37.5 + 2.5 + 2.5 + 37.5 = 80

Cov(X, Y) = 80 รท (4 โˆ’ 1) = 80 รท 3 โ‰ˆ 26.67

The positive covariance confirms advertising spend and sales tend to increase together.

Key Things to Know

  • Sign matters more than magnitude: a positive covariance means the variables move together, a negative one means they move oppositely โ€” but the raw number itself is hard to interpret in isolation.
  • Units affect the scale: covariance is expressed in the product of the two variables' units, which is why it's not directly comparable across different variable pairs.
  • Correlation is the standardized version: dividing covariance by the product of the two standard deviations produces the Correlation Coefficient, which ranges from -1 to 1 and is easier to interpret for relationship strength.
  • Zero covariance doesn't guarantee independence: two variables can have zero linear covariance while still having a strong non-linear relationship.
  • Central to portfolio diversification: in finance, pairing assets with low or negative return covariance can reduce overall portfolio risk even when individual assets are volatile.

Frequently Asked Questions

A positive covariance means that when one variable is above its own mean, the other variable also tends to be above its own mean โ€” the two variables move in the same direction. For example, hours studied and exam scores typically have a positive covariance.
A negative covariance means the two variables tend to move in opposite directions โ€” when one is above its mean, the other tends to be below its mean. Outdoor temperature and heating costs typically have a negative covariance, since costs fall as temperature rises.
Covariance measures the direction of a linear relationship but its magnitude depends on the units of the variables, making it hard to compare across datasets. Correlation standardizes covariance by dividing it by the product of the two variables' standard deviations, producing a unitless value between -1 and 1 that is directly comparable across any pair of variables.
Not reliably on its own โ€” because covariance is scaled by the units of the underlying variables, a large covariance value doesn't necessarily mean a strong relationship, and a small one doesn't necessarily mean a weak one. The correlation coefficient is generally preferred for judging strength since it's normalized to a fixed -1 to 1 range.
Covariance between asset returns is a core input to portfolio theory, since it quantifies how two investments move relative to each other and directly affects overall portfolio risk. Combining assets with low or negative covariance can reduce total portfolio volatility through diversification, even if each asset individually is risky.