Lagrangian Duality and the KKT Conditions
Turning constraints into prices, bounding the optimum, and certifying it.
Leads to: 10.4 solves the resulting systems; 10.5 uses KKT for portfolios.
Learning Objectives
Click a status chip to cycle: Not started → In progress → Studied → Practiced → Needs review → Mastered.
- Form the Lagrangian and the dual function of a constrained problem.
- State weak duality and explain the duality gap.
- State strong duality and Slater's condition for convex problems.
- Write the KKT conditions and use them to solve a constrained problem.
- Interpret Lagrange multipliers as shadow prices / marginal sensitivities.
Key Vocabulary
- Lagrangian
- The function \(L(x,\lambda,\nu)=f_0(x)+\sum_i\lambda_i f_i(x)+\sum_j\nu_j(a_j^\top x-b_j)\) folding constraints into the objective.
- Dual function
- The infimum \(g(\lambda,\nu)=\inf_x L(x,\lambda,\nu)\); concave, and a lower bound on the optimum.
- Weak duality
- Always: \(g(\lambda,\nu)\le p^\star\) for \(\lambda\ge0\); the best such bound is the dual optimum \(d^\star\le p^\star\).
- Strong duality
- When \(d^\star=p^\star\) (zero gap); holds for convex problems under a constraint qualification.
- Slater's condition
- A strictly feasible point exists (\(f_i(x)\lt 0\), equalities met); guarantees strong duality for convex problems.
- KKT conditions
- Stationarity, primal & dual feasibility, and complementary slackness - necessary and (convex case) sufficient for optimality.
Intuition & Motivation
The Lagrangian and dual function
Start from standard form (10.3). Attach a multiplier \(\lambda_i\ge0\) to each inequality and \(\nu_j\) to each equality:
The dual function \(g(\lambda,\nu)=\inf_x L(x,\lambda,\nu)\) is a pointwise infimum of affine functions of \((\lambda,\nu)\), hence always concave even when the primal is not convex.
- Stationarity: \(\nabla f_0(x^\star)+\sum_i\lambda_i^\star\nabla f_i(x^\star)+\sum_j\nu_j^\star a_j=0\).
- Primal feasibility: \(f_i(x^\star)\le0\), \(Ax^\star=b\).
- Dual feasibility: \(\lambda_i^\star\ge0\).
- Complementary slackness: \(\lambda_i^\star f_i(x^\star)=0\) for all \(i\).
For convex problems the KKT conditions are sufficient as well as necessary - solve them and you have the global optimum.
Predict the shadow price
- Allowing \(\lambda_i\lt 0\). Inequality multipliers must be \(\ge0\); only equality multipliers \(\nu\) are free.
- Forgetting complementary slackness: an inactive constraint (\(f_i\lt 0\)) forces \(\lambda_i=0\), and vice versa.
- Assuming strong duality without checking a constraint qualification (Slater). Nonconvex or degenerate problems can have a positive gap.
- Using KKT as sufficient for nonconvex problems - there it is only necessary.
- The dual is always concave, so the dual problem is always convex - sometimes far easier than the primal.
- Complementary slackness is a powerful solver: guess which constraints are active, set their \(\lambda_i\gt 0\), the rest to 0, and solve the reduced system.
- Read multipliers as prices: \(\lambda_i^\star\) is the sensitivity of the optimum to constraint \(i\) - directly meaningful in risk budgeting.
Knowledge Check
Practical Exercise
Solve \(\min\ x_1^2+x_2^2\) s.t. \(x_1+x_2\ge2\) using KKT. (a) Form the Lagrangian. (b) Apply stationarity and complementary slackness. (c) Give \(x^\star\) and \(\lambda^\star\).
(a) Rewrite \(f_1(x)=2-x_1-x_2\le0\). \(L=x_1^2+x_2^2+\lambda(2-x_1-x_2)\), \(\lambda\ge0\).
(b) Stationarity: \(2x_1-\lambda=0,\ 2x_2-\lambda=0\Rightarrow x_1=x_2=\lambda/2\). If the constraint were inactive, \(\lambda=0\) gives \(x=0\), which violates \(x_1+x_2\ge2\). So it is active: \(x_1+x_2=2\).
(c) \(\lambda/2+\lambda/2=2\Rightarrow\lambda^\star=2\), \(x^\star=(1,1)\). Check \(\lambda^\star=2\ge0\) and complementary slackness holds (constraint tight). The shadow price 2 means relaxing the constraint to \(\ge1.9\) would lower the optimum by \(\approx0.2\).
Lesson Summary
Retrieval Practice
Close the lesson and answer from memory before checking. This is deliberate, effortful recall - the single highest-yield study action.
A: Stationarity (\(\nabla_x L=0\)), primal feasibility, dual feasibility (\(\lambda\ge0\)), and complementary slackness (\(\lambda_i f_i=0\)).
A: For convex problems, existence of a strictly feasible point guarantees strong duality (zero duality gap) and attainment of the dual optimum.
Completion Checklist
- I can explain the core ideas in my own words
- I worked the derivations/examples by hand
- I completed the interactive workbench(es)
- I passed the knowledge check
Source References
This lesson synthesizes and paraphrases concepts from the sources below. No copyrighted text, problem sets, or solutions are reproduced. Return to the originals for full depth.
- Additional Exercises for Convex Optimization (Boyd & Vandenberghe, 2016) current - Ch. 5 - Ch. 5 exercises: Lagrangian duality, KKT conditions, and sensitivity interpretation.
- The Elements of Statistical Learning (Hastie, Tibshirani & Friedman, 2nd ed.) current - Ch. 12 - Ch. 12: KKT/duality behind support vector machines and constrained estimators.