Part 2 · Chapter 10

Duality in Linear Programming

Every linear program has a hidden twin. Ask "how much product should I make to maximize profit?" and lurking behind it is a second question — "what is each of my resources really worth?" — that has exactly the same answer. This mirror problem is the dual, and the relationship between the two is one of the most elegant and useful results in all of optimization. It turns shadow prices into a rigorous theory, gives us bounds and optimality certificates for free, and often lets us solve the easier of the two problems instead.

Optimization Techniques Prof. Mithun Mondal Reading time ≈ 45 min
i What you'll learn
  • The idea that every LP (the primal) has an associated dual, and why they share an answer.
  • The rules for constructing the dual from any primal.
  • The primal–dual correspondence for constraints, variables, and signs.
  • Weak duality (a universal bound) and strong duality (equal optimal values, no gap).
  • Complementary slackness, which links a primal optimum to its dual.
  • The economic interpretation — dual variables are shadow prices, readable from the final tableau.
Section 10-1

The Idea of Duality

Suppose a workshop maximizes profit by choosing production quantities, limited by scarce resources. That is the primal problem. Now imagine an outsider who wants to buy all the resources: to set fair prices, they must charge at least enough that the shop would rather sell each resource than use it to make product — yet as little as possible to win the deal. That price-setting problem is the dual. Remarkably, the shop's maximum profit and the minimum total resource value coincide exactly.

Duality is not a coincidence but a structural feature of every LP. It gives bounds (any dual solution bounds the primal), certificates (matching values prove optimality), and computational shortcuts (solve whichever twin is easier). Above all it makes rigorous the shadow prices we have met informally since Chapter 5.

PRIMAL max z = cᵀx Ax ≤ b x ≥ 0 n vars · m constraints DUAL min w = bᵀy Aᵀy ≥ c y ≥ 0 m vars · n constraints b ↔ c A ↔ Aᵀ
The primal and its dual: swap max/min, transpose \(A\), and exchange \(b\) with \(c\)
Section 10-2

Constructing the Dual

For a primal in symmetric form — a maximization with all "\(\le\)" constraints and non-negative variables — the dual is written mechanically:

Symmetric primal–dual pair
\[ \textbf{Primal: } \max\ \mathbf{c}^{\mathsf T}\mathbf{x}\ \text{ s.t. } A\mathbf{x} \le \mathbf{b},\ \mathbf{x} \ge 0 \qquad\Longleftrightarrow\qquad \textbf{Dual: } \min\ \mathbf{b}^{\mathsf T}\mathbf{y}\ \text{ s.t. } A^{\mathsf T}\mathbf{y} \ge \mathbf{c},\ \mathbf{y} \ge 0 \]

Every piece flips role: maximization becomes minimization; the cost vector \(\mathbf{c}\) becomes the dual's right-hand side while the primal's right-hand side \(\mathbf{b}\) becomes the dual's cost; the constraint matrix is transposed, \(A \to A^{\mathsf T}\); and each of the \(m\) primal constraints spawns one of the \(m\) dual variables, while each of the \(n\) primal variables spawns one of the \(n\) dual constraints. A pleasing consequence: the dual of the dual is the original primal.

Section 10-3

Primal–Dual Correspondence

When the primal is not in symmetric form — mixed constraint types or free variables — the dual follows a fixed dictionary. Reading down the table converts any (maximization) primal into its dual.

Primal (maximization)Dual (minimization)
\(i\)-th constraint is \(\le\)\(y_i \ge 0\)
\(i\)-th constraint is \(=\)\(y_i\) free (unrestricted)
\(i\)-th constraint is \(\ge\)\(y_i \le 0\)
variable \(x_j \ge 0\)\(j\)-th dual constraint is \(\ge c_j\)
variable \(x_j\) free\(j\)-th dual constraint is \(= c_j\)
\(m\) constraints\(m\) variables
\(n\) variables\(n\) constraints
Constraints and variables trade places. The single most useful thing to remember is that a primal constraint becomes a dual variable and a primal variable becomes a dual constraint. Once that swap is internalised, the sign rules (which direction each inequality points, which variables are free) follow naturally, and even a large mixed LP can be dualised without error.
Section 10-4

Weak Duality

The first theorem costs almost nothing to prove yet is enormously useful. For any primal-feasible \(x\) and any dual-feasible \(y\), the primal objective can never exceed the dual objective.

🔑
Weak duality
\[ \mathbf{c}^{\mathsf T}\mathbf{x} \;\le\; \mathbf{b}^{\mathsf T}\mathbf{y} \quad \text{for all feasible } x,\, y \]

