Solving a Two-Variable Linear Program Graphically
What you will be able to do
Given a linear program in two variables, the learner can identify the feasible region from its constraints, determine which vertex or edge the objective contour last touches, compute the exact optimal solution by solving the tight constraints, and state whether the optimum is unique.
Orientation
In two variables you can see the whole thing: the region, the objective sliding across it, and the corner where it stops. The picture is a scaffold for the algebra that has to replace it at three variables and beyond.
Two variables is a severe restriction, and no serious problem has only two. The method earns its place for a different reason: it is the only place in the subject where you can see why the optimum sits at a corner. Every later result about bases and vertices is the algebraic version of what this picture shows directly.
It is also where infeasibility, unboundedness, and multiple optima stop being definitions and become three recognizably different pictures.
This unit assumes you can formulate a linear program and plot a straight line.
Intuition
Sweeping the objective contour across the region
The objective gives every point in the plane a value. Points sharing a value lie on a straight line, so the objective is really a family of parallel lines, one for each value.
Picture that family sweeping across the plane. As the value rises the line moves steadily in one direction, never tilting. Somewhere it is deep inside the feasible region; somewhere further on it has left the region entirely.
Solving the program means finding the last position at which the sliding line still touches the shaded region.
That final contact is almost always a single corner, because a line leaving a polygon touches it last at one vertex. The exception is when the line happens to be parallel to one of the region's edges: then it lifts off the whole edge at once, and every point along that edge is equally optimal.
This is the whole method. Everything that follows is the bookkeeping needed to carry it out exactly rather than by eye.
Definition
Translating the objective contour across the feasible region
The objective's contours and the direction of improvement are established in the unit on contour lines and the direction of improvement. Two facts from there are used throughout this unit: the contours of
The method. Shade the feasible region
What the final contact looks like. It is either a single vertex or an entire edge, the latter when the contour is parallel to the constraint that stops it. Two further possibilities end the method before it begins: an empty region, and a region extending without limit in the improving direction. Those four cases are the subject of the unit on terminal outcomes, which treats deciding between them as a competence in its own right; here it is enough to recognise which one you are in.
Where the method stops being a drawing. The picture locates the optimal vertex and identifies which constraints are tight there. The coordinates come from solving those tight constraints as simultaneous equations, never from reading the axes.
Procedure
Steps
Plot each constraint as a line. Replace the inequality with an equality and draw that line. The quickest way is usually its two intercepts: set
Decide which side each inequality allows. Test a point not on the line, normally the origin. If it satisfies the inequality, the allowed side is the side containing it; otherwise it is the other side. The origin fails only when the line passes through it, in which case test any other convenient point.
Shade the region satisfying every constraint at once. Include the sign restrictions:
Read off the outcome if the region is degenerate. An empty region means the program is infeasible; stop. A region unbounded in the improving direction means no finite optimum; stop.
Draw one contour line and note the improving direction. Pick any convenient value of
Identify the last corner the contour touches. Slide the contour in the improving direction, keeping it parallel, until it is about to leave the region.
Solve for that corner exactly. Identify the two constraints that are tight there and solve those two equations simultaneously. Do not read coordinates off the drawing; the drawing located the corner, and algebra gives its coordinates.
Report the value and say whether it is unique. Substitute the corner into the objective. If the contour is parallel to a binding constraint, two adjacent corners share the optimal value and every point between them is optimal too; say so.
Figure
The feasible region, objective contours, and the optimal corner
The worked example drawn: the constraints
Three contours of
| Corner | Tight constraints | |||
|---|---|---|---|---|
| Origin | 0 | 0 | 0 | |
| Upper left | 0 | 6 | 12 | |
| Intersection | 4 | 4 | 20 | |
| Lower right | 6 | 0 | 18 |
The table agrees with the picture and settles it exactly:
Worked example
A two-constraint maximization
Problem.
Goal. Find the optimal solution and value exactly.
Relevant principle. The contour
Step 1: plot the constraint lines by their intercepts.
Reason: two points determine a line, and the intercepts are the two easiest to compute.
Step 2: find the allowed side.
At the origin,
Step 3: the region.
The first quadrant, cut by both lines. Its corners are
Reason:
Step 4: the region is neither empty nor unbounded, so an optimum exists at a corner.
Step 5: the improving direction.
The objective vector is
Step 6: the last corner touched.
Sliding toward the upper right, the final contact is at the intersection of the two constraint lines. Solve
From the first,
Step 7: the optimum. The corner is
Check. Both constraints are tight there:
Interpretation. The optimum is unique: the contour slope
Note that step 7 used algebra, not the drawing. The picture identified which corner; the simultaneous equations gave its exact coordinates. On a hand-drawn axis
Contrast
The drawing locates the corner; algebra gives coordinates
The plot is a device for deciding which corner is optimal. It is not a measuring instrument, and treating it as one produces answers that are wrong in a way no amount of careful drawing can fix.
Take
Read from the plot. The lines cross somewhere near
Solve the tight constraints. At the crossing both hold with equality:
From the second,
Here the reading happened to be right. That is luck, not method: the intersection landed on integers.
Now shift one constraint. Replace the first with
The reliable division of labour. Use the picture to identify the optimal corner and which two constraints are tight there. Then solve those two equations. A hand-drawn axis cannot distinguish