Home › Linear Functions › Lesson 11

Duality, Farkas' Lemma and Complementary Slackness

Lesson 11 of 12

Key idea of this section

Primal:  max cᵀx   s.t.  Ax ≤ b, x ≥ 0
Dual:    min bᵀy   s.t.  Aᵀy ≥ c, y ≥ 0
Weak duality cᵀx ≤ bᵀy;  strong duality: the optimal values are equal

The dual programme

Every LP comes with a partner. To the primal problem max {cᵀx : Ax ≤ b, x ≥ 0} associate the dual problem min {bᵀy : Aᵀy ≥ c, y ≥ 0}. The dual variables yᵢ are multipliers for the primal constraints: if we multiply the i-th constraint by yᵢ ≥ 0 and add, we obtain yᵀAx ≤ yᵀb, and when Aᵀy ≥ c the left side dominates cᵀx for every x ≥ 0. The dual asks for the best upper bound obtainable this way. The dual of the dual is the primal.

Theorem 11.1 (Weak duality)

If x is primal feasible and y is dual feasible, then cᵀx ≤ bᵀy.

Proof. cᵀx ≤ (Aᵀy)ᵀx = yᵀ(Ax) ≤ yᵀb. The first inequality uses Aᵀy ≥ c and x ≥ 0; the second uses Ax ≤ b and y ≥ 0. ∎

Consequently, if feasible x and y have equal objective values, both are optimal; if the primal is unbounded, the dual is infeasible; and if the dual is unbounded below, the primal is infeasible.

Theorem 11.2 (Farkas' lemma, 1902)

For a matrix A and a vector b, exactly one of the following holds: (i) there is x ≥ 0 with Ax = b; (ii) there is y with Aᵀy ≥ 0 and bᵀy < 0.

Proof. Both cannot hold, since then 0 > bᵀy = (Ax)ᵀy = xᵀ(Aᵀy) ≥ 0. Suppose (i) fails, so b lies outside the cone K = {Ax : x ≥ 0}. This cone is convex and closed (a finitely generated cone is closed; this is the one nontrivial technical point, proved via Carathéodory's theorem). By the separating hyperplane theorem there is y with yᵀb < yᵀz for all z ∈ K. Taking z = 0 gives yᵀb < 0. If yᵀz < 0 for some z ∈ K, then scaling z by a large positive factor would make yᵀ(tz) smaller than yᵀb, a contradiction; so yᵀz ≥ 0 for all z ∈ K, and in particular for the columns of A, which says Aᵀy ≥ 0. ∎

The vector y in (ii) is a certificate of infeasibility: a combination of the equations that produces an obviously contradictory consequence. Farkas' lemma is the linear-inequality analogue of the Fredholm alternative "Ax = b is solvable if and only if b is orthogonal to every solution of Aᵀy = 0".

Theorem 11.3 (Strong duality)

If the primal has a finite optimal value, then so does the dual, and the two optimal values are equal. If either problem is infeasible, the other is either infeasible or unbounded.

Idea of proof. Let z* be the primal optimum. For every ε > 0 the system Ax ≤ b, cᵀx ≥ z* + ε, x ≥ 0 is infeasible; after adding slack variables, Farkas' lemma produces a nonnegative combination of the constraints certifying this, and normalising that combination gives a dual feasible y with bᵀy < z* + ε. Combined with weak duality and the fact that the dual optimum is attained (it is an LP with finite value, so Theorem 10.1 applies), this yields equality. A constructive proof comes from the simplex method itself: at an optimal tableau the negatives of the slack coefficients in the objective row form an optimal dual solution, exactly as observed in Lesson 10.

Complementary slackness

From the proof of weak duality, equality cᵀx = bᵀy holds if and only if both inequalities in the chain are equalities, which unpacks to the following conditions (Problem 54).

yᵢ > 0   ⇒   the i-th primal constraint is tight:   (Ax)ᵢ = bᵢ
xⱼ > 0   ⇒   the j-th dual constraint is tight:     (Aᵀy)ⱼ = cⱼ

Worked example. The dual of the Lesson 10 problem is: minimise 4y₁ + 7y₂ + 3y₃ subject to y₁ + y₂ + y₃ ≥ 3, y₁ + 3y₂ ≥ 2, y ≥ 0. At the primal optimum (3, 1), the constraint x + 3y ≤ 7 is slack, so y₂ = 0; and x, y > 0 force both dual constraints to be tight: y₁ + y₃ = 3 and y₁ = 2. Hence y = (2, 0, 1), which is feasible with dual value 4·2 + 0 + 3·1 = 11, equal to the primal value. Both solutions are thereby proved optimal.

Economic and combinatorial meaning

If bᵢ is the available amount of resource i and cⱼ the profit per unit of product j, then the optimal dual variable yᵢ is the shadow price of resource i: the rate at which the optimal profit increases per additional unit of bᵢ (for small changes that do not alter the optimal basis). In the example, an extra unit of the first resource is worth 2, an extra unit of the third is worth 1, and the second resource, not fully used, is worth nothing. Duality also unifies classical min–max theorems of combinatorics and game theory: the max-flow min-cut theorem, König's theorem on bipartite matchings, and von Neumann's minimax theorem for two-person zero-sum games are all instances of LP duality.

Exercise

  • (a)
    Write the dual of: maximise x₁ + x₂ subject to x₁ + 2x₂ ≤ 4, 3x₁ + x₂ ≤ 6, x ≥ 0. Solve both problems and confirm that the values agree.
  • (b)
    Find a Farkas certificate showing that x₁ + x₂ = 1, x₁ − x₂ = 3, x₁, x₂ ≥ 0 has no solution.
Show solution

Answers: (a) Dual: minimise 4y₁ + 6y₂ subject to y₁ + 3y₂ ≥ 1, 2y₁ + y₂ ≥ 1, y ≥ 0. Primal: the vertices (0, 0), (2, 0), (8/5, 6/5), (0, 2) give 0, 2, 14/5, 2, so the optimum is 14/5 at (8/5, 6/5). Both xⱼ are positive, so both dual constraints are tight: y₁ + 3y₂ = 1 and 2y₁ + y₂ = 1 give y = (2/5, 1/5), which is feasible with value 8/5 + 6/5 = 14/5. (b) Take y = (1, −1): Aᵀy = (1 − 1, 1 + 1) = (0, 2) ≥ 0 and bᵀy = 1 − 3 = −2 < 0. In words: subtracting the second equation from the first gives 2x₂ = −2, impossible for x₂ ≥ 0.

V.3.1