All articles
10 min read

Duality in Linear Programming: Write the Dual Without Errors

Duality in linear programming gives each maximisation problem a minimisation partner and the reverse; when both have optima, the values match. A sign table writes the dual; complementary slackness finds its solution.

By Sunil Bansal, Founder · Updated 19 Nov 2026

A student at a desk studies two sheets of graph paper, each showing a shaded polygon, in soft window light.

Key takeaways

  • Duality in linear programming gives every problem (the primal) a partner (the dual) whose feasible solutions bound the primal's best value; when both have optimal solutions, those values are equal.
  • Write the dual from a sign table, not from memory: an equality constraint gives a free dual variable (one with no sign restriction), and each primal variable's sign sets the type of its dual constraint.
  • You can recover a dual solution from a primal optimum: a constraint with unused amount (slack) has dual variable 0, and a positive primal variable makes its dual constraint hold with equality (tight).
  • We found 9 duality questions in 5 of the 8 GATE MA papers covered (2018, 2019 and 2021 to 2026). Five ask you to pick true or false statements, three ask for a dual optimum, and one tests whether a dual point with a free variable is feasible.
In this article
  1. 1What does duality in linear programming say, and why does a dual give a bound?
  2. 2How do you write the dual of a linear programme without a sign error?
  3. 3How do you get the dual solution from the primal solution?
  4. 4Which primal and dual outcomes can happen together?
  5. 5How often does GATE MA ask about duality, and what does it test?
  6. 6How do we teach duality for GATE MA at SBTech Math?
  7. 7Frequently asked questions

Exam questions on duality bring equality constraints, ≥ constraints and variables that may be negative. A dual is easy to write only when every constraint is a ≤ and every variable is at least zero. With anything else, one wrong sign gives a dual with a different answer.

The second trap is doing too much work. In our reading of the GATE (Graduate Aptitude Test in Engineering) Mathematics (MA) questions on duality, some can be settled without solving the dual as a second LP. One kind of question is settled by reasoning about which outcomes are possible for a problem (the primal) and its dual (GATE 2018 MA Q12). Another is settled by solving the primal and reading off the dual (GATE 2025 MA Q49).

The sign of each dual variable comes from its constraint, and the type of each dual constraint comes from its variable. With those two rules fixed, the rest is arithmetic, and the checks below catch the errors.

What does duality in linear programming say, and why does a dual give a bound?

Every linear programme (LP), a problem that maximises or minimises a linear expression under linear constraints, has a dual. Any feasible solution of the dual (one satisfying all its constraints) gives a bound on the primal's best value. For a maximisation primal the bound is an upper bound. If both problems have optimal solutions, their optimal values are equal. Strong duality is that equality of optimal values.

Take the primal in GATE 2025 MA Q49 (IIT Roorkee paper, hosted on the GATE 2026 site): maximise 3x₁ + 5x₂ subject to x₁ ≤ 4, 2x₂ ≤ 12, 3x₁ + 2x₂ ≤ 18, with x₁, x₂ ≥ 0. The paper writes these with slack variables x₃, x₄, x₅, each the unused amount of a ≤ constraint.

Multiply the first, second and third constraints by p, q and r, taking p = 0, q = 1.5 and r = 1, then add. The left side becomes 3x₁ + 5x₂ and the right side 18 + 18 = 36. So no feasible point scores above 36. The point (2, 6) scores 3·2 + 5·6 = 36, so it is optimal.

The multipliers (p, q, r) = (0, 1.5, 1) are a dual solution. The dual is the search for the multipliers that give the tightest bound, and weak duality is the inequality you just used: any feasible dual value bounds the primal. A dual variable is the multiplier on one constraint.

How do you write the dual of a linear programme without a sign error?

Give each primal constraint one dual variable and each primal variable one dual constraint, and take every sign from this table. The rules are the standard conversion rules, set out in the duality chapter of MIT's 15.053 Applied Mathematical Programming notes. The dual's objective uses the primal's right-hand sides, and the dual's right-hand sides are the primal's objective coefficients. A free variable has no sign restriction.

Primal itemMaximise primal: dual is a minimiseMinimise primal: dual is a maximise
Constraint ≤y ≥ 0y ≤ 0
Constraint ≥y ≤ 0y ≥ 0
Constraint =y freey free
Variable x ≥ 0dual constraint ≥dual constraint ≤
Variable x ≤ 0dual constraint ≤dual constraint ≥
Variable x freedual constraint =dual constraint =

