On this page
If you have solved a Class 12 linear programming problem by checking corner points, you have seen half the picture. Every linear program (LP) has a twin called its dual, and when an optimum exists, the two meet at the same number. If feasible region and corner point are rusty, start with our linear programming key terms for Class 12.
How do you write the dual of a linear program?
The definitions here follow Michel Goemans's MIT 18.310 lecture notes on linear programming. For a primal problem "maximise c·x subject to Ax ≤ b, x ≥ 0", the dual is "minimise b·y subject to Aᵀy ≥ c, y ≥ 0".
In words, the recipe is:
Max becomes min.
Each primal constraint gets one dual variable; each primal variable gets one dual constraint.
The profit coefficients and the right-hand sides swap places.
The coefficient matrix is transposed, and ≤ constraints become ≥.
The same notes prove that the dual of the dual is the primal. The idea behind it: multiply each constraint by a non-negative number and add, so the sum bounds the profit; the dual searches for the smallest such bound.
What do weak and strong duality say?
Weak duality: if x is feasible for the primal with value z and y is feasible for the dual with value w, then z ≤ w (Theorem 4.2 in the MIT 18.310 notes). So any dual feasible point is an upper bound on the best profit.
Strong duality: if the primal optimum z* is finite, then so is the dual optimum w*, and z* = w* (Theorem 4.4). In the words of Wikipedia's dual linear program article, if one of the two problems has an optimal solution, so does the other one. If the primal is unbounded, the dual has no feasible point.
A worked example: chairs, tables and their dual
The numbers below are our own; the method follows the MIT 18.310 notes. A workshop makes chairs (x) and tables (y). A chair needs 1 hour of carpentry and 3 hours of finishing and earns a profit of 30 (in hundreds of rupees). A table needs 2 hours of each and earns 40. Each week there are 40 carpentry hours and 60 finishing hours.
The primal:
Maximise z = 30x + 40y
Carpentry: x + 2y ≤ 40
Finishing: 3x + 2y ≤ 60
x ≥ 0, y ≥ 0
The corner points give z = 0 at (0, 0), 600 at (20, 0), 800 at (0, 20) and 900 at (10, 15). So the best plan is 10 chairs and 15 tables, z* = 900.
Now the dual. Let u be the value of one carpentry hour and v the value of one finishing hour:
Minimise w = 40u + 60v
Chair: u + 3v ≥ 30
Table: 2u + 2v ≥ 40
u ≥ 0, v ≥ 0
Weak duality helps before you solve anything: (u, v) = (0, 20) is dual feasible with w = 1200, and the plan (20, 0) earns 600, so 600 ≤ z* ≤ 1200.
The dual's corner points give w = 1200 at (0, 20), 900 at (15, 5) and 1200 at (30, 0). The minimum is w* = 900, and primal and dual agree, as strong duality says they must.
u = 15 is the shadow price of carpentry: one more carpentry hour raises the best profit by 15. Check: with 41 hours the optimal corner moves to (9.5, 15.75), and profit becomes 285 + 630 = 915. Wikipedia reads the dual solution the same way, as an equilibrium price.
How does complementary slackness check your answer?
Theorem 4.5 in the MIT 18.310 notes says a feasible primal x and a feasible dual y are both optimal exactly when every dual variable is zero or its primal constraint is tight, and every primal variable is zero or its dual constraint is tight. Run it on our answer:
x = 10 > 0, so the chair constraint must be tight: 15 + 3(5) = 30. It is.
y = 15 > 0, so the table constraint must be tight: 2(15) + 2(5) = 40. It is.
u = 15 > 0, so carpentry must be used up: 10 + 2(15) = 40. It is.
v = 5 > 0, so finishing must be used up: 3(10) + 2(15) = 60. It is.
Now try a wrong corner, (0, 20). Finishing has slack (40 < 60), so v = 0; y > 0 forces 2u + 2v = 40, so u = 20. But then u + 3v = 20, which breaks the chair constraint u + 3v ≥ 30. No feasible dual fits, so (0, 20) is not optimal.
Why does duality matter beyond the exam?
The MIT notes call duality the most important and useful structural property of linear programs, and use strong duality to prove von Neumann's minimax theorem for zero-sum games. For solving LPs the board way, see linear programming in Class 12 Applied Maths. If you know Lagrange multipliers for constrained optimisation, dual variables will feel familiar: both price a constraint.
To practise, write the dual of an LP you have solved and run the slackness check. The Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer.



