Modern Portfolio Theory and Mean-Variance Optimization › The Mathematics of Diversification
Quantitative FinanceAll chapters Modern Portfolio Theory and Mean-Variance Optimization › The Mathematics of DiversificationOne section · Sections in this chapter7 / 12 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Diversification is often called the "free lunch" of finance because combining different exposures can improve risk-return tradeoffs. Common market or economic factors affect many assets with different exposure magnitudes and signs. Specific risk can diminish when holdings become sufficiently granular and residual dependence is weak; simply increasing the count of holdings is not enough.
Variance Decomposition
Consider an equally-weighted portfolio of assets with identical variance and pairwise correlation . While this is a simplification, it reveals the essential mechanics of diversification. The portfolio variance is:
where:
- : variance of the portfolio
- : number of assets
- : covariance between asset and asset
For the diagonal terms ():
For the off-diagonal terms ():
There are diagonal terms and off-diagonal terms. The diagonal terms represent each asset's own variance contribution, while the off-diagonal terms capture the covariance contributions from all pairs of different assets:
where:
- : variance of each individual asset
- : pairwise correlation between all assets
- : number of assets in the portfolio
The displayed terms are diagonal variance and off-diagonal covariance contributions. For a common-factor interpretation, assume and write centered returns as , where and the residuals have unit variance and are mutually uncorrelated. Then : common-factor variance is constant, while specific variance declines with . The finite equicorrelation matrix permits for , but a fixed negative correlation is not valid as tends to infinity.
For a family of homogeneous portfolios with fixed , as :
where:
- : limiting portfolio variance
- : pairwise correlation between assets
- : variance of individual assets
For fixed , the specific component tends to zero, leaving . The limit is positive when and ; it is zero when . Common-factor risk remains here because every holding retains the same factor exposure. In a market crash, many stocks can fall together, although individual stocks can move differently.
import numpy as np
def calculate_portfolio_variance(n, sigma, rho):
"""Calculate portfolio variance for an equally weighted portfolio."""
return (sigma**2 / n) + ((n - 1) / n) * rho * sigma**2
# Define parameters for visualization
sigma = 0.25
rho_values = [0.0, 0.2, 0.4, 0.6]
n_assets = np.arange(1, 101)

Systematic risk comes from common market or economic factors and remains when the portfolio retains exposure to them. Specific risk can approach zero in increasingly granular portfolios with sufficiently weak residual dependence. The equal-loading model above makes these conditions explicit; the CAPM chapter develops the market-factor interpretation further.
How Many Assets Are Enough?
In this equal-weight, equal-variance model, 20 and 30 assets eliminate 95% and 96.7% of diversifiable variance. That normalized fraction is , independent of correlation when ; correlation still determines the remaining total variance. Real diversification needs depend on concentration, exposures, dependence, and the chosen risk criterion.
# Calculate percentage of diversification benefit captured
sigma = 0.25
rho = 0.3 # Moderate correlation
def pct_diversification(n, sigma, rho):
"""Percentage of diversifiable variance eliminated; n>=1, sigma>0, 0<=rho<1."""
if not np.all(np.isfinite([n, sigma, rho])):
raise ValueError("Portfolio size, volatility and correlation must be finite")
if n < 1 or sigma <= 0 or not 0 <= rho < 1:
raise ValueError("Require n>=1, sigma>0 and correlation in [0, 1)")
# Cancel the positive common factor (1-rho)*sigma² before numerical evaluation.
return 100.0 * (1.0 - 1.0 / n)
# Calculate benefits for various portfolio sizes
asset_counts = [5, 10, 20, 30, 50, 100]
diversification_benefits = {n: pct_diversification(n, sigma, rho) for n in asset_counts}Diversification Benefit Captured (ρ = 0.3):
----------------------------------------
5 assets: 80.00% of diversifiable variance eliminated
10 assets: 90.00% of diversifiable variance eliminated
20 assets: 95.00% of diversifiable variance eliminated
30 assets: 96.67% of diversifiable variance eliminated
50 assets: 98.00% of diversifiable variance eliminated
100 assets: 99.00% of diversifiable variance eliminated
The table illustrates diminishing marginal variance reduction in this model. Whether more holdings are worthwhile in practice depends on their distinct exposures, implementation costs, and investor objectives; the model does not calculate those costs or establish a universal sufficient portfolio size.