We tested the maximise column in November 2026. We built each dual by the table and solved both problems with a numerical LP solver (the open-source HiGHS code in SciPy's Python library). In all 1,239 cases where both had an optimum, the optimal values matched. We did not test the minimise column directly; it follows from the maximise column by negating the objective.

Run this check on your own dual:

  1. Pick any feasible primal point x and any feasible dual point y. For a maximisation primal, c·x must be at most b·y. Pass: it is. Fail: a sign in your dual is wrong.
  2. Count: dual variables must equal primal constraints, and dual constraints must equal primal variables. Pass: both counts match.

The sign trap with equalities. Exercise: minimise 3x₁ + 5x₂ + 6x₃ subject to 2x₁ + 4x₂ + 7x₃ − x₄ = 5 and −3x₁ + 2x₂ − 6x₃ + x₅ = −4, all variables ≥ 0. Both constraints are equalities, so y₁ and y₂ are free. The columns of x₄ and x₅ are (−1, 0) and (0, 1). Each is a variable ≥ 0 in a minimise primal, so each gives a ≤ dual constraint: −y₁ ≤ 0 and y₂ ≤ 0. The restrictions y₁ ≥ 0 and y₂ ≤ 0 therefore come from the slack columns, not from the equalities.

The sign trap in an exam. GATE 2022 MA Q48 gives the primal: maximise 5x₁ + 12x₂ subject to x₁ + 2x₂ + x₃ ≤ 10 and 2x₁ − x₂ + 3x₃ = 8, all x ≥ 0, and asks about a feasible dual point y = (α, −1). The ≤ constraint makes y₁ ≥ 0 and the equality makes y₂ free, so y₂ = −1 is allowed. The dual constraints are y₁ + 2y₂ ≥ 5, 2y₁ − y₂ ≥ 12 and y₁ + 3y₂ ≥ 0. With y = (α, −1) they become α ≥ 7, α ≥ 5.5 and α ≥ 3, so α ≥ 7. A reader who wrongly forced y₂ ≥ 0 would conclude that no point of the form (α, −1) can be dual feasible.

How do you get the dual solution from the primal solution?

Use complementary slackness, the pair of rules that link a primal optimum to a dual optimum: if a primal constraint has slack (unused amount) at the optimum, its dual variable is 0; if a primal variable is positive, its dual constraint holds with equality, which is called being tight. Those conditions give a small set of equations for the dual variables, so you solve equations instead of a second LP. If you need the primal optimum first, our simplex method worked example shows the pivots.

Worked example, GATE 2025 MA Q49. The dual is: minimise 4p + 12q + 18r subject to p + 3r ≥ 3, 2q + 2r ≥ 5, p, q, r ≥ 0, with p, q, r the dual variables of constraints 1, 2 and 3. The primal optimum is x = (2, 6) with slack x₃ = 2 in the first constraint.

  • Constraint 1 has slack, so p = 0.
  • x₁ = 2 > 0, so the first dual constraint is tight: p + 3r = 3, giving r = 1.
  • x₂ = 6 > 0, so the second is tight: 2q + 2r = 5, giving q = 3/2.

The dual value is 4·0 + 12·1.5 + 18·1 = 36, which equals the primal value. The question also gives B⁻¹, the inverse of the basis matrix B (the constraint-matrix columns of the basic variables x₃, x₂, x₁ of the optimal basis), with entries α, β, γ. Writing B from those columns and solving B·B⁻¹ = I gives α = 1, β = 1/3, γ = 1/2. Then α + 3β + 2γ = 3 and p + q + r = 5/2, so statements (A) and (C) are true. α − 3β + 4γ = 2 and p² + q² + r² = 13/4, so (B) and (D) are false.

What a non-zero slack does. Exercise: maximise 0.56x₁ + 0.46x₂ subject to x₁ ≤ 110000, x₁ + 2x₂ ≤ 240000 and 1.5x₁ + x₂ ≤ 180000. The optimum is (60000, 90000), and the first constraint has slack 50000. So y₁ = 0. The other two are tight and both variables are positive, so y₂ + 1.5y₃ = 0.56 and 2y₂ + y₃ = 0.46, giving y₂ = 0.065 and y₃ = 0.33. Both objectives equal 75,000.

The dual variables are shadow prices. One more unit on the right-hand side of the second constraint adds 0.065 to the optimum, for as long as the same constraints stay tight. Slack means extra supply of that resource is worth nothing.

Hands holding a ruler and pencil on graph paper beside a marked corner of a shaded polygon.
Only the edges that are tight at the optimum matter, and they give the few equations that fix the dual.

Which primal and dual outcomes can happen together?

Only four pairings occur. Both have optima with equal values; primal unbounded and dual infeasible; primal infeasible and dual unbounded; or both infeasible. Both feasible always means both have optima, with equal values. These are the standard duality theorems, covered in the same MIT chapter.

PrimalDual
OptimalOptimal, same value
UnboundedInfeasible
InfeasibleUnbounded
InfeasibleInfeasible

GATE 2018 MA Q12 asked for the false statement among four. The false one said that, even if both are feasible, the optimal values of the primal and dual can differ. They cannot.

How often does GATE MA ask about duality, and what does it test?

GATE MA asked a question about duality in 5 of the 8 papers covered, 9 questions in total. Duality is on the syllabus: Section 11 of the GATE 2027 MA syllabus from IIT Madras lists "Duality theory, weak duality and strong duality".

Our count covers the GATE MA papers for 2018, 2019 and 2021 to 2026; the 2017 and 2020 papers are not covered. A duality question here is one whose statement or options refer to the dual of an LP or to dual variables. We assigned each to a category by what you must produce. "Statements" means the answer choices are claims about primal and dual in general or with unknown parameters. "Dual optimum" means you compute a dual optimal value or solution for a specific problem. "Feasibility" means you test a given dual point against the dual's constraints.

Students sit in rows at desks in a quiet exam hall, writing on question papers in daylight.
Duality is one topic among many that students meet in the exam hall, in questions that come up in most years.
PaperDuality questionsWhat they askCategory
2018Q12The false statement about a primal and its dualStatements
2019Q1The false statement about a transportation problem, including its dual variablesStatements
2019Q26Which statements about an LP and its dual are trueStatements
2021Q23Optimal value of a dualDual optimum
2021Q32The statement that is not true, given a feasible dual point's boundStatements
2021Q55A dual optimum from a given primal optimumDual optimum
2022Q48Whether a dual point with a free component is feasible, and for which αFeasibility
2022Q55Which statements about feasible and optimal points of a primal and its dual are trueStatements
2025Q49Statements about the basis inverse and the dual optimumDual optimum
2023, 2024, 2026none

By category: 5 statements (2018 Q12, 2019 Q1, 2019 Q26, 2021 Q32, 2022 Q55), 3 dual optimum (2021 Q23, 2021 Q55, 2025 Q49) and 1 feasibility (2022 Q48), which makes 9.

Our recommendation: before drilling long conversions, learn the sign table above, the four outcome pairs and complementary slackness, in that order. For a two-variable problem, solving the primal first is often quicker. Check the GATE MA syllabus page for the other Section 11 topics, and use the previous-year papers page for full question sets. Our transportation problem page covers the 2019 Q1 setting.

For CSIR NET (Council of Scientific and Industrial Research National Eligibility Test), the position is different. In the CSIR-UGC common syllabus for Mathematical Sciences (the December 2020 document), every candidate answers Unit I and mathematics candidates answer additional questions from Units II and III. Mathematics-stream CSIR NET candidates therefore do not need duality for the exam.

How do we teach duality for GATE MA at SBTech Math?

Our CSIR-NET + GATE Mathematics 2027 course lists Linear Programming among its subjects. It runs as live classes with recordings in Hindi and English, with chapter-wise assignments, previous-year-question discussion, mock tests with analytics, and continuous doubt support with weekly doubt sessions or personal mentoring. As of November 2026 it costs ₹15,999 one time, with access through 30 June 2027, or four instalments of ₹3,999.75 (₹15,999 in total). A ₹999 Demo Plan gives 10 days of access. Details are on the course page.

To ask which course fits your exam and attempt year, contact us, email sbtechmath@gmail.com, or call +91 81265 45455, 9am to 7pm Monday to Saturday.

Prepare duality for GATE MA with SBTech Math

Ask us which SBTech Math course fits your exam and attempt year.
Contact us

Frequently asked questions

Flip the rules for a maximisation primal: ≥ constraints give y ≥ 0 and ≤ constraints give y ≤ 0, and x ≥ 0 variables give ≤ dual constraints. For example, a minimise primal with ≥ constraints and x ≥ 0 gives a maximise dual with y ≥ 0 and ≤ constraints. Equalities still give a free y.
Any feasible dual point is a bound on the primal, so a matching pair of feasible points proves optimality. Dual variables are shadow prices, and an infeasible or unbounded dual tells you what happens to the primal. Solving the dual can also be shorter when a problem has many constraints and few variables.

For a maximisation LP with ≤ constraints, the dual values are the objective-row entries (the z_j − c_j values) under the slack-variable columns of the final tableau. Each slack column belongs to one constraint, so each entry is that constraint's dual variable. Signs depend on your tableau convention.

It gives the same optimal value, and complementary slackness turns a dual optimum into the primal's tight constraints. Positive dual variables mark tight primal constraints, and slack dual constraints force those primal variables to 0. Solving those equations gives the primal solution.
The dual of the dual is the original primal. Applying the sign table twice returns your starting problem, so a quick test of a dual you wrote is to dualise it back and compare.

Sources

  1. 1.GATE 2027 Mathematics (MA) syllabus, IIT Madras, GATE 2027 organising institute
  2. 2.GATE 2025 Mathematics (MA) question paper, Set by IIT Roorkee, hosted on the GATE 2026 site of IIT Guwahati
  3. 3.CSIR-UGC NET common syllabus for Parts B and C, Mathematical Sciences, CSIR Human Resource Development Group, December 2020
  4. 4.Duality in Linear Programming, Chapter 4, MIT 15.053 Applied Mathematical Programming
  5. 5.Our own test of 4,000 random LPs (HiGHS solver through SciPy, November 2026) and our own count of duality questions in the eight GATE MA papers listed above.
  6. 6.SBTech Math course page, SBTech Math, November 2026
  7. 7.SBTech Math contact page, SBTech Math, November 2026

Keep reading

SBTechMath.

India's trusted Mathematics learning platform for CSIR-NET, GATE, IIT-JAM, CUET PG, and competitive exam aspirants. Learn concepts that help you succeed.

© 2026 SBTech Math

Powered by PageLens.ai

Crack CSIR-NET, GATE & IIT-JAM with concept-first learning.

Start Now