Learning Outcomes
You will learn
How to derive a bound on the optimal objective value
How to reformulate the problem into a dual with a different interpretation
Correspondence between the primal (original) and dual problems
Try it out visually!
Primal-to-Dual Construction: build the dual one multiplier at a time, exactly as in this chapter.
Duality and Sensitivity Explorer: the primal, the dual, and the shadow prices, live.
Dual Simplex Method: a further topic to explore after this chapter.
A rival baker knocks on your door with an offer: “Don’t bake tomorrow. Sell me your whole pantry (every unit of flour and sugar) and take the day off.” You would only accept if the payment beats every plan you could bake yourself, so the rival must price each ingredient carefully: the ingredients that go into one cake must fetch at least a cake’s profit, and likewise for cookies; otherwise you would simply say no and bake. The rival, of course, wants the cheapest offer that convinces you. That cheapest convincing offer turns out to equal your best baking profit exactly. Finding the rival’s prices is a linear program too: the dual of yours.
Imagine you run a small bakery that makes two products: cakes () and cookies (). Your goal is to maximize your daily profit. Cakes yield a profit of $3 each, and cookies yield $2 each. You are limited by the ingredients you have on hand: you have at most 4 units of flour and 5 units of sugar available each day. Each cake requires 1 unit of flour and 2 units of sugar, while each cookie requires 1 unit of flour and 1 unit of sugar. We can write this scenario as a linear program:
Here, is the number of cakes you bake, and is the number of cookies. The constraints limit how many of each product you can produce given your resources.
Now, suppose a friend is not sure that you are telling the truth about the maximum profit you can make. They ask, “Can you prove an upper bound on how much money you could possibly earn with these ingredient constraints, without actually solving the problem?”
Consider the constraints in the problem. Each one puts a cap on how large the combination of and can be. If we think of them separately:
The flour constraint: .
The sugar constraint: .
Now, what if we take some nonnegative multipliers and and combine these inequalities into one single inequality? For instance, multiply the flour constraint by and the sugar constraint by and add them up:
Grouping the terms by and gives:
If we choose and cleverly, we can force the left-hand side to be an expression that is always at least as large as our profit function . Specifically, we want
Why? Because if the coefficients on and in our combined inequality dominate those in our profit function, then the upper bound on the combined inequality’s right-hand side () will also serve as an upper bound on the profit . This ensures:
Thus, by choosing and , we obtain a valid upper bound on the maximum profit. If we try to minimize over all that satisfy these inequalities, we find the best (smallest) upper bound on our original problem.
The whole argument is a pipeline: it starts from the constraints you already have and ends at a new optimization problem. Figure 11.1 summarizes it. The key step is the last one: searching for the best certificate is itself a linear program.
Learning Checkpoint 11.1.1
In the bakery problem, take multipliers and . Verify that this choice satisfies both dominance conditions, and compute the resulting upper bound on profit. Then compare it with the bound from . Which certificate is better? Can you find one better still?
We started with the primal problem in a general form:
Each constraint (where is the -th row of ) is valid for all feasible . If we take a nonnegative combination of these constraints, say with multipliers , we get:
This can be written as:
If we choose such that , then for all feasible (since ):
So, is an upper bound on the maximum primal objective value. By minimizing over all such , we seek the tightest upper bound:
This is the dual problem. In our bakery scenario, this dual formulation corresponds to adjusting the prices (the values can be thought of as “shadow prices”) you would assign to each ingredient such that if you charge yourself for using these ingredients at these shadow prices, you end up with the smallest possible “bill” that still always surpasses or equals your maximum possible profit. The Strong Duality Theorem ensures that the optimal primal value equals the optimal dual value. This is precisely the rival baker’s problem from the start of the chapter: the constraints say the offer must beat baking, product by product, and the objective is the rival shopping for the cheapest offer that still convinces you.
From the above reasoning, we have shown that if is feasible for the primal and is feasible for the dual, then . In other words, the value of any feasible primal solution is always bounded above by the value of any feasible dual solution. This inequality is called weak duality; we state it as a theorem in the next section.
Weak duality is not specific to linear programming; the same kind of bound appears in many other classes of optimization problems. In the special case of linear programs (and certain other problem classes), we can say even more: there exist optimal solutions for both problems whose objective values match. This result is known as the Strong Duality Theorem.
Learning Outcomes
Learn the two most important theorems in Linear Programming!!!
Consider the following pair of linear programs, known as a primal-dual pair. The primal problem (P) has decision variables and constraints, while the dual problem (D) has decision variables and constraints.
auto
From weak duality, we know that for any feasible in (P) and any feasible in (D), it holds that:
This indicates that the optimal value of the dual problem is always an upper bound on the optimal value of the primal problem.
Theorem 11.1: Weak Duality
For any feasible solution of the primal problem (P) and any feasible solution of the dual problem (D),
Weak duality theorems appear in many classes of optimization problems. In the special case of linear programs (and some other structured problems), we also have a stronger result, known as the Strong Duality Theorem. This theorem completely characterizes the relationship between the primal and dual solutions:
Theorem 11.2: Strong Duality
For a primal-dual pair of linear programs:
the following cases hold:
Example 11.3: Dual Infeasibility from Primal Unboundedness
Consider the following linear program:
As shown in Example 7.18, this primal problem is unbounded. After applying the simplex method, we found that when enters the basis, there is no constraint preventing it from growing indefinitely, and the objective increases without bound. Therefore, the primal is unbounded.
Now, consider the dual of this problem:
To determine the status of the dual, we apply the simplex method using the Big-M technique to initialize feasibility. The auxiliary variable is introduced to handle the infeasibility of the initial basic solution.
First dictionary (with Big-M penalty):
Setup: price out (not a pivot). At the first equation gives , which is infeasible. We instead make basic: solve the first equation for and substitute it into the objective. This is a rewriting of the same system, not a simplex pivot; it produces a feasible starting dictionary whose objective row carries the Big-M penalty.
Second dictionary:
Pivot: Enter , leave . The coefficient of in the objective is positive, and the ratio test selects (a degenerate pivot: enters at value ).
Final dictionary:
In this final dictionary, all variables in the objective function have non-positive coefficients, but the artificial variable remains in the basis with a positive value. Since at termination, we conclude that the original dual problem is infeasible.
Conclusion via Strong Duality: This is exactly what strong duality predicts: because the primal problem is unbounded, the dual must be infeasible, and the Big-M computation confirms it directly.
Duality in linear programming has a natural economic interpretation: the dual variables represent the value of resources or constraints in the primal problem. These values are commonly known as shadow prices.
Definition 11.4: Shadow Price
The shadow price of a constraint in a linear program tells us how much the optimal objective value would change if we slightly increased the right-hand side of that constraint by one unit, while keeping everything else fixed.
In a maximization problem, a shadow price represents the increase in value per additional unit of a scarce resource. In a minimization problem, it represents the decrease in cost.
Interpretation: If a constraint represents the availability of a resource (e.g., time, material), then its shadow price reflects the marginal value of that resource: how much the objective would improve if you had one more unit of it.
Mathematically: If the constraint has corresponding dual variable , then:
where is the optimal value of the objective function.
Units and Interpretation: The units of a shadow price match the units of the objective function (e.g., dollars of profit) per unit of the resource (e.g., kilograms of flour, hours of labor). If in the bakery example, and the constraint corresponds to sugar (in kg), then each additional kg of sugar would allow the bakery to increase profit by $50.
Example 11.5: The Bakery Revisited
Consider the primal problem:
The dual problem is:
If the optimal dual solution is , then:
The shadow price of flour is 1: each extra unit of flour increases profit by $1.
The shadow price of sugar is 1: each extra unit of sugar increases profit by $1.
We can now close the loop with the running example of Chapters 7–10. Its primal and dual are:
In Chapter 10 we computed the shadow prices of this problem from the final dictionary: $1 per hour, $0 per unit of flour, $1 per unit of sugar. Try that vector, , in the dual. It is feasible (the first constraint gives and the second gives , both tight), and its objective value is
exactly the optimal primal profit. By weak duality no dual solution can do better, so the shadow prices are the optimal dual solution. Note also that flour, the resource with slack at the optimum (), is precisely the one priced at zero, a pattern we will formalize as complementary slackness.
You can experiment with this yourself: drag the multipliers on the three constraints in the Desmos duality explorer (backup interactive plot) and watch the combined inequality sweep across the feasible region. Every valid combination of multipliers gives an upper bound on the profit, and the best one touches the optimal vertex.
Example 11.6: A Larger Example: Bakery 2.0
The primal problem describes a bakery optimizing the production of cakes, cookies, and muffins to maximize profit. The constraints represent limited resources: flour, sugar, and baking time. The dual problem attaches a shadow price to each of these resources, reflecting their marginal value.
Primal Problem:
Optimal Primal Solution:
Dual Problem:
Optimal Dual Solution:
: The shadow price of flour is $0. This implies the flour constraint is non-binding: the bakery is not using all 40 kg of flour. Increasing flour supply would not increase profit.
: The shadow price of sugar is $50. Each additional kilogram of sugar allows the bakery to increase profit by $50. The sugar constraint is binding.
: The shadow price of baking time is $40 per hour. Baking time is fully used and limits production. Gaining one more hour would allow an increase in profit by $40.
From the primal solution:
The flour constraint is not tight
The sugar constraint is tight
The baking time constraint is tight
These relationships satisfy the complementary slackness conditions:
Sensitivity Analysis: Marginal Value of Resources Assuming the current basis remains optimal, the increase in maximum profit from one additional unit of:
Flour = $0
Sugar = $50
Baking Time = $40
The dual solution not only validates the primal objective value (via strong duality), but also assigns economic meaning to each constraint. Shadow prices tell you how much you would be willing to pay for more of each resource, a foundational concept in operations, pricing, and planning.
When Are Shadow Prices Meaningful? Shadow prices are meaningful only when:
The constraint is binding (i.e., tight) at the optimal solution.
The problem satisfies strong duality (which always holds for feasible and bounded linear programs).
The right-hand side is perturbed slightly (local sensitivity).
If a constraint is not tight, then its shadow price is 0: the resource is not limiting the optimal solution.
Connection to the Dual Problem: In the dual problem:
The objective function is the total value of resources, priced at shadow prices.
The constraints ensure that no activity in the primal makes more profit than it costs, when inputs are valued at shadow prices.
This ensures equilibrium: no profitable arbitrage is possible, and every unit of constrained resource is priced at its true marginal value.
Summary of Shadow Price Properties:
A shadow price represents how much you would pay for an extra unit of a constrained resource.
It is equal to the dual variable corresponding to the constraint.
It reflects the marginal value of relaxing that constraint.
Shadow prices are only nonzero for binding constraints.
If a resource is fully used and limits optimality, its shadow price is positive.
If a resource is unused or abundant, its shadow price is zero.
The form of a dual problem depends on the primal’s objective (maximize or minimize), inequality directions, and sign constraints on variables. Rather than memorizing a separate rule for every combination, it helps to see a few representative primal–dual pairs side by side and notice the pattern: constraint types in one problem control variable signs in the other, and vice versa. We walk through four common cases below.
Case 1: Maximization with constraints (standard form). When the primal constraints are equalities, we may combine them with multipliers of any sign, so the dual variables come out free. This is the form produced by adding slack variables, so it is the version most often seen inside the simplex method.
auto
Case 2: Minimization with constraints. Duality is symmetric: a minimization primal produces a maximization dual, and the roles of and swap. Note how the direction of the constraints and the sign restrictions mirror the maximization case.
auto
Case 3: Free variables in the primal. If a primal variable is free, we lose the ability to relax its coefficient: the bound argument only works when the dual coefficients match the objective exactly. Free primal variables therefore force equality constraints in the dual.
auto
Case 4: Sign variations in primal variables and constraints. The remaining variations all follow from the same bounding logic. Each rule below can be checked by asking: what must be true of the multipliers for the combined constraint to bound the objective?
If a primal variable is unrestricted (free), the corresponding dual constraint is an equality.
If , the dual constraint becomes instead of .
If a primal constraint is changed to , then the sign constraint on the corresponding dual variable flips.
This shows how each component in the primal affects the dual, in particular how inequality direction and sign restrictions control the dual variable domain and constraint form.
As you can see, changing the primal’s constraints and variable domains changes the structure of the dual problem. Every such transformation has a corresponding primal-dual pair that maintains the duality principles. In each case, the weak and strong duality theorems still apply.
Learning Checkpoint 11.3.1
Without writing out a full derivation, predict the form of the dual of
Is the dual a maximization or minimization? Are the dual variables sign-restricted or free? Are the dual constraints inequalities or equalities?
Let us now consider a variation of our previous derivation of the dual problem. This time, our primal problem (P) will have equality constraints rather than inequalities, and all variables will remain nonnegative. For example, consider the following linear program with equality constraints and variables:
In matrix form, if we let
our primal problem is:
Previously, when we had inequalities, we formed upper bounds on the objective by taking nonnegative linear combinations of the constraints. Now, since we have equalities, we are free to choose any real multipliers for these constraints (positive, negative, or zero), and the resulting combination will still hold as an equality. This is because any scalar multiple of an equation remains a valid equation.
Let and be arbitrary real numbers, and form the linear combination:
Adding these together gives:
Collecting terms by variable:
Since , if we want the left-hand side to serve as an upper bound on our objective function for all feasible , we need the coefficients of each in the combined inequality to dominate those in the objective. Specifically, we want:
If these inequalities hold, then for every feasible :
Thus, is an upper bound on the maximal value of . Since and are unrestricted in sign, we can try to minimize subject to ensuring these dominance conditions.
In the general setting with equality constraints and nonnegative primal variables, the dual variables associated with these equality constraints are free (they can be positive, negative, or zero). The process we followed above leads us to the dual problem:
subject to the condition that , i.e.:
In our numeric example, minimizing subject to these four inequalities gives the optimal dual solution with value ; the constraints coming from and are tight there, while the other two hold with strict inequality. More generally, the dual problem corresponding to
is
The absence of sign restrictions on is a direct consequence of using equalities in the primal. Since no direction of inequality is fixed, you are free to “add” or “subtract” the given equations as you please, hence no sign constraints emerge on the dual variables.
Example 11.7: Example with Inequalities and Free Variables
Now consider a primal problem with three inequality constraints and two free variables. Suppose:
auto
Here, and can be positive or negative.
We can write this in a compact matrix form. Let:
Then (P) is:
To create a bound on , we take nonnegative combinations of the constraints. Let be the multipliers for the three constraints:
Combining like terms in and :
We want this inequality to hold for all free. If , then by choosing large and positive, we could make the left side arbitrarily large, violating the bound. If , by choosing large and negative, we break the bound. The only way to always hold the inequality is to have exact equality:
Similarly, for :
If , we could send to to break the bound. If , we could send to . Again, the only safe choice is equality:
Thus, the dual constraints must be equalities. The dual problem is:
From our derivation, the dual problem (D) becomes:
subject to:
and
Summarizing, we have
auto
Here we see the pattern: having free in the primal forces the dual constraints to be equalities. In summary:
Primal inequalities with free Dual equality constraints.
Primal equalities with Dual inequalities and free.
These relationships ensure that by choosing appropriate dual multipliers, we can always create a valid bound on the primal objective.
The following table can help remember the above.
| Primal (min) | Dual (max) |
| constraint | variable |
| constraint | variable |
| constraint | variable |
| variable | constraint |
| variable | constraint |
| variable | constraint |
Consider the following primal linear program:
auto
Let , , be dual variables for constraints (1), (2), and (3), respectively.
To derive the dual, we introduce a dual variable for each constraint:
Let be the dual variable for the equality constraint
Let be the dual variable for the constraint
Let be the dual variable for the constraint
Explanation of Dual Structure:
The primal has one equality constraint. Therefore, the corresponding dual variable is unrestricted in sign.
The second primal constraint is a inequality in a maximization problem, so its corresponding dual variable must be : only a nonpositive multiplier turns a constraint into a valid ingredient of an upper bound.
The third primal constraint is a inequality, so its corresponding dual variable must be .
The dual constraints come from the coefficients of the primal variables. Since the primal is a maximization, the dual constraints are .
The dual objective coefficients come from the right-hand sides of the primal constraints: .
Summary: This example demonstrates how mixed constraint types in the primal () lead to a dual with mixed variable sign restrictions. The primal variable bounds also affect whether dual constraints are inequalities or equalities. You need these mappings to construct dual problems correctly.
(A side note: this particular primal happens to be infeasible. Constraints (1) and (2) force , while constraints (1) and (3) force . The construction of the dual is purely syntactic and does not depend on feasibility; consistent with Theorem 11.2, the dual above turns out to be unbounded.)
Consider the following primal linear program:
We now derive the dual using the aggregation method.
Step 1: Multiply constraints by dual variables.
We introduce dual variables corresponding to constraints 1, 2, and 3, respectively.
We aggregate the constraints by forming a linear combination:
Before combining, we must ensure every term contributes a valid inequality, because we’re maximizing in the primal and want an upper bound. So:
- Equality constraint: any multiplier is fine, so - constraint: multiply by (a nonpositive multiplier flips to ) - constraint: multiply by (a nonnegative multiplier preserves )
Now aggregate:
And the aggregated right-hand side is:
So the aggregated constraint is:
Step 2: Ensure this constraint dominates the primal objective.
To upper-bound the primal objective , we want:
Since , domination in the coordinate means the aggregated coefficient must be at least . Since is free, its aggregated coefficient must match the objective coefficient exactly (otherwise a large positive or negative breaks the bound):
Step 3: Formulate the dual.
The dual objective is the right-hand side of the aggregated constraint:
With constraints:
Conclusion:
This derivation shows how:
Constraint direction in the primal determines the sign of the corresponding dual variable.
Sign of a primal variable (e.g., ) determines the direction of the dual constraint: to ensure domination for non-negative variables, we require the dual combination to be the primal coefficients.
The dual objective comes from aggregating the right-hand sides, weighted by the dual variables.
This example illustrates how careful sign and inequality management gives rise to a valid dual that bounds the primal objective from above.
Question: What happens if variable instead was constrained as ?
Exercise 11.8: The Dual of a Small Bakery
A bakery sells loaves (, profit $5 each) and rolls (, profit $4 each), using at most 12 units of flour and 5 units of sugar:
[§11.1]
Exercise 11.9: Formulate the Dual
Write the dual of the following linear program:
Exercise 11.10: Verifying Weak Duality
For the bakery problem of §11.1,
with dual s.t. , , , consider the points and .
Exercise 11.11: Weak Duality Bound
Consider the primal LP:
Exercise 11.12: Dual with Mixed Constraints
Formulate the dual of the following LP:
Identify the sign restrictions on each dual variable and whether each dual constraint is an inequality or an equality.
[§11.3]
Exercise 11.13: Shadow Prices and Dual Variables
A bakery solves the following LP:
The optimal primal solution is with . The optimal dual solution is .
Exercise 11.14: Certificates in Your Own Words
Figure 11.1 describes every dual feasible solution as a certificate.
[Figure 11.1, §11.1, Theorem 11.2]
Exercise 11.15: Strong Duality and Infeasibility
Consider the primal LP:
Exercise 11.16: The Dual of the Dual is the Primal
Consider the symmetric primal-dual pair
Prove that the dual of (D) is again (P). (Hint: first rewrite (D) as a maximization problem in the same symmetric form, with a new objective vector, constraint matrix, and right-hand side; then apply the definition of the dual to that problem and simplify.)
Solution
(Exercise 11.9) There are two constraints, so the dual has two variables , one per constraint. Each of the three primal variables produces a dual constraint whose right-hand side is that variable’s objective coefficient:
Solution
(Exercise 11.11) The dual is subject to , , . For : and , so is dual feasible with objective . For : and , so is primal feasible with objective . By weak duality, every primal value is at most every dual value, so the optimal value satisfies . Since the two bounds coincide, both solutions are in fact optimal and .
Solution
(Exercise 11.16) Rewrite (D) in symmetric maximization form. Minimizing is the same as maximizing , and the constraints are equivalent to . So (D) is
which is the symmetric form with objective vector , matrix , and right-hand side . Its dual, by definition, is
that is, subject to , . Multiplying the objective and the constraints by turns this into
which is exactly (P) with in place of . Hence the dual of the dual is the primal.
So far, we have established that the primal and dual problems are closely linked, and their optimal objective values coincide under strong duality. However, how can we identify optimal solutions for both problems simultaneously? The answer lies in complementary slackness, the condition we use to verify optimality.
Definition 11.17: Complementary Slackness
Complementary slackness conditions state that if and are optimal solutions for the primal and dual problems, then the following must hold:
Equivalently,
Equivalently,
Together, these conditions ensure that at optimality, only the active constraints have positive dual variables, and only the active dual constraints have positive primal variables.
Theorem 11.18: Primal Dual Optimality
A primal solution and a dual solution are optimal if and only if:
This set of conditions allows us to efficiently check whether a given solution is optimal without needing to compare all feasible solutions explicitly.
Complementary slackness provides a way to determine which constraints are binding at the optimal solution. If we solve either the primal or the dual problem, we can use these conditions to deduce the optimal solution of the other problem.
Example 11.19: The Bakery Problem Revisited
Consider the bakery problem from the previous section. Recall the primal and dual formulations:
Primal Problem:
Dual Problem:
Suppose we are given the optimal solutions:
To verify optimality, we check complementary slackness:
Since complementary slackness holds, the given values are indeed optimal solutions.
Often, we do not have full information about an optimal solution. Instead, we might have partial information or only one of the optimal solutions (primal or dual). Complementary slackness allows us to deduce missing information.
Example 11.20: Finding Missing Dual Variables
Suppose we solve the primal problem and find the optimal solution:
Using complementary slackness, we determine :
, so we must have the first dual constraint tight, so .
, so we must have the second dual constraint tight, so .
Solving the system:
Solving for and gives .
Thus, complementary slackness allowed us to determine the dual solution directly from the primal solution.
Complementary slackness characterizes optimality in primal-dual pairs.
If a primal constraint is not tight, the corresponding dual variable is zero.
If a dual constraint is not tight, the corresponding primal variable is zero.
These conditions allow us to find missing solutions and verify optimality efficiently.
Learning Checkpoint 11.5.1
At an optimal solution of the bakery problem, suppose two units of flour are left over (the flour constraint is not tight). What does complementary slackness say about the shadow price of flour? Explain in one sentence why this makes economic sense.
Example 11.21: Verifying Optimality with Complementary Slackness
We are given the primal and dual optimal solutions:
Primal:
Dual:
We will verify that these satisfy complementary slackness.
Step 1: Check tightness of primal constraints
Flour: . This is strictly less than 40, so the constraint is not tight corresponding dual variable .
Sugar: . Tight can be positive.
Baking Time: . Tight can be positive.
Step 2: Check tightness of dual constraints where
: The corresponding dual constraint must be tight:
: No condition required.
: The dual constraint for muffins must be tight:
Since all complementary slackness conditions are satisfied, both solutions are optimal and duality holds (objective values match at 780).
Example 11.22: Recovering Dual Variables via Complementary Slackness
Suppose we only know the optimal primal solution:
We use complementary slackness to recover the optimal dual solution.
Step 1: Use tightness conditions from primal
: Dual constraint for cakes must be tight:
: Dual constraint for muffins must be tight:
Step 2: Use slackness in primal constraints to find zero dual variables
Flour constraint is not tight
Step 3: Substitute into equations (1) and (2):
Step 4: Solve the system
Subtract (2’) from (1’):
Substitute back into (1’):
Result:
Thus, the dual solution is fully recovered using complementary slackness.
Exercise 11.23: Checking the Conditions
Consider the primal-dual pair
and the candidate solutions and .
Exercise 11.24: Bakery Production and Duality Interpretation
A bakery produces cakes (), cookies (), and muffins () to maximize profit:
Subject to the following resource constraints:
Flour ( 40 kg):
Sugar ( 10 kg):
Baking Time ( 7 hrs):
Non-negativity:
The optimal primal solution is:
Dual Linear Program:
The optimal dual solution is:
Answer the following questions:
Use the shadow prices to justify your answers.
Exercise 11.25: Box Constraints and a Dual Certificate
Consider the optimization problem
(a.) What is the dual of this linear program?
(b.) Explain how the dual can be used to prove that a solution is optimal.
(c.) The optimal solution to this linear program is with objective
value .
Using duality theory, prove that this is an optimal solution.
(Hint: Recall that complementary slackness implies that dual variables corresponding
to constraints 1 and 2 must be 0).
Exercise 11.26: Deducing the Primal from a Dual Guess
Consider the following primal-dual pair:
Primal Problem:
Dual Problem:
(a) Suppose you are given a candidate dual solution . Use complementary slackness to determine the values of and .
(b) Is the resulting primal solution feasible?
(c) Does complementary slackness hold? Is this a valid optimal solution pair?
Exercise 11.27: A Positive Price on a Slack Constraint
A classmate solves a primal-dual pair of linear programs and reports a primal feasible and a dual feasible . In their report, the second primal constraint has slack at (its left-hand side is strictly below ), and yet the dual price is . They claim both solutions are optimal.
Exercise 11.28: Disproving a Claimed Optimum
Suppose a linear program has the following primal and dual formulations:
Primal:
Dual:
A student claims that the optimal primal solution is .
(a) Write down the complementary slackness conditions for this problem.
(b) Assuming the student’s claim, use the conditions to derive requirements on and .
(c) Show that no feasible dual solution satisfies these requirements, and conclude that the student’s claimed solution cannot be optimal. What is the actual optimal solution?
Exercise 11.29: Meal Kit Optimization and Duality
You are the operations manager at a startup that assembles and ships healthy meal kits. Each kit appeals to different customer preferences: vegetarian, high-protein, quick-prep, etc. You want to decide how many of each kit to produce today to maximize profit.
There are six meal kit options:
| Variable | Description | Profit per Kit |
| Classic Chicken | $3 | |
| Vegan Delight | $2 | |
| Protein Boost | $4 | |
| Quick & Light | $1 | |
| Gourmet Chef Special | $5 | |
| Breakfast Box | $2 | |
Each kit requires time in two key areas:
Kitchen Prep Time (in hours): chopping, marinating, pre-measuring, etc.
Packaging Labor (in hours): boxing, labeling, sealing, etc.
Your available resources:
10 hours of Kitchen Time
12 hours of Packaging Labor
| Meal Kit | Kitchen Time | Packaging Time |
| : Classic Chicken | 1 | 2 |
| : Vegan Delight | 2 | 0 |
| : Protein Boost | 1 | 0 |
| : Quick & Light | 0 | 1 |
| : Gourmet Chef Special | 1 | 3 |
| : Breakfast Box | 0 | 1 |
The primal linear program is:
Answer the following:
Exercise 11.30: Duality with Mixed Constraint Types: Eco-Friendly Packaging Startup
You are managing production at an eco-friendly packaging startup. Your team produces various biodegradable container sets for local farms and grocery stores. Each set is assembled using labor and recycled material.
You produce three types of packaging sets:
| Variable | Packaging Set Type | Retail Price |
| FreshBox Standard | $6 | |
| FreshBox Premium | $9 | |
| Market Crate | $8 | |
You must manage the use of three critical resources:
Labor Hours: at most 140 available
Recycled Material: must exactly use 240 units
Retail Contract Requirement: the total retail value must be at least $80
The profit per unit for each set is:
| Packaging Set | Profit per Unit |
| : FreshBox Standard | $4 |
| : FreshBox Premium | $6 |
| : Market Crate | $5 |
The retail revenue constraint is:
The resource requirements for each packaging set are:
| Packaging Set | Labor | Material |
| : FreshBox Standard | 2 | 4 |
| : FreshBox Premium | 4 | 6 |
| : Market Crate | 3 | 4 |
The primal linear program is:
Tasks:
Solution
(Exercise 11.24)
Solution
(Exercise 11.25) (a) The dual is
(b) By weak duality, every dual feasible gives an upper bound on the primal objective. If we exhibit a primal feasible and a dual feasible whose objective values are equal, both must be optimal.
(c) At , constraints 1 and 2 have slack ( and ), so . Since , dual constraints 2, 3, 4 must be tight: gives ; then and . The remaining dual constraint holds with slack: , consistent with . So is dual feasible with objective , matching the primal value . By part (b), both solutions are optimal.
Solution
(Exercise 11.28) (a) The conditions are , , , and .
(b) At : the first primal constraint gives (slack), forcing ; the second gives (slack), forcing . But requires the first dual constraint to be tight: .
(c) With we get , a contradiction: no dual solution is compatible, so is not optimal. (It is feasible, but both constraints have slack, so we can do better.) The actual optimum is with value : both primal constraints are tight, and solving , gives the dual optimum with matching value .
Most students and practitioners rarely write down the dual linear program explicitly. However, understanding duality is essential to interpreting the output of optimization solvers and making informed decisions.
In practice, you solve the primal LP, but the solver uses duality internally and reports the dual variables as shadow prices on each constraint: how much the objective would improve if you relaxed that constraint by one unit. The economic meaning of those numbers, the reasoning behind zero versus nonzero values, and the marginal value of resources all rest on the duality concepts developed in this chapter: dual feasibility, strong duality, and complementary slackness. Shadow prices also support rapid “what-if” sensitivity analysis, letting you estimate the impact of changing a right-hand side without re-solving the LP.
As a small illustration, consider the LP below alongside typical solver output:
Primal LP:
Optimal solution: , profit $2250
Shadow prices:
Labor: $25
Material: $0
Without ever writing the dual, the solver output already speaks its language: labor is the scarce resource (an extra hour is worth $25), while material is not fully used (only 45 of the 70 units are consumed, so its shadow price is zero, exactly what complementary slackness predicts).
For students continuing in optimization, operations research, or algorithms, duality returns as a core idea behind decomposition methods (e.g., Benders, Dantzig–Wolfe), primal-dual interior point methods, approximation algorithms, and large-scale optimization.