Skip to content
LoveToCalc

Linear programming

A linear expression in x and y, restricted by linear inequalities, takes its largest and smallest value at one of the region’s corners.

In Swedish: Linjär optimering

The region x ≥ 0, y ≥ 0, x + y ≤ 8, 2x + y ≤ 12, shaded, with its corners (0, 0), (6, 0), (4, 4) and (0, 8). The dashed line 3x + 2y = 20 touches the region only at the corner (4, 4), where 3x + 2y is largest.

Practice questions

A system of inequalities and an objective function: find the optimum value. Every corner of these regions has whole-number coordinates.

Largest value on a bounded region

What is the largest value of z = x + y when

  • x ≥ 0
  • y ≥ 0
  • 5x + y ≤ 25
  • 5x + 4y ≤ 40

Smallest value on an open region

What is the smallest value of z = 5x + 2y when

  • x ≥ 0
  • y ≥ 0
  • 2x + y ≥ 7
  • x + y ≥ 4

The corner point theorem

A linear programming problem has two parts:

The corner point theorem: if the objective function has a largest (smallest) value on the region, it takes that value at one of the region’s corners.

Holds when the constraints and the objective are linear, the constraints are written with ≤ or ≥, and the region has at least one corner. On a bounded region, a polygon, both the largest and the smallest value exist. On an unbounded region the value can grow without limit in some direction, and then the largest (or smallest) value does not exist.

The page has no formula, because the theorem is a statement about a polygon and not an equation.

Why the corners are enough

Every point where z = 3x + 2y has a given value lies on one straight line, and the lines for different values are parallel. A larger z moves the line further out. The largest z the region allows belongs to the last line that still touches the region, and such a line touches it at a corner, or along a whole edge when it is parallel to that edge. In the figure the dashed line is 3x + 2y = 20, and it touches the region only at (4, 4).

The corner method

  1. Draw the boundary lines, where each inequality’s two sides are equal.
  2. Intersect the lines two at a time. An intersection that satisfies every inequality is a corner.
  3. Put each corner into the objective function.
  4. The largest (smallest) value is the answer if the region is bounded. If it is not, check whether the objective grows (falls) in a direction the region continues in.

Worked example

A workshop makes chairs (x) and tables (y). It has 8 hours of labour and 12 kg of glue. A chair takes 1 hour and 2 kg of glue, a table 1 hour and 1 kg. The profit is 3 per chair and 2 per table, in hundreds. The constraints:

Objective: z = 3x + 2y, largest value.

The corners. x = 0 and y = 0 give (0, 0). y = 0 and 2x + y = 12 give (6, 0). x = 0 and x + y = 8 give (0, 8). x + y = 8 and 2x + y = 12: subtract, x = 4 and y = 4. The points (8, 0) and (0, 12) lie outside, since 2 · 8 = 16 > 12 and 0 + 12 = 12 > 8.

The values. z(0, 0) = 0, z(6, 0) = 18, z(4, 4) = 20, z(0, 8) = 16. The largest value is z = 20, with 4 chairs and 4 tables.

The same problem is worked step by step in the linear programming calculator, with the region drawn.

Common mistakes

FAQ

What if two corners give the same value? Then the objective’s level line is parallel to the edge between them, and every point on that edge gives the same value. The largest value is still one number; it is just reached at more points.

Does the answer have to be a whole number? No. A corner can have fractions as coordinates, and then the value at that corner is the answer. When whole-number solutions are asked for, such as a number of chairs, it is a different problem: the whole points near the corner are checked one by one.

What about three variables? The corner point theorem still holds, but the region is a solid and its corners are many. The simplex method is used there, moving from corner to corner instead of trying them all.

Last reviewed October 8, 2026 ·How pages are reviewed

Calculate it in practice

Straight linesAll formulas