Risk, Return, and Probability
Statistical foundations for evaluating investments and quantifying uncertainty.
Content
Covariance and diversification
Versions:
Watch & Learn
AI-discovered learning video
Covariance and Diversification — Why Two Assets Can Be Less Risky Than One
"Diversification is the only free lunch in finance." — Harry Markowitz (and your future calmer self)
You already know expected return and variance (we met them in Position 2), and you've wrestled with arithmetic vs geometric returns (Position 1). Now we take the logical next step: how assets interact. Covariance is the math that describes those interactions, and diversification is the portfolio-level magic trick that uses those interactions to reduce risk.
What is covariance? (And why it’s not scary)
Covariance measures how two random variables — here: asset returns — move together.
- Positive covariance → when A is up, B tends to be up.
- Negative covariance → when A is up, B tends to be down.
- Zero covariance → no linear relationship (they might still be related nonlinearly).
Mathematically:
Cov(R_a, R_b) = E[(R_a - E[R_a])(R_b - E[R_b])]
For sample data (historical returns) use:
Cov_sample = 1/(T-1) * sum_t (R_a_t - mean(R_a)) * (R_b_t - mean(R_b))
Correlation standardizes covariance: ρ_ab = Cov(R_a,R_b) / (σ_a σ_b). Correlation is bounded in [-1, 1] and is easier to interpret than raw covariance.
How covariance enters portfolio risk
For a two-asset portfolio with weights w_a and w_b (= 1 - w_a):
σ_p^2 = w_a^2 σ_a^2 + w_b^2 σ_b^2 + 2 w_a w_b Cov(R_a,R_b)
That last term — the covariance term — is the handshake between assets. If Cov is low or negative, portfolio variance shrinks.
For N assets in vector form:
σ_p^2 = w^T Σ w
where Σ is the covariance matrix and w is the weight vector. In Excel you can compute Σ with COVARIANCE.P (population) or COVARIANCE.S (sample). In Python: pandas.DataFrame.cov() or numpy.cov().
Example — The tiny numbers that make the point
Imagine two assets A and B with these stats (annualized):
| Asset | Expected return | Std. dev. (σ) |
|---|---|---|
| A | 8% | 20% |
| B | 10% | 30% |
Case 1: perfectly correlated (ρ = 1) → Cov = 0.2 * 0.3 * 1 = 0.06.
Case 2: uncorrelated (ρ = 0) → Cov = 0.
Case 3: negatively correlated (ρ = -0.5) → Cov = -0.03.
Take equal weights w_a = w_b = 0.5. Compute σ_p in each case:
- ρ = 1: σ_p^2 = 0.250.04 + 0.250.09 + 20.250.06 = 0.01 + 0.0225 + 0.03 = 0.0625 → σ_p = 25%
- ρ = 0: σ_p^2 = 0.01 + 0.0225 + 0 = 0.0325 → σ_p ≈ 18.03%
- ρ = -0.5: σ_p^2 = 0.01 + 0.0225 - 0.015 = 0.0175 → σ_p ≈ 13.23%
Big idea: with the same assets and same weights, lowering correlation reduces portfolio risk substantially. That’s diversification.
Why diversification works (intuitively)
Think of asset returns like noisy radio stations. Each station's volume (variance) is its own drama. Covariance is the degree to which two stations play the same song at the same time. If they play different songs, the noisy peaks cancel somewhat when you mix them — the resulting playlist is smoother. If they always play the same song (perfect correlation), mixing doesn't help.
Two important consequences:
- Combining independent (low-correlation) assets reduces portfolio variance even if individual variances stay the same.
- Only perfectly negatively correlated assets can eliminate variance entirely. That’s rare in markets.
Covariance matrix — the spreadsheet backpack you’ll never drop
The covariance matrix Σ for N assets is symmetric with variances on the diagonal and covariances off-diagonal.
Example 3-asset Σ (numbers illustrative):
Σ = [ [0.04, 0.006, -0.002],
[0.006, 0.09, 0.01],
[-0.002, 0.01, 0.025] ]
Portfolio variance = w^T Σ w. In Python:
import numpy as np
Sigma = np.array([[0.04, 0.006, -0.002],[0.006,0.09,0.01],[-0.002,0.01,0.025]])
w = np.array([0.4,0.4,0.2])
var_p = w.T @ Sigma @ w
sd_p = np.sqrt(var_p)
In Excel, build Σ with COVARIANCE.P over aligned return series, then use MMULT and TRANSPOSE to compute w'Σw (or use the built-in matrix multiplication if you have dynamic arrays).
Common mistakes (read this like a PSA)
- Treating correlation as constant. It isn’t. Correlations rise toward 1 during crises — the classic diversification betrayal. Use stress-testing and understand tail dependence.
- Confusing covariance with correlation. Covariance is scale-dependent; correlation is normalized. When comparing relationships across assets, prefer correlation.
- Thinking diversification reduces expected return. It may change the risk profile, but expected return of the portfolio is just the weighted average of expected returns. Diversification reduces risk, not expected return (except through reweighting choices).
- Using too-short histories. Sample covariances are noisy. Use longer histories, shrinkage techniques, or factor models to stabilize estimates.
Practical tips for hands-on analytics (Excel & Python)
- Excel: use =COVARIANCE.S(range1, range2) for sample covariance; =CORREL(range1, range2) for correlation. Build the full covariance matrix with these functions across all asset pairs.
- Python: pandas.DataFrame(returns).cov() gives the covariance matrix; DataFrame.corr() gives correlations. Use numpy for linear algebra: var_p = w.T @ cov @ w.
- Stabilize estimates: consider exponentially-weighted covariances (EWMA), shrinkage (toward a single-factor model or the identity), or factor models (CAPM, Fama-French).
Closing — the emotional payoff
Covariance is the connective tissue of portfolio risk. Variance tells you how loud each instrument is; covariance tells you whether they're drumming to the same beat. Diversification is the art of combining different beats so the overall music is less ear-splitting.
Key takeaways:
- Covariance measures co-movement; correlation is its standardized cousin.
- Portfolio variance depends on individual variances and covariances (σ_p^2 = w^T Σ w).
- Lower correlations between assets produce stronger diversification benefits.
- Real-world caveats: correlations are time-varying and sample covariances are noisy — use better estimators and stress tests.
Next step (a friendly dare): plug real return series into Excel or Python, compute a covariance matrix, and simulate how portfolio σ changes as you tweak weights. It’s hands-on, slightly addictive, and the fastest route from “I sort of understand” to “I can defend my allocation in a meeting.”
"If you diversify without understanding covariance, you’re mixing paint blindfolded. Good results may happen — but it'd be nicer if they weren’t just luck."
Comments (0)
Please sign in to leave a comment.
No comments yet. Be the first to comment!