Skip to content
spmaddmath.com.my
Tuition

Study

SyllabusFormulasMethodsExam & PapersTools
LocationsPricingBlogOur TeachersContact
EN

Chapter · Linear Programming

Linear programming: turning words into a graph

Linear programming looks like a word problem and a graph problem stuck together, and that is exactly what it is. You translate a situation into linear inequalities, draw the region where all of them are true at once, and then find the point in that region that makes your target quantity as large or as small as possible.

What linear programming really asks

Linear programming is one of the few chapters in Add Math where almost all the marks come from reading carefully rather than from clever algebra. The maths itself is gentle, straight lines and simple inequalities.

The challenge is translation: turning an everyday situation, written in ordinary sentences, into mathematics you can draw.

Every linear programming question is built from two ingredients. First, a set of constraints, the limits you must respect, such as how much material you have, how much time, or a required ratio.

Second, an objective, the one quantity you are trying to make as big as possible (a profit, an amount produced) or as small as possible (a cost). Both the constraints and the objective are always linear, which is why the whole picture can be drawn with straight lines.

The plain idea

Out of all the choices allowed by the rules, which one is best? Linear programming gives you a reliable, visual way to answer that, you never have to guess.

Turning the words into inequalities

Start by naming your two unknowns clearly, almost always xx and yy, and writing down exactly what each one counts. This single habit prevents more lost marks than anything else, because every inequality afterwards depends on it.

If xx is "the number of type A items" and yy is "the number of type B items", write that sentence down first.

Then work through the passage one sentence at a time. Each restriction becomes one inequality.

The trick is knowing which phrase turns into which symbol, and here the everyday English is very consistent:

The wordsBecomes
at least, not less than, a minimum of\geq
at most, not more than, a maximum of\leq
more than, exceeds>>
less than, fewer than<<
y is at least twice xy2xy \geq 2x
the total does not exceed 12x+y12x + y \leq 12

Two quiet constraints are almost always present even when the passage never mentions them: you usually cannot have a negative amount of anything, so x0x \geq 0 and y0y \geq 0. Forgetting these is a classic way to draw the wrong region.

Finally, write the objective function, the thing to be optimised, as a separate line, for example a return of k=4x+6yk = 4x + 6y.

maximise (or minimise)k=ax+by\text{maximise (or minimise)}\quad k = ax + by
The objective function, the quantity you want at its best.

Drawing the region where the answers live

Each inequality describes a half of the graph, everything on one side of a straight line. To draw it, first draw the line as if it were an equation (replace the inequality sign with ==).

For x+y12x + y \leq 12 you draw the line x+y=12x + y = 12; the easiest way is to find where it crosses the axes: when x=0,y=12x = 0, y = 12, and when y=0,x=12y = 0, x = 12.

Then decide which side you want. A quick, safe method is to test a point that is not on the line, the origin (0,0)(0,0) is ideal when the line does not pass through it.

If the point makes the inequality true, the region you want is the side containing that point; if it makes it false, you want the other side.

Do this for every inequality on the same axes. The feasible region is the area where all of the inequalities are satisfied at the same time, the overlap of all the wanted sides.

Shade it clearly and label it RR. Whichever shading convention your school uses, make sure it is obvious to a marker exactly which region is your answer.

Draw lines lightly first

Rule your lines faintly, decide the region, then darken the boundary of RR. A neat, unambiguous region is worth real marks, because the rest of the question is read off it.

Finding the best point

Here is the fact that makes linear programming reliable: when the objective is linear, its greatest and least values over a region always occur at a corner (vertex) of that region. You never have to search the inside.

This means the whole optimisation shrinks to a short checklist, find the corners, test each one.

  1. 1

    Find the vertices

    Read the corner coordinates off the graph, or solve the two lines that cross at each corner as simultaneous equations.

  2. 2

    Evaluate the objective

    Put each corner's xx and yy into k=ax+byk = ax + by.

  3. 3

    Pick the best

    The largest value is the maximum; the smallest is the minimum. State the point and the value in a sentence.

There is also the "moving line" method, where you draw one line of the objective and slide it across the region until it last touches a corner, useful, but the corner-testing checklist above is the most dependable under exam pressure.

Q1[6 marks]

A craft group prepares two kinds of gift hamper each week: xx of type A and yy of type B. They can prepare not more than 12 hampers in total.

