Skip to content
homeaboutworkprojectsthesiswritingresume
Loading
~/blog/mean-variance-portfolio0%dark
  1. home/
  2. writing/
  3. The Mean-Variance Portfolio

13 June 2026 · 5 min read · updated 13 June 2026

The Mean-Variance Portfolio

The mean-variance problem asks for the portfolio of least variance achieving a target expected return, and because the variance is a positive definite quadratic form and the constraints are linear, it is a convex program with a closed-form solution. We solve it by Lagrange multipliers, derive the efficient frontier as a parabola in the variance-return plane, identify the global minimum variance portfolio, and find the tangency portfolio that maximises the Sharpe ratio when a risk-free asset is available. This is the foundational model of quantitative portfolio choice, an application of convex duality and positive definite matrices.

  • 3 equations
  • 7 results
  • 7 connections
  • quantitative-finance
  • optimization
  • portfolio
On this page▾
  • The minimum-variance problem
  • The efficient frontier
  • The tangency portfolio

5 min left

  • The minimum-variance problem2m
  • The efficient frontier1m
  • The tangency portfolio2m

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 nnn assets with expected returns μ∈Rn\mu\in \R^nμ∈Rn and covariance matrix Σ≻0\Sigma\succ 0Σ≻0, and a portfolio is a weight vector w∈Rnw\in\R^nw∈Rn with w⊤1=1w^\top\one =1w⊤1=1, where 1\one1 is the all-ones vector. We assume the expected returns are not all equal, so μ\muμ is not a scalar multiple of 1\one1.

#The minimum-variance problem

A portfolio www has expected return w⊤μw^\top\muw⊤μ and variance w⊤Σww^\top\Sigma ww⊤Σw. The mean-variance problem fixes the return and minimises the variance.

Definition1

The mean-variance problem at target return mmm is

min⁡w 12w⊤Σwsubject to w⊤μ=m, w⊤1=1.(1)\min_w\ \tfrac12 w^\top\Sigma w\quad\text{subject to } w^\top\mu=m,\ w^\top\one=1. \tag{1}wmin​ 21​w⊤Σwsubject to w⊤μ=m, w⊤1=1.(1)

Because Σ≻0\Sigma\succ 0Σ≻0 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.

Theorem2

Write A=1⊤Σ−1μA=\one^\top\Sigma^{-1}\muA=1⊤Σ−1μ, B=μ⊤Σ−1μB=\mu^\top\Sigma^{-1}\muB=μ⊤Σ−1μ, C=1⊤Σ−11C=\one^\top\Sigma^{-1}\oneC=1⊤Σ−11, and D=BC−A2D=BC-A^2D=BC−A2 (positive, as shown below). The unique solution of Equation (1) is

w∗=Σ−1(λμ+γ1),λ=Cm−AD,γ=B−AmD,(2)w^\ast=\Sigma^{-1}(\lambda\mu+\gamma\one),\qquad\lambda=\frac{Cm-A}{D},\quad\gamma=\frac{B-Am}{D}, \tag{2}w∗=Σ−1(λμ+γ1),λ=DCm−A​,γ=DB−Am​,(2)

and its variance is σ2(m)=Cm2−2Am+BD\sigma^2(m)=\dfrac{Cm^2-2Am+B}{D}σ2(m)=DCm2−2Am+B​.

Proof

The Lagrangian is L=12w⊤Σw−λ(w⊤μ−m)−γ(w⊤1−1)\mathcal L=\tfrac12 w^\top\Sigma w-\lambda(w^\top\mu-m)-\gamma(w^\top\one-1)L=21​w⊤Σw−λ(w⊤μ−m)−γ(w⊤1−1), and stationarity in www reads Σw=λμ+γ1\Sigma w=\lambda\mu+\gamma\oneΣw=λμ+γ1, so w=Σ−1(λμ+γ1)w=\Sigma^{-1}(\lambda\mu+\gamma\one)w=Σ−1(λμ+γ1), using that Σ≻0\Sigma\succ 0Σ≻0 is invertible. Substituting into the two constraints gives the linear system

