Instant PDF download, name-and-email checkout. Complete bundle: every Economics, Statistics and Mathematics book
Mathematics

Optimisation Problems in Calculus: A Step-by-Step Method with Real Cases

How to solve optimisation problems with calculus: build the objective, use the constraint, test the stationary point and check the endpoints.

In 30 seconds
  • An optimisation problem asks for the largest or smallest value of something (cost, profit, area, time) when you are free to choose one quantity.
  • Write the target as a function of one variable, using the constraint to remove any second variable, and state the domain.
  • Differentiate, set the derivative equal to zero and solve. Then prove it is a maximum or minimum with the second derivative test or a sign change.
  • On a closed interval, always compare the stationary values with the endpoints: the best answer is sometimes at the edge.
  • Finish by answering the question in words and units, not just with a value of \( x \).

The case: fencing a school garden for the least money

A school is building a rectangular vegetable garden with an area of 250 m². The side that faces the street must use a decorative steel railing, which costs $16 per metre. The other three sides can use plain wire mesh at $4 per metre. The headteacher wants to know what shape of rectangle makes the fencing as cheap as possible, and what that cheapest bill is. (The prices are illustrative, but they are in the range a school would see.)

A first guess might be a square, with sides of about 15.8 m and a fence costing around $443. Can we do better? The railing is four times as expensive as the mesh, so it makes sense to shorten the street side. Shorten it too much, though, and the garden becomes a thin strip with a huge amount of mesh. Somewhere in between is a best shape, and calculus finds it exactly.

The concept: the top of the hill, the bottom of the valley

Picture the cost as a graph against the length of the street side. As you start shortening a wide garden, the cost falls. As you keep going, it starts to rise again. At the exact turning point, the graph is flat for an instant: its gradient is zero. That flat spot is the cheapest point. The same idea finds the highest point of a profit curve or the largest volume a box can hold. Wherever a smooth quantity reaches a peak or a trough inside its range, its derivative is zero there.

Two details complete the story. A flat point could be a peak, a trough or neither, so you must check which. And real variables have limits (a length cannot be negative, a plot cannot be wider than the land), so the best value might sit at an edge, where the graph is not flat at all.

Key termOptimisation: choosing the value of a variable that makes a quantity (the objective function) as large or as small as possible, subject to the rules of the problem (the constraint and the domain). The best value over the whole domain is the absolute (or global) maximum or minimum.

The formula

For an objective function \( f(x) \) that you can differentiate twice, a stationary point \( x^* \) satisfies

