# Covariance and Correlation

> Covariance and correlation measure how two assets move together. Learn the formulas, how to read them, why correlations change in crises and their portfolio role.

Source: https://learn.tradelabsai.com/math/covariance-and-correlation/  
Track: Math and Statistics · Level: Intermediate · Updated: 2026-10-03  
Publisher: TradeLabs AI (https://tradelabsai.com). Education, not financial advice.  
Cite as: TradeLabs Learn, "Covariance and Correlation", https://learn.tradelabsai.com/math/covariance-and-correlation/

Covariance and correlation measure how two variables move together. In markets, they show whether two assets tend to rise and fall at the same time, move in opposite directions or have no consistent link. Correlation is central to diversification, hedging, pairs trading and portfolio construction. Understanding it, and its limits, helps traders avoid concentrated risk and build portfolios that hold up in different conditions.

## Covariance

```
Cov(X, Y) = Σ (x - x̄)(y - ȳ) / (n - 1)
```

Positive covariance means the variables tend to move in the same direction; negative means opposite directions. Covariance depends on the units and scale of the data, so its size is hard to interpret.

## Correlation

Correlation standardises covariance so it always lies between minus 1 and +1:

```
ρ = Cov(X, Y) / (σ_X × σ_Y)
```

| Correlation | Meaning |
|---|---|
| +1 | Perfect positive relationship |
| +0.7 | Strong positive |
| 0 | No linear relationship |
| minus 0.7 | Strong negative |
| minus 1 | Perfect negative relationship |

This is Pearson correlation, which measures linear relationships. Spearman rank correlation measures whether the variables move in the same order, and is more robust to outliers. See [Outliers and Robust Statistics](https://learn.tradelabsai.com/math/outliers-and-robust-statistics/).

## Worked example

**Example: Two assets**
Daily returns over five days:

| Day | Asset A | Asset B |
|---|---|---|
| 1 | +1% | +0.5% |
| 2 | minus 2% | minus 1.5% |
| 3 | +3% | +2% |
| 4 | 0% | +0.5% |
| 5 | minus 1% | minus 1% |

Means: A = 0.2%, B = 0.1%. The deviations move together closely. Calculating gives a correlation of about 0.97: the assets moved almost in lockstep over this short sample. Five days is far too few to trust this estimate; real analysis uses months or years of data. See [Sampling and Standard Error](https://learn.tradelabsai.com/math/sampling-and-standard-error/).

## Correlation and diversification

Combining assets with low correlation reduces portfolio volatility:

```
σ_p² = w1² σ1² + w2² σ2² + 2 w1 w2 ρ σ1 σ2
```

**Example: The power of low correlation**
Two assets each have 20% volatility. In a 50/50 portfolio:

- ρ = 1: portfolio volatility 20% (no diversification benefit)
- ρ = 0.5: about 17.3%
- ρ = 0: about 14.1%
- ρ = minus 0.5: 10%

Lower correlation means lower portfolio risk for the same expected return. See [Diversification](https://learn.tradelabsai.com/portfolio/diversification/) and [Portfolio Construction](https://learn.tradelabsai.com/portfolio/portfolio-construction/).

## Correlations change

Correlations are not fixed. In market crises, correlations between risky assets often rise sharply, so diversification fails exactly when it is needed. In 2022, stocks and bonds fell together, breaking the negative correlation many portfolios relied on during the previous two decades. Traders monitor rolling correlations over several windows. See [Correlation Management](https://learn.tradelabsai.com/portfolio/correlation-management/) and [Structural Breaks and Regime Changes](https://learn.tradelabsai.com/math/regime-changes/).

## Correlation is not causation

Two assets can be correlated because one drives the other, because both respond to a common factor or purely by chance. Spurious correlations are common in data mining. Correlation also misses nonlinear relationships: two variables can be strongly related but show near zero correlation. See [Granger Causality](https://learn.tradelabsai.com/math/granger-causality/).

## Correlation vs cointegration

Correlation measures how returns move together day to day. Cointegration measures whether prices stay together over the long run. Two stocks can be highly correlated yet drift apart, or have modest correlation yet stay tied together. Pairs traders care about cointegration. See [Cointegration](https://learn.tradelabsai.com/math/cointegration/) and [Pairs Trading](https://learn.tradelabsai.com/strategies/pairs-trading/).

## Beta and correlation

A stock's beta to the market combines correlation with relative volatility:

```
β = ρ × (σ_stock / σ_market)
```

See [Alpha and Beta](https://learn.tradelabsai.com/portfolio/alpha-and-beta/).

## Estimating correlation in practice

Use returns, not prices, because trending prices create misleading correlations. Choose a window long enough to be stable, such as 60 to 250 trading days, and compare it with shorter windows to see changes. For assets that trade at different times, such as US and Asian stocks, daily returns can understate correlation; weekly returns help. See [Rolling and Expanding Windows](https://learn.tradelabsai.com/math/rolling-and-expanding-windows/).

## Frequently asked questions

### What is the difference between covariance and correlation?

Covariance measures how two variables move together in their original units; correlation standardises it to a scale from minus 1 to +1.

### Why does correlation matter in trading?

It determines how much diversification you get, how well hedges work and whether positions concentrate the same risk.

### Do correlations stay the same?

No. They change over time and often rise during market stress, reducing diversification when it is most needed.

Next, learn how reliable estimates from samples are in [Sampling and Standard Error](https://learn.tradelabsai.com/math/sampling-and-standard-error/).

## Continue learning

- Next lesson: [Sampling and Standard Error](https://learn.tradelabsai.com/math/sampling-and-standard-error/)
- Previous lesson: [Percentiles, Quantiles and Z-Scores](https://learn.tradelabsai.com/math/z-scores/)
- Related: [Percentiles, Quantiles and Z-Scores](https://learn.tradelabsai.com/math/z-scores/): A z score shows how many standard deviations a value is from its mean. Learn the formula, its uses in mean reversion and pairs trading, and the pitfalls.
- Related: [Correlation Management](https://learn.tradelabsai.com/portfolio/correlation-management/): Correlation management keeps a portfolio from turning into one big bet. Learn to measure correlations, combine correlated risks and set sensible limits.
- Related: [Diversification](https://learn.tradelabsai.com/portfolio/diversification/): Diversification lowers risk by combining assets that do not move together. Learn the maths, how many holdings you need, its limits in crises and common mistakes.
- Related: [Currency Correlations](https://learn.tradelabsai.com/forex/currency-correlations/): Many currency pairs move together or in opposite directions. Learn common correlations, safe havens and commodity currencies, and how to avoid doubling your risk.
- Related: [Pairs Trading](https://learn.tradelabsai.com/strategies/pairs-trading/): Pairs trading buys one asset and shorts a related one when their spread stretches, betting it will converge. Learn pair selection, hedge ratios, z scores and risks.
- Related: [Alpha and Beta](https://learn.tradelabsai.com/portfolio/alpha-and-beta/): Beta measures how much a portfolio moves with the market; alpha is the return beyond what that exposure explains. Learn formulas, CAPM, regression and pitfalls.