They must prepare at least 3 of type A. The number of type B prepared is not more than twice the number of type A.

Each type A hamper returns RM4 and each type B returns RM6. Write the inequalities, then find how many of each to prepare for the greatest return.

Show worked solution

Let xx = type A hampers, yy = type B hampers. Translating each sentence gives the constraints:

  • Not more than 12 in total: x+y12x + y \leq 12
  • At least 3 of type A: x3x \geq 3
  • Type B not more than twice type A: y2xy \leq 2x
  • Cannot be negative: y0y \geq 0

Objective: maximise k=4x+6yk = 4x + 6y. The corners of the feasible region are (3,0)(3,0), (3,6)(3,6), (4,8)(4,8) and (12,0)(12,0).

Testing each in k=4x+6yk = 4x + 6y:

Corner (x,y)(x,y)k=4x+6yk = 4x + 6y
(3,0)(3,0)12
(3,6)(3,6)48
(4,8)(4,8)64
(12,0)(12,0)48

The greatest value is at (4,8)(4,8). So they should prepare 4 type A and 8 type B hampers for a greatest return of RM64.

The mistakes that cost marks

Most lost marks in this chapter are not maths errors at all, they are reading and drawing errors. A short mental checklist catches almost all of them before they happen.

  • Mixing up \leq and \geq. Re-read the phrase and match it to the table above; "not more than" is \leq, not <<.
  • Forgetting x0x \geq 0 and y0y \geq 0, which quietly changes the whole region.
  • Reading a ratio the wrong way round: "B is at most twice A" is y2xy \leq 2x, not x2yx \leq 2y.
  • Leaving the region unclear, so the marker cannot tell which area is RR.
  • Testing only some corners, or misreading a corner's coordinates off the graph.

Why neat working pays here

Because it needs a full graph drawn on graph paper, linear programming fits the longer structured questions of Paper 2 (2 hours 30 minutes, 100 marks; there is no Paper 3). Marking is analytic, so each correct inequality, a clearly shaded region, and each tested corner is a scorable step, you can earn most of the marks even if the final choice slips.

Your calculator is a non-programmable scientific calculator, which is all the arithmetic here needs.

How one-to-one teaching can help

Linear programming is a chapter where a student can understand every line of the theory and still lose marks, simply because the translation step, words into inequalities, is a skill that grows with feedback. Working one-to-one, a teacher can watch how you read a passage, catch the exact sentence you misread, and show you the habit of naming variables and testing corners until it becomes automatic.

Our teachers are experienced; lessons are online and taught in English, while the SPM papers are set bilingually in Bahasa Melayu and English.

If this chapter feels slippery, you are welcome to begin with a one-hour paid trial class at the teacher's own rate (from RM50 per hour, depending on experience). We won't promise a grade, but we can help you turn a wordy, intimidating question into a calm, step-by-step routine you trust.

Get 1-to-1 help.

Book a Trial Class

Frequently asked questions

Do I shade the region I want or the region I don't want?

Either convention can be marked correct, as long as it is unambiguous. The safest habit is to shade the feasible region RR itself and label it clearly, so the marker sees exactly which area holds your answer.

Whatever you choose, state it once and be consistent.

Why is the best answer always at a corner?

Because the objective k=ax+byk = ax + by is linear, its value changes steadily as you move across the region and can only reach its greatest or least value at an edge, and among the edges, at a corner. That is why you only ever need to test the vertices, never the inside of the region.

What do "at least" and "at most" become?

"At least" (or "not less than", "a minimum of") becomes \geq. "At most" (or "not more than", "a maximum of") becomes \leq.

"More than" is a strict >> and "less than" a strict <<. Matching the phrase to the symbol carefully is where most of the marks are won.

Which paper is linear programming in?

Because it needs a drawn graph on graph paper, it fits the longer structured questions of Paper 2 (2 hours 30 minutes, 100 marks). There is no Paper 3 in Add Math, and marking is analytic, so your inequalities, region and corner tests each score along the way.

Source:SRC-FORMAT

Written by the spmaddmath.com.my editorial team.· Last updated 5 September 2026

Ready to get started?

Book a Trial Classfrom RM50/hr · One-hour paid trial · Same-day reply
Book a Trial ClassOne-hour paid trial · Same-day reply