Back to All Blogs
Operations ResearchFeatured

The Simplex Method: A Step-by-Step Worked Example

Solver360 Team
February 14, 2025
9 min read

The Simplex Method: A Step-by-Step Worked Example

The Simplex method is the workhorse of linear programming. It efficiently finds the optimal solution to problems with many variables and constraints by moving from one corner (vertex) of the feasible region to a better one, until no further improvement is possible. This tutorial walks through a complete example.

You can solve any linear program and see every tableau with the free Simplex Method Solver.

The Problem

A workshop makes two products, x₁ and x₂, and wants to maximize profit:

📐 Formula
Maximize Z = 3x₁ + 5x₂ Subject to: x₁ ≤ 4 2x₂ ≤ 12 3x₁ + 2x₂ ≤ 18 x₁, x₂ ≥ 0

Step 1: Add Slack Variables

Convert each ≤ inequality into an equation by adding a non-negative slack variable (s₁, s₂, s₃):

📐 Formula
x₁ + s₁ = 4 2x₂ + s₂ = 12 3x₁ + 2x₂ + s₃ = 18

The slacks form the initial basis, so we start at x₁ = 0, x₂ = 0 (the origin).

Step 2: Build the Initial Tableau

The objective row uses Cⱼ − Zⱼ to identify improving variables. Since x₂ has the largest positive coefficient (5), it enters the basis first.

Step 3: Ratio Test (Choose the Leaving Variable)

Divide each right-hand side by the entering column's positive coefficient. The smallest non-negative ratio determines the pivot row. For x₂, the binding constraint is 2x₂ ≤ 12, giving x₂ = 6.

Step 4: Pivot and Repeat

After pivoting x₂ into the basis, we recompute the tableau and find that x₁ still improves the objective. We pivot again. The Simplex method continues until no Cⱼ − Zⱼ value is positive — that signals the optimum.

The Optimal Solution

📐 Formula
x₁ = 2, x₂ = 6 Z = 3(2) + 5(6) = 6 + 30 = 36

The maximum profit is 36, achieved by producing 2 units of x₁ and 6 units of x₂. At this point the labor and machine constraints are binding (fully used), while the x₁ ≤ 4 constraint has slack.

Handling ≥ and = Constraints

Real problems often include ≥ or = constraints. These need surplus and artificial variables and the two-phase method: Phase I drives the artificial variables to zero to find a feasible starting point, and Phase II optimizes the real objective. The Simplex Method Solver handles all constraint types and both maximization and minimization automatically.

Common Pitfalls

  • Wrong pivot column/row — always pick the most positive Cⱼ − Zⱼ (for maximization) and the smallest positive ratio.
  • Forgetting non-negativity — every variable, including slacks, must stay ≥ 0.
  • Stopping early — continue until no positive Cⱼ − Zⱼ remains.

Try It Yourself

Enter your objective and constraints into the Simplex Method Solver to see each tableau, the entering/leaving variables, and the optimal solution. For two-variable problems you can also visualize the feasible region with the Graphical Method Solver, require whole-number answers with the Integer Programming Solver, or form the dual and check shadow prices with Duality & Shadow Prices. For a full map of these tools, read LP Toolkit: Simplex, Graphical, Integer, and Duality.

Key Takeaways

  • The Simplex method moves between feasible corner points toward the optimum.
  • Slack variables convert ≤ constraints to equations; the two-phase method handles ≥ and =.
  • For the example, the optimum is x₁ = 2, x₂ = 6, Z = 36.
Tags:
Simplex MethodLinear ProgrammingOptimization