\[ f'(x^*) = 0 \]

and the second derivative test tells you what kind of point it is:

\[ f”(x^*) > 0 \Rightarrow \text{min} \] \[ f”(x^*) < 0 \Rightarrow \text{max} \]

Here \( x \) is the quantity you choose (the decision variable), \( f(x) \) is what you want to make best (cost, profit, area), \( f'(x) \) is its rate of change and \( f”(x) \) measures how that rate is changing, which tells you whether the curve bends upwards (a valley) or downwards (a hill). If \( f”(x^*) = 0 \) the test gives no answer, and you check the sign of \( f'(x) \) on either side instead.

On a closed interval \( a \le x \le b \), the candidates test (also called the closed interval method) says the absolute maximum and minimum are among the values \( f(a) \), \( f(b) \) and \( f(x^*) \) at every stationary point inside the interval[1].

Mathematics Made Simple textbook coverChapter 12 of Mathematics Made Simple turns every optimisation word problem into one four-step method.Get the textbook · $12

Why this formula fits the case

The fencing bill changes smoothly as the street side changes: there are no jumps, because metres of fence can be any length. A smooth curve that falls and then rises must flatten out at its lowest point, so solving \( C'(x) = 0 \) is exactly the right way to find it. The second derivative then confirms that the flat point is the bottom of a valley and not the top of a hill.

It is not the right tool every time. If the variable can only take whole values (number of buses, number of staff), calculus gives a guide value, and you then test the whole numbers on either side. If there are two or more free variables with a constraint that you cannot easily solve for one of them, you need methods such as Lagrange multipliers. If everything is linear, the best point is always at a corner of the feasible region, and linear programming does the job. And if the domain has edges, the derivative alone can miss the answer, which is why the endpoint check matters.

Setting it up

Let the street side be \( x \) metres and the other pair of sides be \( y \) metres. The garden has four sides: one street side of railing, one back side of mesh, and two side runs of mesh.

  • Objective: total cost \( C = 16x + 4x + 4y + 4y = 20x + 8y \) dollars.
  • Constraint: area \( xy = 250 \), so \( y = \dfrac{250}{x} \).
  • One variable: substitute to get \( C(x) = 20x + \dfrac{2000}{x} \).
  • Domain: \( x > 0 \). (There is no upper limit yet; we add one in Worked example 3.)

Notice what the two terms mean. \( 20x \) is the cost that grows with the street side; \( 2000/x \) is the cost of the side runs, which shrinks as the street side grows. The optimum balances the two.

Solving it

Worked example 1

Find the dimensions that minimise \( C(x) = 20x + \dfrac{2000}{x} \) for \( x > 0 \), and the minimum cost.

Step 1Differentiate: \( C'(x) = 20-\dfrac{2000}{x^2} \).
Step 2Set \( C'(x) = 0 \): \( 20 = \dfrac{2000}{x^2} \), so \( x^2 = 100 \).
Step 3Since \( x > 0 \), \( x = 10 \) m. Then \( y = \dfrac{250}{10} = 25 \) m.
Step 4Second derivative: \( C”(x) = \dfrac{4000}{x^3} \), so \( C”(10) = \dfrac{4000}{1000} = 4 > 0 \). This is a minimum.
Step 5It is the only stationary point on \( x > 0 \), and \( C \to \infty \) as \( x \to 0 \) and as \( x \to \infty \), so it is the absolute minimum.
Step 6Minimum cost: \( C(10) = 20(10) + \dfrac{2000}{10} \), which is \( 200 + 200 = 400 \) dollars.

The cheapest garden is 10 m along the street and 25 m deep, and the fencing costs $400, compared with about $443 for the square.

Fencing cost C(x) = 20x + 2000/x $
railing + back side: 20xtwo side runs: 2000/xtotal cost C(x)
5101520253020040060080010000x (m)C ($)minimum (10, 400)(8, 410)frontage limit x = 8
Figure 1. The total cost is the sum of a rising straight line and a falling curve. It bottoms out at x = 10 m, where the two parts are equal ($200 each). If the frontage is capped at 8 m, the best you can do is the endpoint, at $410.

The second case moves from geometry to business, and the variable is a price rather than a length.

Worked example 2

A local gym finds that if it charges \( p \) dollars a month, it keeps \( N = 1200-20p \) members. Each member costs $10 a month to serve, and fixed costs (rent, staff) are $8,000 a month. Prices are allowed from $10 to $60. Find the price that maximises monthly profit. (Illustrative figures.)

Step 1Profit = (margin per member) × (members) − fixed cost: \( \pi(p) = (p-10)(1200-20p)-8000 \).
Step 2Expand: \( \pi(p) = 1200p-20p^2-12000 \) \( {}+ 200p-8000 \).
Step 3Simplify: \( \pi(p) = -20p^2 + 1400p-20000 \).
Step 4Differentiate: \( \pi'(p) = -40p + 1400 \). Setting this to zero gives \( p = 35 \).
Step 5\( \pi”(p) = -40 < 0 \), so \( p = 35 \) is a maximum.
Step 6Endpoints: \( \pi(10) = 0 \times 1000-8000 = -8000 \) and \( \pi(60) = 50 \times 0-8000 = -8000 \).
Step 7At \( p = 35 \): \( N = 1200-700 = 500 \) and \( \pi = 25 \times 500-8000 = 4500 \).

The gym should charge $35 a month. It keeps 500 members and earns $4,500 profit, far better than either endpoint.

Worked example 3 (an endpoint answer)

Back at the school, the street side sits between two existing buildings, so it can be at most 8 m long. Find the cheapest garden now.

Step 1The domain is now \( 0 < x \le 8 \). The stationary point \( x = 10 \) lies outside it, so it is not allowed.
Step 2On \( 0 < x \le 8 \) we have \( x^2 \le 64 \), so \( C'(x) \le 20-\dfrac{2000}{64} \), which is \( -11.25 < 0 \). Cost is falling all the way to the edge.
Step 3The minimum is at the endpoint \( x = 8 \): \( C(8) = 160 + \dfrac{2000}{8} \), which is \( 160 + 250 = 410 \) dollars.
Step 4Depth: \( y = \dfrac{250}{8} = 31.25 \) m.

With an 8 m frontage the best garden is 8 m by 31.25 m and costs $410. Setting \( C'(x) = 0 \) alone would have given an answer the school cannot build.

Mathematics Made Simple Practice Questions coverDrill optimisation until it is automatic with 1,565 practice questions, each with a fully worked answer.Get 1,565 questions · $9

What the answer tells us

In the garden, the minimum came where the two parts of the bill were equal: $200 on railing and back fence, $200 on side runs. That is no accident. For any cost of the form \( ax + \dfrac{b}{x} \), the minimum is at \( ax = \dfrac{b}{x} \), so the two parts balance, and the minimum cost is \( 2\sqrt{ab} \). Here \( 2\sqrt{20 \times 2000} = 2\sqrt{40000} = 400 \). If you shorten the street side past 10 m, every metre saved on railing costs more than a metre’s worth of extra mesh.

Check that the answer is sensible. The units work: metres for lengths, dollars for cost. The shape is long and narrow, as we predicted, because the expensive side should be short. And the saving over the square, about $43 or roughly 10%, is worth having on a school budget.

Sensitivity is worth a moment too. If the railing went up to $25 a metre, the cost would become \( 29x + 2000/x \), and the best street side would shrink to \( \sqrt{2000/29} \approx 8.30 \) m, at a cost of about $482. In the gym, the best price is \( p = 30 + c/2 \) for a cost per member \( c \). If that cost rose from $10 to $14, the best price would rise only from $35 to $37: the gym should pass on half of the increase, not all of it. Patterns like this are what economists call comparative statics, and they come straight from the derivative[2].

Monthly profit π(p) = (p − 10)(1200 − 20p) − 8000 $
profit at price p
1015202530354045505560−9000−6000−3000030006000p ($)π ($)maximum (35, 4500)(10, −8000)(60, −8000)
Figure 2. Profit is a downward parabola in price. Both endpoints of the sensible price range lose the full $8,000 fixed cost; the peak is at p = $35.
Common mistakeStopping at \( x = 10 \) and writing it as the answer. The question asked for the dimensions and the cost, so give \( x = 10 \) m, \( y = 25 \) m and $400. Examiners reward the final, interpreted answer, and the value of \( x \) alone rarely earns the last mark.
Common mistakeKeeping two variables. You cannot differentiate \( C = 20x + 8y \) usefully while \( y \) is free. Always use the constraint to write \( y \) in terms of \( x \) before you differentiate.
Exam tipAP Calculus AB/BC (topics 5.10 and 5.11) expects you to justify an absolute extremum: either the candidates test on a closed interval, or “the only critical point, and \( f’ \) changes sign from negative to positive” on an open one[3]. Cambridge 9709 Pure Mathematics 1 (topic 1.7) usually splits the question into “show that \( C = 20x + 2000/x \)” and then “find the stationary value and determine its nature”[4]. IB Mathematics: analysis and approaches SL 5.8 sets optimisation in context, often with a GDC allowed for the solving step[5].

The Mathematics Made Simple textbook builds this method up in Chapter 12, and the Mathematics Made Simple practice questions book adds two full mock papers for timed practice.

Mathematics Made Simple bundle coverGet both Mathematics Made Simple books for $16 and cover optimisation for AP, Cambridge 9709 and IB AA.Both books · $16

Practice questions

EasyQ1. A rectangle has a perimeter of 36 cm. Find the largest area it can have. Show worked answer
Let the sides be \( x \) and \( 18-x \), with \( 0 < x < 18 \).
\( A = x(18-x) = 18x-x^2 \), so \( A’ = 18-2x \).
\( A’ = 0 \) gives \( x = 9 \), and \( A” = -2 < 0 \), so it is a maximum.
The rectangle is a 9 cm by 9 cm square, with area \( 81 \) cm².
EasyQ2. A firm’s profit is \( \pi(Q) = 120Q-3Q^2-500 \) dollars. Find the output that maximises profit, and the maximum profit. Show worked answer
\( \pi'(Q) = 120-6Q = 0 \) gives \( Q = 20 \).
\( \pi”(Q) = -6 < 0 \), so it is a maximum.
\( \pi(20) = 2400-1200-500 = 700 \) dollars.
MediumQ3. A closed box has a square base of side \( x \) cm and a volume of 324 cm³. The base and lid cost 3 cents per cm², and the four sides cost 2 cents per cm². Find the dimensions that minimise the cost, and the minimum cost. Show worked answer
Height \( h = \dfrac{324}{x^2} \).
Cost \( C = 3(2x^2) + 2(4xh) = 6x^2 + \dfrac{2592}{x} \) cents.
\( C'(x) = 12x-\dfrac{2592}{x^2} = 0 \) gives \( x^3 = 216 \), so \( x = 6 \) cm and \( h = 324/36 = 9 \) cm.
\( C”(x) = 12 + \dfrac{5184}{x^3} \), so \( C”(6) = 36 > 0 \): a minimum.
\( C(6) = 216 + 432 = 648 \) cents, which is $6.48.
MediumQ4. The volume of water in a tank, in hundreds of litres, is \( V(t) = t^3-9t^2 + 24t + 10 \) for \( 0 \le t \le 6 \) hours. Find the greatest and least volumes over this period. Show worked answer
\( V'(t) = 3t^2-18t + 24 = 3(t-2)(t-4) \), so the stationary points are \( t = 2 \) and \( t = 4 \).
Candidates: \( V(0) = 10 \), \( V(2) = 30 \), \( V(4) = 26 \), \( V(6) = 46 \).
Greatest volume 4,600 litres at \( t = 6 \) (an endpoint); least volume 1,000 litres at \( t = 0 \) (also an endpoint). The local maximum at \( t = 2 \) is not the absolute maximum.
ExamQ5. A power cable runs from a station \( A \) on one bank of a straight river 300 m wide to a point \( B \) on the opposite bank, 1,000 m downstream. The cable goes underwater from \( A \) to a point \( P \) on the far bank, \( x \) m downstream, and then along the bank to \( B \). Underwater cable costs $50 per metre; cable on land costs $30 per metre. (a) Show that the cost is \( C(x) = 50\sqrt{90000 + x^2} + 30(1000-x) \). [2] (b) Find the value of \( x \) that minimises the cost. [4] (c) Find the minimum cost and show it is less than both endpoint costs. [3] Show worked answer
(a) By Pythagoras, \( AP = \sqrt{300^2 + x^2} = \sqrt{90000 + x^2} \) [1]; the land section is \( 1000-x \), so \( C = 50\sqrt{90000 + x^2} + 30(1000-x) \) [1].
(b) \( C'(x) = \dfrac{50x}{\sqrt{90000 + x^2}}-30 \) [1]. Setting it to zero: \( 50x = 30\sqrt{90000 + x^2} \) [1], so \( 25x^2 = 9(90000 + x^2) \) and \( 16x^2 = 810000 \) [1]. So \( x^2 = 50625 \) and \( x = 225 \) m [1].
(c) \( \sqrt{90000 + 50625} = \sqrt{140625} = 375 \), so \( C(225) = 50(375) + 30(775) \), which is \( 18750 + 23250 = 42000 \) dollars [1]. \( C(0) = 15000 + 30000 = 45000 \) [1]; \( C(1000) = 50\sqrt{1090000} \approx 52202 \) [1]. The minimum is $42,000.

Frequently asked questions

Do I always need the second derivative test?

No. Any valid justification works: the second derivative, a sign change in the first derivative, or the candidates test on a closed interval. The second derivative is quickest when it is easy to compute; the sign change is safer when \( f”(x^*) = 0 \).

What is the difference between a local and an absolute maximum?

A local maximum is higher than the points just around it. The absolute maximum is the highest value over the whole domain. In Q4 above, \( t = 2 \) is a local maximum, but the absolute maximum is at the endpoint \( t = 6 \).

What if there is no stationary point in the domain?

Then the function is rising or falling throughout, and the optimum (if there is one) is at an endpoint, as in Worked example 3. On an open domain with no stationary point, there may be no maximum or minimum at all.

References

  1. Strang, G. and Herman, E. (2016) Calculus Volume 1, Section 4.7 “Applied Optimization Problems”. Houston, TX: OpenStax. https://openstax.org/details/books/calculus-volume-1
  2. Chiang, A.C. and Wainwright, K. (2005) Fundamental Methods of Mathematical Economics, 4th edn. New York: McGraw-Hill.
  3. College Board (2020) AP Calculus AB and AP Calculus BC Course and Exam Description, Unit 5, topics 5.10–5.11. New York: College Board.
  4. Cambridge International (2024) Cambridge International AS & A Level Mathematics 9709: Syllabus for examination in 2026 and 2027, Pure Mathematics 1, topic 1.7 Differentiation. Cambridge: Cambridge University Press & Assessment.
  5. International Baccalaureate Organization (2019) Mathematics: analysis and approaches guide (first assessment 2021), SL 5.8. Cardiff: IBO.
Mathematics Made Simple complete bundle cover
This topic has a full chapter in Mathematics Made Simple, with 1,565 fully worked practice questions in the bundle.Mathematics Made Simple Complete Bundle — Textbook + 1,565 Practice Questions
Get it for $16
E

The EconTutorials team writes clear, exam-focused lessons in economics and statistics for A-Level, IB, AP and university students, with more than 13 years of classroom teaching behind every guide and book in the Made Simple series.