Hexa Scholar

Linear programming: why the optimum sits at a corner

A faceted gold gem rests on a navy table under a straight brass ruler that touches it at only its single highest corner.
A straight ruler laid on a gem touches it at one corner.

The question

Inside a five-corner polygon of allowed points, which point makes 3x + 2y largest, and how can you be sure without checking every point?

You pick; the page pushes a level line across the polygon to check.

  1. 1 SeePick the best point for four goals.
  2. 2 TryTurn the goal and watch the winner.
  3. 3 ProveBuild the averaging argument line by line.
  4. 4 ApplyProblems to check yourself.
Before you start · 3 quick checks on the side of a line, where two lines cross and a point on a segment, about 3 min

Two ideas before you start

2 ideas

Each limit keeps one side of a line

Figure: the part of the plane kept by the chosen limit, shaded, with its boundary line dashed; with all five limits, the polygon P. It needs JavaScript.

Keep

Only the points that pass all five tests remain: the polygon P with corners A = (0, 0), B = (6, 0), C = (4, 4), D = (3, 5) and E = (0, 6).

A linear inequality such as 2x + y ≤ 12 keeps the points on one side of the line 2x + y = 12. The allowed points are the points that pass every test: an intersection of half-planes, here a polygon.

Exact definition

Linear program. A linear program in two variables asks for the largest (or smallest) value of a linear function \(f(x, y) = c_1 x + c_2 y\) over the set \(P\) of points that satisfy finitely many linear inequalities \(a_{i1}x + a_{i2}y \le b_i\). The vector \(c = (c_1, c_2)\) is fixed, \(P\) is the feasible set, and a point of \(P\) where \(f\) takes its largest value is a maximizer.

On this page \(P\) is the set of points with \(2x + y \le 12\), \(x + y \le 8\), \(x + 3y \le 18\), \(x \ge 0\) and \(y \ge 0\), a polygon with corners \(A = (0, 0)\), \(B = (6, 0)\), \(C = (4, 4)\), \(D = (3, 5)\) and \(E = (0, 6)\). An inequality \(a \cdot x \ge b\) is the same as \(-a \cdot x \le -b\).

A linear goal is level along parallel lines

Figure: three parallel level lines of f = x + 2y, the chosen one dashed, and an arrow in the direction c = (1, 2). It needs JavaScript.

Level k

Level line: x + 2y = 4

Every point on the dashed line has x + 2y = 4, for example (4, 0) and (0, 2). A larger k slides the line, without turning it, in the direction of the arrow c = (1, 2).

The points where f = c₁x + c₂y takes one value k form a straight line, a level line. Lines for different k are parallel, and f grows in the direction of the vector c, which is perpendicular to them.

Exact definition

Level lines. For a vector \(c \ne 0\) and a number \(k\), the level line of \(f(x) = c \cdot x\) at height \(k\) is the set of points \(x\) with \(c \cdot x = k\). Any two level lines are parallel, and each is perpendicular to \(c\): if \(c \cdot x = c \cdot x' = k\), then \(c \cdot (x' - x) = 0\).

A step from \(x\) in the direction \(c\) raises \(f\): \(f(x + tc) = f(x) + t\,|c|^2\), which is larger than \(f(x)\) for every \(t \gt 0\).

Fine print: corners, edges and weighted averages

A corner (vertex) of the polygon \(P\) is a point of \(P\) where two boundary lines with different directions cross. An edge is the part of \(P\) on one boundary line, a segment between two neighboring corners. Corners are found by solving two boundary equations at a time, as in the lesson on linear systems, and keeping the solutions that satisfy every limit.

\(P\) is convex: each half-plane is convex, and an intersection of convex sets is convex (see convex sets and convex functions). \(P\) is bounded here: it fits inside a disk. The region \(x \ge 0\), \(y \ge 0\) alone is not bounded.

Fact. Every point \(x\) of a bounded polygon with corners \(v_1, \dots, v_k\) is a weighted average of them: \(x = \lambda_1 v_1 + \dots + \lambda_k v_k\) with every \(\lambda_j \ge 0\) and \(\lambda_1 + \dots + \lambda_k = 1\). Reason: the segments from \(v_1\) to the other corners cut \(P\) into triangles, and a point of a triangle is a weighted average of its three corners. Stage 3 uses this fact.

1 See

Pick the best point for four goals

How the page decides

The page computes \(f\) at the five corners with exact arithmetic. For a goal with \(c \ne 0\), as in every round here, stage 3 proves that the largest value of \(f\) on the whole polygon is the largest corner value, and that a point other than a corner reaches it only when two neighboring corners tie, along the edge between them.

Each round has one answer and then ends. There are four rounds; a table then compares your answers with the right ones. Start over clears everything.

2 Try

Turn the goal and watch the winner

A maximizer is a point of the polygon where f takes its largest value. Two quick questions first; the explorer below them opens once both are answered.

The explorer and its goals open after you answer both questions.

3 Prove

Why no point beats the best corner

Theorem

Assumptions. \(P\) is a nonempty bounded polygon in the plane, the set of points that satisfy finitely many linear inequalities, with corners \(v_1, \dots, v_k\) (\(k \ge 3\)). The vector \(c\) is fixed, possibly \(0\), and \(f(x) = c \cdot x\). Let \(M = \max_j f(v_j)\), the largest corner value, reached at a best corner \(v_{j^*}\).

Fact used (Start tab, fine print). Every \(x \in P\) is a weighted average of the corners: \(x = \sum_j \lambda_j v_j\) with every \(\lambda_j \ge 0\) and \(\sum_j \lambda_j = 1\). Here \(\sum_j\) adds over \(j = 1, \dots, k\).

Conclusion. \(f(x) \le M\) for every \(x \in P\), so the largest value of \(f\) on \(P\) is \(M\), reached at the corner \(v_{j^*}\). If \(x\) is a maximizer, then in its weighted average every corner with \(\lambda_j \gt 0\) has \(f(v_j) = M\).

Each option is one step about the \(P\), \(c\), \(f\), \(M\), \(x\) and weights \(\lambda_j\) of the theorem. Pick the one that is true for every polygon, vector and point the theorem covers.

4 Apply

Problems

Each problem has hints and a full solution. Answers can be typed as a decimal or a fraction; amounts in dollars may include a dollar sign and commas.

Key point To solve a small linear program, find the corners by solving pairs of boundary equations, keep the ones that satisfy every limit, and compare the values of f there. On an unbounded region, first make sure a best value exists, for example with a bound like the one in P4.
Level Intermediate undergraduate Prerequisites Convex sets and convex functions; linear systems Time ~40 min

Related lessons: Convex sets explains why an intersection of half-planes is convex. Lagrange multipliers finds the best point on a curved constraint, where no corners exist. Separating hyperplanes studies lines that keep a convex set on one side, like the level line through the best corner.

Further reading