Skip to Main Content

Risk & Quant

Covariance

Covariance is a measure of how two return series move together, calculated as the average product of their deviations from their own means.
Also Called
  • Cov(X, Y)
  • Sample Covariance
  • Covariance of Returns
  • Sigma Xy
By InsiderFinance TeamUpdated Sources & Methodology

Build Covariance From Paired Deviations

Deviations are in percentage points. Products sum to 44; dividing by five gives sample covariance 8.8 squared percentage points.
MonthA DeviationB DeviationProduct
1224
2−4−28
34416
4−200
5−4−416
6400
Deviations are in percentage points. Products sum to 44; dividing by five gives sample covariance 8.8 squared percentage points.
On This Page
  1. What is covariance?
  2. Covariance example: six months of returns
  3. Covariance units and bounds
  4. Covariance matrix and portfolio variance
  5. Sample vs population covariance and time scaling
  6. Covariance in beta and hedge ratios
  7. Limitations of covariance
  8. Bottom line
  9. FAQ

Key Takeaways

  • Covariance is the average product of two variables’ deviations from their own means, so it measures joint movement rather than the dispersion of a single series.
  • The sample estimator divides the sum of paired deviation products by n minus 1, the same Bessel correction used for sample variance.
  • The sign carries the information a reader can use directly: positive means the two series tend to deviate in the same direction, negative means they offset, and zero means no average linear co-movement.
  • Covariance has the product of the input units. Its absolute value is bounded by the product of the two standard deviations, so the bound changes with their scale.
  • Dividing covariance by both standard deviations produces correlation, the unitless version bounded between −1 and +1.
  • The covariance of a series with itself is its variance, which is why the diagonal of a covariance matrix holds variances.

What is covariance?

Covariance is a measure of how two variables move together, calculated as the average product of their deviations from their own means. Positive covariance means those products are positive on balance, so the series tend to deviate in the same direction; negative covariance means they tend to offset. For return data, covariance enters correlation, portfolio variance, beta and minimum-variance hedge calculations.

Pairing a series with itself produces its variance.

Formula

Sample covariance: Cov(X, Y) = sum of (Xi − Xbar)(Yi − Ybar) / (n − 1); Equivalent one-pass form: Cov(X, Y) = [n / (n − 1)] × [mean(XY) − mean(X) × mean(Y)]; Correlation: r(X, Y) = Cov(X, Y) / (σX × σY); Two-asset portfolio variance: wA² σA² + wB² σB² + 2 wA wB Cov(A, B)
  • Xi and Yi are the paired period returns of the two series, observed over the same calendar.
  • Xbar and Ybar are the sample means of each series over the same window.
  • n is the count of paired observations. The n − 1 divisor gives an unbiased covariance estimator for independent paired draws from one joint distribution with finite second moments. The n divisor describes the complete observed set.
  • σX and σY are the sample standard deviations of the same two series, computed with the same n minus 1 divisor.
  • Cov(X, X) equals the variance of X, so variance is the special case of covariance where both series are the same.
  • mean(XY) is the average of the paired products themselves. Subtracting the product of the two means gives the population covariance in a single pass; the n over n minus 1 factor converts it to the sample estimate.
  • Covariance is reported in the product of the input units, such as percent squared, so rescaling the returns rescales the number.
  • The absolute value of Cov(X, Y) can never exceed σX times σY. That Cauchy-Schwarz ceiling is the only bound covariance has, and dividing by it is exactly what confines correlation to −1 through +1.

Covariance example: six months of returns

