Phase 10 - Lesson 10.5

Applications: Portfolio Optimization and Regularization

Convex optimization at work: minimum-variance portfolios and ridge/lasso estimators.

⏱ 55 min● Intermediate🔗 Prereqs: 10.2, 10.3
↖ Phase 10 hub
Builds on: 10.2–10.3 gave optimality and KKT; here they solve real quant problems.
Leads to: Phase 11 (stat learning) and 14 (math finance) build on these formulations.

Learning Objectives

Click a status chip to cycle: Not started → In progress → Studied → Practiced → Needs review → Mastered.

Key Vocabulary

Covariance matrix \(\Sigma\)
PSD matrix of asset return covariances; \(w^\top\Sigma w\) is portfolio variance.
Minimum-variance portfolio
Weights minimizing \(w^\top\Sigma w\) subject to \(\mathbf1^\top w=1\) (fully invested).
Mean-variance / Markowitz
Trade off return against variance: \(\max\ \mu^\top w-\tfrac{\gamma}{2}w^\top\Sigma w\).
Risk aversion \(\gamma\)
The weight on variance; larger \(\gamma\) gives more conservative portfolios.
Ridge regression
Least squares with an \(\ell_2\) penalty \(\lambda\|\beta\|_2^2\); shrinks coefficients, convex, closed form.
Lasso
Least squares with an \(\ell_1\) penalty \(\lambda\|\beta\|_1\); convex, induces sparsity (variable selection).

Intuition & Motivation

Intuition
Two of the most-used tools in quant finance are the same kind of object: a convex quadratic minimized under simple constraints or penalties. The minimum-variance portfolio asks ‘how do I hold $1 across assets to wobble least?’ - a quadratic in the weights. Ridge and lasso ask ‘how do I fit coefficients without overfitting?’ - a quadratic plus a convex penalty. Because all are convex, the solutions are global, stable, and (for min-variance and ridge) closed-form.

The minimum-variance portfolio

Let \(\Sigma\succ0\) be the return covariance of \(n\) assets and \(w\) the portfolio weights. Fully invested means \(\mathbf1^\top w=1\). Portfolio variance is \(w^\top\Sigma w\). The problem

\[\min_w\ \tfrac12\,w^\top\Sigma w\quad\text{s.t.}\quad \mathbf 1^\top w=1\] (10.9)

is a convex QP with one equality constraint - exactly the KKT worked example of 10.3 with \(Q=\Sigma,\ a=\mathbf1\). Its solution is

