Skip to content
spmaddmath.com.my
Tuition

Study

SyllabusFormulasMethodsExam & PapersTools
LocationsPricingBlogOur TeachersContact
EN

Worked examples · Linear Programming

Linear Programming, Worked Examples (medium)

These medium Linear Programming examples move from setting up a region to working inside it: you find the corner points yourself by solving boundary lines in pairs, model a short word problem as a full set of constraints, and then optimise, once for a maximum profit and once for a minimum cost. Work each fully on paper first, then check every line against ours.

What these examples cover

These medium Linear Programming examples move from setting up the region to working inside it. You will find the corner points yourself by solving two boundary lines at a time, translate a short word problem into a full set of constraints, and then optimise, once for a maximum profit and once for a minimum cost.

The numbers stay clean, but now the vertices are earned rather than handed to you, which is exactly what the SPM questions ask. Attempt each fully on paper first: form the model, find every corner, then substitute into the objective.

Only after that, check your working line by line against ours and locate any step that differs.

Worked examples

Work through all three. Notice the shared shape: identify the boundary lines, solve them in pairs to pin down the corners, then let the objective function decide between those corners.

Q1[5 marks]

A feasible region is defined by x0x\ge 0, y0y\ge 0, x+y8x+y\le 8 and y3xy\le 3x. The objective function is k=5x+4yk=5x+4y.

(a) Find the coordinates of the vertices of the region. (b) Determine the maximum value of kk.

Show worked solution

(a) The region is bounded by four lines: the axes x=0x=0 and y=0y=0, the line x+y=8x+y=8, and the line y=3xy=3x. Find the corners by solving these boundaries in pairs, keeping only the crossings that satisfy every inequality.

y=3x,  y=0    (0,0)y=3x,\; y=0 \;\Rightarrow\; (0,0)
x+y=8,  y=0    (8,0)x+y=8,\; y=0 \;\Rightarrow\; (8,0)
y=3x,  x+y=8    x+3x=8,  4x=8,  x=2,  y=6y=3x,\; x+y=8 \;\Rightarrow\; x+3x=8,\; 4x=8,\; x=2,\; y=6

So the region is the triangle with vertices O(0,0)O(0,0), B(8,0)B(8,0) and C(2,6)C(2,6).

(b) Evaluate k=5x+4yk=5x+4y at each vertex:

At O(0,0):k=5(0)+4(0)=0\text{At } O(0,0):\quad k=5(0)+4(0)=0
At B(8,0):k=5(8)+4(0)=40\text{At } B(8,0):\quad k=5(8)+4(0)=40
At C(2,6):k=5(2)+4(6)=10+24=34\text{At } C(2,6):\quad k=5(2)+4(6)=10+24=34

Answer

The vertices are O(0,0)O(0,0), B(8,0)B(8,0) and C(2,6)C(2,6), and the maximum value is k=40k=40 at B(8,0)B(8,0). Because 5x5x rewards xx more heavily than 4y4y rewards yy, the corner with the largest xx wins, even though it uses no yy at all.

Q2[6 marks]

A bakery makes xx cakes and yy pies each day under these conditions: the oven holds at most 12 items in total; demand keeps the number of pies to at most twice the number of cakes; and a standing order needs at least 2 cakes each day. The profit is P=5x+9yP=5x+9y ringgit.

(a) Write the three inequalities (besides x0x\ge 0 and y0y\ge 0). (b) Find how many of each to make for maximum profit, and state that profit.

Show worked solution

(a) Translate each condition. 'At most 12 in total' caps the sum; 'pies at most twice the cakes' bounds yy by 2x2x; 'at least 2 cakes' sets a floor on xx.

x+y12,y2x,x2x+y\le 12,\qquad y\le 2x,\qquad x\ge 2

(b) The corners of this region are where the boundary lines x=2x=2, y=0y=0, y=2xy=2x and x+y=12x+y=12 meet in pairs. Solve each pair and keep the points that obey every constraint:

