Linear Programming Duality
Statement
Given a primal linear program:
its dual is:
Weak duality holds always: for any primal-feasible and dual-feasible , .
Strong duality (LP duality theorem): if both programs are feasible and bounded, their optimal values coincide, .
Visualization
2x2 example. Primal: s.t. , , .
Dual: s.t. , , .
Primal optimal: , objective .
Dual optimal: , objective . Duality gap ✓
| Solution type | primal obj | ||
|---|---|---|---|
| Primal feas. | 1 | 2 | 5 |
| Primal opt. | 1 | 1 | 3 |
| Solution type | dual obj | ||
|---|---|---|---|
| Dual feas. | 0 | 1 | 1 |
| Dual opt. | 1 | 2 | 3 |
Weak duality lower-bounds primal: for all feasible pairs. At optimality, both sides equal 3.
Proof Sketch
- Weak duality: for primal-feasible and dual-feasible :
- Strong duality: if the primal is bounded below and feasible, KKT conditions produce a dual certificate with .
- Complementary slackness: at optimality, and .
- Mathlib contains LP theory via
Mathlib.LinearProgramming.*(work in progress); the weak duality bound is a direct arithmetic consequence.
Connections
- KKT ConditionsKKT ConditionsNecessary optimality conditions for constrained optimization via Lagrangian gradient and complementary slacknessRead more → — LP duality is a special case of KKT conditions; the dual variables are the Lagrange multipliers of the primal constraints
- Minimax Theorem — LP duality is equivalent to the minimax theorem for bilinear zero-sum games
- Cauchy–Schwarz InequalityCauchy–Schwarz InequalityThe inner product of two vectors is bounded by the product of their normsRead more → — both are instances of the broader Hahn–Banach duality theory
- Rank–Nullity TheoremRank–Nullity TheoremThe dimensions of image and kernel of a linear map sum to the domain dimensionRead more → — the primal/dual feasibility conditions are linear systems; rank-nullity governs when they have solutions
Lean4 Proof
import Mathlib.Algebra.Order.Field.Basic
/-- Weak LP duality for the 2x2 example:
y₁ + y₂ ≤ x₁ + 2 * x₂ for any primal-feasible (x₁,x₂) and dual-feasible (y₁,y₂). -/
theorem lp_weak_duality_2x2
(x1 x2 y1 y2 : ℝ)
(hx1 : 1 ≤ x1) (hx2 : 1 ≤ x2)
(hy1 : y1 ≤ 1) (hy2 : y2 ≤ 2)
(hy1n : 0 ≤ y1) (hy2n : 0 ≤ y2) :
y1 + y2 ≤ x1 + 2 * x2 := by
linarith