\[w^\star=\frac{\Sigma^{-1}\mathbf 1}{\mathbf 1^\top\Sigma^{-1}\mathbf 1},\qquad \sigma_{\min}^2=\frac{1}{\mathbf 1^\top\Sigma^{-1}\mathbf 1}.\] (10.10)
Worked Example - Two-asset closed form
1
Let assets have variances \(\sigma_1^2,\sigma_2^2\) and correlation \(\rho\), so \(\Sigma=\begin{pmatrix}\sigma_1^2&\rho\sigma_1\sigma_2\\ \rho\sigma_1\sigma_2&\sigma_2^2\end{pmatrix}\).
2
Write \(w=(w_1,1-w_1)\) and minimize \(v(w_1)=w_1^2\sigma_1^2+(1-w_1)^2\sigma_2^2+2w_1(1-w_1)\rho\sigma_1\sigma_2\).
3
Set \(v'(w_1)=0\) and solve: \(w_1^\star=\dfrac{\sigma_2^2-\rho\sigma_1\sigma_2}{\sigma_1^2+\sigma_2^2-2\rho\sigma_1\sigma_2}\), \(w_2^\star=1-w_1^\star\).
4
Sanity checks: if \(\sigma_1=\sigma_2\) then \(w_1^\star=1/2\) (symmetry); if \(\rho=0\), weights tilt inversely to variance (\(w_1\propto1/\sigma_1^2\)).

Mean–variance (Markowitz)

Investors want return too. Maximize expected return penalized by risk:

\[\max_w\ \mu^\top w-\tfrac{\gamma}{2}\,w^\top\Sigma w\quad\text{s.t.}\quad\mathbf 1^\top w=1,\] (10.11)

a concave (hence convex-minimization) problem. Its KKT solution \(w^\star=\tfrac1\gamma\Sigma^{-1}(\mu-\nu\mathbf1)\) traces the efficient frontier as \(\gamma\) varies: large \(\gamma\) (very risk-averse) approaches the minimum-variance portfolio (10.10); small \(\gamma\) chases return.

Regularization as convex optimization

The same machinery tames regression. Ordinary least squares \(\min_\beta\|y-X\beta\|_2^2\) overfits when features are many or collinear. Add a convex penalty:

Both penalties are convex, so the estimators are global optima - statistically stable and reproducible. This connects convex optimization directly to statistical learning (Phase 11).

Interactive: solve a two-asset portfolio

Common Mistakes to Avoid
  • Forgetting the budget constraint \(\mathbf1^\top w=1\); the unconstrained variance minimizer is \(w=0\) (invest nothing).
  • Assuming minimum-variance weights are nonnegative. Without a no-short constraint, \(w_i\) can be negative (a short position).
  • Inverting a near-singular \(\Sigma\) from noisy data; regularize/shrink \(\Sigma\) (echoing ridge) for stable weights.
  • Treating lasso like ridge - lasso is non-smooth, so plain gradient descent needs subgradients/proximal steps.
Quant Practitioner Tips
  • Estimation error in \(\Sigma\) and \(\mu\) dominates real portfolio risk; shrinkage (a convex regularizer on \(\Sigma\)) often beats the raw optimum.
  • Ridge = \(\ell_2\) shrinkage (keeps all vars, improves conditioning); lasso = \(\ell_1\) (sparse, selects vars). The choice is a modeling decision.
  • Adding a no-short constraint \(w\ge0\) turns the QP into one needing KKT with inequality multipliers - still convex, solvable by projection/QP solvers.

Knowledge Check

Q1 Medium
The minimum-variance portfolio weights (fully invested) are:
\(\Sigma^{-1}\mu\)
\(\Sigma^{-1}\mathbf1/(\mathbf1^\top\Sigma^{-1}\mathbf1)\)
\(\mathbf1/n\)
\(\Sigma\mathbf1\)
Q2 Medium
Ridge regression differs from OLS by:
Using an \(\ell_1\) penalty
Adding \(\lambda\|\beta\|_2^2\), giving \(\hat\beta=(X^\top X+\lambda I)^{-1}X^\top y\)
Being non-convex
Removing the intercept
Q3 Easy
For two assets with equal variances and \(\rho\lt 1\), the minimum-variance weight on asset 1 is:
\(1\)
\(1/2\)
\(0\)
Undefined

Practical Exercise

Two assets: \(\sigma_1=0.10,\ \sigma_2=0.20,\ \rho=0.25\). (a) Compute the minimum-variance weights. (b) Compute the resulting portfolio variance. (c) Is either weight a short position?

▶ Show full solution

(a) \(\text{cov}=\rho\sigma_1\sigma_2=0.25\cdot0.10\cdot0.20=0.005\). \(w_1=\dfrac{\sigma_2^2-\text{cov}}{\sigma_1^2+\sigma_2^2-2\text{cov}}=\dfrac{0.04-0.005}{0.01+0.04-0.01}=\dfrac{0.035}{0.04}=0.875\), \(w_2=0.125\).

(b) \(\sigma^2=w_1^2\sigma_1^2+w_2^2\sigma_2^2+2w_1w_2\text{cov}=0.875^2(0.01)+0.125^2(0.04)+2(0.875)(0.125)(0.005)\) \(=0.007656+0.000625+0.001094\approx0.009375\), so \(\sigma\approx0.0968\) (below asset 1's 0.10).

(c) Both weights are positive (0.875 and 0.125), so no shorting. Diversification lowered risk below the least-risky asset alone.

After the reveal, answer for yourself: How would a negative correlation \(\rho\lt 0\) change the achievable minimum variance?

Lesson Summary

Minimum-variance and Markowitz portfolios are convex quadratic programs whose KKT solutions are closed-form: \(w^\star=\Sigma^{-1}\mathbf1/(\mathbf1^\top\Sigma^{-1}\mathbf1)\) for minimum variance, with the two-asset case reducing to a simple ratio. Ridge (\(\ell_2\)) and lasso (\(\ell_1\)) regularization are the same convex-optimization idea applied to regression - shrinking or selecting coefficients - yielding stable, global estimators that bridge to statistical learning.

Retrieval Practice

Close the lesson and answer from memory before checking. This is deliberate, effortful recall - the single highest-yield study action.

▶ Show retrieval prompts & answers
Q: Give the minimum-variance portfolio formula and the two-asset weight.
A: \(w^\star=\Sigma^{-1}\mathbf1/(\mathbf1^\top\Sigma^{-1}\mathbf1)\); two-asset \(w_1=(\sigma_2^2-\rho\sigma_1\sigma_2)/(\sigma_1^2+\sigma_2^2-2\rho\sigma_1\sigma_2)\).
Q: How do ridge and lasso differ, and why are both convex?
A: Ridge adds \(\lambda\|\beta\|_2^2\) (smooth, shrinks all, closed form); lasso adds \(\lambda\|\beta\|_1\) (non-smooth, induces sparsity). Both add a convex penalty to a convex loss, so the problems are convex.

Completion Checklist

Confidence / mastery rating
Personal notes

Source References

This lesson synthesizes and paraphrases concepts from the sources below. No copyrighted text, problem sets, or solutions are reproduced. Return to the originals for full depth.