Module 2 of 6 · Lesson 2 of 3

Contour Lines and the Direction of Improvement

Where the objective is constant, and which way along it improves.

What you will be able to do

Given a linear objective and a direction of optimisation, the learner can draw or describe the contour family, identify the coefficient vector as the direction of increase, decide whether a proposed direction improves the objective, and state which way a contour must be pushed.

Orientation

Points of equal objective value form parallel lines. Everything about solving a linear program graphically follows from knowing which way to push them.

Those are two skills, not one, and only the first is drawing. The family of lines needs the slope, and the slope is identical whether you are maximising or minimising. Which way to push needs the sign, and the sign comes from the coefficient vector together with the direction of optimisation.

This matters because the second skill fails silently. A contour family drawn perfectly and pushed the wrong way produces a confident answer at the wrong corner, and nothing in the drawing looks amiss.

This unit assumes you can compute a dot product and plot a straight line.

Intuition

Deciding the direction on a worked program

Two programs sharing one contour family, worked to the point where the drawing stops helping.

Program A. Maximise 3 x 1 + 2 x 2 . Program B. Minimise 3 x 1 + 2 x 2 .

The contour family is identical: the lines 3 x 1 + 2 x 2 = k for varying k , all with slope − 3 / 2 . Drawing them is the same task in both programs, and the drawing is equally correct in both.

Where they differ. Take the point ( 2 , 2 ) , objective value 10 , and move along d = ( 1 , 1 ) :

c T d = 3 ( 1 ) + 2 ( 1 ) = 5 > 0 ,

so the objective rises by 5 per unit travelled. Program A wants that move; Program B wants − d . Nothing in the picture distinguishes the two, because a family of parallel lines carries no orientation.

A direction that changes nothing. Take d = ( 2 , − 3 ) :

c T d = 3 ( 2 ) + 2 ( − 3 ) = 6 − 6 = 0 .

Moving along ( 2 , − 3 ) from any point keeps the objective at its current value. That direction is along a contour, and it is the same contour direction for both programs. Note it is perpendicular to c = ( 3 , 2 ) , which is the whole content of the geometry.

A test to run before trusting a drawing. Pick any two points in the feasible region, compute the objective at both, and confirm the one you believe is better actually scores better. On Program B, ( 0 , 0 ) scores 0 and ( 2 , 2 ) scores 10 , so ( 0 , 0 ) is the better of the two, which contradicts the habit of pushing away from the origin. The arithmetic settles it; the drawing never will.

Why this is the error that survives practice. A learner who has only maximised builds the habit "push away from the origin", and it works every time until the first minimisation. The habit is a coincidence of the problems seen, not a rule, and the drawing offers no warning when it fails.

Figure

Objective contours and the coefficient vector normal to them

c fixes the contours; the contours fix c only up to sign and scale

The two ways of seeing a linear objective, drawn in one scene because the lesson's idea is the translation between them.

As contours. 3 x 1 + 2 x 2 = k is a line for each k , and the lines are parallel: same slope − 3 / 2 , different intercepts. Three are drawn, at k = 6 , 12 and 18 . Moving along any one of them changes x 1 and x 2 but not the objective, which is what a contour is.

As a vector. The coefficient vector c = ( 3 , 2 ) is drawn in red. It is perpendicular to every contour, and it points the way k increases. The blue segment lies along a contour, at right angles to c : the direction in which the objective stays put.

The translation is the thing to carry away:

c ⟷ c T x = k .

The two forms carry different information, which is why the lesson keeps both. From c you can draw the whole family: they are the lines it crosses squarely, spaced by | c | . From an unlabelled family you recover only the normal direction, up to scale and sign — c and − c produce exactly the same lines, and so does 2 c . Which way is uphill, and how fast, is what the vector adds.

Maximising means sliding the contour as far as it will go along c while still touching the region, which is the graphical method in one sentence. It needs the vector, not only the family.

Definition

Contours, the coefficient vector, and the sign test

The canonical statement gives the contour geometry and the test c T d . Its value is that one identity answers questions that look separate.

Which way to move. The objective changes by λ c T d , so a direction improves a maximisation exactly when c T d > 0 . No drawing is required and the test works in any dimension, which matters because the picture stops at three.

