Linear programming duality and certificates
Prove global bounds by weighted constraints and distinguish optimality, infeasibility, and unboundedness certificates.
On this page
The question for today
What you’ll understand
- Derive a dual for a maximization LP with nonnegative variables.
- Verify an optimality certificate using primal and dual feasibility.
- Use a precise theorem of alternatives to certify infeasibility.
An optimizer proposes a decision; a certificate explains why no better decision exists. Linear programming duality builds such explanations by taking nonnegative weighted sums of the constraints. The resulting bound is independently checkable with matrix arithmetic, even when finding the proposed solution required a sophisticated algorithm. This separation between search and verification is valuable in scientific computation: a plausible objective value becomes a mathematical conclusion only after the relevant feasibility and bound conditions have been checked.
Construct the upper bound
Consider maximizing subject to and . A nonnegative weight vector gives . If , multiplying that inequality componentwise by also gives . Hence is an upper bound for every primal feasible objective. The dual minimizes this upper bound subject to the two conditions just used. Equality constraints would give unrestricted multipliers; unrestricted primal coordinates would require dual equalities. Signs follow from the bound proof rather than a memorized recipe.
Weak duality requires only feasibility and elementary inequalities. If a primal feasible point and a dual feasible point have equal objective values, both are optimal immediately. If their values differ, the nonnegative gap quantifies how far the primal point could still be from optimality. A small gap is meaningful only when feasibility has also been assessed: two infeasible vectors can have identical objective values. For floating-point results, include residual bounds or exact rational reconstruction when a formal certificate is needed rather than treating a printed gap as self-authenticating.
Strong duality and the alternatives
For a finite-dimensional linear program, if the primal is feasible and has a finite optimal value, an optimal primal solution exists and the dual also has an attained optimum with the same value. Strict feasibility is not required for this LP theorem. An unbounded primal forces dual infeasibility by weak duality. However, primal infeasibility alone does not force dual unboundedness: both programs can be infeasible. Always state which feasible side is known before drawing an implication. Feasibility, finite optimality, and unboundedness are different statuses, not interchangeable failure messages.
A useful exact alternative applies to the equality system , . Either such an exists, or there is a vector with and , but never both. Indeed, simultaneous existence would imply , a contradiction. The existence of a separating certificate when the system is infeasible is Farkas' lemma. Notice that the certificate multiplier is unrestricted in sign here because the original restrictions are equalities. A different primal form needs a correspondingly different certificate.
What certificates establish
An unboundedness certificate needs both a feasible base point and an improving recession direction. In our maximization form, require , , , , and . Then remains feasible while its value grows without limit. A direction alone cannot prove unboundedness if the original region is empty. Likewise, a dual vector certifies a bound only after every dual inequality and sign restriction is verified. These details make certificates short enough to audit without rerunning the optimization algorithm.
With rational input, exact arithmetic can verify a supplied rational certificate using finitely many additions, multiplications, and comparisons. This does not imply that all optimization problems are easy to solve: integer programming can have a strong continuous bound yet a hard combinatorial search. Even within linear programming, the conditioning and encoding size affect numerical algorithms. The dual perspective gives a useful workflow: propose a feasible decision, construct a bound from prices, compare their objectives, and investigate the remaining gap rather than trusting the first solver status line.
Work it through
A two-number proof of optimality
Maximize subject to , , and . Certify .
The proposed point is nonnegative and uses resources and , so it is primal feasible with objective nine.
The dual minimizes with , , and . Choose ; both dual inequalities are equalities.
The dual value is also nine. Alternatively, add the two original resource inequalities to obtain for every feasible decision. Equal primal and dual values close the gap exactly.
The primal point (1,3) and dual prices (1,1) are feasible with equal value nine, establishing global optimality.
The living notebook
Explore the model
Interactive lab · vectors
Inspect coefficients of a weighted bound
Pause and Reset; set angle to 0 degrees and magnitude to 1, then note the projection (1,0). Reset again and set angle to 90 degrees and magnitude to 1, giving (0,1). On paper these are the two unit resource-price vectors; their sum selects one copy of each inequality in the worked certificate.
- x component
- 1.393
- y component
- 0.975
- Magnitude
- 1.7
Playback traces a fixed vector and its projections. Angle and magnitude set the geometry; the moving marker does not change them. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forNonnegative weights combine valid resource bounds. The instrument shows one vector and its projections; it does not draw the primal feasible region, add vectors automatically, or certify dual feasibility.
Pause & reason
Check your understanding
Your turn
Try it yourself
Certify that with is infeasible using the stated equality-form Farkas lemma.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
There is one equality, so its multiplier is a single real number. Seek a negative weighted right-hand side and nonnegative weighted coefficients.
Compare with the solution
Set , , and . Then while . If a feasible vector existed, multiplying its equality by this multiplier would make a nonnegative left-hand side equal a negative number, impossible.
Keep the idea
Take it with you
- Feasible dual prices supply global objective bounds.
- Equal feasible primal and dual values prove optimality without a search history.
- Infeasibility and unboundedness require different certificates and precise sign conventions.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.