Skip to content

Operations Management and Strategic Management · Optimum Allocation of Resources - LPP

Duality and Sensitivity Analysis in Linear Programming

Updated 10 October 2026 · Fact-checked

Every LPP (the primal) has a companion LPP called the dual. Their optimal objective values are equal. The optimal dual variables are shadow prices: the change in the objective per extra unit of a resource. Sensitivity analysis uses the final simplex table to see how far parameters can change before the solution changes.

Understand Duality and Sensitivity Analysis

Every linear programming problem, called the primal, has a twin problem called the dual. If the primal asks "how many units of each product should we make to maximise profit from limited resources?", the dual asks "what is the least total value we should put on those resources?" Both use the same data, arranged differently.

The key result is the duality theorem: if one problem has an optimal solution, so does the other, and the optimal objective values are equal. So you can solve whichever is easier. A primal with many constraints and few variables is often easier to solve through its dual, because the simplex effort depends mainly on the number of constraints.

The dual variables have a business meaning. Each one is a shadow price (dual value): the amount by which the optimal objective value changes if you get one more unit of that resource, with everything else unchanged. A resource that is not fully used (it has slack) has a shadow price of zero, because extra units add nothing. A scarce resource that is fully used has a positive shadow price in a maximisation problem. This tells management the most it should be willing to pay for extra capacity.

Sensitivity analysis asks: after finding the optimal solution, how much can a profit coefficient, a resource limit or a technical coefficient change before the optimal basis changes? You do not re-solve from scratch. You read the final simplex table. A shadow price is valid only within a range of the right-hand-side value. Outside that range the basis changes and the shadow price changes.

In the exam you will mostly be asked to write the dual, read the shadow prices from the final table, and interpret them in words.

Key rules to remember

Dual of a maximisation primal (all ≤ constraints)
Primal: Max Z = Σ cj xj, subject to Σ aij xj ≤ bi, xj ≥ 0. Dual: Min W = Σ bi yi, subject to Σ aij yi ≥ cj, yi ≥ 0.
Each primal constraint gives one dual variable. Each primal variable gives one dual constraint. Objective coefficients and right-hand sides swap roles, and the coefficient matrix is transposed.
Dual of a minimisation primal (all ≥ constraints)
Primal: Min Z = Σ cj xj, subject to Σ aij xj ≥ bi, xj ≥ 0. Dual: Max W = Σ bi yi, subject to Σ aij yi ≤ cj, yi ≥ 0.
Max becomes Min or the reverse, and the inequality direction flips for the constraints.
Handling other constraint types
Equality constraint in primal ↔ unrestricted (free) dual variable. Unrestricted primal variable ↔ equality dual constraint.
For a max primal, convert a ≥ constraint to ≤ by multiplying by -1 before dualising. For a min primal, convert a ≤ constraint to ≥ the same way.
Duality theorem
Optimal Z (primal) = Optimal W (dual)
Holds when either problem has a finite optimal solution. If one is unbounded, the other is infeasible.
Shadow price
Shadow price of resource i = yi* = change in optimal Z per unit increase in bi
Valid only while the optimal basis stays the same, i.e. within the range of bi. It is zero for a resource with positive slack.
Complementary slackness
xj × (dual slack of constraint j) = 0 and yi × (primal slack of constraint i) = 0
If a resource is not fully used, its shadow price is 0. If a variable is positive, its dual constraint is binding.
Reading the final simplex table
Shadow price of a ≤ resource = Zj value under its slack variable column (maximisation)
A slack column has cj = 0, so Cj - Zj = 0 - Zj = -Zj under that column. The shadow price is therefore the Zj value, which is the negative of the Cj - Zj entry. In a Max problem the Cj - Zj entries under slack columns are ≤ 0 at the optimum, so the shadow prices are ≥ 0.

How to solve Duality and Sensitivity Analysis questions

Use this order for any question on writing the dual, finding shadow prices or interpreting sensitivity.

  1. 1Write the primal clearly. Make it a standard form: for Max, all constraints ≤; for Min, all constraints ≥. Multiply any other inequality by -1 to convert it. Replace an equality by a free dual variable.
  2. 2Name one dual variable (y1, y2, ...) for each primal constraint.
  3. 3Build the dual objective: swap type (Max ↔ Min) and use the primal right-hand-side values as the dual objective coefficients.
  4. 4Build one dual constraint for each primal variable: use the column of that variable as coefficients, the primal objective coefficient as the right-hand side, and flip the inequality (≤ becomes ≥ for a Max primal).
  5. 5State the sign restrictions: y ≥ 0 for inequality constraints, free for equality constraints.
  6. 6To get dual values, either solve the dual, or read the Zj values under the slack columns of the final primal table. Check that the dual objective equals the primal optimum.
  7. 7Interpret in words: for each resource, state the shadow price in rupees per unit, whether the resource is scarce or in surplus, and the range over which the price holds.
  8. 8For sensitivity questions, test whether the proposed change keeps all right-hand-side values non-negative and all Cj - Zj entries of the right sign. If so, the basis is unchanged.

