MATH 4810Computational Modelling

Module 06 · Unit 6.2 · Lesson 1 of 3

Dual Models and the Fundamental Duality Theorem

Every linear program has a companion. The dual tells you what each constraint is worth, and its optimal value equals the primal's.

Duration ≈ 3 hours Prerequisite Unit 6.1 Feeds Lab 12 · Assignment 5
  1. Lesson 1
  2. Lesson 2
  3. Lesson 3

1 Modelling context

A linear program is one way to describe a decision problem. It presents the problem from the perspective of the decision-maker: which quantities to choose, subject to which resource limits. The dual of the problem presents the same situation from the perspective of the resources: what is each resource worth, and how much would the decision-maker pay for more of it?

The two perspectives are mathematically equivalent — their optimal objective values are equal — but they answer different questions. The primal answers "what should we do?" The dual answers "what is each constraint costing us?" Both are useful. For a decision-maker, the second question is often more actionable: it identifies which constraints are worth relaxing, and by how much.

Duality is a modelling tool

The dual is not just a theoretical construct. Its optimal values are the shadow prices that drive investment decisions, pricing decisions, and capacity planning. Understanding duality is understanding what an LP solution actually tells you.

2 Learning objectives

By the end of this lesson you will be able to

  • Construct the dual of a linear program in standard form.
  • Construct the dual of an LP in general form by converting to standard form first.
  • State weak duality, strong duality, and complementary slackness.
  • Verify strong duality on a small instance by hand.
  • Interpret the dual variables as marginal values of the primal constraints.

3 Prerequisite review

Standard form LP
A maximization problem with ≤ constraints and nonnegative variables. Any LP can be converted to this form.
Matrix transposition
The n × m matrix Aᵀ obtained by interchanging rows and columns of A. The dual of a primal with constraint matrix A has constraint matrix Aᵀ.
Feasibility
A point that satisfies all constraints. Every LP has either a feasible region or no feasible solution.
Optimality
A feasible point that maximizes or minimizes the objective over the feasible region.

4 Mathematical formulation

The standard-form pair

The primal-dual pair in standard form:

Primal:  maximize    c₁ x₁ + c₂ x₂ + … + cₙ xₙ
         subject to  a₁₁ x₁ + a₁₂ x₂ + … + a₁ₙ xₙ ≤ b₁
                     a₂₁ x₁ + a₂₂ x₂ + … + a₂ₙ xₙ ≤ b₂
                     …
                     a_{m1} x₁ + … + a_{mn} xₙ ≤ b_m
                     x₁, x₂, …, xₙ ≥ 0

Dual:    minimize    b₁ y₁ + b₂ y₂ + … + b_m y_m
         subject to  a₁₁ y₁ + a₂₁ y₂ + … + a_{m1} y_m ≥ c₁
                     a₁₂ y₁ + a₂₂ y₂ + … + a_{m2} y_m ≥ c₂
                     …
                     a_{1n} y₁ + … + a_{mn} y_m ≥ cₙ
                     y₁, y₂, …, y_m ≥ 0

In matrix form:

Primal:  max  cᵀ x       Dual:  min  bᵀ y
         s.t. A x ≤ b            s.t. Aᵀ y ≥ c
              x ≥ 0                   y ≥ 0

Reading the construction

  • One dual variable per primal constraint. The primal has m constraints, so the dual has m variables y₁, …, y_m.
  • One dual constraint per primal variable. The primal has n variables, so the dual has n constraints.
  • Coefficients transpose. The coefficient of y_i in the j-th dual constraint is a_{ij} — the same coefficient that appears in the i-th primal constraint next to x_j.
  • Objective and RHS swap roles. The primal objective coefficients c_j become the dual constraint right-hand sides; the primal constraint bounds b_i become the dual objective coefficients.
  • Direction reverses. Maximization becomes minimization; ≤ becomes ≥.

The fundamental duality theorem

Weak duality. For any feasible x of the primal and any feasible y of the dual:

cᵀ x ≤ bᵀ y

The primal objective is always bounded above by the dual objective.

Strong duality. If the primal has an optimal solution x*, then the dual has an optimal solution y*, and:

cᵀ x* = bᵀ y*

The two optima are equal. (By the symmetric statement, if either problem has a finite optimum, so does the other.)

Complementary slackness. At optimality:

  • If the i-th primal constraint is not binding (slack positive), then y_i = 0.
  • If y_i > 0, then the i-th primal constraint is binding.
  • If the j-th primal variable is positive (x_j > 0), then the j-th dual constraint is binding.
  • If the j-th dual constraint has slack, then x_j = 0.
Relationship between primal and dual A horizontal axis showing the objective value. A point on the left marked "primal optimum" and a point on the right marked "dual optimum" coincide at the same value. Beneath the axis, a label reads "primal objective is bounded above by dual objective for any feasible pair; the two meet at optimality." objective value cᵀ x* = bᵀ y* primal ≤ cᵀ x* dual ≥ bᵀ y* For any feasible pair: cᵀ x ≤ bᵀ y. At optimality: the two values meet.
Figure 6.5. Weak and strong duality. Any feasible primal objective is bounded above by any feasible dual objective. At optimality, they are equal.

