What is covariance?

Covariance measures whether two uncertain quantities tend to be above or below their own averages together. For investment returns it supplies the interaction term in portfolio variance: the spread of combined returns depends on how holdings move together, as well as on each holding separately.

Multiply deviations, then take their expected value

A random variable is a number determined by an uncertain outcome. E[X] means its expected value: an average weighted by the probabilities of its possible values. A deviation is a value minus that average. For two variables X and Y, covariance is Cov(X,Y) = E[(X − E[X]) × (Y − E[Y])]. The expectation uses paired outcomes and their joint probabilities, meaning the chances of the two values occurring together.

Products are positive when both deviations have the same sign and negative when their signs differ. Positive covariance means same-sign deviations outweigh opposite-sign deviations in that probability-weighted sum; negative covariance means the reverse. Zero means cancellation in this measure, not that neither variable tells us anything about the other.

Units matter when comparing covariance

Covariance has the units of X multiplied by the units of Y. If both are returns in decimal form, its units are decimal return squared. If returns are expressed in percentage points, the covariance number is 10,000 times larger because each input is multiplied by 100.

Variance is a variable’s covariance with itself: Var(X) = E[(X − E[X])²]. Standard deviation, written σ, is the square root of variance and has the original units. When both standard deviations are positive, correlation ρ = Cov(X,Y) ÷ (σX × σY). Correlation removes the units and lies between −1 and +1.

Illustrative one-year inputs: return standard deviations of 0.10 and 0.20, with correlation +0.5, give covariance 0.5 × 0.10 × 0.20 = 0.01 decimal return squared, or 100 percentage-point-squared. This is a measure of joint variation, not a 1% return.

Zero covariance can hide dependence

An illustrative mathematical counterexample uses five equally likely values of X: −2, −1, 0, 1 and 2. Let Y = X². Then E[X] = 0, E[Y] = 2 and E[XY] = (−8 − 1 + 0 + 1 + 8) ÷ 5 = 0. Consequently Cov(X,Y) = E[XY] − E[X]E[Y] = 0. Yet knowing X determines Y exactly. This is nonlinear dependence: a curved relationship rather than a straight-line one.

Historical covariance estimates depend on the sample, aligned observation dates, time horizon and return convention. They can change. The Academy lesson uses covariance to combine simultaneous holdings; it does not assume that an estimate remains stable or that diversification prevents losses.

Frequently asked questions

Does negative covariance mean one asset always gains when the other loses?

No. Covariance compares returns with their own expected returns, not with zero, and summarizes all the paired possibilities. Its sign does not promise an offset on every occasion.

Is covariance the variance of an estimated average?

No. Here covariance describes two uncertain returns, and variance describes the spread of a return around its expected value. Uncertainty in an estimated sample mean is a separate statistical question.

Does zero covariance prove independence?

No. Independence means that knowing one variable gives no information about the distribution of the other. Zero covariance only removes this particular measure of linear association; nonlinear dependence can remain.

Learn this in the Academy

See it on a ticker

Browse all S&P 500 tickers to see this metric applied to individual companies.

Related terms

Educational research only — not investment advice.