Skip to content
Calcolatore del Metodo del Simplesso Calcolatore del Metodo del Simplesso
← Torna al blog
How to Solve LPP by Simplex Method: Step-by-Step Example

How to Solve LPP by Simplex Method: Step-by-Step Example

Pubblicato il October 16, 2026 · di Simplex Method Calculator Editorial Team

The simplex method is the standard way to solve a linear programming problem (LPP) by hand. It starts at a corner of the feasible region, moves to a better neighbouring corner at every step, and stops when no neighbour can improve the objective. This guide walks through the whole procedure on one problem, showing every tableau, so you can follow each number and repeat the method on your own homework.

If you only need the answer, paste the same problem into the simplex method calculator with steps. It produces exactly the tableaus shown below.

The Problem

A workshop makes two products. Product 1 earns 12 per unit and product 2 earns 16 per unit. Product 1 needs 10 hours of machine time and 8 hours of labour; product 2 needs 20 hours of machine time and 8 hours of labour. The workshop has 120 machine hours and 80 labour hours available. How many of each product should it make?

Let x1 and x2 be the units of each product. The LPP is:

  • Maximize Z = 12x1 + 16x2
  • Subject to 10x1 + 20x2 ≤ 120 (machine hours)
  • 8x1 + 8x2 ≤ 80 (labour hours)
  • x1, x2 ≥ 0

Step 1: Write the Problem in Standard Form

The simplex method works with equations, not inequalities. Add one slack variable to each ≤ constraint. A slack variable measures unused capacity, so it is always zero or positive.

  • 10x1 + 20x2 + s1 = 120
  • 8x1 + 8x2 + s2 = 80
  • Z = 12x1 + 16x2 + 0s1 + 0s2

Setting x1 = x2 = 0 gives an obvious starting solution: s1 = 120, s2 = 80 and Z = 0. This is the initial basic feasible solution. The slack variables are the basic variables and x1, x2 are non-basic (equal to zero).

If your problem has ≥ or = constraints, slack variables alone are not enough. You also need surplus and artificial variables, handled by the Big M method or the two-phase method.

Step 2: Build the Initial Simplex Tableau

Each row of the tableau is one constraint. The Cb column holds the objective coefficient of the basic variable in that row. The Zj row is the sum of Cb times each column entry, and the Cj − Zj row is the objective coefficient minus Zj.

BasisCbx1x2s1s2RHS
s10102010120
s20880180
Zj00000
Cj − Zj121600

Because every basic variable is a slack with Cb = 0, every Zj is 0 and Cj − Zj simply equals the objective coefficients. For a detailed explanation of these two rows, see how to calculate Zj and Cj − Zj.

Step 3: Choose the Entering Variable (Pivot Column)

For a maximization problem, the variable with the largest positive Cj − Zj enters the basis, because each unit of it increases Z the most. Here x2 has 16, which is larger than 12, so x2 enters and its column is the pivot column.

Step 4: Choose the Leaving Variable (Minimum Ratio Test)

Divide each right-hand side by the matching positive entry in the pivot column:

  • Row s1: 120 / 20 = 6
  • Row s2: 80 / 8 = 10

The smallest ratio is 6, so s1 leaves and the pivot element is 20. The ratio test is what keeps the solution feasible: it tells you how far x2 can increase before some constraint is used up. Here machine hours run out first, at x2 = 6.

Step 5: Pivot

Make the pivot element 1 and every other entry in its column 0:

  1. Divide the s1 row by 20. It becomes the new x2 row: 1/2, 1, 1/20, 0 | 6.
  2. Subtract 8 times the new x2 row from the s2 row: 4, 0, −2/5, 1 | 32.

Recompute Zj and Cj − Zj with the new Cb values (x2 now has Cb = 16):

BasisCbx1x2s1s2RHS
x2161/211/2006
s2040−2/5132
Zj8164/5096
Cj − Zj40−4/50

The current solution is x1 = 0, x2 = 6, Z = 96. It is better than before, but x1 still has a positive Cj − Zj of 4, so the solution is not optimal yet.

Step 6: Repeat Until Optimal

Second iteration. x1 enters (Cj − Zj = 4). Ratio test: row x2 gives 6 / (1/2) = 12 and row s2 gives 32 / 4 = 8. The smallest is 8, so s2 leaves and the pivot element is 4.

Divide the s2 row by 4 to get the new x1 row: 1, 0, −1/10, 1/4 | 8. Then subtract 1/2 times this row from the x2 row: 0, 1, 1/10, −1/8 | 2.

BasisCbx1x2s1s2RHS
x216011/10−1/82
x11210−1/101/48
Zj12162/51128
Cj − Zj00−2/5−1

Every Cj − Zj value is now zero or negative, so this tableau is optimal.

Step 7: Read the Optimal Solution

Read the values of the basic variables from the RHS column:

  • x1 = 8, x2 = 2
  • Maximum Z = 12(8) + 16(2) = 128
  • s1 = s2 = 0, so both machine hours and labour hours are fully used.

Always check the answer in the original constraints: 10(8) + 20(2) = 120 and 8(8) + 8(2) = 80. Both are satisfied exactly.

The numbers under the slack columns in the Zj row also carry meaning. They are the shadow prices: one extra machine hour would raise Z by 2/5, and one extra labour hour would raise Z by 1. This is often asked as a follow-up question in exams; see what is a shadow price for a full explanation.

The Simplex Method in Short

  1. Convert every constraint to an equation with slack, surplus or artificial variables.
  2. Put the coefficients in the initial tableau and compute Zj and Cj − Zj.
  3. Pick the entering variable: the most positive Cj − Zj for maximization (most negative for minimization).
  4. Pick the leaving variable with the minimum ratio test, using positive entries only.
  5. Pivot so the entering column becomes a unit column.
  6. Repeat until no Cj − Zj can improve the objective, then read the solution.

Common Mistakes When Solving an LPP by Simplex Method

  • Using negative or zero entries in the ratio test. Only divide by positive pivot-column entries. If none are positive, the problem is unbounded.
  • Forgetting to update Cb. After each pivot, the Cb of the new basic variable changes, so Zj must be recomputed from scratch.
  • Mixing up the stopping rule. Maximization stops when all Cj − Zj ≤ 0; minimization stops when all Cj − Zj ≥ 0.
  • Rounding too early. Keep fractions such as 1/20 and 2/5 exact until the end, or small errors add up across iterations.

Minimization Problems

To solve a minimization LPP, either maximize −Z with the same rules and change the sign of the final value, or keep it as minimization and enter the variable with the most negative Cj − Zj. Both approaches are explained with an example in maximization vs minimization in the simplex method, and you can solve one directly with the simplex minimization calculator.

Check Your Work

Solving an LPP by hand is the best way to learn the method, but it is easy to make an arithmetic slip in the third or fourth tableau. Enter 12x1 + 16x2 as the objective and the two constraints on separate lines in the LPP simplex method calculator to see the same three tableaus and confirm x1 = 8, x2 = 2 and Z = 128.