Why w' Sigma w Is Portfolio Risk
The risk term in Markowitz optimization is not decoration. It is the variance of the portfolio return, written in a compact form that solvers understand.
The Skill
After this lesson, you should be able to see w' Sigma w in a paper and translate it into plain language: "portfolio variance, including both individual asset risk and how assets move together."
In Lesson 0001, the simple portfolio objective was:
maximize mu' w - gamma * w' Sigma w
subject to 1' w = 1
w >= 0
The first term, mu' w, is expected return. The second term, w' Sigma w, is variance. The risk-aversion parameter gamma says how much expected return you demand for bearing one more unit of variance.
Why the Formula Works
If asset returns are a vector r and portfolio weights are w, the portfolio return is the weighted sum r_p = w' r. The variance of that weighted sum is:
Var(r_p) = Var(w' r) = w' Sigma w
The covariance matrix Sigma is the object that makes this more than a weighted average. Its diagonal entries are asset variances. Its off-diagonal entries are covariances, which measure whether pairs of assets tend to move together.
This is why the official CVXPY quadratic-program example can write a portfolio problem with objective (1/2) x' Sigma x - r' x, and why the MOSEK Portfolio Optimization Cookbook begins its portfolio models from Markowitz-style mean-variance optimization.
The Two-Asset Case
For two assets, the compact matrix formula expands into something easier to inspect:
Var(r_p) = w_A^2 sigma_A^2 + w_B^2 sigma_B^2 + 2 w_A w_B rho_AB sigma_A sigma_B
The final term is where diversification lives. If correlation is high, the assets share risk. If correlation is low or negative, the combined portfolio can be less risky than the standalone assets suggest.
Two-Asset Risk Lab
Asset A volatility is fixed at 20%; asset B volatility is fixed at 12%.
Why Convexity Appears
A valid covariance matrix is positive semidefinite: w' Sigma w is never negative. That property makes variance a convex quadratic function of the weights. So minimizing variance, or penalizing variance while maximizing return, can fit into the quadratic-program family when the constraints are linear.
This matters practically. Convex quadratic programs are not just pretty math; they are problems that modern solvers can handle reliably. This is the bridge from Markowitz theory to actual portfolio construction code.
Retrieval Practice
In
Which part of the two-asset formula creates diversification?
Why does positive semidefiniteness matter here?
Primary Source
Read the local Optimization Bootcamp PDF when you want broader optimization background, then use Boyd and Vandenberghe's Convex Optimization for the convexity vocabulary behind positive semidefinite quadratic forms.
For portfolio-specific formulations, compare this lesson with the CVXPY quadratic-program example and the MOSEK Portfolio Optimization Cookbook. Keep the risk reference open while reading.