Quickest way: Transpose and flip

When to use it: When you only need to write the dual, or when both the primal and dual objective values are given and you must check them.

  1. Write the primal data as a table: constraint rows, with the objective row at the bottom and the right-hand-side column at the right.
  2. Transpose the table: rows become columns. The old objective row becomes the new right-hand side, and the old right-hand side becomes the new objective row.
  3. Change Max to Min (or Min to Max) and flip every inequality.
  4. Add y ≥ 0. Check the count: dual variables = primal constraints, dual constraints = primal variables.
  5. As a check, the optimal values must match. For a quick sensitivity answer, shadow price × change in resource = change in profit, if the change lies within range.

Common mistakes in Duality and Sensitivity Analysis

  • Dualising a Max problem that still has a ≥ constraint without converting it first.

    Students apply the standard rule mechanically to the problem as given.

    Fix: Convert to standard form first. For a Max primal, multiply a ≥ constraint by -1 so it becomes ≤. Then dualise.

  • Not flipping the inequality or the objective type, or flipping only one of them.

    Students remember "swap" but not what exactly swaps.

    Fix: Remember that Max ↔ Min and the constraint direction flips together. Max primal with ≤ gives Min dual with ≥.

  • Mixing up which numbers go on the right-hand side of the dual.

    Both objective coefficients and resource limits are plain numbers, so they get confused.

    Fix: Primal objective coefficients (cj) become dual right-hand sides. Primal right-hand sides (bi) become dual objective coefficients.

  • Stating a shadow price without units or without saying it is per extra unit of the resource.

    Students treat it as just a number from the table.

    Fix: Write: "Each extra hour of Machine A increases the maximum profit by ₹x, within the stated range."

  • Saying a slack resource has a positive shadow price, or applying a shadow price over any size of change.

    The link between slack and value, and the limited validity of shadow prices, is forgotten.

    Fix: A resource with unused capacity has a shadow price of zero. Always check that the change stays within the range where the basis does not change.

  • Taking the shadow price from the wrong row or column of the final table, or with the wrong sign.

    Under a slack column, Cj - Zj = -Zj, so the Cj - Zj row shows negative values for a Max problem, and students copy them as they are.

    Fix: Take the Zj value under the slack variable of that resource, which is the negative of the Cj - Zj entry there. It should be non-negative for a Max problem. Confirm by checking that Σ bi yi equals the optimal Z.

Worked examples

Example 1

A firm makes products A and B. Primal: Maximise Z = 3x1 + 5x2 (profit in ₹) subject to x1 + 2x2 ≤ 10 (machine hours), 3x1 + x2 ≤ 15 (labour hours), x1, x2 ≥ 0. (a) Write the dual. (b) Solve the primal and find the shadow price of each resource, with the range over which it is valid.

Show the solution
  1. Dual variables: y1 for machine hours, y2 for labour hours.
  2. Dual: Minimise W = 10y1 + 15y2 subject to y1 + 3y2 ≥ 3 (from x1), 2y1 + y2 ≥ 5 (from x2), y1, y2 ≥ 0.
  3. Primal corner points: (0, 0) gives Z = 0. (5, 0) gives Z = 15. (0, 5) gives Z = 25.
  4. Both constraints meet where x1 + 2x2 = 10 and 3x1 + x2 = 15. From the second, x2 = 15 - 3x1. Then x1 + 30 - 6x1 = 10, so x1 = 4 and x2 = 3. Z = 12 + 15 = 27.
  5. Maximum is 27 at (4, 3). Both resources are fully used, so both shadow prices can be positive.
  6. Solve the dual constraints as equalities: y1 + 3y2 = 3 and 2y1 + y2 = 5. From the first, y1 = 3 - 3y2. Then 6 - 6y2 + y2 = 5, so y2 = 0.2 and y1 = 2.4.
  7. Check: W = 10(2.4) + 15(0.2) = 24 + 3 = 27, equal to the primal optimum.
  8. Range for machine hours b1 (labour fixed at 15): solving x1 + 2x2 = b1 and 3x1 + x2 = 15 gives x1 = (30 - b1) ÷ 5 and x2 = (3b1 - 15) ÷ 5. Both must be ≥ 0, so 5 ≤ b1 ≤ 30.
  9. Range for labour hours b2 (machine fixed at 10): solving x1 + 2x2 = 10 and 3x1 + x2 = b2 gives x1 = (2b2 - 10) ÷ 5 and x2 = (30 - b2) ÷ 5. Both must be ≥ 0, so 5 ≤ b2 ≤ 30.

