Portfolio Theory: Diversification and the Efficient Frontier
Modern Portfolio Theory shows that combining assets can reduce risk without sacrificing expected return. This is the foundation of how institutional portfolios are constructed.
In 1952, Harry Markowitz published a paper that changed finance forever: Portfolio Selection. The core insight was mathematical but profound, by combining assets, you can reduce risk without sacrificing expected return. This is Modern Portfolio Theory (MPT).
The Core Insight: Diversification
Different assets don’t move perfectly together. When one falls, another might rise. By combining them, you reduce the portfolio’s overall volatility.
Key formula for two-asset portfolio variance:
Where:
- = portfolio weights
- = individual variances
- = correlation between assets (-1 to +1)
Key insight: If , portfolio variance is less than the weighted average of individual variances.
When : You can construct a risk-free portfolio by combining the two assets perfectly.
When : Diversification provides no benefit.
Minimum Variance Portfolio
Given a set of assets, what weights minimize portfolio variance?
For two assets, you can solve this analytically. For many assets, you use optimization:
Where is the covariance matrix of asset returns.
The Minimum Variance Portfolio (MVP) is always on the efficient frontier.
The Efficient Frontier
The efficient frontier is the set of portfolios that offer the highest expected return for a given level of risk.
For any point on the frontier:
- No other portfolio offers higher expected return for the same risk
- No other portfolio has lower risk for the same expected return
Key shapes:
- Portfolios below the frontier are suboptimal (same risk, lower return)
- The Capital Market Line (CML) extends from the risk-free rate tangent to the efficient frontier, at that tangency, you have the optimal risky portfolio (called the market portfolio in CAPM)
Portfolio Expected Return
Portfolio expected return is simply the weighted average of individual expected returns:
This is linear and simple. The complexity is in the variance.
Correlation and Diversification
Correlation () measures how two assets move together:
| Correlation | Interpretation |
|---|---|
| +1.0 | Assets move perfectly together |
| +0.5 | Moderate positive relationship |
| 0 | No linear relationship |
| -0.5 | Moderate negative relationship |
| -1.0 | Assets move perfectly oppositely |
The benefit of diversification is greatest when correlations are low or negative.
During crises, correlations often spike toward 1, all assets fall together. This is why true diversification is harder than it looks.
Portfolio Optimization in Python
import numpy as np
import pandas as pd
from scipy.optimize import minimize
def portfolio_return(weights, expected_returns):
"""Calculate portfolio expected return."""
return np.dot(weights, expected_returns)
def portfolio_volatility(weights, cov_matrix):
"""Calculate portfolio volatility (standard deviation)."""
return np.sqrt(np.dot(weights.T, np.dot(cov_matrix, weights)))
def minimum_variance_portfolio(expected_returns, cov_matrix):
"""
Find the minimum variance portfolio.
"""
n_assets = len(expected_returns)
def portfolio_vol(w):
return np.sqrt(np.dot(w.T, np.dot(cov_matrix, w)))
constraints = {'type': 'eq', 'fun': lambda w: np.sum(w) - 1}
bounds = tuple((-1, 1) for _ in range(n_assets)) # Allow shorting
initial_weights = np.ones(n_assets) / n_assets
result = minimize(portfolio_vol, initial_weights, method='SLSQP',
bounds=bounds, constraints=constraints)
return result.x
def efficient_frontier(expected_returns, cov_matrix, n_portfolios=100):
"""
Compute the efficient frontier.
"""
n_assets = len(expected_returns)
target_returns = np.linspace(np.min(expected_returns),
np.max(expected_returns),
n_portfolios)
frontier = []
for target in target_returns:
def portfolio_vol(w):
return np.sqrt(np.dot(w.T, np.dot(cov_matrix, w)))
constraints = [
{'type': 'eq', 'fun': lambda w: np.sum(w) - 1},
{'type': 'eq', 'fun': lambda w: np.dot(w, expected_returns) - target}
]
bounds = tuple((-1, 1) for _ in range(n_assets))
initial_weights = np.ones(n_assets) / n_assets
result = minimize(portfolio_vol, initial_weights, method='SLSQP',
bounds=bounds, constraints=constraints)
if result.success:
frontier.append({
'target_return': target,
'volatility': result.fun,
'weights': result.x
})
return pd.DataFrame(frontier)
def max_sharpe_ratio_portfolio(expected_returns, cov_matrix, rf=0.0):
"""
Find portfolio with maximum Sharpe ratio.
"""
n_assets = len(expected_returns)
def neg_sharpe(w):
ret = np.dot(w, expected_returns)
vol = np.sqrt(np.dot(w.T, np.dot(cov_matrix, w)))
return -(ret - rf) / vol
constraints = {'type': 'eq', 'fun': lambda w: np.sum(w) - 1}
bounds = tuple((-1, 1) for _ in range(n_assets))
initial_weights = np.ones(n_assets) / n_assets
result = minimize(neg_sharpe, initial_weights, method='SLSQP',
bounds=bounds, constraints=constraints)
return result.x
PROMPT
Use numpy, pandas, and scipy.optimize to build Markowitz portfolio math and optimize the minimum-variance portfolio, sweep the efficient frontier, and find the max-Sharpe portfolio.
Limitations of MPT
1. Input sensitivity: Small changes in expected returns or correlations produce very different portfolios.
2. Correlation instability: Correlations change over time, especially in crises.
3. Estimation error: Expected returns are hard to estimate accurately. Covariance is easier, but still noisy.
4. Normality assumption: MPT uses mean and variance, but return distributions have fat tails.
5. Shorting constraints: In practice, many investors can’t short.
These limitations are why Black-Litterman (1992) and other approaches were developed, to address the input sensitivity problem.
Key Takeaways
- Diversification reduces portfolio risk when correlations are less than 1
- The efficient frontier contains all optimal portfolios (max return for a given risk)
- Minimum variance portfolio is the lowest-risk portfolio on the frontier
- Maximum Sharpe ratio portfolio is the tangency portfolio (optimal risky portfolio in CAPM)
- MPT has real limitations, inputs are noisy, correlations are unstable
References
- Markowitz, “Portfolio Selection.” Journal of Finance, 1952.
- Sharpe, “Capital Asset Prices.” Journal of Finance, 1964.
- Ang, Asset Management. Oxford University Press, 2014. ISBN: 978-0-19-995932-3.
- Litterman, Modern Investment Management. Wiley, 2003. ISBN: 978-0-471-44375-7.