Converting Inequalities to Equalities with Slack Variables

Learn how to convert linear inequality constraints into equality constraints by introducing nonnegative slack and surplus variables. This is the first step in putting any linear program into standard form.

Step 1 of 157%

Tutorial

Slack Variables for ≤ Constraints

The standard form of a linear program requires every constraint to be an equality. To convert a \leq inequality into an equality, we introduce a nonnegative slack variable that absorbs the gap between the two sides.

For a constraint of the form

a1x1+a2x2++anxnb,a_1 x_1 + a_2 x_2 + \cdots + a_n x_n \leq b,

we introduce a slack variable s0s \geq 0 and rewrite the constraint as

a1x1+a2x2++anxn+s=b.a_1 x_1 + a_2 x_2 + \cdots + a_n x_n + s = b.

The variable ss measures how much slack remains between the left-hand side and the bound bb. Since the original inequality says LHS is at most bb, the gap s=bLHSs = b - \text{LHS} is automatically nonnegative.

Illustration. The constraint 2x1+x282x_1 + x_2 \leq 8 becomes

2x1+x2+s1=8,s10.2x_1 + x_2 + s_1 = 8, \qquad s_1 \geq 0.

At the point (x1,x2)=(3,1)(x_1, x_2) = (3, 1), the LHS equals 77, so the slack is s1=87=1s_1 = 8 - 7 = 1.

navigate · Enter open · Esc close · ⌘K/Ctrl K toggle