Every linear program (the primal) has an associated linear program (the dual) built from the same data.
Consider a primal in standard form, with , an matrix , , . It has variables and constraints.
The dual has variables and constraints. One variable per primal constraint. :
By index:
Same data , rearranged: transposed, and exchanged, objective sense flipped, and the constraint and variable counts swapped ( constraints, variables). The correspondence table lists every swap; the direction rules cover constraints that are not .
Primal-Dual Correspondence
- Objective flips
Maximize primal minimize dual (or vice versa). - Primal constraint dual variable
1 dual variable per primal constraint. - Primal variable dual constraint
1 dual constraint per primal variable. - RHS and objective coefficients swap
Primal RHS becomes dual objective coefficients; primal objective coefficients become dual RHS. - Constraint matrix transposes
Dual constraint coefficients are the transpose of the primal’s.
Constraint Direction Rules
For a maximization primal with non-negative variables:
- Primal constraint dual variable
- Primal constraint dual variable
- Primal constraint dual variable unrestricted in sign
For a minimization primal with non-negative variables, the two inequality rules swap. The equality rule is unchanged.
- Primal constraint dual variable
- Primal constraint dual variable
- Primal constraint dual variable unrestricted in sign
The canonical constraint direction, the one giving a non-negative dual variable, is for a max primal and for a min primal. A deviation from it forces the opposite sign.
The variable-to-constraint mapping mirrors this. A non-negative primal variable gives a dual constraint for a max primal, a dual constraint for a min primal.
Mnemonics
- MOTS
Max flips to Min. Objective coefficients swap with RHS. Transpose . Sizes swap ( constraints give variables, variables give constraints). - Max is under, min is over
The canonical constraint direction is for a max primal, for a min primal. - Same, equal, opposite
Compare a primal constraint to the canonical direction. Same gives dual variable . Equality gives it unrestricted. Opposite gives it . - Same, equal, opposite (variable side)
Take the max primal case, where a non-negative variable gives a dual constraint. A free variable gives an dual constraint. A non-positive variable gives a dual constraint. For a min primal every direction flips. - Pay only for what you use up
A non-binding primal constraint has dual value . A positive dual value forces its primal constraint to bind. See complementary slackness.
Theorems
Weak Duality Theorem
For a maximization primal and its minimization dual, every primal feasible objective value is every dual feasible objective value.
Consequences:
- If the primal is unbounded, the dual is infeasible, and vice versa.
- If a primal feasible and a dual feasible satisfy , both are optimal.
- Dual infeasible does not imply primal unbounded; both problems can be infeasible.
Strong Duality Theorem
If the primal has an optimal solution, the dual also has an optimal solution, and their optimal objective values are equal.
Only four primal-dual outcome pairs are possible:
| Primal | Dual |
|---|---|
| optimal | optimal, equal values |
| unbounded | infeasible |
| infeasible | unbounded |
| infeasible | infeasible |
Complementary Slackness
Primal feasible and dual feasible are both optimal if and only if for every matched pair one side is 0: either a constraint is binding (0 slack/surplus) or its corresponding variable in the other problem is 0, never both non-zero.
Proof sketch: strong duality makes both in the weak duality chain equalities; each gap is a sum of non-negative terms equal to 0, so every term is 0.
Used to recover one problem’s optimal solution directly from the other’s, without re-solving.
Reading Dual Values from the Primal Optimal Table
The optimal dual variable values appear in the primal’s optimal simplex tableau, in the objective row under the columns of the corresponding primal slack/surplus variables (with sign adjusted for the constraint direction).
Each is the shadow price of primal constraint : the rate changes per unit increase of , valid over the range that keeps the current basis optimal.
Worked Example
Primal, the same LP as the simplex worked example:
3 constraints give 3 dual variables ; 2 primal variables give 2 dual constraints. All primal constraints are , so all . Transposing the constraint matrix and swapping RHS with objective coefficients:
The primal’s final tableau has objective row entries under , so , , . Then , confirming strong duality.
Complementary slackness holds at , :
- Primal constraint 1 has slack , so .
- , so primal constraints 2 and 3 are binding: , .
- , so both dual constraints are binding: , .