Learn
Lesson · Duality and Sensitivity Analysis · The two theorems

Complementary Slackness

At optimality a positive price forces its constraint tight and a positive activity forces its dual constraint tight. Run those implications backwards and a claimed plan determines a candidate set of prices by a small linear system; testing those prices for feasibility certifies the claim or refutes it, with no algorithm run at all. The converse does not hold, and where it fails is where degeneracy first bites.

yᵢ > 0 ⟹ row i tight row i has slack ⟹ yᵢ = 0 xⱼ > 0 ⟹ dual column j tight column j has slack ⟹ xⱼ = 0 claim x = (2, 6): cutting has 2 spare ⟹ y1 = 0 x1 > 0 ⟹ y1 + 3y3 = 3 so y3 = 1 x2 > 0 ⟹ 2y2 + 2y3 = 5 so y2 = 3/2 test y ≥ 0 ✓ and bᵀy = 36 = cᵀx ✓ certified, with no pivot the converse fails: a tight row can be worth exactly nothing
The conditions, run backwards to produce prices

Core ideas

What this lesson establishes

The conditions themselves are two lines. The idea is that they can be read as a system to solve rather than a property to observe.

1

The conditions are what a closed gap forces, term by term

Weak duality's two links are sums of non-negative terms. If the ends are equal then every term in both sums is zero, which means yᵢ and row i's slack are never both positive, and xⱼ and dual column j's gap are never both positive. Complementary slackness is that statement and nothing more.

2

Read backwards, they are a linear system for the prices

Given a claimed plan you know which rows have slack — those prices are zero — and which activities are positive — those dual constraints are equalities. That is m linear equations in m unknowns, usually, and solving it is arithmetic rather than search.

3

Testing the candidate is the whole verdict

If the prices come out feasible for the dual, then the claim and the prices are a feasible pair with equal values, so both are optimal. If any sign or any dual constraint fails, the claim is refuted and the failing constraint is the reason. No pivot is performed either way.

The material

Certifying somebody else's answer, and the converse that does not hold

Where the conditions come from, how to run them backwards, and the two ways the system can fail to settle the question the way you expect.

Definition · Complementary slackness

A primal-feasible x and a dual-feasible y satisfy complementary slackness when, for every row i, either yᵢ = 0 or row i holds with equality; and for every column j, either xⱼ = 0 or dual constraint j holds with equality.

The two halves have names worth keeping apart. A row with slack must be priced at zero; an activity that is used must be exactly worth its ingredients.

Theorem · Complementary slackness characterises optimality

A feasible pair (x, y) is optimal for both programmes if and only if it satisfies complementary slackness.

Weak duality gave cᵀx ≤ yᵀAx ≤ bᵀy. Write the two gaps out: the right one is bᵀy − yᵀAx = yᵀ(b − Ax), a sum of products of a price and its row's slack, and the left one is yᵀAx − cᵀx = (Aᵀy − c)ᵀx, a sum of products of a dual gap and its activity. Feasibility makes every factor in both sums non-negative.

So cᵀx = bᵀy exactly when both sums are zero, which for non-negative terms means every individual product is zero — which is complementary slackness. And by weak duality, cᵀx = bᵀy at a feasible pair is precisely optimality of both.

□

That is the theorem. The use is what makes it worth a lesson: somebody hands you a plan and says it is optimal, and you would like to find out without running the algorithm. The conditions tell you which prices are forced to be zero and which dual constraints are forced to be equalities, and that is usually enough equations to determine y outright.

claim x = (2, 6) is optimal for the workshop rows cutting 2 ≤ 4 slack 2 ⟹ y1 = 0 glazing 12 ≤ 12 tight ⟹ no condition on y2 assembly 18 ≤ 18 tight ⟹ no condition on y3 columns x1 = 2 > 0 ⟹ y1 + 3y3 = 3 x2 = 6 > 0 ⟹ 2y2 + 2y3 = 5 solve y1 = 0, so 3y3 = 3 y3 = 1 2y2 + 2 = 5 y2 = 3/2 test y = (0, 3/2, 1) ≥ 0 ✓ b'y = 4(0) + 12(3/2) + 18(1) = 36 = c'x ✓ verdict certified
Example · A claim that turns out to be right

The system above has three equations — one from the slack row, two from the positive activities — and three unknowns, and it produces the same y the final tableau holds, reached without a single pivot. The lab prints each equation with the sentence that produced it, so that the system is visibly derived rather than assembled.

