Optimising under rules
Real portfolios obey rules: the weights add up to one, no short sales, a cap on turnover. A constrained problem is minf(w) subject to equalities h(w)=0 and inequalities g(w)≤0. With one equality, the best feasible point is where ∇f points straight through the constraint surface, because any sideways component could be used to improve f without leaving the surface. That is the Lagrange condition ∇f+λ∇h=0, and the number λ is the Lagrange multiplier. Collecting everything in the Lagrangian L=f+λh+μg turns the constrained problem into the search for a stationary point of L.
∇f+λ∇h+μ∇g=0,h=0,g≤0,μ≥0,μg=0(1) For inequalities the full set of conditions, named after Karush, Kuhn and Tucker, has four parts: stationarity of the Lagrangian, primal feasibility (the constraints hold), dual feasibility (μ≥0) and complementary slackness (μg=0). Complementary slackness says each inequality is either inactive, with g<0 and μ=0, so it does not matter, or active, with g=0 and μ>0, so it acts like an equality. For a convex problem these conditions are necessary and sufficient for a global optimum. The multiplier is also a price: it is the rate at which the best value of f improves when the constraint is relaxed by one unit.
Two small examplesMinimise
x2+y2 subject to
x+y=1. The Lagrange conditions
2x+λ=0 and
2y+λ=0 give
x=y=−λ/2, and the constraint then gives
λ=−1 and
x=y=0.5, with value
0.5. If the constraint is relaxed to
x+y=c, the best value becomes
c2/2, whose slope at
c=1 is
1=−λ. Next, minimise
(x−2)2 subject to
x≤1. The unconstrained minimum
x=2 breaks the rule, so the constraint is active at
x=1 and
2(x−2)+μ=0 gives
μ=2>0. With the rule
x≤3 instead, the unconstrained minimum is allowed and
μ=0.
The minimum-variance portfolio is the model case: minimise wTΣw subject to 1Tw=1. The Lagrange condition 2Σw+λ1=0 gives w∝Σ−11. For two uncorrelated assets with variances 0.04 and 0.09 the weights are proportional to 1/0.04=25 and 1/0.09=11.1, so w1=0.692, w2=0.308 and the portfolio variance is 1/(25+11.1)=0.0277. The multiplier equals −2 times that minimum variance. In a real portfolio a long-only rule or a turnover cap has its own multiplier, and a large μ tells you that rule is costing you a lot.
- Equality constraint: ∇f+λ∇h=0 together with h=0.
- Inequality: μ≥0 and μg=0; active means g=0, inactive means μ=0.
- Price: a multiplier is the sensitivity of the best value to a relaxation of its constraint.
Check feasibility and signsAfter solving, verify the answer against all four conditions. The most common slips are a multiplier with the wrong sign for an inequality (it must be μ≥0 when constraints are written g≤0) and an active constraint that was assumed inactive. Sign conventions differ between textbooks and libraries, so always read which form your solver expects. Lab · what's graded
- The multiplier10 pts
- The optimal point10 pts
- Relaxing the constraint10 pts
- A two-asset minimum-variance weight15 pts
- The minimum variance15 pts
- The four KKT conditions15 pts
- An active constraint10 pts
- What a multiplier tells you15 pts