π Calculus Kingdom Β· Calculus
Optimization
Turn a word problem into a function of one variable and find its best value: two numbers, a fenced field, an open box, a can of least material, the closest point, the best price.
In short
- Separate the two roles. The constraint is what is fixed and is an equation; the objective is what you are making as large or as small as possible and is what gets differentiated. Optimising the constraint by mistake is the single most common wrong turn in the topic.
- Reduce to one variable before differentiating, and write down the domain of that variable at the same moment. An objective with two letters in it is not ready, and a critical number outside the domain is not a candidate.
- A zero derivative only makes a point a candidate. Justify it with the sign of the second derivative (negative for a maximum, positive for a minimum) or with a sign change in the first derivative, and on a closed interval compare every critical number against both endpoints.
- Answers are exact, and they answer the question asked. Keep fractions as fractions and pi as pi, and check at the end whether the question wanted the x, the value, the price or the area.
Five steps, in this order
On the bench at the Tangent Laboratory there is a coil of wire, a sheet of card, an empty tin and a slate with two numbers chalked on it. Technician Fluxion asks the same question of all four: what is the best you can do? The largest area from that wire. The biggest box from that card. The least metal in that tin. The largest product from those two numbers.
Every one of those questions is answered the same way, and the whole craft is the order of the steps.
1. Draw it, and label the moving parts with letters. Not numbers. The moment you write 5 on the drawing you have promised that side will never change, and the thing you are hunting for is exactly the change.
2. Write down the quantity you want to make big or small. This is the objective. Area, volume, cost, distance, profit β give it a name, A or V or C, and write it as a formula.
3. Write down what is fixed. This is the constraint: the 40 m of fencing, the 500 cm3 the tin must hold, the fact that the two numbers add to 30. It is an equation, and it always has one more letter in it than you want.
4. Use the constraint to reduce the objective to ONE variable. Solve the constraint for one letter, substitute it into the objective, and write down the interval of values that letter is allowed to take. This step is the whole difficulty of the topic. Once it is done, the calculus is a page of Grade 11 work.
5. Differentiate, set the derivative to zero, and justify. Then answer the question that was actually asked.
Step 4 is where nearly everything goes wrong, so it is worth saying plainly. An objective with two letters in it cannot be differentiated usefully. A = xy tells you nothing until the constraint turns it into A(x) = x(20 - x). And every reduction comes with a domain: x cannot be negative, and it cannot be so large that another length goes negative either. Write the domain down at the same time as the function. You will need it in step 5.
The families, and what each one turns into
There are perhaps six shapes of problem in the whole subject, and they repeat with different words on top.
Two numbers. "Two positive numbers add to 30; make the product largest." Constraint x + y = 30, objective P = xy, so P(x) = x(30 - x) and P'(x) = 30 - 2x. The answer is 15 and 15: with a fixed sum, an even split gives the largest product. Turn it around β "the product is 36, make the sum smallest" β and S(x) = x + 36/x, S'(x) = 1 - 36/x2, and the answer is 6 and 6 again. Weight one of them, though, and the even split stops being best: to make x*y2 largest with x + y = 30, the squared letter takes two thirds and the answer is x = 10, y = 20.
Fences. Fencing is a perimeter constraint and area is the objective. A plain rectangle with all four sides fenced comes out square. Change the perimeter and the answer changes with it: with a wall along one side, the best paddock is twice as wide as it is deep; with two internal dividing fences the shape is different again. Never reach for "it must be a square" β write 2x + 4y = 60 or whatever the fencing actually pays for, and let the derivative decide.
Boxes from a sheet. Cut a square of side x from each corner of an a by b sheet and fold the flaps up. The height is x, and each base measurement loses two cuts: V(x) = x(a - 2x)(b - 2x), on 0 < x < half of the shorter side. Expanding gives a cubic, so V'(x) is a quadratic with two roots β and usually only one of them is a length the sheet can spare.
Least material. A closed box with a square base and a fixed volume turns out to be a cube. Take the lid off and the answer changes: s3 = 2V rather than V, and the best tank is twice as wide as it is tall. A closed cylinder of fixed volume is best when h = 2r, that is, when it is exactly as tall as it is wide. Price the base differently from the sides and the shape shifts again, because the objective is now cost, not area.
The closest point. Minimise the square of the distance. It is smallest at exactly the same place, and it saves you a square root and a chain rule. To find the point of y = x2 nearest (0, 5): D(x) = x2 + (x2 - 5)2, D'(x) = 2x(2x2 - 9), and the useful roots have x2 = 9/2.
Money. Revenue is quantity times price, and the price is not a constant: a demand rule p = a - bx says that selling more forces the price down. R(x) = x(a - bx) is a downward parabola. Profit is revenue minus cost, and a fixed cost changes how much you earn without changing how much you should make.
Why it is a maximum: justifying, and checking the ends
A critical number is a candidate, nothing more. A(x) has a zero derivative at its maximum, at its minimum, and at a flat spot that is neither, so "A'(c) = 0" on its own justifies nothing. Two arguments do:
- The second derivative test. Work out A''(c). Negative means concave down, so c is a maximum; positive means concave up, so c is a minimum. Read it the right way round β the sign that looks like a frown is the one that gives the biggest value.
- The sign change. Show A'(x) > 0 to the left of c and A'(x) < 0 to the right. The function climbs, turns, and comes back down, so the turn is the highest point.
Either is enough, and in an optimization problem the second derivative is often a single number, which makes it the quicker of the two.
Then there is the part that is easy to skip. Most of these problems live on a closed interval β a cut is between 0 and half the sheet, a fenced side is between 0 and the whole roll. On a closed interval the largest and smallest values can only happen at a critical number inside it or at one of the two endpoints, so the candidates are:
the critical numbers in the interval, and both ends
Work out the objective at every candidate and compare the numbers. That is the candidates test, and it is the only method that cannot be talked out of the right answer.
Two things it protects you from. The first is a critical number outside the domain: V'(x) = 0 might offer you a cut of 10/3 cm on a sheet only 5 cm wide, which is not a box at all, and it must simply be crossed out. The second is a maximum that sits at an end rather than at a turn. Cut a wire into a square and a circle and the one critical number is the smallest total area; the largest total area is at an end, where the whole wire becomes a circle. If a problem asks for a maximum and your only critical number is a minimum, the answer is at an endpoint β that is the shape of the argument, not a dead end.
Exact answers, and the wire that keeps pi
An optimization answer is exact. If it is a whole number, say the whole number. If it is a fraction, give it in lowest terms. If pi is in it, leave pi in it.
Here is the classic that produces one. A wire 12 cm long is cut in two; one piece is bent into a square and the other into a circle. How should it be cut to make the total area as small as possible?
Let x be the length given to the square. Its side is x/4, so its area is x2/16. The other piece, of length 12 - x, becomes the circle's circumference, so the radius is (12 - x)/(2*pi) and the area is (12 - x)2/(4*pi).
A(x) = x2/16 + (12 - x)2/(4*pi), for 0 <= x <= 12 A'(x) = x/8 - (12 - x)/(2*pi)
Set A'(x) = 0 and clear the fractions: pi*x = 4(12 - x), so x(pi + 4) = 48 and
x = 48/(4 + pi) cm
A''(x) = 1/8 + 1/(2*pi) is positive, so this really is the smallest total area. The answer is 48/(4 + pi), not 6.72 β a decimal is a description of the answer, and the exact form is the answer.
Notice what the same picture says about the largest total area. A'' is positive everywhere, so the one critical number is a minimum, and the maximum has to be at an end. All wire to the square gives 9 cm2; all wire to the circle gives 144/(4*pi), which is about 11.5 cm2. The circle wins: for a given perimeter, a circle encloses more area than any square. There the endpoint is not a technicality, it is the whole answer.
One last habit, and it costs nothing. When you have the critical number, read the question again. It may want the value rather than the x, or the price rather than the quantity, or the area rather than a side. Half the marks lost in this topic are lost after the calculus is finished.
Worked examples
Example 1
An open box is made from a 5 cm by 8 cm sheet of card by cutting a square of side x from each corner and folding the flaps up. What size cut gives the largest volume, and what is that volume?
- Draw the sheet with a square of side x gone from each corner. Folding up gives a box of height x, and each base measurement has lost a cut at BOTH ends: the base is (5 - 2x) by (8 - 2x).
- Objective: V(x) = x(5 - 2x)(8 - 2x). Domain: both base measurements must stay positive, so 0 < x < 5/2.
- Expand before differentiating: V(x) = 4x3 - 26x2 + 40x, so V'(x) = 12x2 - 52x + 40 = 4(3x - 10)(x - 1).
- V'(x) = 0 gives x = 1 or x = 10/3. The second one is bigger than 5/2, so it would cut away more card than the sheet has: cross it out.
- Justify: V is zero at both ends of the domain and positive in between, so the one critical number inside it gives the maximum.
- Answer both parts: the cut is 1 cm, and V(1) = (1)(3)(6) = 18 cm3.
Example 2
A closed cylindrical can must hold 54pi cm3. What radius and height use the least metal?
- Objective: the metal is two circles and the curved side, S = 2*pi*r2 + 2*pi*r*h. Constraint: pi*r2*h = 54pi.
- Reduce to one variable. The constraint gives h = 54/r2, so S(r) = 2*pi*r2 + 2*pi*r*(54/r2) = 2*pi*r2 + 108*pi/r, for r > 0.
- Differentiate: S'(r) = 4*pi*r - 108*pi/r2. Setting it to zero, the pi cancels: 4r = 108/r2, so r3 = 27 and r = 3.
- Justify: S''(r) = 4*pi + 216*pi/r3 is positive for every r > 0, so r = 3 is a minimum.
- Finish the question: h = 54/9 = 6 cm. The best can has radius 3 cm and height 6 cm β its height is exactly its diameter, which is true of every cylinder of least surface area.
Example 3
A farmer has 120 m of fencing for a rectangular enclosure that is to be divided into three equal pens by two fences parallel to one pair of sides. What is the largest total area?
- Draw it. Let y be the length of one dividing fence. The two outer sides parallel to those dividers are also y long, so the fencing pays for four lengths of y, plus the other two sides, each of length x.
- Constraint: 2x + 4y = 120, so x = 60 - 2y. Objective: A = xy.
- Reduce to one variable: A(y) = y(60 - 2y) = 60y - 2y2, for 0 < y < 30.
- Differentiate: A'(y) = 60 - 4y = 0 gives y = 15. A''(y) = -4 is negative, so this is the maximum.
- Then x = 60 - 2(15) = 30, and the largest area is (30)(15) = 450 m2. Notice the enclosure is not a square: the internal fences are paid for out of the same 120 m, and that tilts the answer.
Practice problems, with solutions
Three problems of increasing difficulty, each with the full working. In the game these are generated fresh every time; these three are fixed so this page always shows the same ones.
Problem 1
Difficulty 1 of 5Two positive numbers add up to 10. What is the largest their product can be?
Answer: 25
- Constraint: x + y = 10, so y = 10 - x.
- P(x) = x(10 - x) = 10x - x2
- P'(x) = 10 - 2x = 0 gives x = 5.
- P''(x) = -2, which is negative, so x = 5 gives the maximum.
- Both numbers are 5, and the largest product is (5)(5) = 25.
Problem 2
Difficulty 3 of 5A right-angled triangle has one leg 24 cm long lying on the x-axis and the other leg 14 cm long lying on the y-axis, with the right angle at the origin. A rectangle is drawn inside it with two sides on those legs and one corner on the hypotenuse. What is the largest area the rectangle can have?
Answer: 84 cm2
- Hypotenuse: y = 14 - (7/12)x, for 0 < x < 24.
- A(x) = x(14 - (7/12)x) = 14x - (7/12)x2
- A'(x) = 14 - (7/6)x = 0 gives x = 12, which is half of 24.
- A''(x) = -7/6, which is negative, so this is the maximum.
- y = 14 - (7/12)(12) = 7, so the best rectangle is 12 cm by 7 cm, with area 84 cm2.
Problem 3
Difficulty 4 of 5Zara makes an open box from a 30 cm by 48 cm sheet of card by cutting a square of side x from each corner and folding the four flaps up. What size square should be cut from each corner to make the volume as large as possible?
Answer: 6 cm
- V(x) = x(30 - 2x)(48 - 2x) = 4x3 - 156x2 + 1440x, for 0 < x < 15.
- V'(x) = 12x2 - 312x + 1440
- Solving V'(x) = 0 and keeping the root inside the domain gives x = 6.
- V is zero at both ends of the domain and positive in between, so that critical number gives the maximum.
- The square cut from each corner should have side 6 cm.
Common mistakes
- Maximising the constraint instead of the objective. "Two numbers add to 30, make the product largest" is answered with a product, not with 30, and "a can holds 54pi cm^3" is the condition on the can, never the amount of metal it uses.
- Stopping at the critical number when the question wanted the value, or handing in the value when it wanted the x. Both halves of the work are usually available in one line each, so write the critical number down, then read the question again before you choose which one to give.
- Assuming the square, or forgetting to double a side. A square is best only when all four sides cost the same; a free wall, a set of internal dividers, or a missing lid changes the answer. In the same way, a rectangle under a curve reaching from -x to x is 2x wide, and a corner cut from a sheet is taken off both ends of the side.
- Keeping a critical number that lies outside the domain. V'(x) = 0 will happily offer a cut wider than the sheet. Write the interval down when you build the function, and cross out any root that falls outside it.
- Never checking the endpoints. On a closed interval the extreme value can sit at an end, and when the only interior critical number is a minimum, the maximum certainly does. The candidates test β every critical number inside, plus both ends β settles it every time.
What you should be able to do
- Write the constraint and the quantity to optimise, then reduce to one variable.
- Find the critical number and justify that it gives a maximum or a minimum.
- Solve box, fence, distance and revenue problems exactly.
- Check both endpoints of a closed domain against the critical numbers, and reject a critical number that lies outside it.
Where this fits in the curriculum
Common Core
- FUN-4.B
AP Calculus AB, Unit 5 β Solve optimization problems and justify the answer.
The Common Core has no calculus standards; this is the AP Calculus AB learning objective.