Why does combining two risky assets sometimes make them safer?
Two stocks, each with the same average return and the same volatility. Hold one — risky. Hold the other — equally risky. Hold half of each — and somehow the mix can be less risky than either alone. Sometimes a lot less. The mechanism isn’t a fluke or a fee structure; it’s a single cross-term in a quadratic, and that quadratic is the same one vectors writes for the squared length of a sum.
Risk doesn’t add — it composes through correlation. Risk starts with a
Risk as variance — what 'risky' actually measures
In finance, risk is shorthand for how much the outcome jitters around its average, not how much you might lose worst-case. The standard tool is
Two assets, four numbers
Pick two assets, A and B. Each has a mean return and a variance: . Mix them in proportion in A and in B. The mean of the mix is the easy part — averaging:
If you only cared about means, mixing assets with the same μ is pointless: you get the same μ. But the variance of the mix has three terms, not two:
The first two are what you’d guess: each asset’s own variance, scaled by its share squared. The third — the
import numpy as np
# Two assets: same mean return 5%, same standard deviation σ = 1.
# We'll compute portfolio mean and variance for any (weight, correlation).
mu_A, mu_B = 0.05, 0.05
sig_A, sig_B = 1.0, 1.0
def portfolio(w, rho):
"""w: fraction in A; (1-w) in B. rho: correlation of returns."""
mu = w * mu_A + (1 - w) * mu_B
var = (w**2 * sig_A**2
+ (1 - w)**2 * sig_B**2
+ 2 * w * (1 - w) * rho * sig_A * sig_B)
return mu, var
# Same expected return regardless of weight (because mu_A == mu_B).
# Variance is what moves.
[(rho, *portfolio(w=0.5, rho=rho)) for rho in (1.0, 0.0, -1.0)]
# → [(1.0, 0.05, 1.00), perfect lockstep — no diversification benefit
# (0.0, 0.05, 0.50), independent — variance halves at 50/50
# (-1.0, 0.05, 0.00)] perfect anti — risk literally vanishesCorrelation — covariance, normalized
Covariance has awkward units (the product of A’s units and B’s units), so people quote the unit-free version:
Three regimes. — perfect lockstep — and is just the weighted average of and . Mixing buys nothing. — independent — and the cross-term vanishes; falls strictly below the weighted average of the variances. — perfect anti-lockstep — and the cross-term is negative, large; with at the variance hits exactly zero. Risk doesn’t just shrink; it disappears. The widget above is a one-line dial through these three regimes.
# Minimum-variance weight, closed form.
# Take d/dw of σ²_p(w) and set to zero:
# w* = (σ_B² − ρ σ_A σ_B) / (σ_A² + σ_B² − 2 ρ σ_A σ_B)
def min_var_weight(rho, sig_A=1.0, sig_B=1.0):
num = sig_B**2 - rho * sig_A * sig_B
den = sig_A**2 + sig_B**2 - 2 * rho * sig_A * sig_B
return num / den if abs(den) > 1e-12 else 0.5
[(rho, min_var_weight(rho)) for rho in (-1, -0.5, 0, 0.5, 0.99)]
# → [(-1, 0.50), A and B equally weighted — perfect cancellation
# (-0.5, 0.50), still 50/50 because σ_A = σ_B
# (0, 0.50),
# (0.5, 0.50),
# (0.99, 0.50)]
# With σ_A = σ_B the answer is always 0.5; differing σ's would tilt w*.It's the same algebra as |a + b|² in vectors
The portfolio variance formula isn’t a finance invention — it’s the formula for the squared length of a vector sum, dressed in finance words. Treat returns as random vectors: each asset is one component of a 2D vector, and the portfolio is a weighted combination. The squared length identity from the vectors module:
Replace with , with , and the dot product with — and you’ve recovered portfolio variance. Covariance is just a dot product on random variables. The cosine of the angle between them is correlation. “Two assets at right angles” means uncorrelated; “two assets pointing the same way” means correlated; “two assets pointing opposite” means anti-correlated, and that pair cancels.
This is why the vectors module is consumed by physics, graphics, ML, and finance: the same two operations (add and scale) that move a Bezier control handle also build a portfolio. The applications don’t share theorems — they share the algebra.
The minimum-variance mix
Set : a one-line calculus problem. The answer is
When , this reduces to for any : the safest mix of two equally-volatile assets is always half-and-half. When , the formula tilts: the lower-volatility asset gets more weight, but the tilt depends on too. The widget marks as the green dot on the variance curve; drag and watch the curve flatten or sharpen around it. The full Modern Portfolio Theory generalization — N assets, an N×N covariance matrix, a quadratic to minimize subject to constraints — is just this same calculation written in vector-matrix form. One pair, three terms, one cross-term. Everything else is bookkeeping.
# Sanity check via Monte Carlo: simulate joint returns at given ρ,
# form the 50/50 portfolio, measure realized variance, compare to formula.
import numpy as np
def simulate(rho, n=200_000, seed=0):
rng = np.random.default_rng(seed)
z1 = rng.standard_normal(n)
z2 = rng.standard_normal(n)
a = mu_A + sig_A * z1
b = mu_B + sig_B * (rho * z1 + np.sqrt(1 - rho**2) * z2)
p = 0.5 * a + 0.5 * b
return p.mean(), p.var()
formula = portfolio(w=0.5, rho=-0.5)
sim = simulate(rho=-0.5)
formula, sim
# → ((0.05, 0.25), (0.0501, 0.2503))
# Closed form and simulation agree to three decimals.
# The whole MPT machinery from Markowitz onward sits on top of this single
# scalar identity; the rest is generalizing to N assets and adding
# constraints (no shorts, sector caps, etc.).ρ = 0 doesn’t mean independent — it means linearly uncorrelated. A and B can be tightly bound by a non-linear relationship (e.g., B = A²) and still report ρ ≈ 0 over a symmetric range. The portfolio variance formula uses ρ directly, so it underestimates risk in this case; pre-2008 quant strategies that ranked pairs by historical ρ alone learned this expensively. Variance is a second-moment quantity; everything else lives in the higher moments and the copula. The math here is exact under the assumptions; the assumptions are where the danger hides.
Risk doesn’t add — it composes through correlation. Portfolio variance is — three terms, one cross-term. The cross-term is what mixing buys you, and it can be negative. That’s why two risky things can be safer together than either alone.
Asset A has mean return ; asset B has . You hold the 50/50 mix. What is the portfolio’s mean return? Now you tilt to 25% A, 75% B — what changes?
A and B both have , and (perfect lockstep). Compute at . Compare to (all B) and (all A).
Same σ = 1 each, now . Show that there exists a at which exactly. Find the value of . Why can’t real portfolios achieve this?
Asset A: , . Asset B: , , . A “common sense” investor says: A has the higher expected return and the same horizon — go all-in on A. Show why a mix with some B can give a better risk-adjusted return (lower σ per unit μ above the riskless rate). Compute σ_p for w = 0.5 and compare to σ_A.
Finance courses introduce portfolio variance as a new identity, with a covariance matrix that arrives without provenance. Linear-algebra courses introduce dot products and squared lengths without mentioning that a dot product is what makes a portfolio more than the sum of its parts. The two are the same piece of math. Lemma puts the formula next to so the sameness is visible. Modern Portfolio Theory, the Sharpe ratio, the efficient frontier — all are this identity with more dimensions and constraints stacked on. None require new math, only patience with the bookkeeping.