Hexa Scholar

LP duality: what can you prove about the cheapest plan?

Side-by-side crates holding rolled blankets and water canisters in different proportions.
The two packing options supply blankets and water in different proportions.

The question

How can prices for blankets and water certify the lowest cost of filling an order?

  1. 1 SeeSet prices and close the gap.
  2. 2 TryPredict what extra supplies change.
  3. 3 ProveBuild the duality proof line by line.
  4. 4 ApplyCheck bounds and certify costs.
Before you start · 3 quick checks on weighted totals, inequalities, and transposing a table

Two ideas before you start

2 ideas

A purchase plan must fill the order

Two bars show the quantities delivered. Marks show the minimum requirements.

Switch plans and compare the end of each bar with its requirement mark. A plan must meet both requirements.

Exact definition

The original problem, or primal, minimizes \(c^\top x\) over \(x\ge0\) with \(Ax\ge b\). The vector \(x\) lists crate amounts, \(c\) lists crate costs, \(A\) lists the supplies in each crate, and \(b\) lists required quantities. Row \(i\) of \(A\) describes one supply. Column \(j\) describes one type of crate. Vector inequalities compare matching coordinates.

A set of prices must pass the crate tests

A bar shows the value assigned to one crate’s contents. The mark shows its cost.

Value each crate’s contents using your chosen prices. Each assigned value must stay at or below its crate cost.

Exact definition

The dual maximizes \(b^\top y\) over \(y\ge0\) with \(A^\top y\le c\). The vector \(y\) lists dollars per unit of each supply. The transpose \(A^\top\) turns each original column into a row, so the \(j\)-th coordinate of \(A^\top y\) prices the contents of crate \(j\). The dual objective prices the required quantities at those same rates.

Fine print on what the model counts

Crate amounts can be any nonnegative real numbers. Buying a fraction of a crate gives that fraction of its supplies and costs that fraction of its price. Supplies add across crates, costs are fixed, and extra supplies are allowed. The game uses whole-dollar price inputs. The mathematical dual allows any nonnegative real prices that pass the crate tests.

A superscript \(\top\) indicates a transpose. A vector product such as \(c^\top x\) adds matching products. A table product such as \(Ax\) does that calculation once per row. The same notation covers more than the supplies and crates pictured here.

1 See

Raise the lower bound

How the page checks your prices

Pricing all supplies in a feasible purchase plan gives at least the value assigned to the order, because prices are nonnegative and the plan fills the order. That same total is at most the purchase cost, because each crate passed its price test. The order value is therefore a lower bound on the cost of any feasible plan.

The two quantities shown by the page come from different choices. Prices give the bound. A purchase plan gives a cost. The gap is the least feasible cost minus your bound, so it is shown only for a price pair that passes both tests. When a bound and a feasible cost agree, each side certifies the other.

2 Try

What changes when the order changes?

Consider a new order and new crate costs. Suppose a feasible plan and a feasible set of prices already agree in value. The plan delivers more blankets than the order requires.

3 Prove

Why the bound holds and when it is exact

Weak and strong LP duality

Let \(A\) be a real matrix with finitely many rows and columns, and let \(b,c\) be real vectors of matching sizes. Use the primal and dual forms from Start. Weak duality says \(b^\top y\le c^\top x\) for any feasible pair. Strong duality says that if the primal is feasible and its cost is bounded below by a finite number, both optima are attained and their values agree.

Build the weak bound first. Then use separation to show why bounds can get arbitrarily close to the primal optimum.

Proof setup for the separation steps

Form the set \(C\) of pairs \((u,v)\) that admit some \(x\ge0\) with \(Ax\ge u\) and \(c^\top x\le v\). Write \(u=Ax-s\) and \(v=c^\top x+t\) with \(s,t\ge0\). The set is a cone, meaning it is closed under nonnegative linear combinations. Its generators are the crate columns paired with their costs, the vectors \((-e_i,0)\) for unit coordinate vectors \(e_i\), and \((0,1)\), the cost direction. The proof uses ordinary vector algebra here, without assuming that \(A,b,c\) have positive entries.

A cone generated by finitely many vectors is closed. Each conic combination can be reduced to an independent set of generators. If the generators with positive coefficients are dependent, take a dependence with at least one positive coefficient. Subtract the largest multiple of it that keeps every coefficient nonnegative. At least one coefficient becomes zero, and that generator drops out. Repeat. Each independent set generates a closed cone because coordinates in its span are continuous. Finitely many of those closed cones cover \(C\), including the origin from the empty set.

Let \(p\) be the finite infimum of feasible cost. By closedness, \((b,p)\in C\), since there are feasible costs approaching \(p\). So some \(x\ge0\) has \(Ax\ge b\) and \(c^\top x\le p\), which means the primal optimum \(p\) is attained. For any \(\varepsilon\gt0\), \((b,p-\varepsilon)\) lies outside \(C\). The separating hyperplane theorem gives a linear functional \(\ell(u,v)=-z^\top u+\gamma v\) strictly smaller there than on \(C\). In particular its value there is negative, since \(0\in C\). Its value is nonnegative throughout \(C\), since a negative value in the cone could be scaled arbitrarily far below the separating level.

4 Apply

Check prices, then use them as certificates

Each order below uses the same crate mixes and gives its own purchase costs. Treat amounts as divisible and costs as linear. Use dollars unless the question asks for another unit.

Key point Check feasibility on each side before comparing values. An agreed value certifies optimality. When the gap is positive, one proposal or both can improve.
Level Undergraduate Prerequisites Linear inequalities, dot products, and transposes Time About minutes

Further reading