w⊤μ=λ μ⊤Σ−1μ+γ μ⊤Σ−11=λB+γA=m,w⊤1=λ 1⊤Σ−1μ+γ 1⊤Σ−11=λA+γC=1,(3)\begin{aligned} w^\top\mu&=\lambda\,\mu^\top\Sigma^{-1}\mu+\gamma\,\mu^\top\Sigma^{-1}\one=\lambda B+\gamma A=m,\\ w^\top\one&=\lambda\,\one^\top\Sigma^{-1}\mu+\gamma\,\one^\top\Sigma^{-1}\one=\lambda A+\gamma C=1, \end{aligned} \tag{3}w⊤μw⊤1​=λμ⊤Σ−1μ+γμ⊤Σ−11=λB+γA=m,=λ1⊤Σ−1μ+γ1⊤Σ−11=λA+γC=1,​(3)

using the symmetry μ⊤Σ−11=1⊤Σ−1μ=A\mu^\top\Sigma^{-1}\one=\one^\top\Sigma^{-1}\mu=Aμ⊤Σ−11=1⊤Σ−1μ=A. The determinant of this two-by-two system is BC−A2=DBC-A^2=DBC−A2=D, which is positive by the Cauchy-Schwarz inequality in the inner product ⟨x,y⟩Σ−1=x⊤Σ−1y\langle x,y \rangle_{\Sigma^{-1}}=x^\top\Sigma^{-1}y⟨x,y⟩Σ−1​=x⊤Σ−1y, since A2=⟨1,μ⟩Σ−12≤⟨1,1⟩⟨μ,μ⟩=CBA^2=\langle\one,\mu\rangle_{\Sigma^{-1}}^2\le\langle\one, \one\rangle\langle\mu,\mu\rangle=CBA2=⟨1,μ⟩Σ−12​≤⟨1,1⟩⟨μ,μ⟩=CB with equality only if μ\muμ and 1\one1 are proportional, excluded when returns are not all equal. Solving gives λ=(Cm−A)/D\lambda=(Cm-A)/Dλ=(Cm−A)/D and γ=(B−Am)/D\gamma=(B-Am)/Dγ=(B−Am)/D. The variance is w∗⊤Σw∗=w∗⊤(λμ+γ1)=λm+γw^{\ast\top}\Sigma w^\ast=w^{\ast\top}(\lambda\mu+\gamma\one)=\lambda m+\gammaw∗⊤Σw∗=w∗⊤(λμ+γ1)=λm+γ, and substituting the multipliers yields σ2(m)=(Cm2−2Am+B)/D\sigma^2(m)=(Cm^2-2Am+B)/Dσ2(m)=(Cm2−2Am+B)/D. Strict convexity makes this stationary point the unique global minimiser.

#The efficient frontier

The variance σ2(m)=(Cm2−2Am+B)/D\sigma^2(m)=(Cm^2-2Am+B)/Dσ2(m)=(Cm2−2Am+B)/D is a parabola in the target return mmm, opening upward since C=1⊤Σ−11>0C=\one^\top\Sigma^{-1}\one>0C=1⊤Σ−11>0. Its vertex is the global minimum variance portfolio, found by minimising over mmm or directly by dropping the return constraint.

Corollary3

The portfolio of least variance among all fully invested portfolios is wmin⁡=Σ−11/Cw_{\min}=\Sigma^{-1}\one/Cwmin​=Σ−11/C, with return A/CA/CA/C and variance 1/C1/C1/C.

Proof

Minimising σ2(m)\sigma^2(m)σ2(m) over mmm sets its derivative 2Cm−2A=02Cm-2A=02Cm−2A=0 at m=A/Cm=A/Cm=A/C, where σ2=(C(A/C)2−2A(A/C)+B)/D=(B−A2/C)/D=(BC−A2)/(CD)=1/C\sigma^2=(C(A/C)^2-2A(A/ C)+B)/D=(B-A^2/C)/D=(BC-A^2)/(CD)=1/Cσ2=(C(A/C)2−2A(A/C)+B)/D=(B−A2/C)/D=(BC−A2)/(CD)=1/C. Substituting m=A/Cm=A/Cm=A/C into Equation (2) gives λ=0\lambda=0λ=0 and γ=1/C\gamma=1/Cγ=1/C, so wmin⁡=Σ−11/Cw_{\min}=\Sigma^{-1}\one/Cwmin​=Σ−11/C, whose return is wmin⁡⊤μ=A/Cw_{\min}^\top\mu=A/Cwmin⊤​μ=A/C.

The upper branch of the parabola (returns above A/CA/CA/C) 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 mmm.

The bullet-nosed frontier (its efficient upper branch highlighted) traces the least risk at each return. The dashed capital market line from the risk-free rate is tangent to the frontier; its slope is the maximum Sharpe ratio, and it exists only while the rate lies below the minimum-variance return.

#The tangency portfolio