x=2,  y=0    (2,0)x=2,\; y=0 \;\Rightarrow\; (2,0)
x=2,  y=2x    y=4,(2,4)x=2,\; y=2x \;\Rightarrow\; y=4,\quad (2,4)
y=2x,  x+y=12    3x=12,  x=4,  y=8,(4,8)y=2x,\; x+y=12 \;\Rightarrow\; 3x=12,\; x=4,\; y=8,\quad (4,8)
x+y=12,  y=0    (12,0)x+y=12,\; y=0 \;\Rightarrow\; (12,0)

Now evaluate the profit P=5x+9yP=5x+9y at each corner:

At (2,0):  P=5(2)+9(0)=10\text{At }(2,0):\; P=5(2)+9(0)=10
At (2,4):  P=5(2)+9(4)=10+36=46\text{At }(2,4):\; P=5(2)+9(4)=10+36=46
At (4,8):  P=5(4)+9(8)=20+72=92\text{At }(4,8):\; P=5(4)+9(8)=20+72=92
At (12,0):  P=5(12)+9(0)=60\text{At }(12,0):\; P=5(12)+9(0)=60

Answer

The maximum profit is P=RM92P=\text{RM}\,92, made by baking 44 cakes and 88 pies. Both quantities must be whole numbers, and (4,8)(4,8) already is, so the plan is directly usable.

Notice the winner is the corner where the two slanted lines y=2xy=2x and x+y=12x+y=12 meet, not one sitting on an axis.

Q3[5 marks]

A feasible region is defined by x0x\ge 0, y0y\ge 0, x+2y8x+2y\ge 8 and 2x+y102x+y\ge 10. The cost function is C=3x+2yC=3x+2y.

Find the minimum cost and the point at which it occurs.

Show worked solution

The two \ge constraints push the region away from the origin, so it stretches out to the upper right without an upper bound, there is no maximum, but a minimum exists at a corner. Find the corners by pairing the boundaries and keeping those that satisfy both inequalities.

x+2y=8,  y=0    (8,0)x+2y=8,\; y=0 \;\Rightarrow\; (8,0)
2x+y=10,  x=0    (0,10)2x+y=10,\; x=0 \;\Rightarrow\; (0,10)

The two slanted lines also cross. Take x=82yx=8-2y from the first and substitute into the second:

2(82y)+y=10    163y=10    y=2,  x=42(8-2y)+y=10 \;\Rightarrow\; 16-3y=10 \;\Rightarrow\; y=2,\; x=4

So the corners of the region are (8,0)(8,0), (4,2)(4,2) and (0,10)(0,10). The other axis crossings each break the constraint they were not built from: (5,0)(5,0) gives x+2y=5<8x+2y=5<8, and (0,4)(0,4) gives 2x+y=4<102x+y=4<10, so neither is a vertex.

Now evaluate C=3x+2yC=3x+2y:

At (8,0):  C=3(8)+2(0)=24\text{At }(8,0):\; C=3(8)+2(0)=24
At (4,2):  C=3(4)+2(2)=12+4=16\text{At }(4,2):\; C=3(4)+2(2)=12+4=16
At (0,10):  C=3(0)+2(10)=20\text{At }(0,10):\; C=3(0)+2(10)=20

Answer

The minimum cost is C=16C=16 at (4,2)(4,2). This is the vertex where the two slanted constraints meet, which is often exactly where the cheapest feasible plan sits.

Q4[3 marks]

A feasible region is defined by x0x\ge 0, y0y\ge 0, 2x+y102x+y\le 10 and x+3y12x+3y\le 12. Determine which of the points A(3,2)A(3,2), B(5,3)B(5,3) and C(1,4)C(1,4) lies inside the feasible region.

Show worked solution

A point lies in the feasible region only if it satisfies every inequality at once, not just one of them. Test each point against 2x+y102x+y\le 10 and x+3y12x+3y\le 12, all three points already have x0x\ge 0 and y0y\ge 0.

A(3,2):2(3)+2=810,3+3(2)=912A(3,2):\quad 2(3)+2=8\le 10, \qquad 3+3(2)=9\le 12

Both limits hold for AA, so it satisfies every constraint and lies inside the region.

B(5,3):2(5)+3=13>10C(1,4):1+3(4)=13>12B(5,3):\quad 2(5)+3=13>10 \qquad C(1,4):\quad 1+3(4)=13>12

BB already breaks the first constraint, and CC passes the first (2(1)+4=6102(1)+4=6\le 10) but breaks the second, so neither point is feasible.

