From multipliers to a second problem
The lesson on Lagrange multipliers treated the KKT conditions as a recipe and multipliers as shadow prices. Duality explains why the recipe works and turns the multipliers into the variables of a second optimisation problem, the dual, whose value is a lower bound on the original. That bound is what solvers report as the "duality gap", what certifies that a portfolio is optimal, and, in linear programmes, what becomes the no-arbitrage pricing theorem.
Objective: derive a dual, use weak duality to bound a problem, know when strong duality holds, derive the KKT conditions from strong duality, and solve and interpret a small QP both ways.
The Lagrangian dual
Take a primal problem in standard form,
with Lagrangian . The dual function is
- is always concave, whatever and are: it is a pointwise infimum of functions that are affine in .
- Weak duality: for any and any feasible , , because and . Taking the best of each side, .
The dual problem is a convex problem even when the primal is not, which is why duals give bounds for hard nonconvex problems (for example semidefinite relaxations of combinatorial ones). The duality gap for any primal-feasible and dual-feasible bounds how suboptimal is: a gap of is a proof that is optimal to , and it is the stopping test interior-point solvers use.
Strong duality and Slater's condition
Strong duality, , does not always hold, but for convex problems it holds under a mild condition. Slater's condition: the problem is convex (convex , affine ) and there is a strictly feasible point, for every nonlinear inequality and all affine constraints satisfied. Then , and the dual optimum is attained when is finite. For linear programmes and for QPs with linear constraints, feasibility alone is enough.
What can go wrong without it:
- Gap. s.t. on the domain . Feasibility forces , so . But (send with ), so . The problem is convex, but no point satisfies .
- No attained multiplier. s.t. : , , so but only as . The KKT conditions have no solution: is impossible at . Constraints that are tangent at the optimum (degenerate risk limits, for instance) make multipliers blow up and solvers struggle.
KKT from strong duality
Suppose strong duality holds with primal optimal and dual optimal. Then
Both inequalities are equalities, which yields two facts:
- minimises , so (if differentiable) : stationarity.
- , and since every term is , each is zero: , complementary slackness.
With primal and dual feasibility these are the KKT conditions. So under strong duality KKT is necessary; for a convex problem any KKT point is optimal (the Lagrangian is convex in , so stationarity means minimises it, and then closes the gap), so KKT is also sufficient.
The dual of a QP
For s.t. with : minimising the Lagrangian over gives , and
The dual is a QP with only sign constraints on . Projected-gradient and coordinate-ascent methods exploit exactly this (it is how support-vector machines are trained), and from any you recover a candidate .
Worked example
a small QP via KKT and via its dual
Minimise subject to , and . Find and the multipliers from the KKT conditions, then derive the dual function, maximise it, and confirm there is no gap.
Show solutionHide solution
Write the constraints as , , , with multipliers . Stationarity:
Active-set search. The unconstrained minimiser violates and .
- Only active: project onto , giving . Violates .
- Only active: . Violates .
- and active: , and so by complementary slackness. The second stationarity equation gives ; the first gives .
Both multipliers are non-negative, all constraints hold, the problem is convex: with .
The dual. Minimising over : , . Substituting and collecting terms,
(The linear coefficients are the constraint values at the unconstrained minimiser : , and .) Maximise over . Increasing from 0 lowers while , so . Setting the other partial derivatives to zero:
so and , , exactly the KKT multipliers. Then : no gap, as Slater predicts (the point is strictly feasible).
Weak duality in action. Any gives a bound: and are both below .
Prices. says raising the cap from to lowers the optimum by about (exactly: , value , a fall of ). says loosening the budget is worth a third as much per unit. The cap is the expensive constraint.
Dual variables as prices
Perturb the constraints to and and let be the optimal value. For a convex problem with strong duality:
- Local: and where differentiable. Loosening constraint by one unit improves the optimum by .
- Global: for every perturbation. In the example, loosening the budget by cannot improve the value by more than ; the true improvement is , because is convex in the perturbation and the linear estimate is a bound.
- Signs. A tightened constraint can only hurt, so inequality multipliers are . A large multiplier flags the constraint that is driving the solution; in a portfolio that is the one worth negotiating with the risk manager.
Sign conventions differ by author and solver ( versus , versus ), so when a solver reports a multiplier, check its sign against a finite-difference re-solve before interpreting it.
In a linear programme the dual variables are literally prices. In the classic resource-allocation LP (maximise revenue subject to resource limits), the dual chooses a price for each resource so that every activity's resource cost is at least its revenue, and minimises the total value of the resources. At the optimum, by complementary slackness, an activity is run only if it exactly breaks even at those prices, and a resource with spare capacity has price zero.
Worked example
arbitrage, state prices and LP duality
Three horses race; a stake of 1 on horse A, B or C returns 2, 4 or 6 if that horse wins and nothing otherwise. Choose stakes with to maximise the guaranteed payout . Write the dual and interpret its variables.
Show solutionHide solution
Primal (an LP): maximise subject to for each horse , with , , .
Dual. Attach to each payout constraint and to the budget:
The supremum over the free variable is finite only if ; the supremum over is finite only if . What remains is , so the dual is
The form a probability vector, and is the expected payout of a unit bet on under . The dual looks for the pricing measure that makes the best bet look as unattractive as possible.
Solve. To minimise over the simplex, equalise: , so and .
Primal from complementary slackness. Every , so every payout constraint binds: for all , so , i.e. and , matching . (A solver, scipy.optimize.linprog with HiGHS, returns these multipliers, up to its sign convention.)
Reading it. is the value of raising the guaranteed floor in state : a state price. If some probability vector made every bet fair or worse, , then and no arbitrage would exist. That is the fundamental theorem of asset pricing in miniature: no arbitrage if and only if a positive pricing measure exists, and the proof is LP duality (Farkas' lemma). Here , so no such exists and the arbitrage returns per unit staked.
Knowledge check
For a nonconvex primal problem (say, minimum variance with a cardinality constraint written using nonconvex functions), the Lagrangian dual function g(λ, ν) is:
Knowledge check
A solver for a convex minimisation reports a feasible point with objective 0.70 and a dual-feasible multiplier vector with dual value 0.62. What do you know about the optimal value p*?
Knowledge check
In a convex minimisation, the constraint is active with multiplier , and another constraint holds with . Which statement is correct?
Knowledge check
Which problem can have a nonzero duality gap?
Key takeaways
- The dual function is always concave and (weak duality); a primal–dual pair with a small gap certifies near-optimality.
- Strong duality holds for convex problems under Slater's condition (a strictly feasible point) and for any feasible LP or linearly constrained QP. Without it there can be a gap or unattainable multipliers.
- Strong duality implies the KKT conditions, including complementary slackness ; for convex problems KKT is also sufficient.
- Multipliers are prices: , and globally. In an arbitrage LP the dual variables are state prices, and LP duality is the no-arbitrage theorem.
Practice problems
Finished reading?
Answer the 4 knowledge checks to complete this lesson (0 done).