# How do I use the simplex method?

Solves a linear programming problem by the simplex method and shows every tableau, pivot column, ratio test and pivot, with the two-phase method for ≥ and = constraints.

- Page: https://www.acalculator.org/math/simplex-method-calculator
- JSON spec: https://www.acalculator.org/math/simplex-method-calculator.json
- Version: d35229eb7c9b

## Default answer

Example with the default inputs (Goal Maximize, Objective z = 40x + 30y, Constraints (one per line, or split by ;) x + y <= 12; 2x + y <= 16): The optimal value is 400, at x = 4, y = 8.

## Inputs

| Key | Label | Description |
| --- | --- | --- |
| goal | Goal | Whether to find the largest or the smallest value of the objective. |
| obj | Objective z = | The expression to maximize or minimize, such as 40x + 30y. |
| st | Constraints (one per line, or split by ;) | Each constraint on its own line, with ≤ (<=), ≥ (>=) or =, such as x + y <= 12. Every variable is at least 0. |

## Outputs

| Key | Label | Description |
| --- | --- | --- |
| value | Optimal value of z | The largest (or smallest) value of the objective that meets every constraint. |
| solution | Where it occurs | The value of each variable at the optimum. |
| exact | Exact optimal value | The optimal value as a decimal, or as a fraction when its decimal does not end. |
| steps | Simplex tableaus | Each simplex tableau, the pivot chosen and why, up to the optimal tableau. |

## Method

Add a slack variable to each ≤ row (and a surplus and an artificial variable to each ≥ row, an artificial to each = row). Pivot on the most negative bottom-row entry and the smallest ratio until no bottom entry is negative; with artificials, first maximize −(sum of artificials).

## Assumptions

- Every variable is at least 0; lines such as x ≥ 0 may be typed but are not needed.
- A strict < or > is read as ≤ or ≥.
- Typed decimals and fractions are read exactly, and every tableau is exact.
- Ties go to the first column, and in the ratio test to the row whose basic variable comes first; after 50 pivots the first negative column is used, so the method cannot cycle.

## Worked examples

1. goal = max, obj = 40x + 30y, st = x + y <= 12
2x + y <= 16 gives value = 400, solution = x = 4, y = 8. Source: Sekhon and Bloom, Applied Finite Mathematics, §4.2 Maximization By The Simplex Method (Example 4.2.1: maximize Z = 40x₁ + 30x₂ with x₁ + x₂ ≤ 12 and 2x₁ + x₂ ≤ 16; pivot on 2, then on 1/2; x₁ = 4, x₂ = 8, Z = 400), CC BY 4.0, https://math.libretexts.org/Bookshelves/Applied_Mathematics/Applied_Finite_Mathematics_(Sekhon_and_Bloom)/04:_Linear_Programming_The_Simplex_Method/4.02:_Maximization_By_The_Simplex_Method (retrieved 2026-10-05).
2. goal = max, obj = 2x + 3y + 4z, st = 3x + 2y + z <= 10
2x + 5y + 3z <= 15 gives value = 20, solution = x = 0, y = 0, z = 5.
3. goal = min, obj = 60x + 50y, st = 8x + 16y >= 200
60x + 40y >= 960
2x + 2y >= 40 gives value = 1,080, solution = x = 8, y = 12. Source: Sekhon and Bloom, Applied Finite Mathematics, §3.2 Minimization Applications (Example 2: minimize 60x + 50y with 8x + 16y ≥ 200, 60x + 40y ≥ 960, 2x + 2y ≥ 40; the minimum 1080 at (8, 12)), CC BY 4.0, https://math.libretexts.org/Bookshelves/Applied_Mathematics/Applied_Finite_Mathematics_(Sekhon_and_Bloom)/03%3A_Linear_Programming_-_A_Geometric_Approach/3.02%3A_Minimization_Applications (retrieved 2026-10-05).
4. goal = max, obj = x + y, st = x + 3y <= 4
3x + y <= 4 gives value = 2, solution = x = 1, y = 1, exact = 2.
5. goal = max, obj = x + 2y, st = 3x + 3y <= 4 gives value = 2.666667, solution = x = 0, y = 4/3 ≈ 1.333333333, exact = 8/3 ≈ 2.666666667.

## FAQ

### What is the simplex method?

A step-by-step way to solve a linear programming problem. It starts at a corner of the feasible region (all main variables 0) and moves from corner to corner, raising the objective each time, until no move can raise it further.

### How do I choose the pivot column?

Pick the most negative entry in the bottom row. Its variable enters the solution. If no entry is negative, the tableau is optimal.

### How do I choose the pivot row?

Divide each right-side value by the positive entry in the pivot column, and pick the row with the smallest ratio. In the first tableau of maximize 40x + 30y with x + y ≤ 12 and 2x + y ≤ 16, the ratios are 12 and 8, so the pivot is the 2 in row 2.

### What are slack variables?

A slack variable turns a ≤ constraint into an equation: x + y ≤ 12 becomes x + y + s1 = 12, with s1 ≥ 0 the unused amount. A ≥ constraint gets a surplus variable that is subtracted instead.

### How does the simplex method handle ≥ and = constraints?

With the two-phase method. Each ≥ and = row gets an artificial variable. Phase 1 drives the artificial variables to 0, which finds a starting corner; if it cannot, the problem is infeasible. Phase 2 then optimizes the real objective.

### How do I minimize with the simplex method?

Maximize −z instead. The page puts z’s coefficients (not their negatives) in the bottom row and reads the minimum as minus the final bottom-right value. Minimizing 60x + 50y under three ≥ constraints gives 1080 at (8, 12).

## Sources

- Sekhon and Bloom, Applied Finite Mathematics, §4.2 Maximization By The Simplex Method (Example 4.2.1, the tableau and the pivot rules), CC BY 4.0, on Mathematics LibreTexts. https://math.libretexts.org/Bookshelves/Applied_Mathematics/Applied_Finite_Mathematics_(Sekhon_and_Bloom)/04:_Linear_Programming_The_Simplex_Method/4.02:_Maximization_By_The_Simplex_Method (retrieved 2026-10-05)
- Sekhon and Bloom, Applied Finite Mathematics, §3.2 Minimization Applications (Example 2: minimize 60x + 50y; the minimum 1080 at (8, 12)), CC BY 4.0, on Mathematics LibreTexts. https://math.libretexts.org/Bookshelves/Applied_Mathematics/Applied_Finite_Mathematics_(Sekhon_and_Bloom)/03%3A_Linear_Programming_-_A_Geometric_Approach/3.02%3A_Minimization_Applications (retrieved 2026-10-05)