Answer

Only A(3,2)A(3,2) lies inside the feasible region. BB and CC each fail one of the two inequalities, which is enough to place them outside, a feasible point must pass every constraint together.

Q5[3 marks]

A boundary line of a feasible region passes through P(4,0)P(4,0) and Q(0,6)Q(0,6), and the origin lies inside the region. (a) Find the equation of line PQPQ.

(b) State the inequality that the feasible region satisfies along this boundary.

Show worked solution

(a) Use the two intercepts to form the equation: the line crosses the xx-axis at 44 and the yy-axis at 66, so write it in intercept form and clear the fractions.

x4+y6=1    3x+2y=12\frac{x}{4}+\frac{y}{6}=1 \;\Rightarrow\; 3x+2y=12

(b) Since the origin lies inside the region, substitute (0,0)(0,0) into the left-hand side and compare it with 1212.

3(0)+2(0)=0,0<123(0)+2(0)=0, \quad 0<12

Answer

The boundary line is 3x+2y=123x+2y=12, and because the origin satisfies 3x+2y<123x+2y<12 and lies inside the region, the feasible side is 3x+2y123x+2y\le 12. Check: both given points satisfy this with equality, 3(4)+2(0)=123(4)+2(0)=12 and 3(0)+2(6)=123(0)+2(6)=12, exactly as intercepts should.

Q6[3 marks]

In a linear programming problem, the objective function is P=3x+qyP=3x+qy, where qq is a positive constant. The maximum value of PP is 3838, occurring at the vertex (6,4)(6,4).

Find the value of qq.

Show worked solution

Substitute the vertex and the given maximum value into the objective function; this gives one equation in qq.

3(6)+q(4)=383(6)+q(4)=38
18+4q=38    4q=20    q=518+4q=38 \;\Rightarrow\; 4q=20 \;\Rightarrow\; q=5

Answer

q=5q=5, which is positive as required. Check: with q=5q=5, P=3(6)+5(4)=18+20=38P=3(6)+5(4)=18+20=38, matching the given maximum exactly.

Q7[4 marks]

A feasible region is defined by x0x\ge 0, y0y\ge 0, x8x\le 8 and x+2y12x+2y\le 12. The objective function is K=x+2yK=x+2y.

(a) Find the vertices of the region. (b) Find the maximum value of KK, and describe every point where it occurs.

Show worked solution

(a) The region is bounded by the axes, the line x=8x=8 and the line x+2y=12x+2y=12. Pair the boundaries to find each vertex.

x=0,  y=0    (0,0)x=8,  y=0    (8,0)x=0,\;y=0 \;\Rightarrow\;(0,0) \qquad x=8,\;y=0 \;\Rightarrow\;(8,0)
x=8,  x+2y=12    y=2,  (8,2)x=0,  x+2y=12    y=6,  (0,6)x=8,\;x+2y=12 \;\Rightarrow\; y=2,\;(8,2) \qquad x=0,\;x+2y=12 \;\Rightarrow\; y=6,\;(0,6)

(b) Evaluate K=x+2yK=x+2y at every vertex.

K(0,0)=0,K(8,0)=8,K(8,2)=8+4=12,K(0,6)=0+12=12K(0,0)=0,\quad K(8,0)=8,\quad K(8,2)=8+4=12,\quad K(0,6)=0+12=12

KK reaches 1212 at both (8,2)(8,2) and (0,6)(0,6), and this is not a coincidence. K=x+2yK=x+2y has exactly the same gradient as the boundary line x+2y=12x+2y=12, so every point along that edge already satisfies x+2y=12x+2y=12, which means K=12K=12 all the way along it, not only at the two endpoints.

Answer

The vertices are (0,0)(0,0), (8,0)(8,0), (8,2)(8,2) and (0,6)(0,6). The maximum value is K=12K=12, achieved at every point on the edge joining (8,2)(8,2) and (0,6)(0,6), a whole line segment of optimal solutions, not a single vertex.

Q8[4 marks]

A relief centre packs xx food boxes and yy hygiene boxes for a distribution run. The run must include at least 1212 boxes in total; because hygiene items are more limited, the number of hygiene boxes must be at least half the number of food boxes; and storage limits food boxes to at most 1616.

