Simplex Algorithm
Revise Simplex Algorithm for Further Decision Mathematics 1 WDM11 (AS Level) — revision notes and instant AI marking. Free to start.
The Simplex Algorithm
A step-by-step way to find the best possible answer (maximum profit, minimum cost) to a problem with lots of variables — by hopping between corners of a shape until you can't do any better.
Summary — What This Chapter Covers
- The simplex algorithm solves linear programming problems with more than 2 variables — too many to draw on a graph.
- Slack variables turn ≤ inequalities into equations so we can put them in a table.
- The initial tableau organises all the equations and the objective function into a grid.
- One "iteration" of the algorithm = pivot column → θ-values → pivot row → row operations. Repeat until no negative numbers remain in the objective row.
- When a problem has ≥ constraints or asks you to minimise, plain simplex doesn't work directly — you need surplus and artificial variables.
- The two-stage method first finds *any* feasible starting point (by maximising a helper function I), then runs simplex normally to optimise P.
- The Big-M method is a one-stage shortcut alternative — it bakes a penalty for artificial variables straight into the objective function using a "very large number" M.
- Minimising C is done by maximising P = −C, then flipping the sign back at the end.
1. Why Do We Need the Simplex Algorithm?
You've probably solved linear programming (LP) problems before using the graphical method: draw the constraints as lines, shade the feasible region, and test the vertices (corners) to find the best one. That works brilliantly — as long as you only have 2 decision variables, because you can draw them on x-y axes.
But what if your furniture company makes chairs, tables, and bookshelves? That's 3 variables — and you'd need a 3D graph. Add a fourth product and you're completely stuck with pictures. That's exactly where the simplex algorithm comes in: it does the same job as the graphical method (checking corner points of the feasible region) but algebraically, using a table instead of a picture. It can handle any number of variables.
There's one catch: to start hopping between vertices, the algorithm needs a vertex to start at — and it always wants to start at the origin (make 0 of everything). If the origin is inside your feasible region (true for problems where you're only ever constrained by "at most" limits, i.e. all ≤), you're good to go immediately. If the origin ISN'T in the feasible region (which happens when you have ≥ constraints, like "must produce at least 20 units"), you need extra machinery first — that's the two-stage method or Big-M method, covered later in this guide.
2. Slack Variables & the Initial Tableau
1 What is a slack variable?
The simplex algorithm works with equations, not inequalities. But our constraints are things like 2x + 3y ≤ 10. We need to convert that ≤ into an =.
Think of a slack variable as filling up the "gap" or "slack" left over when you don't use the full amount. If 2x + 3y only comes to 7, there's 3 units of "slack" unused out of the 10 available. So we introduce a variable — call it s₁ — that soaks up exactly that leftover amount:
If s₁ = 0, it means the constraint is being used up completely (it's "tight" or "binding"). If s₁ is large, there's lots of spare capacity in that constraint.
2 Building the initial tableau
Once every constraint is an equation, and the objective function is rearranged so everything is on one side (P = 8x + 5y + 7z becomes P − 8x − 5y − 7z = 0), we're ready to build the table — called the initial tableau.
- Columns: basic variable (b.v.), each decision variable, each slack variable, and "Value" (the right-hand side of each equation).
- Rows: one row per constraint equation, using the coefficients exactly as written, plus a final row for the objective function.
- Basic variable column (fill in LAST): for each row, find the column that has a
1in that row and0everywhere else — that variable is the "basic variable" for that row. At the start, this is always the slack variables, since each one only appears once.
Worked Example. Maximise P = 8x + 5y + 7z subject to:
2x + 3y ≤ 10 x + 2y + 5z ≤ 60 5y + 3z ≤ 40
| b.v. | x | y | z | s₁ | s₂ | s₃ | Value |
|---|---|---|---|---|---|---|---|
| s₁ | 2 | 3 | 0 | 1 | 0 | 0 | 10 |
| s₂ | 1 | 2 | 5 | 0 | 1 | 0 | 60 |
| s₃ | 0 | 5 | 3 | 0 | 0 | 1 | 40 |
| P | −8 | −5 | −7 | 0 | 0 | 0 | 0 |
Write the constraint 3a + 4b + c ≤ 24 as an equation using a slack variable, and state what it means if that slack variable equals 0.
3. Applying the Simplex Algorithm (One Iteration)
Once your initial tableau is ready, you repeat the same 4-step cycle ("an iteration") until you're done. Think of each iteration as hopping to a better vertex of the feasible region.
- STEP 1 — Find the pivot column. Look along the objective row (ignore the Value column) and find the most negative entry. That column is the pivot column — it tells you which variable would improve P the most if you increased it.
- Calculate θ-values. For every other row, divide "Value" by the entry in the pivot column:
θ = Value ÷ (pivot column entry). If the entry is 0 or negative, that row's θ is "n/a" (ignore it). - STEP 2 — Find the pivot row & pivot element. The pivot row is whichever row has the smallest non-negative θ. Where the pivot row meets the pivot column is the "pivot element."
- STEP 3 — Row operations. Turn the pivot element into 1 (divide the whole pivot row by itself). Then use multiples of this new pivot row to make every other entry in the pivot column (including the objective row!) equal to 0.
- STEP 4 — Update the basic variable column. After the row operations, find the columns that now have a single 1 and 0s elsewhere — those are your new basic variables.
Worked Example — Iteration 1 (continuing the tableau above):
Most negative in objective row = −8 (column x). θ₁ = 10÷2 = 5, θ₂ = 60÷1 = 60, θ₃ = n/a. Smallest θ is 5, so R1 is the pivot row, pivot = 2.
| b.v. | x | y | z | s₁ | s₂ | s₃ | Value |
|---|---|---|---|---|---|---|---|
| x | 1 | 1.5 | 0 | 0.5 | 0 | 0 | 5 |
| s₂ | 0 | 0.5 | 5 | −0.5 | 1 | 0 | 55 |
| s₃ | 0 | 5 | 3 | 0 | 0 | 1 | 40 |
| P | 0 | 7 | −7 | 4 | 0 | 0 | 40 |
Still a negative (−7 in the z column) — not finished yet, so we'd run another iteration.
In a tableau, the objective row reads: x: −3, y: −6, s₁: 0, s₂: 0, Value: 0. Which column is the pivot column, and why?
4. The Two-Stage Simplex Method
Plain simplex only works when the origin (make 0 of everything) is inside the feasible region — which is true only when every constraint is ≤. But real problems often have constraints like x + y ≥ 20 ("must produce at least 20"), and the origin fails that constraint (0 + 0 is not ≥ 20). Also, plain simplex can only maximise, not minimise.
The two-stage simplex method fixes both problems by running simplex twice:
- Stage 1: Find any valid starting vertex (a "basic feasible solution") by maximising a helper objective function called I.
- Stage 2: Once a valid starting point exists, run the normal simplex algorithm on the real objective function P, as usual.
1 Surplus variables (for ≥ constraints)
For a ≥ constraint like x + y + z ≥ 20, we can't add a slack (that only works for ≤). Instead we subtract a surplus variable, which represents the excess above the minimum requirement:
2 Artificial variables — why we need them too
Here's the snag: in x + y + z − s₁ = 20, there's no column with a clean "1 here, 0 everywhere else" pattern to use as a starting basic variable (unlike slack variables, which are naturally "ready to go"). So we bolt on an artificial variable, a₁, purely to give that row a basic variable to start with:
Artificial variables are a bit like scaffolding on a building — useful for getting started, but they must be "torn down" (forced back to 0) before you can trust the final answer. That's exactly the job of Stage 1.
I = −(a₁ + a₂ + …) for however many artificial variables you introduced. Since artificial variables must be ≥ 0, the biggest I can ever be is 0 (when every artificial variable is exactly 0). Stage 1 uses simplex to maximise I, chasing it up toward 0.
Before it can go in the tableau, rewrite each
aᵢ in terms of the decision/surplus variables (rearrange its constraint), substitute into I, then rearrange I so all variables are on one side.
3 Setting up the initial two-stage tableau
Worked Example. Maximise P = 2x + 4y + 3z subject to x+y+z ≥ 20, 2x−y+2z ≥ 25, 2x+3y+4z ≤ 80.
Constraints become: x+y+z−s₁+a₁=20, 2x−y+2z−s₂+a₂=25, 2x+3y+4z+s₃=80. Working out I: I − 3x − 3z + s₁ + s₂ = −45.
The tableau now has two objective rows — one for P, one for I:
| b.v. | x | y | z | s₁ | s₂ | s₃ | a₁ | a₂ | Value |
|---|---|---|---|---|---|---|---|---|---|
| a₁ | 1 | 1 | 1 | −1 | 0 | 0 | 1 | 0 | 20 |
| a₂ | 2 | −1 | 2 | 0 | −1 | 0 | 0 | 1 | 25 |
| s₃ | 2 | 3 | 4 | 0 | 0 | 1 | 0 | 0 | 80 |
| P | −2 | −4 | −3 | 0 | 0 | 0 | 0 | 0 | 0 |
| I | −3 | 0 | −3 | 1 | 1 | 0 | 0 | 0 | −45 |
Notice that a₁ and a₂ are automatically the starting basic variables — that's exactly the problem they were designed to solve.
4 Stage 1: maximise I
Run ordinary simplex, but treat the I row as the objective row (ignore the P row entries for pivot-choosing purposes during Stage 1). Keep going until the I row has no negative entries.
If I = 0: check that a₁ and a₂ are no longer basic variables (or if they still are, their value is 0). You can now delete the I row and both artificial variable columns — their job is done.
5 Stage 2: maximise P as normal
This is just the ordinary simplex algorithm again, applied to the cleaned-up tableau from the end of Stage 1, using the P row. Keep pivoting until no negative entries remain in the P row — then read off the optimal solution exactly as before.
A problem has constraint 4x − y ≥ 12. Write this as an equation using a surplus and an artificial variable, and explain the role each one plays.
5. Minimising Problems
The simplex algorithm (and the two-stage method) is built to maximise. So what if the question asks you to minimise a cost function C? Use a neat trick: minimising C gives exactly the same solution as maximising −C.
P + 4x + 2y = 0 for the tableau). At the very end, flip the sign back: C_min = −P_max.Everything else about the two-stage method (surplus/artificial variables, Stage 1 maximising I, Stage 2 maximising P) works exactly the same way for minimisation problems — you're just working with −C the whole time instead of C.
6. The Big-M Method
The Big-M method solves exactly the same kinds of problems as the two-stage method (≥ constraints, minimisation) but does it in a single continuous run instead of two separate stages. It's an alternative approach, not a different type of problem.
Big-M: just one objective row and one run — fewer stages, but the algebra involves an "arbitrarily large number" M, which can get fiddly to track.
1 What is M?
M is a symbol representing "an enormous positive number" — bigger than any number you could realistically write down. It's never given a numerical value. It's just there to guarantee that any expression like 1 − M is definitely negative, and M − 12 is definitely positive, no matter how the rest of the numbers work out. This lets the algorithm "punish" any solution that still relies on an artificial variable, forcing them to zero automatically.
2 Setting up the Big-M tableau
- STEP 1: Use slack, surplus and artificial variables to convert every constraint into an equation, exactly as before.
- STEP 2: Rearrange each constraint that contains an artificial variable, making that artificial variable the subject (e.g.
a₁ = 18 − 2x − 3y + s₃). - STEP 3: Let
A= the sum of all artificial variables. SubtractMAfrom the objective function P, substitute in your expressions from Step 2, and simplify.
3 Running the algorithm
From here, it's the ordinary simplex algorithm — pivot column (most negative, now some entries are algebraic in M), θ-values, pivot row, row operations. The only tricky part is the arithmetic: you're adding/subtracting terms like −(4M+3) instead of plain numbers. Just treat M like an unknown you're collecting terms for, e.g. −4M+3 combined with +8M gives 4M+3.
−(4M+3) or M − 12 — wait, M−12 is actually positive (M dominates). Only expressions where the M-term itself is negative (like −4M+3 or 3−M) count as negative overall. Focus on the sign in front of the M first — that's what decides whether the whole term is negative.
The tableau is optimal (finished) when there are no negative entries in the objective row — same rule as always. At that point, any leftover terms containing M in the P value itself should have cancelled out to exactly 0 if the solution is truly feasible.
4 Big-M for minimising
Same trick as the two-stage method: introduce Q = −P, write Q in the tableau-ready form, and maximise Q using Big-M. At the end, P_min = −Q_max.
In a Big-M objective row you see the entry −(2M + 2) under column y. Is this negative? What does that mean for the algorithm?
What to Memorise
Concepts Checklist
Exam Tips & Common Mistakes
- 2. Slack Variables & the Initial Tableau
- Exam Tips & Common Mistakes
Read the full Simplex Algorithm notes free
That's the preview — create a free account to read the rest, plus flashcards and practice questions with instant AI marking. No credit card.
Unlock the full notes free →