An economic interpretation

The dual has a natural economic interpretation. Consider the primal as a production-planning problem: maximize the value of goods produced, subject to resource constraints. The dual variable y_i is the marginal value of the i-th resource — what one additional unit of that resource would be worth.

Under this interpretation:

  • The dual objective bᵀ y is the total value of the resources if they were priced at their marginal values.
  • The dual constraints state that the value of the resources used in producing one unit of product j must be at least the unit profit c_j. Otherwise, the firm would be undervaluing the resources.
  • Strong duality says that, at optimality, the total value of the resources equals the total value of the products — the decision-maker is indifferent between selling the resources at their marginal values and producing the goods.

5 Worked example

Dual of the production planning LP

Return to the LP from Unit 6.1, Lesson 1:

maximize   40 x_A + 30 x_B
subject to 2 x_A + x_B ≤ 100    (labour)
           x_A + 3 x_B ≤ 90     (material)
           x_A ≤ 40             (demand A)
           x_B ≤ 30             (demand B)
           x_A, x_B ≥ 0

Step 1 — Identify the primal structure.

Primal variables: x_A, x_B (n = 2).
Primal constraints: labour, material, demand A, demand B (m = 4).

Step 2 — Write the dual.

The dual has one variable for each primal constraint: y_L (labour), y_M (material), y_A (demand A), y_B (demand B). The dual has one constraint for each primal variable.

minimize   100 y_L + 90 y_M + 40 y_A + 30 y_B
subject to 2 y_L + y_M + y_A       ≥ 40    (from x_A)
            y_L + 3 y_M     + y_B  ≥ 30    (from x_B)
            y_L, y_M, y_A, y_B ≥ 0

Step 3 — Solve the primal.

From Unit 6.1, the primal optimum is x_A = 40, x_B = 16.67, with cᵀ x* = 40 · 40 + 30 · 16.67 ≈ 2100.

Binding constraints: material and demand A.

Step 4 — Solve the dual by complementary slackness.

By complementary slackness, the constraints that are not binding in the primal correspond to dual variables that are zero:

y_L = 0     (labour is not binding)
y_B = 0     (demand B is not binding)

And the primal variables that are positive correspond to binding dual constraints:

x_A = 40 > 0  ⟹  2 y_L + y_M + y_A = 40
x_B = 16.67 > 0  ⟹  y_L + 3 y_M + y_B = 30

Substituting y_L = y_B = 0:

y_M + y_A = 40
3 y_M = 30  ⟹  y_M = 10
⟹ y_A = 30

So the dual optimum is (y_L, y_M, y_A, y_B) = (0, 10, 30, 0).

Step 5 — Verify strong duality.

Dual objective: 100·0 + 90·10 + 40·30 + 30·0
              = 0 + 900 + 1200 + 0
              = 2100  ✓  equals the primal optimum

Step 6 — Interpret the dual.

  • y_M = 10: one additional kilogram of material would increase profit by $10.
  • y_A = 30: relaxing the demand cap on product A by one unit would increase profit by $30.
  • y_L = 0: labour is not binding; additional labour hours have no value at the current plan.
  • y_B = 0: demand cap B is not binding; relaxing it has no value.

These marginal values are exactly the information a decision-maker needs: is it worth paying to relax a constraint? The dual answers.

6 Verification check

Checks to perform

  • Check dimensions. The dual has m variables (one per primal constraint) and n constraints (one per primal variable).
  • Check the coefficients. The coefficient of y_i in the j-th dual constraint should equal a_{ij} from the primal.
  • Check the objective and RHS. Dual objective coefficients are b_i (primal RHS). Dual constraint bounds are c_j (primal objective).
  • Check the directions. Maximization ↔ minimization; ≤ ↔ ≥. The dual of a ≤ constraint is a nonnegative variable.
  • Verify strong duality numerically. Solve both the primal and the dual and confirm the two objective values agree to within solver tolerance.
  • Verify complementary slackness. Check that each non-binding primal constraint has a zero dual variable, and each positive primal variable corresponds to a binding dual constraint.

7 Interpretation

The dual is the same problem from a different perspective. The primal asks "what should we do?" The dual asks "what is each constraint worth?" For a decision-maker, the second question is often more directly useful, because it identifies which constraints to relax and how much to pay for relaxation.

Three interpretive points:

  • The dual is not an alternative problem. It is the same problem seen from the other side. Its optimum equals the primal's, always.
  • Complementary slackness ties the two together. Only binding primal constraints have positive dual variables. Only positive primal variables correspond to binding dual constraints.
  • The dual variables are the shadow prices. They have a decision-relevant interpretation as marginal values of the constraints. Unit 6.2 Lesson 2 develops this interpretation in depth.

Reporting the dual

A complete report of an LP solution includes the primal optimum, the binding constraints, the dual optimum (shadow prices), and the complementary slackness pattern. The dual information is often more useful to the decision-maker than the primal solution.

8 Uncertainty and limitations

The duality theorem is a mathematical fact. Its application to a decision problem inherits the uncertainties of the model itself.