Answer: Dual: Min W = 10y1 + 15y2, subject to y1 + 3y2 ≥ 3, 2y1 + y2 ≥ 5, y1, y2 ≥ 0. Optimal primal: x1 = 4, x2 = 3, Z = ₹27. Shadow price of a machine hour = ₹2.4 (valid for 5 ≤ machine hours ≤ 30) and of a labour hour = ₹0.2 (valid for 5 ≤ labour hours ≤ 30), each with the other resource held constant. Optimal W = 27.

Example 2

Primal: Minimise Z = 4x1 + 6x2 (cost in ₹) subject to x1 + x2 ≥ 5 and x1 + 3x2 ≥ 9, x1, x2 ≥ 0. (a) Write the dual and find its optimal solution. (b) If the first requirement rises from 5 to 6 units, what is the new minimum cost, assuming the basis is unchanged? Over what range of the first requirement is this valid?

Show the solution
  1. Dual variables y1, y2. Dual: Maximise W = 5y1 + 9y2 subject to y1 + y2 ≤ 4 and y1 + 3y2 ≤ 6, y1, y2 ≥ 0.
  2. Solve the primal first. At the point where both constraints are equal: x1 + x2 = 5 and x1 + 3x2 = 9 give 2x2 = 4, so x2 = 2 and x1 = 3. Z = 12 + 12 = 24.
  3. Other corner points: (9, 0) gives Z = 36. (0, 5) gives Z = 30. The minimum is 24 at (3, 2).
  4. Solve the dual constraints as equalities: y1 + y2 = 4 and y1 + 3y2 = 6 give 2y2 = 2, so y2 = 1 and y1 = 3. W = 15 + 9 = 24, equal to the primal optimum.
  5. Shadow price of the first requirement = 3 (cost rises by ₹3 per extra unit required).
  6. New cost for 6 units: 24 + 3 × 1 = ₹27. Direct check: x1 + x2 = 6 and x1 + 3x2 = 9 give x2 = 1.5, x1 = 4.5, so Z = 18 + 9 = 27. This matches.
  7. Range: let the first requirement be b1. Then x2 = (9 - b1) ÷ 2 and x1 = (3b1 - 9) ÷ 2. Both must be ≥ 0, so b1 ≤ 9 and b1 ≥ 3.

Answer: Dual: Max W = 5y1 + 9y2, subject to y1 + y2 ≤ 4, y1 + 3y2 ≤ 6, y1, y2 ≥ 0. Optimal y1 = 3, y2 = 1, W = 24. New minimum cost = ₹27. The shadow price of ₹3 per unit holds for the first requirement between 3 and 9 units, with the second requirement kept at 9.

Exam tips

  • Always state the primal in standard form before writing the dual. Examiners give mixed constraints to test this step, and the working earns marks.
  • Verify your answer in one line: show that primal optimum Z equals dual optimum W. This catches most errors.
  • When asked to interpret, write a full sentence with the rupee value, the unit of the resource and the words "within the range". A bare number scores less.
  • For MCQs, remember three facts: a slack resource has a shadow price of zero, the number of dual variables equals the number of primal constraints, and optimal objective values are equal.
  • For sensitivity questions, check non-negativity of the right-hand sides after the change. If any becomes negative, the basis has changed and the shadow price no longer applies.

Practice questions from Optimum Allocation of Resources - LPP

Duality and Sensitivity Analysis 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 Sensitivity Analysis: frequently asked questions

What is the dual of an LPP and why do we need it?

The dual is a second LPP built from the same data as the primal, with variables and constraints swapped. It gives the same optimal value and its variables are the shadow prices of the resources. It is useful when the dual is easier to solve and for valuing resources.

What does shadow price mean in linear programming?

It is the change in the optimal objective value when one more unit of a resource becomes available, other data unchanged. It also shows the highest price worth paying for an extra unit. It holds only within a range of the resource limit.

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

For a Max problem with ≤ constraints, read the Zj value under the slack variable of that constraint. A slack variable that is in the basis has a shadow price of zero. Check that Σ bi yi equals the optimal Z.

What is sensitivity analysis in linear programming?

It studies how the optimal solution responds to changes in objective coefficients, resource limits or technical coefficients. You use the final simplex table to find the range in which the current basis stays optimal and feasible, without re-solving the problem.