The three-activity preset is the same exercise with one activity not made. Claim (2, 6, 0): the contract row has 2 spare, so its price is 0; the two positive activities give 2y1 + y2 + y3 = 8 and y1 + y2 = 5; solving gives y = (3, 2, 0), and bᵀy = 46 = cᵀx. The unused third activity contributes no equation at all, and its dual constraint is left to be checked as an inequality: y1 + 2y2 = 7 ≥ 3, which holds with 4 to spare.

A refutation, and the trap inside it

Example · A feasible claim that is not optimal

Claim x = (4, 3) for the workshop. It is feasible: 4 ≤ 4, 6 ≤ 12, 18 ≤ 18. Glazing now has 6 spare, so y2 = 0; both activities are positive, so y1 + 3y3 = 3 and 2y2 + 2y3 = 5. The second gives y3 = 5/2, and then y1 = 3 − 15/2 = −9/2.

The cutting row is a ≤ row in a maximisation, so its price may not be negative. The claim is refuted, and the reason is a specific one that can be stated: no set of prices consistent with this plan is dual feasible, so this plan cannot be optimal.

Now the trap. At that refuted claim, cᵀx = 27 and bᵀy = 27 as well — the two numbers agree. Equal values prove optimality only for a feasible pair, and y = (−9/2, 0, 5/2) is not feasible, so the agreement establishes nothing. The lab prints both numbers side by side on this preset for exactly that reason: the coincidence is what makes the feasibility test look skippable, and it is not.

Where the converse fails

It is tempting to read the conditions in both directions and conclude that a tight row must carry a positive price. That is false, and it fails precisely at a degenerate optimum. The conditions say that a positive price forces tightness; they say nothing at all about a tight row, and at a corner where more rows are tight than there are variables they cannot.

Example · A corner where three rows are tight and only two matter

max x + y subject to x ≤ 2 (kiln), y ≤ 2 (wheel) and x + y ≤ 4 (firing). The optimum is (2, 2) with z* = 4, and all three rows are tight there. No row has slack, so the conditions give only two equations — y1 + y3 = 1 and y2 + y3 = 1 — for three unknowns.

The lab solves that underdetermined system, reports y = (1, 1, 0), and says in as many words that y3 was never pinned down: the conditions left it free and a choice was made. So here is a row that is tight and priced at exactly nothing, and a second set of prices (0, 0, 1) that is equally optimal. Degeneracy in the primal is multiple optima in the dual, and this is the smallest instance of it.

The system can also be contradictory, which is a refutation of a different shape. Claim (1, 1) on the same programme: every row has slack, so all three prices are forced to zero, and both activities are positive, so y1 + y3 = 1 — 0 = 1. There are no prices to test at all, and the lab reports the verdict as such rather than inventing one. An infeasible claim, by contrast, is refused before any of this begins.

Interactive

Certified, or refuted with a reason

the slackness conditions solved for a price vector, and that vector tested

Certifying a claim without solvingslack forces a price to zero, and a positive amount forces a constraint tight
a condition that holdsa condition that failsa price the conditions never pinned down

Method

Testing a claim without solving anything

Feasibility, then the conditions, then the system, then the test. Stop at the first step that fails, and say why.

1

Check the claim is feasible at all

One substitution per row and the sign restrictions. An infeasible claim is refuted here, and going on to solve for prices would be answering a question nobody asked.

2

Write one condition per slack row and one per positive activity

A row with slack forces its price to zero. A strictly positive activity forces its dual constraint to hold with equality. Tight rows and unused activities contribute nothing — that is the asymmetry the converse gets wrong.

3

Solve the system exactly, and say what it left free

Usually it determines y. When it does not — fewer equations than prices, which is what a degenerate corner produces — say so, and record that any choice you then make is a choice rather than a consequence.

4

Test the candidate against every dual constraint and every sign

Certified means: feasible pair, equal values, both points optimal. Refuted means: name the constraint or the sign that failed. Do not let cᵀx = bᵀy stand in for the feasibility test; those two numbers can agree at a refuted claim.

Certify, refute, or neither

Score 0 / 0

Two claims about the workshop, one certified and one refuted

Both claims are feasible and both produce a full set of prices. The difference is one sign, and the second half is written out because the numbers there conspire to look like a proof.