Proof in one line: \(\mathbf{c}^{\mathsf T}x \le (A^{\mathsf T}y)^{\mathsf T}x = y^{\mathsf T}(Ax) \le y^{\mathsf T}b = \mathbf{b}^{\mathsf T}y\), using \(A^{\mathsf T}y \ge c\), \(x \ge 0\), then \(Ax \le b\), \(y \ge 0\). Every dual-feasible value is an upper bound on the primal maximum, and every primal-feasible value is a lower bound on the dual minimum. Two immediate corollaries: if the primal is unbounded, the dual must be infeasible; and if \(\mathbf{c}^{\mathsf T}x = \mathbf{b}^{\mathsf T}y\) for some feasible pair, both are optimal.

Section 10-5

Strong Duality

Weak duality leaves open a gap between the best primal and best dual values. The strong duality theorem closes it completely: for linear programs there is no duality gap.

objective value primal (max) rises ↑ dual (min) falls ↓ z★ = w★ no duality gap
Strong duality: the primal maximum and dual minimum meet exactly — the gap is zero
🔑
Strong duality
\[ \text{If either problem has an optimal solution, so does the other, and } z^\star = w^\star. \]

The optimal profit equals the optimal imputed value of the resources, exactly. This is special to (and characteristic of) linear programming — general nonlinear problems can have a positive duality gap. It is also why the simplex method, on solving the primal, hands you the dual optimum for free.

Section 10-6

Complementary Slackness

Strong duality says the optimal values match; complementary slackness says how the optimal solutions themselves are linked. At optimality, a primal variable and its partner dual constraint cannot both be slack, and a primal constraint and its partner dual variable cannot both be slack.

Complementary slackness conditions
\[ y_i\,(b_i - \mathbf{a}_i^{\mathsf T}x) = 0 \quad\forall i,\qquad x_j\,(\mathbf{a}_j^{\mathsf T}y - c_j) = 0 \quad\forall j \]
PRIMAL DUAL constraint i (slack) variable yᵢ ×=0 variable xⱼ constraint j (surplus) ×=0
Complementary slackness pairs each primal quantity with a dual one; at least one of each pair is zero

Read practically: if a resource is not fully used (primal constraint has slack), its price is zero (\(y_i = 0\)); if a product is made (\(x_j > 0\)), its dual constraint is binding (it earns exactly its worth). These conditions are strong enough to recover one optimal solution from the other — given the primal optimum, you can solve for the dual optimum, and vice versa, without re-running the simplex method.

Section 10-7

Economic Interpretation & Reading the Dual

The dual variables \(y_i\) are precisely the shadow prices of Chapter 5: the marginal value of one more unit of resource \(i\). Their weighted sum \(w = \mathbf{b}^{\mathsf T}y\) is the total imputed value of all resources, which strong duality equates to the optimal profit. And — the practical payoff — the dual optimum is sitting in the primal's final simplex tableau all along: it is the \(z\)-row entries under the slack variables.

Final z-row (Wyndor, Ch 8)x₁x₂s₁s₂s₃RHS
z0003/2136
🔑
The dual optimum lives under the slacks
\[ y^\star = (y_1, y_2, y_3) = (0,\ \tfrac{3}{2},\ 1),\qquad w^\star = \mathbf{b}^{\mathsf T}y^\star = 4(0)+12(\tfrac32)+18(1) = 36 = z^\star \]

The \(z\)-row entries under \(s_1, s_2, s_3\) are the dual variables. Resource 1 (with slack in the primal) prices at \(0\); resources 2 and 3 (binding) carry positive shadow prices. Their total imputed value \(36\) equals the optimal profit \(36\), confirming strong duality — all read off a single tableau.

Section 10-8

Worked Examples

1 Dual of a symmetric LP

Problem. Write the dual of \(\max\ z = 3x_1 + 5x_2\) s.t. \(x_1 \le 4,\ 2x_2 \le 12,\ 3x_1 + 2x_2 \le 18,\ x \ge 0\).

Solution. Three constraints give three dual variables \(y_1, y_2, y_3 \ge 0\); two primal variables give two dual constraints:

Dual
\[ \min\ w = 4y_1 + 12y_2 + 18y_3 \ \ \text{s.t.}\ \ y_1 + 3y_3 \ge 3,\ \ 2y_2 + 2y_3 \ge 5,\ \ y \ge 0 \]

The columns of \(A\) became the dual constraints; \(b\) became the dual objective.

2 A dual with mixed constraints

Problem. Dualise \(\max\ z = 2x_1 + x_2\) s.t. \(x_1 + x_2 \le 6,\ x_1 - x_2 = 2,\ x \ge 0\).

Solution. The "\(\le\)" gives \(y_1 \ge 0\); the "\(=\)" gives \(y_2\) free. The dual is \(\min\ w = 6y_1 + 2y_2\) s.t. \(y_1 + y_2 \ge 2,\ y_1 - y_2 \ge 1,\ y_1 \ge 0,\ y_2\ \text{free}\). The equality constraint is exactly what freed the sign of \(y_2\).

3 Weak duality as a bound

Problem. For the pair in Example 1, a primal-feasible point gives \(z = 30\) and a dual-feasible point gives \(w = 40\). What can you conclude about \(z^\star\)?