Limitations of duality as a decision tool
Limitation Effect
Coefficient uncertainty Shadow prices depend on the coefficients; if they are wrong, so are the marginal values
Validity range Shadow prices are valid only within the sensitivity range of the constraint
Model scope The dual is only defined for the LP as specified; if the decision problem changes, so does the dual
Integrality If variables are required to be integers, the dual may not apply in the same form

Shadow prices are local

A shadow price of $10 for material means that one additional unit would be worth $10 — but only within the sensitivity range. Beyond that range, the value of additional material changes and may be lower. Always check the sensitivity range before acting on a shadow price.

9 Common implementation errors

Watch for these

  • Getting the transpose wrong. The coefficient of y_i in the j-th dual constraint is a_{ij}. Transposing incorrectly produces a valid LP that is not the dual.
  • Forgetting nonnegativity. In standard-form primal-dual pairs, all variables are nonnegative. If the primal has equality constraints or free variables, the dual requires special handling.
  • Missing constraints. Every primal variable appears in the dual as a constraint. A common error is to omit the constraint for a variable that was not present in the original formulation.
  • Mixing conventions. Different textbooks present the primal-dual relationship with different sign conventions. Be consistent within a single analysis.
  • Not verifying strong duality. If the primal and dual optimal values disagree, there is an error in the construction. Verify by solving both.
  • Assuming the dual is infeasible because the primal is unbounded. By weak duality, an unbounded primal implies an infeasible dual. But the converse is not automatic.

10 Independent modelling task

Your turn

  1. Take the LP from Unit 6.1's task, or any LP of your choice.
  2. Write the dual. Verify the dimensions, the coefficients, the objective, the RHS, and the directions.
  3. Solve the primal in a spreadsheet. Record the optimal solution, the objective value, and the binding constraints.
  4. Solve the dual in a spreadsheet. Record the optimal dual variables and the dual objective value.
  5. Verify strong duality: the two objective values should agree.
  6. Verify complementary slackness: each non-binding primal constraint should have a zero dual variable.
  7. Interpret the dual variables as shadow prices. What is the marginal value of each constraint?

This exercise forms part of Laboratory 12 and the duality component of Assignment 5.

11 Reflection prompt

Reflect before continuing

A shadow price of zero for a constraint means the constraint is not binding. Does this mean the constraint is unnecessary?

Two or three sentences. Consider the distinction between a constraint being non-binding at the current optimum and the constraint being irrelevant to the problem.

12 Lesson summary

Key takeaways

  • Every LP has a dual. The dual is a minimization problem with one variable per primal constraint and one constraint per primal variable.
  • Weak duality: any feasible primal objective is bounded above by any feasible dual objective.
  • Strong duality: at optimality, primal and dual objective values are equal.
  • Complementary slackness links the two: only binding constraints have positive dual variables; only positive primal variables correspond to binding dual constraints.
  • Dual variables are shadow prices. They give the marginal value of each primal constraint.

Coming next

Lesson 2 develops the interpretation of shadow prices and reduced costs as decision-relevant quantities.

§ Self-quiz, practice, and homework

Self-quiz

Q1

The dual of a maximization LP with m ≤ constraints has:

Show answer

m variables and n constraints.

Q2

Weak duality states that:

Show answer

Primal objective ≤ dual objective for any feasible pair.

Q3

Complementary slackness implies that:

Show answer

A constraint with positive slack has a zero dual variable.

Q4

The dual variables are interpreted as:

Show answer

The marginal values of the primal constraints.

Q5

If the primal is unbounded, the dual is:

Show answer

Infeasible. By weak duality, an unbounded primal implies an infeasible dual.

Practice exercises

  1. Write the dual of: maximize 3x₁ + 2x₂ subject to x₁ + x₂ ≤ 4, 2x₁ + x₂ ≤ 6, x₁, x₂ ≥ 0.
  2. Solve the primal in exercise 1 by enumerating the vertices. Solve the dual by the same method. Verify strong duality.
  3. For the production planning example, verify complementary slackness by checking each constraint and each variable.
  4. Write the dual of: maximize x₁ + 4x₂ subject to 2x₁ + x₂ ≤ 8, x₁ + 3x₂ ≤ 12, x₁, x₂ ≥ 0. Solve both.

Homework problems

  1. Dual construction and verification. Choose an LP with at least three variables and three constraints. Write the dual, verify strong duality numerically, and verify complementary slackness. Report the shadow prices and interpret each in the context of the problem. 500–700 words.
  2. Economic interpretation. For an LP of your choice, write a paragraph interpreting the dual variables as marginal values of the constraints. State what a decision-maker should pay for one additional unit of each binding resource.
  3. Equality constraints. Investigate what happens to the dual when a primal constraint is an equality rather than an inequality. Look up or derive the rule, and demonstrate on a small instance.

Mini project

Take an LP model of a decision problem. Write and solve both the primal and the dual. Verify strong duality and complementary slackness. Produce a one-page report including the primal solution, the dual solution, the shadow prices, and an interpretation of the shadow prices in decision-relevant terms. Submit the report and the spreadsheet. This is part of Laboratory 12 and the duality component of Assignment 5.

👤