Skip to content

Strategic Cost Management · Linear Programming

Duality and Shadow Prices in Linear Programming

Updated 11 October 2026 · Fact-checked

Duality means every linear programming problem (the primal) has a paired problem (the dual). Resource constraints become dual variables, which are shadow prices: the change in the optimal objective for one extra unit of a scarce resource. Convert the primal using standard rules, then read dual values from the final simplex table.

Understand Duality and Shadow Prices

Every LP problem you formulate, called the primal, has a second LP built from the same data, called the dual. The primal asks: how many units of each product should we make to get the best profit from limited resources? The dual asks: what is the minimum value we should place on each resource so that no product is shown as earning more than it contributes?

The dual variables are the shadow prices (also called opportunity costs or dual values) of the resources. A shadow price is the amount by which the optimal profit rises if you get one more unit of that resource, or falls if you lose one unit. It holds only while the same set of constraints stays binding, that is, within the range of validity.

A resource that is fully used (a binding constraint, zero slack) usually has a positive shadow price. A resource with unused capacity (positive slack) has a shadow price of zero. Extra units of it add nothing to profit because you already have spare.

The key link is the strong duality theorem: if the primal has an optimal solution, so does the dual, and the optimal objective values are equal. So you can solve whichever problem is easier. In a final simplex table, the dual values sit in the Zj row (or Cj - Zj row, with sign) under the slack variable columns.

In decisions, shadow prices tell you the maximum you should pay above the normal price to get extra scarce resource, such as overtime, extra machine hours or extra material. If an outside offer costs less than the shadow price, buy; if more, do not.

Key rules to remember

Primal to dual: objective
Max Z = c1x1 + ... + cnxn ↔ Min W = b1y1 + ... + bmym
Maximisation primal gives a minimisation dual, and the reverse. Dual objective coefficients are the primal right-hand sides (b values).
Primal to dual: constraints
Number of dual constraints = number of primal variables; number of dual variables = number of primal constraints
Each primal constraint gives one dual variable. Each primal variable gives one dual constraint. The dual's right-hand sides are the primal's objective coefficients (c values).
Transpose rule
Dual coefficient matrix = transpose of primal coefficient matrix (rows become columns)
The coefficient of xj in constraint i of the primal becomes the coefficient of yi in constraint j of the dual.
Standard pair (max, ≤)
Primal: Max Z = cx, Ax ≤ b, x ≥ 0 ↔ Dual: Min W = by, Aᵀy ≥ c, y ≥ 0
Put the primal in this form first. For a min primal with ≥ constraints, the dual is a max with ≤ constraints.
Handling = and ≥ in a max primal
A ≥ constraint: multiply by -1 to get ≤ form. An = constraint: gives a dual variable unrestricted in sign (or write it as two inequalities, ≤ and ≥).
Convert ≥ constraints before forming the dual. An unrestricted primal variable gives an = constraint in the dual.
Strong duality
Optimal Z (primal) = Optimal W (dual)
Holds when both problems have optimal solutions. Use it as a check on your answer.
Shadow price
Shadow price of resource i = yi* = ΔZ ÷ Δbi
Change in optimal objective per unit change in resource i, valid only within the range where the optimal basis stays the same.
Complementary slackness
If slack in constraint i > 0, then yi* = 0. If yi* > 0, then constraint i is binding.
Likewise, if xj* > 0 then the j-th dual constraint holds as an equality.

How to solve Duality and Shadow Prices questions

Use this method for any question that asks you to write the dual, find shadow prices, or interpret them.

  1. 1Write the primal clearly: objective, constraints, and non-negativity. Label the constraints by resource (machine hours, labour hours, material).
  2. 2Bring it to standard form. For a maximisation, all constraints should be ≤. For a minimisation, all should be ≥. Multiply by -1 where needed. An = constraint needs no conversion: its dual variable is unrestricted in sign (or you can write it as two inequalities, ≤ and ≥).
  3. 3Create one dual variable (y1, y2, ...) for each primal constraint, in the same order.
  4. 4Build the dual objective: swap Max with Min (or the reverse) and use the b values (right-hand sides) as coefficients of the y variables.
  5. 5Build one dual constraint per primal variable using the transposed coefficients. Use ≥ for a max primal and ≤ for a min primal, with the primal c values on the right-hand side. Add y ≥ 0, except for the variable of an = constraint, which is unrestricted.
  6. 6Obtain the optimal values. Either solve the dual graphically or by simplex, or read them from the Zj row under the slack columns of the final simplex table of a maximisation problem with ≤ constraints.
  7. 7Check that optimal Z equals optimal W. Then interpret: state each shadow price in rupees per unit of that resource, and identify resources with zero shadow price as having spare capacity.
  8. 8Give the decision: compare any offered price for extra resource with its shadow price and recommend accordingly.