Each food box costs RM8 and each hygiene box costs RM5. (a) Write the three inequalities (besides x0x\ge 0 and y0y\ge 0).

(b) Find how many of each box gives the minimum cost, and state that cost.

Show worked solution

(a) Translate each condition. 'At least 12 in total' sets a floor on the sum; 'hygiene boxes at least half the food boxes' bounds yy below by x2\frac{x}{2}; 'at most 16 food boxes' caps xx.

x+y12,x2y,x16x+y\ge 12,\qquad x\le 2y,\qquad x\le 16

(b) The vertices of this region sit where x+y=12x+y=12, x=2yx=2y and x=16x=16 meet in pairs, together with the axis x=0x=0. Solve each relevant pair:

x=0,  x+y=12    (0,12)x+y=12,  x=2y    2y+y=12,  y=4,  x=8,  (8,4)x=0,\;x+y=12 \;\Rightarrow\;(0,12) \qquad x+y=12,\;x=2y \;\Rightarrow\; 2y+y=12,\;y=4,\;x=8,\;(8,4)
x=2y,  x=16    y=8,  (16,8)x=2y,\;x=16 \;\Rightarrow\; y=8,\;(16,8)

Now evaluate the cost C=8x+5yC=8x+5y at each corner:

C(0,12)=8(0)+5(12)=60,C(8,4)=64+20=84,C(16,8)=128+40=168C(0,12)=8(0)+5(12)=60,\quad C(8,4)=64+20=84,\quad C(16,8)=128+40=168

Answer

The minimum cost is C=RM60C=\text{RM}\,60, packing 00 food boxes and 1212 hygiene boxes. This makes sense: the ratio condition only sets a floor on hygiene boxes relative to food boxes, never the reverse, so the cheapest feasible plan simply avoids the pricier item altogether.

The pattern never changes, boundaries, corners, objective, whether you are chasing a maximum or a minimum, and whether the region is a tidy triangle or an open wedge stretching away from the origin.

Key method points

These three examples rehearse the core skill of the chapter: turning a region into a short list of corner points, then testing the objective at each. Keep the following in mind.

  • Find a corner by solving the two boundary lines that meet there as a pair of simultaneous equations.
  • Substitution and elimination both work; pick whichever keeps the numbers cleaner for that pair of lines.
  • Always check a candidate corner satisfies every other constraint, an intersection point that breaks a constraint is not a vertex of the region.
  • For a maximum profit, take the largest objective value among the corners; for a minimum cost, take the smallest.
  • A region can be unbounded and still have a minimum (or a maximum) at a corner, as long as the objective is pushed toward that corner.
  • Keep x0x\ge 0 and y0y\ge 0 in the model whenever the variables count real quantities, and give the answer as whole units when the context demands it.

How a teacher helps

The step students most often rush is checking that an intersection point really belongs to the region. Two lines always cross somewhere, but that crossing counts as a vertex only if it obeys every other constraint.

Our teacher slows this exact moment down, testing each candidate corner against the full list before it is used. Because our teachers are experienced, you build the habit of proving a corner rather than assuming it.

Lessons are taught in English, while SPM papers are set in both Malay and English, so the notation reads the same to you either way.

Get 1-to-1 help.

Book a Trial Class

Frequently asked questions

How do I find a corner point exactly?

Take the two boundary lines that meet at that corner and solve them as a pair of simultaneous equations, by substitution or elimination. The solution is the corner's coordinates, but only count it as a vertex if it also satisfies every other constraint.

Can a Linear Programming problem have no maximum?

Yes. If the region is unbounded in the direction the objective grows, the objective can increase without limit, so there is no maximum, though a minimum may still exist at a corner.

A bounded region always has both a maximum and a minimum.

The answer had y=0y=0. Is that allowed?

Yes. A corner can sit on an axis, and the optimum is free to land there.

It simply means the best plan uses none of that variable. Report the corner and the objective value as normal.

Do I need to draw the graph, or is algebra enough?

In the exam you draw and shade the region, then read or calculate the corners. Working the corners algebraically, as here, is the reliable check: it pins each vertex to exact coordinates rather than an estimate read off the grid.

Source:SRC-DSKP-EN

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