Skip to content
IGCSE·Tuition
Additional Mathematics · Lessons

Form an objective function from a constraint

The calculus in an optimisation question is short, and the set-up before it is where most students get stuck.

On this page
  1. The three-line set-up
  2. Worked example
  3. Another example with a wall
  4. The mistake to watch for
  5. Check yourself
  6. Where this leads next

To form an objective function, write the quantity you want to maximise or minimise, then use the constraint to replace one variable so only one is left. Only then can you differentiate.

This is the core skill of stationary points and optimisation. It builds on finding stationary points and classifying them.

The three-line set-up

Every optimisation problem can be started with three lines.

  1. Objective: write a formula for what you are optimising, such as A = xy.
  2. Constraint: write the fixed condition as an equation, such as 2x + y = 60.
  3. Substitute: rearrange the constraint for one variable and put it into the objective, giving a function of one variable.

If you can write these three lines neatly, the rest is the same differentiate, solve and classify routine from the earlier lessons.

Worked example

A rectangle has a perimeter of 36 cm. Find the dimensions that give the largest area.

Step 1, variables: let the sides be x cm and y cm.

Step 2, constraint: perimeter gives 2x + 2y = 36, so x + y = 18 and y = 18 − x.

Step 3, objective function: A = xy = x(18 − x) = 18x − x².

Step 4, differentiate: dA/dx = 18 − 2x. Setting this to zero gives x = 9, then y = 18 − 9 = 9.

Step 5, classify: d²A/dx² = −2, which is negative, so this is a maximum.

Step 6, answer: the largest area is 9 × 9 = 81 cm², when the rectangle is a 9 cm by 9 cm square.

Another example with a wall

A farmer uses 60 m of fencing on three sides of a pen, with the fourth side against a wall. With sides x m (two of them) and y m (parallel to the wall), the constraint is 2x + y = 60. So y = 60 − 2x and A = 60x − 2x², which has a maximum at x = 15 and A = 450 m².

Notice that the constraint does not always look like “perimeter is fixed”. Reading which sides need fencing is part of the skill.

The mistake to watch for

A common slip is to write the constraint incorrectly, or to try to differentiate before eliminating.

Mistaken working: A = xy, so dA/dx = y.

The student treated y as a constant, but y changes as x changes.

The correction is that y depends on x through the constraint, so replace it first.

For the wall problem, using y = 60 − x (wrong, since two sides have length x) would give A = 60x − x², a maximum at x = 30 and the wrong answer. Always check the constraint against a labelled sketch.

Check yourself

Try these without a calculator, then open each answer.

1. Two numbers add to 12. Find the largest possible product.

Show answer

Let the numbers be x and 12 − x. P = x(12 − x) = 12x − x². dP/dx = 12 − 2x = 0 gives x = 6. d²P/dx² = −2 < 0, so it is a maximum.

Largest product = 6 × 6 = 36

2. Two numbers add to 10. Find the least possible value of the sum of their squares.

Show answer

S = x² + (10 − x)² = 2x² − 20x + 100. dS/dx = 4x − 20 = 0 gives x = 5. d²S/dx² = 4 > 0, so it is a minimum.

Least sum of squares = 25 + 25 = 50

3. A rectangle has perimeter 50 cm. Write its area as a function of one variable and find the greatest area.

Show answer

x + y = 25, so y = 25 − x and A = 25x − x². dA/dx = 25 − 2x = 0 gives x = 12.5, so y = 12.5. d²A/dx² = −2 < 0, a maximum.

Greatest area = 12.5 × 12.5 = 156.25 cm²

Where this leads next

The next lesson asks what happens when the allowed range of x is restricted: check endpoints as well as stationary values. The function composition and inverse explorer may help if you want more practice substituting one expression into another.

Teachers in online one-to-one Additional Mathematics tuition often start with exactly this skill, because a clean set-up makes the rest of the problem much shorter.

Questions people ask

What is an objective function?

It is the quantity you want to make as large or as small as possible, written as a formula. For a pen it might be the area A = xy. To differentiate it you first need it in terms of one variable only.

What is a constraint?

A constraint is a fixed condition in the problem, such as 60 m of fencing or a volume of 32 cm³. It gives an equation linking the variables, which you use to eliminate one variable from the objective function.

How do I know which variable to eliminate?

Choose the one that is easier to make the subject of the constraint. Usually that is the variable with power 1 and no other terms attached. Either choice leads to the same optimum, but one path has simpler algebra.

Updated:

Your next step

If you understand the calculus but cannot decide where to begin on a word problem, a one-to-one teacher can work through the set-up with you until the first three lines feel routine.

Paid one-hour trial at your assigned teacher’s confirmed rate, starting from RM80. Other fees, schedules and ongoing arrangements are confirmed directly with your teacher after the trial class.

Tuition is arranged with a parent or guardian. Send them this page on WhatsApp and they can enquire for you.

Parent or guardian? Enquire here

9,000+ students helped through our service