Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 10

Duality in Linear Programming

Recommended resources

Hello! Welcome to the second lesson in our module on Linear Programming and Duality.

In our last session, we focused on how to translate a problem into a formal linear program and convert it into a standard primal form: a maximization problem with ≤ constraints and non-negative variables. This standardization is the key that unlocks the next concept.

Today, we will explore duality, one of the most fundamental and elegant ideas in optimization theory. Every linear program has a corresponding "shadow" problem called its dual. The relationship between a primal LP and its dual is not just a mathematical curiosity; it has profound theoretical implications and is the central mechanism we will use to prove the Minimax Theorem.

Our goal for this lesson is to learn how to construct the dual program for a given primal LP. We will start by building an intuition for where the dual comes from and then establish the mechanical rules for its construction.

1. An Intuitive Path to the Dual

Before jumping into formal definitions, let's understand why the dual exists. Imagine you have a maximization LP (the primal). You want to find the maximum possible value for your objective function. How could you be certain you've found it? One way is to find an upper bound on that value. The dual problem is, in essence, a systematic way of finding the best possible upper bound.

This video provides an excellent, step-by-step derivation of the dual by exploring this very idea of finding the tightest upper bound on a primal problem's objective value.

Linear Programming (LP) Duality, part 1: Introduction and Physical Interpretation

The following video from the Algorithms Lab channel shows how we can derive the dual problem by taking linear combinations of the primal constraints to form an upper bound on the objective function. The dual LP is then the problem of finding the coefficients for this linear combination that make the upper bound as small as possible.

Please watch the segment from the beginning until 05:43. Pay close attention to how new variables (y1, y2, y3) are introduced as multipliers for the primal constraints, and how the optimization problem for finding the best values of these multipliers naturally becomes a new linear program.

The core idea from the video is that we can multiply our primal constraints by some non-negative values and add them together. This creates a new, valid inequality. By choosing the values cleverly, we can make the left side of this new inequality look like an upper bound for our original objective function. The dual problem is simply the search for the values that make this upper bound as tight (i.e., as small) as possible.


2. The Duality Transformation: Standard Form

This intuitive process leads to a clean, mechanical transformation. Let's start with the standard form we defined in the last lesson. We'll call this the primal program.

Primal (Π)

Its corresponding dual program is constructed as follows:

Dual (⨿)

Notice the beautiful symmetry in this transformation:

  • The maximization in the primal becomes a minimization in the dual.
  • The primal objective coefficients become the right-hand-side vector for the dual's constraints.
  • The primal right-hand-side vector becomes the objective coefficients for the dual.
  • The constraint matrix is transposed to .
  • For each of the constraints in the primal, there is a corresponding dual variable .
  • For each of the variables in the primal, there is a corresponding dual constraint.

The document below provides a concise, formal definition of this relationship.

[PDF] Linear Programming - Jeff Erickson

The following section from Jeff Erickson's notes on algorithms presents the primal-dual relationship in canonical form, which matches our standard form.

Please read the first part of section 'H.4 Linear Programming Duality', stopping at the subheading 'Dualizing Arbitrary LPs'. This section clearly shows the mechanical translation from primal to dual.

A key property highlighted in the reading is that duality is an involution: the dual of the dual is the original primal program. This means the choice of which to call "primal" is arbitrary; they are two sides of the same coin.


3. Duality for General Linear Programs

What if our primal LP is not in standard form? For example, what if it has equality constraints (=) or unrestricted variables? We could first convert it to standard form and then find the dual, but that can be tedious. A more direct method is to use a set of extended transformation rules.

The following video provides a systematic "recipe" for constructing the dual of any LP, regardless of its form.

Linear Programming (LP) Duality, part 1: Introduction and Physical Interpretation

This segment of the Algorithms Lab video presents a complete set of rules for handling different types of constraints (≤, ≥, =) and variables (non-negative, non-positive, unrestricted) when constructing a dual.

Please watch from 15:03 to 20:03. Focus on the correspondence between the type of a primal constraint and the sign of its corresponding dual variable, and vice-versa.

The rules from the video can be summarized in a clear table. This table is your main tool for constructing duals.

Primal-Dual Transformation Rules for Linear Programming
This table shows the correspondence between primal and dual problems. For a maximization primal, each `≤` constraint corresponds to a non-negative (`≥ 0`) dual variable, an `=` constraint to an unrestricted dual variable, and so on. The relationship is symmetric; you can read it from right to left for a minimization primal.

Let's walk through an example to solidify this. Consider the following primal LP:

Primal LP:

Let's construct its dual step-by-step using the rules:

  1. Objective: The primal is max, so the dual will be min. The primal RHS vector is . This becomes the dual objective coefficients.

    • Dual Objective: minimize 10y_1 + 4y_2
  2. Dual Variables: The primal has two constraints, and , so the dual will have two variables, and .

    • Primal constraint is an equality (=). The table tells us the corresponding dual variable, , is unrestricted.
    • Primal constraint is a less-than-or-equal-to (≤). The table tells us the corresponding dual variable, , is non-negative (≥ 0).
  3. Dual Constraints: The primal has two variables, and , so the dual will have two constraints. The primal objective coefficients are , which become the dual RHS. The primal constraint matrix is transposed to .

    • The first dual constraint corresponds to primal variable . Since , this dual constraint will be a greater-than-or-equal-to (≥) type. The coefficients are from the first column of (or first row of ).
      • 1*y_1 + 2*y_2 ≥ 5
    • The second dual constraint corresponds to primal variable . Since is unrestricted, this dual constraint will be an equality (=). The coefficients are from the second column of (or second row of ).
      • 2*y_1 - 1*y_2 = 6

Putting it all together, we get the complete dual LP.

Dual LP:


Conclusion

In this lesson, we demystified the concept of the dual linear program. We saw that it arises naturally from the search for the tightest upper bound on a primal problem's solution, and we established a set of mechanical rules to construct it for any given LP.

Key Takeaways:

  • Every linear program (the primal) has a corresponding dual program.
  • For a standard max primal, the dual is a min problem where the roles of the objective coefficients () and the constraint bounds () are swapped. The constraint matrix is transposed ().
  • There is a precise symmetry between the types of constraints in the primal and the sign restrictions on the variables in the dual, and vice-versa.
  • This relationship allows us to construct the dual for any LP, not just those in standard form.

Preview of the next lesson:

Now that we can construct both a primal and a dual LP, the natural question is: what is the exact relationship between their solutions? In the next lesson, we will state and prove the Weak Duality Theorem. This theorem formalizes the intuition we started with today—that the objective value of any feasible solution to a dual min problem provides an upper bound for the objective value of any feasible solution to its corresponding primal max problem. This is the first major step in connecting LP duality to the Minimax Theorem.