Quickest way: Transpose and read: dual in under two minutes

When to use it: Use when the question only asks you to write the dual or state the shadow prices, and the two-variable primal is already solved or easy to solve.

  1. Write the primal in a grid: rows are constraints, columns are variables, with b on the right and c at the bottom.
  2. Read the grid by columns to get the dual constraints, and by the b column to get the dual objective.
  3. For a two-resource, two-product problem, find the optimum by setting both binding primal constraints to equality and solving.
  4. Find shadow prices by setting the dual constraints of the products made (x > 0) to equality and solving for y. Any resource with slack gets y = 0.
  5. Confirm that 'sum of b × y' equals the primal optimal Z. If not, recheck.

Common mistakes in Duality and Shadow Prices

  • Not converting the primal to standard form before writing the dual.

    Students apply the transpose rule straight away to a max problem with a ≥ constraint.

    Fix: For a max problem, make every constraint ≤ first (multiply a ≥ constraint by -1). For a min problem, make every constraint ≥. Then dualise.

  • Using the wrong inequality direction in the dual.

    Students copy the primal's sign instead of reversing it.

    Fix: Max primal with ≤ gives a min dual with ≥. Min primal with ≥ gives a max dual with ≤. Say it aloud once before writing.

  • Mixing up the c and b values.

    The roles swap between the two problems and the swap is easy to forget.

    Fix: The primal's right-hand sides become the dual's objective coefficients. The primal's objective coefficients become the dual's right-hand sides.

  • Stating a shadow price as the cost of the resource or as the profit per unit of product.

    The word 'price' suggests a purchase price.

    Fix: A shadow price is the increase in optimal profit (contribution) from one extra unit of the resource. It is what the resource is worth at the margin, over and above any cost already deducted in the contribution figures.

  • Giving a positive shadow price to a resource that has unused capacity.

    Students read the dual value without checking the slack in the primal's optimal solution.

    Fix: Use complementary slackness. If the primal optimum leaves slack in a constraint, its shadow price is zero.

  • Applying a shadow price to any size of change in the resource.

    The value looks like a fixed rate.

    Fix: State that the shadow price is valid only within the range over which the current set of binding constraints stays optimal. Beyond it, recompute.

Worked examples

Example 1

A firm makes products A and B. Contribution is ₹40 per unit of A and ₹50 per unit of B. Each unit of A needs 2 machine hours and 1 labour hour. Each unit of B needs 1 machine hour and 2 labour hours. Available: 100 machine hours and 80 labour hours. (a) Formulate the primal. (b) Write the dual. (c) Find the optimal solution of both and the shadow price of each resource. (d) The firm can hire extra labour hours at ₹15 per hour above the normal rate. Should it?

Show the solution
  1. Primal: Max Z = 40x1 + 50x2, subject to 2x1 + x2 ≤ 100 (machine hours), x1 + 2x2 ≤ 80 (labour hours), x1, x2 ≥ 0.
  2. Dual: let y1 be the value of a machine hour and y2 the value of a labour hour. Min W = 100y1 + 80y2, subject to 2y1 + y2 ≥ 40 (product A), y1 + 2y2 ≥ 50 (product B), y1, y2 ≥ 0.
  3. Solve the primal. Set both constraints as equalities: 2x1 + x2 = 100 and x1 + 2x2 = 80. Multiply the first by 2: 4x1 + 2x2 = 200. Subtract the second: 3x1 = 120, so x1 = 40. Then x2 = 100 - 80 = 20. Check labour: 40 + 40 = 80. Correct.
  4. Z = 40 × 40 + 50 × 20 = 1,600 + 1,000 = ₹2,600. Both products are made, so both dual constraints are equalities.
  5. Solve the dual: 2y1 + y2 = 40 and y1 + 2y2 = 50. From the first, y2 = 40 - 2y1. Substitute: y1 + 80 - 4y1 = 50, so y1 = 10 and y2 = 20.
  6. W = 100 × 10 + 80 × 20 = 1,000 + 1,600 = ₹2,600. This equals the primal Z, so the solution is verified.
  7. Shadow prices: ₹10 per machine hour and ₹20 per labour hour. Both resources are fully used (no slack), and the dual solution gives positive values, 10 and 20.
  8. Decision: an extra labour hour adds ₹20 to contribution, while it costs ₹15 extra. Net gain is ₹5 per hour, so hire, within the range over which the same two constraints stay binding.

