14: Portfolio Optimization
Modern portfolio theory is linear algebra in disguise. Harry Markowitz’s Nobel Prize-winning insight: don’t just maximize returns—minimize variance for a given return. The math? Quadratic forms, covariance matrices, and constrained optimization.
The Setup
You have assets with:
- Expected returns:
- Covariance matrix: (an symmetric positive semi-definite matrix)
- Portfolio weights: where
The portfolio return is .
The portfolio variance is .
This is a quadratic form—the variance depends on how weights interact through the covariance structure.
Why Covariance Matrices Matter
The covariance matrix encodes how assets move together:
- Diagonal entries are individual variances
- Off-diagonal entries capture correlations
- is always symmetric and positive semi-definite
Key insight: Portfolio risk isn’t just the sum of individual risks. Correlations can cancel out—this is diversification.
The Minimum Variance Portfolio
The simplest problem: find weights that minimize variance with no return target.
Minimize:
Subject to: (weights sum to 1)
Using Lagrange multipliers:
Taking the gradient and setting to zero:
Using the constraint :
The minimum variance portfolio is just the inverse covariance matrix applied to a vector of ones, normalized.
The Efficient Frontier
Now add a return target: minimize variance for a given expected return .
Minimize:
Subject to:
The solution traces out the efficient frontier—the curve of optimal risk-return tradeoffs.
Using two Lagrange multipliers:
where and are determined by the constraints. The efficient frontier is a parabola in variance-return space (or a hyperbola in standard deviation-return space).
The Role of Eigenvalues
Decompose (spectral decomposition). Then:
where are the weights in the eigenvector basis.
Interpretation:
- Each eigenvalue is a principal variance direction
- Large eigenvalues = high-risk directions in asset space
- Eigenvectors are uncorrelated “principal portfolios”
Risk decomposition: Portfolio variance is a weighted sum of eigenvalues, with weights determined by exposure to each principal direction.
Numerical Example
Three assets with:
The minimum variance portfolio:
- Compute
- Apply to :
- Normalize: divide by
Result: The minimum variance portfolio underweights the high-variance asset and overweights low-variance, low-correlation assets.
Practical Considerations
Estimation Error
and are estimated from historical data. Small errors in can cause large errors in —especially if is near-singular.
Solutions:
- Shrinkage estimators: Blend sample covariance with a structured target (e.g., diagonal)
- Factor models: Assume where is a small factor covariance matrix
- Regularization: Add to before inverting
Constraints
Real portfolios have constraints:
- No short selling:
- Position limits:
- Sector exposure limits
These turn the problem into quadratic programming—still tractable, but no longer closed-form.
Key Takeaways
- Portfolio variance is a quadratic form:
- Covariance matrix is everything: It encodes diversification potential
- Inverse covariance appears everywhere: Minimum variance, efficient frontier, risk parity
- Eigendecomposition reveals risk structure: Principal directions of portfolio risk
- Estimation matters: amplifies estimation errors
The Markowitz framework is 70 years old, but the linear algebra hasn’t changed. Covariance matrices, quadratic forms, eigendecomposition—these are the tools that turn “don’t put all your eggs in one basket” into a precise mathematical statement.
Comments
Loading comments...