Solution. Weak duality says \(z \le w\) always, so \(30 \le z^\star \le 40\): the true optimum is trapped between the two. Any dual-feasible value is a certificate that the primal cannot exceed it — a cheap and rigorous bound before the problem is even solved.

4 Verifying strong duality

Problem. The primal of Example 1 optimizes at \((2,6)\) with \(z^\star = 36\). Check the dual value at \(y = (0, \tfrac32, 1)\).

Solution. \(w = 4(0) + 12(\tfrac32) + 18(1) = 0 + 18 + 18 = 36\). Since \(z^\star = w^\star = 36\) and both points are feasible, strong duality holds and both are optimal — the values meet with no gap.

5 Recovering the dual by complementary slackness

Problem. Given the primal optimum \((2,6)\) of Example 1, find the dual optimum using complementary slackness.

Solution. Primal constraint 1 has slack (\(2 < 4\)), so \(y_1 = 0\). Both primal variables are positive, so both dual constraints are binding: \(y_1 + 3y_3 = 3\) and \(2y_2 + 2y_3 = 5\). With \(y_1 = 0\), the first gives \(y_3 = 1\); the second gives \(2y_2 = 5 - 2 = 3 \Rightarrow y_2 = \tfrac32\). Thus \(y^\star = (0, \tfrac32, 1)\) — obtained without any simplex iterations.

6 Reading the dual from the tableau

Problem. A primal maximization has final \(z\)-row entries under its slacks \(s_1, s_2\) equal to \(2\) and \(5\), with \(b = (10, 8)\). State the dual solution and value.

Solution. The dual variables are the slack reduced costs: \(y^\star = (2, 5)\). The dual objective is \(w^\star = \mathbf{b}^{\mathsf T}y^\star = 10(2) + 8(5) = 60\), which must equal the primal optimum \(z^\star\). The final tableau delivered the entire dual solution — no separate dual solve required.

Review

Chapter Summary

The pair

Every primal has a dual; the dual of the dual is the primal.

Construction

Swap max/min, transpose \(A\), exchange \(b \leftrightarrow c\); constraints become variables and vice versa.

Weak duality

\(\mathbf{c}^{\mathsf T}x \le \mathbf{b}^{\mathsf T}y\) always — every dual value bounds the primal optimum.

Strong duality

At optimality \(z^\star = w^\star\); LP has no duality gap.

Complementary slackness

Each primal–dual pair has at least one zero; recovers one optimum from the other.

Shadow prices

Dual variables = marginal resource values, read from the \(z\)-row under the slacks.

Practice

Problems

For each item, apply the correspondence rules carefully and state which duality theorem you use. Difficulty rises down the list.

  1. Write the dual of \(\max\ z = 4x_1 + 3x_2\) s.t. \(2x_1 + x_2 \le 10,\ x_1 + 3x_2 \le 15,\ x \ge 0\).
  2. Write the dual of \(\min\ z = 5x_1 + 4x_2\) s.t. \(x_1 + x_2 \ge 6,\ 2x_1 + x_2 \ge 8,\ x \ge 0\).
  3. Dualise \(\max\ z = x_1 + 2x_2\) s.t. \(x_1 + x_2 = 4,\ x_1 - x_2 \le 1,\ x_1 \ge 0,\ x_2\ \text{free}\).
  4. State weak duality and use it to bound \(z^\star\) if a primal-feasible value is \(22\) and a dual-feasible value is \(31\).
  5. Explain why an unbounded primal forces the dual to be infeasible.
  6. The primal of Problem 1 optimizes at some \((x_1^\star, x_2^\star)\) with \(z^\star = 27\); what is the dual optimal value, and why?
  7. State the complementary slackness conditions and interpret each in resource-pricing language.
  8. Given a primal optimum where constraint 2 has slack and both variables are positive, deduce which dual variables are zero and which dual constraints are binding.
  9. A final primal tableau has \(z\)-row slack entries \(0, 4, 2\) with \(b = (6, 5, 9)\). State the dual solution and value.
  10. Show that the dual of the dual returns the original primal for the symmetric form.
  11. Use complementary slackness to find the dual optimum of \(\max\ z = 3x_1 + 5x_2\) (Example 1) if you are told only the primal optimum \((2,6)\).
  12. A furniture maker solves a profit-max LP and finds the shadow price of labour is ₹0 while machine-time is ₹4. Interpret both prices, explain what complementary slackness implies about labour usage at the optimum, and advise which resource to buy more of and up to what price.
Tip: when you solve the primal, you have already solved the dual — read the dual variables from the final \(z\)-row under the slack columns, and verify with \(w^\star = \mathbf{b}^{\mathsf T}y^\star = z^\star\). Use weak duality as a sanity check throughout: any dual-feasible value you can guess is a legitimate upper bound on a primal maximization, so if your "optimal" primal value ever exceeds a known dual-feasible value, you have made an arithmetic error. Duality is not only theory — it is a built-in error detector.