# How do I solve linear programming?

Maximizes or minimizes a linear objective subject to linear constraints (≤, ≥ or =) with every variable at least 0, showing the corner points for two variables and the exact optimum.

- Page: https://www.acalculator.org/math/linear-programming-calculator
- JSON spec: https://www.acalculator.org/math/linear-programming-calculator.json
- Version: f7e15588235a

## 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 | Corner points | The objective at each corner of the feasible region (for two variables), or the simplex tableaus otherwise. |

## Method

Every variable ≥ 0. The optimum of a linear objective over the feasible region is at a corner point; the page finds it with the two-phase simplex method in exact fractions and, for two variables, lists every corner with z there.

## 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 step is exact.

## 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, §3.1 Maximization Applications (corner-point method; Examples 1 to 3), 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.01%3A_Maximization_Applications (retrieved 2026-10-05) (Example 1: corners (0, 0), (0, 12), (4, 8), (8, 0); the maximum $400 at (4, 8)).
2. goal = max, obj = 20x + 30y, st = x + y <= 7
x + 2y <= 12
2x + y <= 12 gives value = 190, solution = x = 2, y = 5. Source: Sekhon and Bloom, Applied Finite Mathematics, §3.1 Maximization Applications (corner-point method; Examples 1 to 3), 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.01%3A_Maximization_Applications (retrieved 2026-10-05) (Example 2: the maximum $190 at (2, 5)).
3. goal = max, obj = 10x + 15y, st = x + y >= 1
x + 2y <= 6
2x + y <= 6 gives value = 50, solution = x = 2, y = 2. Source: Sekhon and Bloom, Applied Finite Mathematics, §3.1 Maximization Applications (corner-point method; Examples 1 to 3), 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.01%3A_Maximization_Applications (retrieved 2026-10-05) (Example 3, mixed constraints: the maximum 50 at (2, 2)).
4. goal = min, obj = 15x + 25y, st = x >= 1
y >= 1
20x + 30y >= 110 gives value = 85, solution = x = 4, y = 1. Source: Sekhon and Bloom, Applied Finite Mathematics, §3.2 Minimization Applications (Examples 1 and 2), 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) (Example 1: the minimum $85 at (4, 1)).
5. 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 (Examples 1 and 2), 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) (Example 2: the minimum 1080 at (8, 12)).

## FAQ

### What is linear programming?

A way to find the largest or smallest value of a linear objective, such as profit 40x + 30y, when the variables must meet linear constraints, such as x + y ≤ 12 and 2x + y ≤ 16, and cannot be negative.

### How does the corner point method work?

The constraints mark out a region of allowed points, the feasible region. The fundamental theorem of linear programming says the best value is at a corner of that region. So list the corners, work out the objective at each, and pick the largest (or smallest).

### How do I type the problem?

Type the objective as an expression, such as 40x + 30y. Type each constraint on its own line with <=, >= or =, such as 2x + y <= 16. You may use ≤ and ≥, decimals, fractions such as 1/2, and any variable names. Every variable is taken to be at least 0.

### What does an example look like?

Maximize 40x + 30y with x + y ≤ 12 and 2x + y ≤ 16. The corners are (0, 0), (0, 12), (4, 8) and (8, 0), giving 0, 360, 400 and 320, so the maximum is 400 at x = 4, y = 8.

### What if there is no answer?

If no point meets every constraint, the problem is infeasible. If the objective can grow (or fall) forever inside the region, it is unbounded and has no maximum (or minimum). The page says which.

### Can it solve problems with more than two variables?

Yes, up to 8 variables and 12 constraints. With more than two variables the region cannot be drawn flat, so the page shows the simplex tableaus instead of the corner list.

## Sources

- Sekhon and Bloom, Applied Finite Mathematics, §3.1 Maximization Applications (the corner-point method and the fundamental theorem of linear programming; Examples 1 to 3), 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.01%3A_Maximization_Applications (retrieved 2026-10-05)
- Sekhon and Bloom, Applied Finite Mathematics, §3.2 Minimization Applications (Examples 1 and 2), 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)
- Sekhon and Bloom, Applied Finite Mathematics, §4.2 Maximization By The Simplex Method (the tableau, pivot column, ratio test and pivot), 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)
