Foundations to Frontier
Tests
A. Mathematical Foundations › A6 Optimization › Convex optimization

Lagrangian Duality: Weak and Strong Duality

Every constrained problem has a shadow problem, its dual, built by pricing the constraints with Lagrange multipliers. The dual always gives a lower bound on the optimum (weak duality), and for convex problems satisfying Slater's condition the bound is tight (strong duality). You will build the Lagrangian and dual function, derive duals of QPs and LPs, interpret multipliers as sensitivities, use dual ascent, and allocate a satellite's transmit power across channels by water-filling.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Pricing a rule instead of enforcing it

Suppose a rover may use at most 10 Wh. Instead of forbidding more, charge a price for every Wh used beyond the budget, and pay a rebate for every Wh saved. Now the rover can do whatever it likes, and the price nudges it. Set the price too low and it overspends; too high and it underspends. At just the right price, its free choice exactly matches the best plan within the budget.

The price is a Lagrange multiplier. The problem of finding the best price is the dual problem.

Price the constraint: the Lagrangian and the dual function
f (solid), L(x, λ) (orange dashed); shaded = feasibledual g(λ) (green) ≤ p* (blue dashed)
p* = 0.656 at x* = 1.81 · g(λ = 1.00) = 0.550 · d* = max g = 0.640 at λ* ≈ 1.60 · duality gap 0.016
The multiplier λ is a price for violating the constraint. For each price, minimizing the Lagrangian over all x (feasible or not) gives a lower bound g(λ) on the true optimum p*: weak duality. The best bound d* = max g equals p* for the convex objective (strong duality), and λ* is how much p* would drop per unit of loosening a. For the non-convex double well the bound can stall below p*, leaving a duality gap. If the constraint is inactive (a left of the bowl's bottom), λ* = 0.
Why engineers care

Duality gives certificates (a dual value proves how good your solution is), sensitivities (how much better you’d do with one more unit of fuel, power or bandwidth), and decomposition: big problems split into pieces coordinated by prices. That’s how power is allocated across satellite channels and how distributed robots share resources.

📝 Quick check (Level 0)
0/3 answered
  1. 1. A Lagrange multiplier can be read as…
  2. 2. For a minimization problem, the dual gives a…
  3. 3. At the right price, the unconstrained choice…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

The Lagrangian

For min⁡f0(x)\min f_0(x) s.t. fi(x)≤0f_i(x)\le0, hj(x)=0h_j(x) = 0:

L(x,λ,ν)=f0(x)+∑iλifi(x)+∑jνjhj(x),λ≥0L(x, \lambda, \nu) = f_0(x) + \sum_i\lambda_if_i(x) + \sum_j\nu_jh_j(x),\qquad\lambda\ge0

The dual function and the dual problem

g(λ,ν)=inf⁡xL(x,λ,ν)g(\lambda, \nu) = \inf_xL(x, \lambda, \nu)

gg is always concave, even if the original problem isn’t, because it’s a pointwise infimum of affine functions of (λ,ν)(\lambda, \nu). The dual problem is d⋆=max⁡λ≥0,νg(λ,ν)d^\star = \max_{\lambda\ge0,\nu}g(\lambda, \nu).

Example

min⁡x2\min x^2 s.t. x≥1x\ge1. Then L=x2+λ(1−x)L = x^2 + \lambda(1 - x), minimized at x=λ/2x = \lambda/2, so g(λ)=λ−λ2/4g(\lambda) = \lambda - \lambda^2/4. The maximum is at λ⋆=2\lambda^\star = 2 with d⋆=1=p⋆d^\star = 1 = p^\star.

📝 Quick check (Level 1)
0/3 answered
  1. 1. The dual function g is always…
  2. 2. Multipliers of inequality constraints must be…
  3. 3. For min x² s.t. x ≥ 1, λ* =

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 45 minUndergraduate students and practising engineers.

Weak duality

For any feasible xx and any λ≥0\lambda\ge0, g(λ,ν)≤L(x,λ,ν)≤f0(x)g(\lambda, \nu)\le L(x, \lambda, \nu)\le f_0(x). Hence d⋆≤p⋆d^\star\le p^\star. The duality gap is p⋆−d⋆≥0p^\star - d^\star\ge0. Any feasible pair gives a bound: if f0(x)−g(λ,ν)≤εf_0(x) - g(\lambda, \nu)\le\varepsilon, then xx is ε\varepsilon-optimal. That’s a stopping certificate.

Strong duality and Slater’s condition

If the problem is convex and Slater’s condition holds (some xx has fi(x)<0f_i(x) < 0 for all non-affine inequalities), then d⋆=p⋆d^\star = p^\star and the dual optimum is attained. Non-convex problems can have a positive gap. The demo’s double well shows one.

Standard duals

  • Equality-constrained QP min⁡12x⊤Qx+c⊤x\min\frac12x^\top Qx + c^\top x s.t. Ax=bAx = b: g(ν)=−12(c+A⊤ν)⊤Q−1(c+A⊤ν)−b⊤νg(\nu) = -\frac12(c + A^\top\nu)^\top Q^{-1}(c + A^\top\nu) - b^\top\nu.
  • LP: min⁡c⊤x\min c^\top x s.t. Ax≥b,x≥0Ax\ge b, x\ge0 has the dual max⁡b⊤y\max b^\top y s.t. A⊤y≤c,y≥0A^\top y\le c, y\ge0. LP strong duality holds whenever either problem is feasible and bounded.

Multipliers as sensitivities

Perturb a constraint to fi(x)≤uif_i(x)\le u_i. Then ∂p⋆/∂ui=−λi⋆\partial p^\star/\partial u_i = -\lambda_i^\star. The multiplier is the marginal value of loosening the constraint, the shadow price. For min⁡x2\min x^2 s.t. x≥ax\ge a, p⋆=a2p^\star = a^2 and dp⋆/da=2a=λ⋆dp^\star/da = 2a = \lambda^\star.

Dual ascent

∇νg(ν)=Ax(ν)−b\nabla_\nu g(\nu) = Ax(\nu) - b, the constraint violation at the Lagrangian minimizer. Gradient ascent on the dual raises prices where constraints are violated. This is the basis of decomposition methods and ADMM (A6.2-8).

🐍 Exercise 1: duality for an equality-constrained QP
Implement the dual function of an equality-constrained QP and solve its KKT system. Verify weak duality for random multipliers, a zero gap at ν*, and recover ν* by dual gradient ascent.
📝 Quick check (Level 2)
0/3 answered
  1. 1. Weak duality says d* ≤ p* for…
  2. 2. Slater's condition requires…
  3. 3. The dual gradient ∇_ν g equals…

Level 3: Advanced

★★★★☆ Advanced⏱ 45 minGraduate level, with full derivations and proofs.

Proof of weak duality

For feasible x~\tilde x and λ≥0\lambda\ge0: ∑λifi(x~)≤0\sum\lambda_if_i(\tilde x)\le0 and hj(x~)=0h_j(\tilde x) = 0, so L(x~,λ,ν)≤f0(x~)L(\tilde x, \lambda, \nu)\le f_0(\tilde x). Then g(λ,ν)=inf⁡xL≤L(x~,λ,ν)≤f0(x~)g(\lambda, \nu) = \inf_xL\le L(\tilde x, \lambda, \nu)\le f_0(\tilde x). Take the inf over feasible x~\tilde x and the sup over (λ,ν)(\lambda, \nu). ∎

Deriving the QP dual

∇xL=Qx+c+A⊤ν=0\nabla_xL = Qx + c + A^\top\nu = 0 gives x(ν)=−Q−1(c+A⊤ν)x(\nu) = -Q^{-1}(c + A^\top\nu). Substituting gives g(ν)=−12(c+A⊤ν)⊤Q−1(c+A⊤ν)−b⊤νg(\nu) = -\frac12(c + A^\top\nu)^\top Q^{-1}(c + A^\top\nu) - b^\top\nu. Setting ∇g=Ax(ν)−b=0\nabla g = Ax(\nu) - b = 0 recovers the KKT system. ∎

Why Slater gives strong duality (sketch)

Consider the set A={(u,t):∃x, fi(x)≤ui, f0(x)≤t}\mathcal A = \{(u, t) : \exists x,\ f_i(x)\le u_i,\ f_0(x)\le t\}. It’s convex for convex problems. The point (0,p⋆−ε)(0, p^\star - \varepsilon) lies outside it, so a separating hyperplane exists. Slater rules out a vertical hyperplane, and normalizing the hyperplane’s coefficients gives multipliers achieving g=p⋆g = p^\star (Boyd and Vandenberghe, §5.3). ∎

Exercise 3.1: Dual of min ‖x‖² s.t. aᵀx = b

L=∥x∥2+ν(a⊤x−b)L = \|x\|^2 + \nu(a^\top x - b) gives x=−νa/2x = -\nu a/2 and g(ν)=−ν2∥a∥2/4−νbg(\nu) = -\nu^2\|a\|^2/4 - \nu b. Then ν⋆=−2b/∥a∥2\nu^\star = -2b/\|a\|^2 and d⋆=b2/∥a∥2=p⋆d^\star = b^2/\|a\|^2 = p^\star, the squared distance from the origin to the hyperplane.

📝 Quick check (Level 3)
0/3 answered
  1. 1. Weak duality's proof uses that, for feasible x, Σλᵢfᵢ(x) is…
  2. 2. Strong duality's proof uses…
  3. 3. For min x² s.t. x ≥ a (a > 0), dp*/da equals…

Level 4: Expert

★★★★★ Expert⏱ 35 minResearchers: original papers and open problems.

Water-filling a satellite’s transmit power

A satellite has 3 W to spread across 5 downlink sub-channels with different noise-to-gain ratios nin_i. Maximize the total capacity ∑log⁡(1+pi/ni)\sum\log(1 + p_i/n_i) s.t. ∑pi=P\sum p_i = P and p≥0p\ge0. The KKT/dual analysis gives pi=max⁡(0,w−ni)p_i = \max(0, w - n_i): pour “water” to a common level w=1/ν⋆w = 1/\nu^\star over a floor of noise levels. Noisy channels stay dry. A 1-D bisection on the dual variable solves the whole problem, and the dual value certifies optimality.

🐍 Exercise 2 (research): water-filling by duality
Allocate power across noisy channels by bisecting on the water level. Check that random feasible allocations are worse, that every dual value bounds capacity from above, and that the gap closes at ν* = 1/w.

Duality in AI, robotics and aerospace

  • Communications: water-filling and its multi-user generalizations allocate power and bandwidth on satellites and in networks (Cover and Thomas, 2006; Palomar and Chiang, 2006, network utility maximization).
  • Support vector machines are solved in the dual, where the kernel trick appears (Cortes and Vapnik, 1995).
  • Distributed multi-robot coordination: dual decomposition lets robots plan independently while prices enforce shared constraints (Bertsekas and Tsitsiklis, 1989).
  • Constrained RL and safe learning: Lagrangian methods add cost constraints to policy optimization (Altman, 1999; Achiam et al., 2017).

References

  1. S. Boyd, L. Vandenberghe (2004). Convex Optimization. Cambridge University Press. Ch. 5.
  2. D. Bertsekas (2016). Nonlinear Programming, 3rd ed. Athena Scientific. Ch. 5–6.
  3. R. T. Rockafellar (1970). Convex Analysis. Princeton University Press.
  4. T. Cover, J. Thomas (2006). Elements of Information Theory, 2nd ed. Wiley. §9.4 (water-filling).
  5. D. Palomar, M. Chiang (2006). “A tutorial on decomposition methods for network utility maximization.” IEEE JSAC, 24(8).
  6. C. Cortes, V. Vapnik (1995). “Support-vector networks.” Machine Learning, 20.
  7. D. Bertsekas, J. Tsitsiklis (1989). Parallel and Distributed Computation. Prentice-Hall.
  8. E. Altman (1999). Constrained Markov Decision Processes. Chapman & Hall/CRC.
  9. J. Achiam, D. Held, A. Tamar, P. Abbeel (2017). “Constrained policy optimization.” ICML.
  10. M. Slater (1950). “Lagrange multipliers revisited.” Cowles Commission Discussion Paper, Math. 403.