A risk-free asset returning rrr changes the geometry, since borrowing and lending at rrr 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.

Proposition4

With a risk-free rate r<A/Cr<A/Cr<A/C below the minimum-variance return, the risky portfolio maximising the Sharpe ratio w⊤μ−rw⊤Σw\dfrac{w^\top\mu-r}{\sqrt{w^\top\Sigma w}}w⊤Σw​w⊤μ−r​ over w⊤1=1w^\top\one=1w⊤1=1 is the tangency portfolio wT=Σ−1(μ−r1)1⊤Σ−1(μ−r1)w_T=\dfrac{\Sigma^{-1}(\mu-r\one)}{\one^\top\Sigma^{-1}(\mu-r\one)}wT​=1⊤Σ−1(μ−r1)Σ−1(μ−r1)​.

Proof

On the budget set w⊤1=1w^\top\one=1w⊤1=1 the excess return is w⊤μ−r=w⊤(μ−r1)w^\top\mu-r=w^\top(\mu-r\one)w⊤μ−r=w⊤(μ−r1), so the Sharpe ratio equals S(w)=w⊤(μ−r1)/w⊤ΣwS(w)=w^\top(\mu-r\one)/\sqrt{w^\top\Sigma w}S(w)=w⊤(μ−r1)/w⊤Σw​, which is invariant under positive scaling w↦tww\mapsto tww↦tw, t>0t>0t>0. By Cauchy-Schwarz in the Σ\SigmaΣ inner product, S(w)≤(μ−r1)⊤Σ−1(μ−r1)=B−2rA+r2CS(w)\le\sqrt{(\mu-r\one)^\top \Sigma^{-1}(\mu-r\one)}=\sqrt{B-2rA+r^2C}S(w)≤(μ−r1)⊤Σ−1(μ−r1)​=B−2rA+r2C​ for all w≠0w\neq 0w=0, with equality iff www is a positive multiple of w∗=Σ−1(μ−r1)w^\ast=\Sigma^{-1}(\mu-r\one)w∗=Σ−1(μ−r1), so the global directional maximiser is the ray R+w∗\R_+w^\astR+​w∗. To realise this ray on the budget set we need t>0t>0t>0 with (tw∗)⊤1=1(tw^\ast)^\top\one=1(tw∗)⊤1=1, that is t=1/(1⊤Σ−1(μ−r1))=1/(A−rC)t=1/(\one^\top\Sigma^{-1}(\mu -r\one))=1/(A-rC)t=1/(1⊤Σ−1(μ−r1))=1/(A−rC), which exists precisely because r<A/Cr<A/Cr<A/C makes A−rC>0A-rC>0A−rC>0. Thus the constrained maximiser coincides with the global maximiser, giving the stated tangency portfolio with attained Sharpe ratio B−2rA+r2C>0\sqrt{B-2rA+r^2C}>0B−2rA+r2C​>0 (positive since Σ−1≻0\Sigma^{-1}\succ 0Σ−1≻0 and μ≠r1\mu\neq r\oneμ=r1). Equivalently the Lagrange condition μ−r1=2κΣw\mu-r\one=2\kappa\Sigma wμ−r1=2κΣw on w⊤Σw=1w^\top\Sigma w=1w⊤Σw=1 gives w∝Σ−1(μ−r1)w\propto\Sigma^{-1}(\mu-r\one)w∝Σ−1(μ−r1), and substituting it back yields objective value w⊤(μ−r1)=2κw^\top(\mu-r\one)=2\kappaw⊤(μ−r1)=2κ, so the maximiser is the branch with κ>0\kappa>0κ>0 and the minimiser the κ<0\kappa<0κ<0 branch. The line from the risk-free point through wTw_TwT​ 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 Σ−1\Sigma^{-1}Σ−1 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.

[1]
H. Markowitz, “Portfolio Selection,” The Journal of Finance, vol. 7, no. 1, pp. 77–91, 1952.
[2]
D. G. Luenberger, Investment Science. Oxford University Press, 1998.

Part 1 of 2 in Quantitative Finance

next →The Black-Scholes Equation

Explore connections

see in the atlas →

related

  • Convex Duality and the KKT Conditions
  • Positive Definite Matrices
  • The Ornstein-Uhlenbeck Process
cite
@misc{mean-variance-portfolio,
  author = {Zac Kienzle},
  title  = {The Mean-Variance Portfolio},
  year   = {2026},
  month  = {06},
  url    = {https://zackienzle.com/blog/mean-variance-portfolio}
}