Whether a whole edge is optimal. If c T d = 0 along an edge, every point on it has the same objective value. That is the multiple-optima case, and it is detected by the same dot product rather than by inspecting the drawing for a parallel contour.

Why the gradient and the contours are both needed. The contour family says where equal-value lines run but is identical for c and − c , so it cannot say which way improves. The vector c supplies the orientation and says nothing about the values. A maximisation pushes along c , a minimisation against it, and the two representations are used together for that reason.

A caution about slope: − c 1 / c 2 is undefined when c 2 = 0 , where the contours are vertical. The dot product has no such special case.

Example

Reading direction off the coefficients

A maximisation with positive coefficients. max 3 x 1 + 2 x 2 gives c = ( 3 , 2 ) . Contours have slope − 3 / 2 . Push along ( 3 , 2 ) , up and to the right. Check: from ( 0 , 0 ) to ( 3 , 2 ) the objective goes from 0 to 13 .

The same objective minimised. min 3 x 1 + 2 x 2 . The contours are identical lines with identical slope. Push against ( 3 , 2 ) , towards the origin. Nothing about the drawing changed; the travel direction reversed.

A negative coefficient. max 2 x 1 − 5 x 2 gives c = ( 2 , − 5 ) . Improvement means moving right and down. A learner pushing 'away from the origin' by habit would slide up and to the right and lose 5 per unit of x 2 gained.

A direction test. With c = ( 2 , − 5 ) , is d = ( 1 , 1 ) improving for a maximisation? c T d = 2 − 5 = − 3 < 0 : no, it worsens the objective. Is d = ( 5 , 2 ) ? c T d = 10 − 10 = 0 : neither. It runs along a contour, and the objective is unchanged.

The last case is the significant one. A direction with c T d = 0 is exactly how a linear program comes to have an edge of equally good answers.

Worked example

Deciding which corner a minimisation reaches

Problem. For

min x 1 − 3 x 2 subject to x 1 + x 2 ≤ 6 , x 1 ≤ 4 , x 1 , x 2 ≥ 0 ,

say which corner the contour reaches last, using the direction of improvement rather than testing every corner.

Goal. Identify the optimal corner from the geometry, then confirm.

Relevant principle. c points towards increase; a minimisation travels against c .

Step 1: write down c . c = ( 1 , − 3 ) .

Step 2: find the travel direction. Minimising, so travel along − c = ( − 1 , 3 ) : left and up. Decreasing x 1 and increasing x 2 both reduce the objective, which matches the signs directly. A positive coefficient on x 1 means less x 1 is better, a negative coefficient on x 2 means more x 2 is better.

Step 3: push that way within the region. Going left drives x 1 to its smallest feasible value; going up drives x 2 as high as the constraints allow. With x 1 = 0 , the binding limit is x 1 + x 2 ≤ 6 , giving x 2 = 6 . The corner is ( 0 , 6 ) .

Step 4: confirm against the other corners. They are ( 0 , 0 ) , ( 4 , 0 ) , ( 4 , 2 ) and ( 0 , 6 ) , with objective values 0 , 4 , − 2 and − 18 . The minimum is − 18 at ( 0 , 6 ) , as predicted.

Check the sign convention held. Had this been a maximisation, travel would be along c = ( 1 , − 3 ) , right and down, reaching ( 4 , 0 ) with value 4 , the largest of the four. The region never changed; only the travel direction did.

What did the work. The coefficient signs alone identified the corner before any value was computed. Enumerating the corners confirmed it; it was not the method.

Non-example

Things that are not the improving direction

Not the improving direction: the contour's own slope. The contour for max 3 x 1 + 2 x 2 has slope − 3 / 2 , and ( − 2 , 3 ) is a direction along it. Moving that way changes the objective by c T d = − 6 + 6 = 0 . Along the contour is precisely where nothing improves.

Not the improving direction: away from the origin. For max 2 x 1 − 5 x 2 , the direction ( 1 , 1 ) leads away from the origin and worsens the objective, since c T ( 1 , 1 ) = − 3 . The habit works only for objectives with all-positive coefficients and fails quietly otherwise.

Not a contour: a constraint line. x 1 + 2 x 2 ≤ 8 drawn as x 1 + 2 x 2 = 8 is a boundary of the region. It bounds what is permitted. A contour bounds nothing. It records where the objective is constant, and it extends across the whole plane, inside the region and outside it alike.

