A portfolio is a trade-off between expected return and risk, and the mean-variance framework makes the trade-off precise by measuring return as the mean and risk as the variance of the portfolio's payoff. Maximising return for a given risk, equivalently minimising risk for a given return, is a convex quadratic program, since the variance is the positive definite quadratic form of the covariance matrix and the constraints are linear, and so the solution is unique and closed-form. This post solves it and reads off the efficient frontier [1], [2]. There are assets with expected returns and covariance matrix , and a portfolio is a weight vector with , where is the all-ones vector. We assume the expected returns are not all equal, so is not a scalar multiple of .
#The minimum-variance problem
A portfolio has expected return and variance . The mean-variance problem fixes the return and minimises the variance.
The mean-variance problem at target return is
Because the objective is strictly convex and the constraints are affine, so the problem is convex with a unique minimiser, and the Karush-Kuhn-Tucker conditions for equality constraints, the Lagrange conditions, are necessary and sufficient.
Write , , , and (positive, as shown below). The unique solution of Equation (1) is
and its variance is .
The Lagrangian is , and stationarity in reads , so , using that is invertible. Substituting into the two constraints gives the linear system
using the symmetry . The determinant of this two-by-two system is , which is positive by the Cauchy-Schwarz inequality in the inner product , since with equality only if and are proportional, excluded when returns are not all equal. Solving gives and . The variance is , and substituting the multipliers yields . Strict convexity makes this stationary point the unique global minimiser.
#The efficient frontier
The variance is a parabola in the target return , opening upward since . Its vertex is the global minimum variance portfolio, found by minimising over or directly by dropping the return constraint.
The portfolio of least variance among all fully invested portfolios is , with return and variance .
Minimising over sets its derivative at , where . Substituting into Equation (2) gives and , so , whose return is .
The upper branch of the parabola (returns above ) is the efficient frontier. These are the portfolios not dominated by another of equal variance and higher return. In the plane of standard deviation against return the frontier is a hyperbola, and every efficient portfolio is a combination of any two efficient portfolios, the two-fund theorem, because the solution Equation (2) is affine in .
#The tangency portfolio
A risk-free asset returning changes the geometry, since borrowing and lending at lets every portfolio be levered, and the best risky portfolio to lever is the one maximising the Sharpe ratio, the excess return per unit of risk.
With a risk-free rate below the minimum-variance return, the risky portfolio maximising the Sharpe ratio over is the tangency portfolio .
On the budget set the excess return is , so the Sharpe ratio equals , which is invariant under positive scaling , . By Cauchy-Schwarz in the inner product, for all , with equality iff is a positive multiple of , so the global directional maximiser is the ray . To realise this ray on the budget set we need with , that is , which exists precisely because makes . Thus the constrained maximiser coincides with the global maximiser, giving the stated tangency portfolio with attained Sharpe ratio (positive since and ). Equivalently the Lagrange condition on gives , and substituting it back yields objective value , so the maximiser is the branch with and the minimiser the branch. The line from the risk-free point through is tangent to the efficient frontier, hence the name.
Every optimal portfolio splits between the risk-free asset and this single risky fund.
The mean-variance model makes the optimal weights the inverse covariance applied to the returns, the same that appears in the Gaussian density and in least-squares estimation. Its inputs are the first two moments, the mean vector and covariance matrix, whose positive definite structure makes the problem convex. Its output, the efficient frontier, is the boundary on which every rational risk-return trade-off lives. The statistical arbitrage and execution strategies elsewhere in the blog build on it, turning the abstract optimisation and linear algebra of the foundations into the concrete algebra of investing.