A trader pulls six monthly returns for two stocks over the same calendar. Stock A returns +4%, −2%, +6%, 0%, −2%, and +6%. Stock B returns +3%, −1%, +5%, +1%, −3%, and +1%. Returns are stated in percentage points.

  • Means: A = 12 / 6 = +2.0%, B = 6 / 6 = +1.0%
  • A deviations: +2, −4, +4, −2, −4, +4. B deviations: +2, −2, +4, 0, −4, 0
  • Paired products: (2)(2) + (−4)(−2) + (4)(4) + (−2)(0) + (−4)(−4) + (4)(0) = 4 + 8 + 16 + 0 + 16 + 0 = 44
  • Sample covariance: 44 / (6 − 1) = 8.8 percent squared
  • Sample standard deviations: A = square root of (72 / 5) = 3.79%, B = square root of (40 / 5) = 2.83%
  • Correlation: 8.8 / (3.79 × 2.83) = 0.82
  • Equal-weight portfolio variance: 0.25 × 14.4 + 0.25 × 8.0 + 2 × 0.5 × 0.5 × 8.8 = 10.0 percent squared, so portfolio volatility = 3.16%

Sample covariance is 8.8 squared percentage points, or 0.00088 in squared decimal-return units. Sample correlation is 0.82 under either scale. The 50/50 portfolio has variance 10 squared percentage points and volatility 3.16%, compared with the 3.31% weighted-volatility reference.

Covariance units and bounds

Converting both return series from percentage-point numbers to decimals divides covariance by 10,000. The example becomes 0.00088. Correlation stays unchanged because both standard deviations are rescaled too.

At fixed standard deviations, absolute covariance cannot exceed their product. If one series is constant, its covariance with the other is zero and the correlation division is undefined.

Covariance matrix and portfolio variance

A covariance matrix is symmetric. Its diagonal contains variances and its other entries contain pairwise covariances. Portfolio variance is wᵀSigma w.

A 100-asset symmetric matrix has 100 × 101 / 2 = 5,050 distinct entries. Calculate those entries from a coherent set of aligned observations or an appropriate covariance estimator.

For two assets, the formula contains both squared-weight variance terms and the cross term 2 × wA × wB × covarianceAB. Apply the actual weight signs before interpreting a negative covariance as an offset.

Sample vs population covariance and time scaling

The n − 1 sample covariance is unbiased under independent paired sampling from one finite-second-moment distribution. The n divisor describes the observed set. Use a consistent convention across covariance and variance calculations.

For additive return increments with no cross-time covariance and stable one-period covariance, covariance scales with the number of periods. Compounded simple returns and cross-time dependence require their corresponding aggregation.

Covariance in beta and hedge ratios

Asset/benchmark covariance divided by benchmark variance gives beta. Exposure/hedge covariance divided by hedge variance gives a minimum-variance hedge ratio.

A ratio calculated from returns sizes hedge notional relative to exposure notional. A ratio calculated from price changes uses the corresponding price-change units. Contract multipliers then convert exposure into contracts.

Covariance-based marginal VaR formulas belong to the specified linear distribution model; general quantile-based risk contributions require their own calculation.

Limitations of covariance

  • Convert to correlation to compare strength. Covariance carries the product of the input units, so the same relationship is 8.8 in squared percentage points and 0.00088 in squared decimals.
  • Check the paired observations for a nonlinear relationship. Covariance measures only linear co-movement, and zero covariance does not establish independence, because a nonlinear relationship can also produce zero covariance.
  • Use enough observations and check for outliers. Few observations, outliers and the chosen window can move a sample covariance, and even where the n − 1 estimator is unbiased, any one sample’s estimate can land above or below the true value.
  • Re-estimate covariance as the relationship changes. Scaling a one-period figure to a longer horizon assumes stable covariance and no cross-time dependence.
  • Use a covariance estimator built for large matrices. A 100-asset matrix has 5,050 distinct entries, and errors in them carry into any portfolio weights built from it.

Bottom line

Covariance measures how two return series move together linearly, in the product of their units, which is the form portfolio variance, beta and hedge ratios need. Calculate it on aligned observations with a consistent estimator, and convert it to correlation when you need to compare relationships across assets.

Clear answers

Frequently Asked Questions

Sources and Further Reading

  1. NIST/SEMATECH e-Handbook of Statistical Methods: Mean Vector and Covariance Matrix
  2. CFA Institute: Portfolio Risk and Return, Part I
  3. FINRA: Asset Allocation and Diversification
  4. Cboe: Implied Correlation Index
  5. NumPy Reference: numpy.cov

How entries are sourced, calculated and updated: editorial methodology.

Continue learning