Not a reason to reverse c : a minimisation. For min 3 x 1 + 2 x 2 the vector c = ( 3 , 2 ) still points towards increase. It is not redefined as ( − 3 , − 2 ) . What changes is that you travel against it. Redefining c per problem type is how sign errors enter the reduced-cost test later, where there is no picture to catch them.

Contrast

Contour slope against direction of improvement

Two facts about a linear objective look like one fact, and separating them is the whole of this unit.

What the drawing settles. Where the equal-value lines run. This needs only the ratio of the coefficients, and it is identical for max 3 x 1 + 2 x 2 , for min 3 x 1 + 2 x 2 , and for max − 3 x 1 − 2 x 2 . All three produce the same family of parallel lines of slope − 3 / 2 .

What the drawing cannot settle. Which way along them improves. Those three problems travel in three different ways: along ( 3 , 2 ) , against ( 3 , 2 ) , and against ( 3 , 2 ) respectively. A family of parallel lines carries no orientation, so no amount of care in drawing recovers it.

Why the error survives inspection. Suppose the direction is taken backwards on the first of these. The contours are correct, the region is correct, the contour is slid neatly until it last touches, at the wrong corner. The output is a specific point and a specific value, both plausible, neither flagged by anything visible. Compare an arithmetic slip, which usually produces something that looks odd.

The habit that prevents it. Write c down explicitly, state whether you are maximising or minimising, and say the travel direction in words before sliding anything: maximising, so travel along c , or minimising, so travel against c . When a direction is in doubt, test it: compute c T d and read the sign. One multiplication settles what an hour of careful drawing cannot.

Exercise

1. For max 5 x 1 + x 2 , give the contour slope and the travel direction. Then do the same for min 5 x 1 + x 2 .

2. With c = ( 4 , − 1 ) and a maximisation, decide for each direction whether it improves, worsens, or leaves the objective unchanged: ( 1 , 1 ) , ( 1 , 4 ) , ( − 1 , 0 ) .

3. Find a nonzero direction along which max 6 x 1 + 9 x 2 does not change, and say what it would mean for such a direction to run along an edge of the feasible region.

4. A learner says: 'It is a minimisation, so I flipped the objective to − c and then pushed away from the origin.' Is the answer right? Is the reasoning? Explain what happens if they later reuse this on min − 2 x 1 + 3 x 2 .

5. Two objectives, max 2 x 1 + 3 x 2 and max 4 x 1 + 6 x 2 , are optimised over the same region. What is the same about their contour families, what is the same about their optimal solutions, and what differs about their optimal values?

What to carry forward

A linear objective assigns a value to every point. Equal-value points form contours: parallel straight lines sharing the coefficient vector, differing only in position.

The coefficient vector c is orthogonal to every contour and points towards increase, always, irrespective of whether the problem maximises or minimises. What the direction of optimisation changes is which way you travel: along c to maximise, against c to minimise.

Any direction can be tested rather than judged. Moving along d changes the objective by c T d , so the sign of one dot product decides whether d improves, worsens, or does nothing. A direction with c T d = 0 runs along a contour, and when such a direction lies along an edge of the feasible region, that edge is a set of equally optimal points.

Drawing the family and choosing the direction are separate skills with separate failure modes, and only the second fails invisibly. This same quantity returns as the reduced cost once the geometry is gone, where the sign convention is all that remains of the picture.

Next step

Practice Contour Lines and the Direction of Improvement

Practice records what support you used, so the evidence reflects how you actually performed.

Practice this lessonSkip to Solving a Two-Variable Linear Program Graphically

Results update as you type. Use the up and down arrow keys to move between results, Enter to open one, and Escape to close.

Type to search.

Settings

Appearance

Interface density

Your record

Your progress is stored in this browser and nowhere else: an identifier, the answers you have given, the mastery states and review schedule derived from them, and the lesson you last opened. Clearing it makes you a new learner on this device. It cannot be undone, and it will not affect your appearance or density settings.

Focus timer

Focus--minutes remaining

Phase

Kept in this browser only, and used to label the session in your own history.

Today

Nothing recorded yet. Finish a focus session and it will appear here.

Settings

Focus sessions between long breaks.

Sessions you are aiming for in a day.

Notifications

Your history

Sessions are stored in this browser and nowhere else. They are not evidence and never reach your mastery record.