Answer: Dual: Min W = 100y1 + 80y2 s.t. 2y1 + y2 ≥ 40, y1 + 2y2 ≥ 50, y ≥ 0. Optimal plan: 40 units of A and 20 of B, contribution ₹2,600. Shadow prices: ₹10 per machine hour, ₹20 per labour hour. Hiring extra labour at ₹15 above normal rate is worthwhile, up to the limit where the optimal basis stays valid.

Example 2

A minimisation problem: Min Z = 20x1 + 30x2 subject to 2x1 + x2 ≥ 10 and x1 + 3x2 ≥ 15, x1, x2 ≥ 0. (a) Write the dual. (b) Solve the primal and the dual and verify the result. (c) Interpret the dual values.

Show the solution
  1. The primal is a minimisation with ≥ constraints, so it is already in standard form. Create y1 for the first constraint and y2 for the second.
  2. Dual: Max W = 10y1 + 15y2, subject to 2y1 + y2 ≤ 20 (for x1), y1 + 3y2 ≤ 30 (for x2), y1, y2 ≥ 0.
  3. Solve the primal by corner points. Intersection of 2x1 + x2 = 10 and x1 + 3x2 = 15: from the first, x2 = 10 - 2x1. Then x1 + 30 - 6x1 = 15, so x1 = 3 and x2 = 4.
  4. Other corners: (0, 10) gives Z = 300; (15, 0) gives Z = 300. At (3, 4): Z = 60 + 120 = 180. The minimum is 180.
  5. Both x1 and x2 are positive, so both dual constraints are equalities: 2y1 + y2 = 20 and y1 + 3y2 = 30. From the first, y2 = 20 - 2y1. Substitute: y1 + 60 - 6y1 = 30, so y1 = 6 and y2 = 8.
  6. W = 10 × 6 + 15 × 8 = 60 + 120 = 180. This equals the primal minimum, so it is verified.
  7. Interpretation: raising the first requirement by one unit raises the minimum cost by ₹6. Raising the second by one unit raises it by ₹8. Lowering a requirement by one unit saves the same amounts, within the valid range.

Answer: Dual: Max W = 10y1 + 15y2 s.t. 2y1 + y2 ≤ 20, y1 + 3y2 ≤ 30, y ≥ 0. Primal optimum x1 = 3, x2 = 4, minimum cost ₹180. Dual optimum y1 = 6, y2 = 8, W = ₹180. The dual values are the marginal cost of each requirement: ₹6 and ₹8 per unit.

Exam tips

  • In MCQs, the usual traps are the direction of the inequality in the dual and which values become the new objective. Check these two things first.
  • If the question gives the final simplex table, do not re-solve. Read shadow prices from the Zj row under the slack columns, and state them with a unit (₹ per hour, per kg).
  • Always write one line of interpretation after the number: what one extra unit of the resource is worth and whether the offered price is below or above it.
  • Verify that primal optimum equals dual optimum. It takes 20 seconds and catches arithmetic slips.
  • Mention the limit: shadow prices are valid only within the range where the optimal basis does not change. Examiners often award a mark for this.

Practice questions from Linear Programming

Duality and Shadow Prices in other exams

The same ground in other exams, if you are preparing for more than one or want another angle on it.

Duality and Shadow Prices: frequently asked questions

What is the difference between the primal and the dual in LPP?

The primal is the original problem, usually choosing product quantities to maximise profit within resource limits. The dual is the paired problem that values the resources to minimise their total worth while covering each product's contribution. Both give the same optimal objective value.

What is a shadow price in linear programming?

It is the change in the optimal objective value for a one-unit increase in the right-hand side of a constraint, that is, the value of one more unit of a scarce resource. It equals the optimal dual variable for that constraint. A resource with spare capacity has a shadow price of zero.

How do I find the shadow price from the simplex table?

In the final simplex table of a maximisation problem with ≤ constraints, read the Zj values under the slack variable columns. Each one is the shadow price of the resource that slack belongs to. The Cj - Zj entries there are the negatives of these values. For a minimisation problem or a table with artificial variables, check the sign convention before reading the values.

Why do we need the dual when we can solve the primal?

The dual gives the economic meaning of the resources, which helps with decisions about buying extra capacity. It can also be easier to solve when the primal has few constraints and many variables, or the reverse. Solving either one gives the other's optimal value.