workshop max 3x1 + 5x2 cutting x1 ≤ 4 glazing 2x2 ≤ 12 assembly 3x1+2x2 ≤ 18 dual rows x1 column y1 + 3y3 ≥ 3 x2 column 2y2 + 2y3 ≥ 5 y ≥ 0 CLAIM A x = (2, 6) rows cutting 2 vs 4 slack 2 ⟹ y1 = 0 glazing 12 vs 12 tight ⟹ − assembly 18 vs 18 tight ⟹ − columns x1 = 2 > 0 ⟹ y1 + 3y3 = 3 x2 = 6 > 0 ⟹ 2y2 + 2y3 = 5 solve y1 = 0 → 3y3 = 3 → y3 = 1 → 2y2 = 3 → y2 = 3/2 test y = (0, 3/2, 1) ≥ 0 ✓ c'x = 36 b'y = 0 + 18 + 18 = 36 equal VERDICT certified: both points optimal, no pivot run CLAIM B x = (4, 3) feasible? 4 ≤ 4 ✓ 6 ≤ 12 ✓ 18 ≤ 18 ✓ yes rows cutting 4 vs 4 tight ⟹ − glazing 6 vs 12 slack 6 ⟹ y2 = 0 assembly 18 vs 18 tight ⟹ − columns x1 = 4 > 0 ⟹ y1 + 3y3 = 3 x2 = 3 > 0 ⟹ 2y2 + 2y3 = 5 solve y2 = 0 → 2y3 = 5 → y3 = 5/2 y1 = 3 − 3(5/2) = 3 − 15/2 = −9/2 test y1 = −9/2, and a ≤ row in a maximisation may not be priced below zero ✗ and yet c'x = 3(4) + 5(3) = 27 b'y = 4(−9/2) + 12(0) + 18(5/2) = −18 + 45 = 27 the two values AGREE, and prove nothing VERDICT refuted: no feasible prices accompany this plan

Claim B is the one to remember. Its two values agree to the last fraction, and the pair is still not optimal, because equal values prove optimality only when both points are feasible. Reading 27 = 27 as a certificate is the error the feasibility test exists to prevent, and the true optimum is 36.

For a faded rehearsal, claim (2, 2) on the degenerate programme max x + y subject to x ≤ 2, y ≤ 2, x + y ≤ 4. The supplied observation is that no row has slack, so the conditions give you two equations and not three. Write them, say what is left undetermined, choose a value, and check that your choice is dual feasible. Then find a second, different set of optimal prices for the same plan.

Then claim (1, 1) on that same programme and watch the conditions contradict each other: every row slack forces every price to zero, and a positive activity then asks for 0 = 1. There is nothing to test, and the honest verdict is that no prices can accompany the claim.

Common mistakes

1
Reading the converse: a tight constraint must have a positive priceThe conditions say a positive price forces tightness. The reverse fails at every degenerate optimum, where more rows are tight than there are variables and at least one of them must be priced at zero. The lab ships that instance on purpose. A reader who has only ever seen the conditions behave will assert the converse for years, and it will be wrong every time a corner is over-determined.
2
Letting equal values stand in for the feasibility testcᵀx = bᵀy proves optimality only when both points are feasible, and at the refuted claim (4, 3) both numbers come out 27. The candidate prices produced by the conditions are candidates: their signs and their dual constraints have to be checked before the agreement means anything.
3
Writing a condition for a tight row or an unused activityOnly slack rows and positive activities generate conditions. Adding an equation for every tight row over-determines the system and produces a contradiction that looks like a refutation; adding one for an activity that is zero asserts something the theorem never claimed. Count the conditions before solving: slack rows plus positive activities, and nothing else.

Check your understanding

✓
Finish when you can certify or refute a claimed optimum in writing, with no algorithm run and no step left implicit.

You should be able to check a claim for feasibility, write exactly one condition per slack row and per positive activity, solve for y, test every sign and every dual constraint, and state the verdict — including the two verdicts that are neither a clean certificate nor a clean refutation: an undetermined price at a degenerate corner, and a contradictory system with no prices at all.

Note: Do this lesson on the degenerate instance as well as on the clean one. Complementary slackness is where degeneracy first bites, and it bites twice: a tight row can be priced at nothing, and the conditions can leave a price undetermined so that the answer you get depends on a choice you made. Both show up again in the next lesson, where a degenerate corner also makes a right-hand-side range collapse against one of its ends.

Kept in this browser only, for you. Nothing is sent anywhere and nothing checks it. Carry it to another device.

Feedback and recommendations

Something to change about this lesson? Write it down, tick it off when it is handled, and export the list when you want to act on it. Kept in this browser only: nothing is sent anywhere, and nobody is notified.

No recommendations yet for this lesson.