Slack, Surplus and Artificial Variables: Converting an LPP to Standard Form
게시일 October 16, 2026 · 작성자 Simplex Method Calculator Editorial Team
Before the simplex method can start, every inequality in a linear program has to become an equation. That is the job of slack, surplus and artificial variables. Choosing the right one for each constraint, and getting the signs right, is the first step of every simplex problem and a common source of lost marks.
This guide explains each type of variable, the rules for converting a problem to standard form, and works through one example that uses all of them.
Standard Form for the Simplex Method
A linear program is in standard form for the simplex method when:
- Every constraint is an equation.
- Every right-hand side (RHS) is non-negative.
- Every variable is non-negative.
- The objective is written as maximize (or minimize, consistently).
Some textbooks call this the standard form and the version with a ready-made identity basis the canonical form. Either way, the goal is a set of equations with an obvious starting solution.
Slack Variables (for ≤ Constraints)
A slack variable measures unused capacity. It is added to the left side of a ≤ constraint.
- 2x1 + 3x2 ≤ 12 becomes 2x1 + 3x2 + s1 = 12, with s1 ≥ 0.
If x1 = 3 and x2 = 1, the left side is 9 and s1 = 3: three units of the resource are unused. In the objective, slack variables have coefficient 0, because unused capacity earns nothing. Slack variables also give a free starting basis: setting the decision variables to zero makes each slack equal to its RHS.
Surplus Variables (for ≥ Constraints)
A surplus variable measures how far a ≥ constraint is exceeded. It is subtracted from the left side.
- 4x1 + x2 ≥ 8 becomes 4x1 + x2 − s2 = 8, with s2 ≥ 0.
If x1 = 3 and x2 = 0, the left side is 12 and s2 = 4: the requirement is exceeded by four. Surplus variables also have objective coefficient 0.
A surplus variable cannot start the basis. With the decision variables at zero, the equation gives −s2 = 8, so s2 = −8, which breaks the non-negativity rule.
Artificial Variables (for ≥ and = Constraints)
An artificial variable is added only to create a starting basis where none exists. It has no real meaning and must be zero in any valid final answer.
- For a ≥ constraint: 4x1 + x2 − s2 + a2 = 8. Now a2 = 8 is a valid start.
- For an = constraint: x1 + 2x2 = 5 becomes x1 + 2x2 + a3 = 5.
Because artificial variables are fake, the method must push them out. The Big M method does this with a large penalty in the objective; the two phase method does it by first minimizing their sum.
Summary Table
| Constraint | Add | Sign | Objective coefficient | Starts the basis? |
|---|---|---|---|---|
| ≤ | Slack s | + | 0 | Yes |
| ≥ | Surplus s | − | 0 | No |
| ≥ | Artificial a | + | −M (max) or +M (min) | Yes |
| = | Artificial a | + | −M (max) or +M (min) | Yes |
Two More Conversions
Negative right-hand side. Multiply the whole constraint by −1 and reverse the inequality. For example, −x1 + x2 ≥ −5 becomes x1 − x2 ≤ 5, which then gets a slack variable.
Unrestricted (free) variable. If a variable may be negative, replace it with the difference of two non-negative variables: x3 = x3′ − x3″, with x3′, x3″ ≥ 0.
Worked Example
Convert this problem to standard form.
Maximize Z = 2x1 + 3x2 − x3
Subject to
- x1 + x2 + x3 ≤ 10
- 2x1 − x2 ≥ 4
- x1 + 2x3 = 8
- −x1 + x2 ≥ −5
x1, x2 ≥ 0, and x3 is unrestricted in sign.
Step 1: Free variable. Replace x3 with x3′ − x3″ everywhere.
Step 2: Negative RHS. Constraint 4 has RHS −5. Multiply by −1: x1 − x2 ≤ 5.
Step 3: Add helper variables.
- Constraint 1 (≤): add slack s1.
- Constraint 2 (≥): subtract surplus s2 and add artificial a2.
- Constraint 3 (=): add artificial a3.
- Constraint 4 (now ≤): add slack s4.
Result:
- Maximize Z = 2x1 + 3x2 − x3′ + x3″ + 0s1 + 0s2 + 0s4 − M a2 − M a3
- x1 + x2 + x3′ − x3″ + s1 = 10
- 2x1 − x2 − s2 + a2 = 4
- x1 + 2x3′ − 2x3″ + a3 = 8
- x1 − x2 + s4 = 5
- all variables ≥ 0
Starting basis: s1 = 10, a2 = 4, a3 = 8, s4 = 5, with every other variable at zero. That is one basic variable per row, each with a coefficient of +1, so the simplex method can begin.
Reading Slack and Surplus in the Final Answer
In the optimal tableau, slack and surplus values carry useful information:
- A slack of 0 means the constraint is binding: the resource is fully used. A positive slack means spare capacity.
- A surplus of 0 means a ≥ requirement is met exactly. A positive surplus means it is exceeded.
- The Zj value under a slack column is the shadow price of that resource, the gain in Z from one more unit. See the worked examples in simplex tableau explained.
Common Mistakes
- Adding a surplus variable instead of subtracting it. A ≥ constraint needs −s.
- Forgetting the artificial variable for a ≥ or = constraint, leaving a row with no starting basic variable.
- Multiplying by −1 without flipping the inequality.
- Leaving an artificial variable positive in the final answer. That means the problem is infeasible, not that you have a solution.
Let the Calculator Do It
The simplex method calculator with slack variables accepts constraints with ≤, ≥ and =, adds the slack, surplus and artificial variables automatically, and shows them as columns in every tableau. It assumes all variables are non-negative, so replace any free variable yourself before entering the problem, using two new names such as x4 − x5 in place of x3′ − x3″. Negative right-hand sides are handled for you.