Definition · The dual problemGiven a maximisation max cᵀx subject to Ax ≤ b and x ≥ 0, its dual is the minimisation min bᵀy subject to Aᵀy ≥ c and y ≥ 0. The original programme is called the primal. There is one dual variable for each primal constraint and one dual constraint for each primal variable.
The dual variables are called prices throughout this course, because that is what their units make them: a quantity of objective per unit of right-hand side.
That definition is the clean case, and reading it as a recipe is how the mixed-form cases go wrong. So here is where it comes from, on the workshop programme above: three resources, two products, and the question of how large 3x1 + 5x2 could possibly be.
choose y1, y2, y3 ≥ 0 and multiply each row by its own price:
y1 ( x1 ) ≤ 4y1
y2 ( 2x2 ) ≤ 12y2
y3 ( 3x1 + 2x2 ) ≤ 18y3
-----------------------------------------------------
(y1 + 3y3) x1 + (2y2 + 2y3) x2 ≤ 4y1 + 12y2 + 18y3
the left side is at least 3x1 + 5x2 for every x ≥ 0 exactly when
y1 + 3y3 ≥ 3 2y2 + 2y3 ≥ 5
and then, for every feasible x,
3x1 + 5x2 ≤ 4y1 + 12y2 + 18y3
so the best bound this construction can give is
min 4y1 + 12y2 + 18y3 subject to those two rows, y ≥ 0
Every line of that is forced. y ≥ 0 is needed at the first step, because a negative multiplier would turn each ≤ into a ≥ and the sum would bound nothing. x ≥ 0 is needed at the second step, because (y1 + 3y3)x1 ≥ 3x1 requires x1 not to be negative. And the dual is a minimisation because a bound is only worth having as small as it can be made. The dual is not the transpose of the primal; it is the cheapest certificate the primal admits, and the transpose is what that turns out to look like.
Theorem · The transformation rulesLet the primal be a maximisation. Then each row contributes a price whose sign its direction fixes: a ≤ row gives y ≥ 0, a ≥ row gives y ≤ 0, and an = row gives a y with no sign restriction at all. Each column contributes a dual constraint whose direction its variable's sign fixes: x ≥ 0 gives a ≥ row, x free gives an = row, and x ≤ 0 gives a ≤ row.
If the primal is a minimisation every one of those turns over: now ≥ rows give y ≥ 0, ≤ rows give y ≤ 0, x ≥ 0 gives a ≤ dual row, and the dual is a maximisation.
Each rule is the derivation above run on that shape. A ≥ row in a maximisation is a floor; relaxing a floor cannot improve a maximum, so its price cannot be positive. An = row binds in both directions, so nothing restricts the sign of its price. A free variable can be made negative, so the domination step must hold as an equality rather than as an inequality.
Example · The workshop and its dual, side by sideThe primal reads max 3x1 + 5x2 subject to x1 ≤ 4 (cutting), 2x2 ≤ 12 (glazing), 3x1 + 2x2 ≤ 18 (assembly), x ≥ 0. Its dual reads min 4y1 + 12y2 + 18y3 subject to y1 + 3y3 ≥ 3 (the x1 column), 2y2 + 2y3 ≥ 5 (the x2 column), y ≥ 0.
Read the first dual row aloud: the cutting and assembly capacity that one unit of x1 consumes must be worth at least the 3 that unit earns. That sentence is the dual constraint, and it is why the direction is ≥ rather than ≤.
The three cases that are not the textbook case
A programme with only ≤ rows and only non-negative variables is the one every textbook prints, and it is the one that teaches least, because in it the rules are invisible. The lab ships a preset with a cap, a floor, a quota and a variable free to go negative precisely so that all three of the awkward rules have to be applied at once.
Example · A cap, a floor, a quota and a free variablemax 4u + 3v subject to 2u + v ≤ 10 (capacity), u − v ≥ 1 (balance), u + v = 4 (quota), u ≥ 0 and v free. The dual is min 10y1 + y2 + 4y3 subject to 2y1 + y2 + y3 ≥ 4 (the u column) and y1 − y2 + y3 = 3 (the v column), with y1 ≥ 0, y2 ≤ 0 and y3 free.
Three separate rules did that. The ≥ row turned y2 non-positive, the = row left y3 unrestricted, and the free v turned its dual row into an equality. The lab prints the sentence that fixed each one on the link joining the pair, and the programme solves to z* = 18 at u = 6, v = −2 — a negative variable at the optimum, which is what declaring it free was for.
Take the dual of that dual and the original programme comes back, sign for sign and direction for direction. That is not a special case of the tidy shape: it is a property of the four rules, and it holds on the minimisation, on the floor, on the quota and on the free variable alike. The lab's last control runs the construction twice and reports whether the result agrees with what it started from — and on every preset it does.
Example · A minimisation, where every direction turns overmin 2x + 3y subject to x + y ≥ 4 (protein), x ≤ 3 (supply), y ≥ 1 (oats), x, y ≥ 0 has the dual max 4y1 + 3y2 + y3 subject to y1 + y2 ≤ 2 (the x column) and y1 + y3 ≤ 3 (the y column), with y1 ≥ 0, y2 ≤ 0, y3 ≥ 0.
Everything has flipped and nothing has been memorised. In a minimisation the requirement to be met is the ≥ row, so that is the row with a non-negative price; the ≤ row is now the cap whose relaxation cannot help, so its price is non-positive; and the dual constraints say that what a unit is worth must not exceed what it costs.