Optimisation: the Box and the Can

Where the quantity you want most of stops growing, its rate of change is zero, and that is how a derivative finds the best box or the cheapest can without trying every one. Move the cut or the radius and watch the tangent level off, then work through the solution a step at a time, including the step that checks the ends of the allowed range.

Extremes on a closed interval
Loading interactive simulation...

Lesson

The theory — Optimisation: the Box and the Can

Optimisation with a derivative: write the quantity you want largest or smallest as a function of one variable on the interval the problem allows, find where its derivative is zero, and compare the values there with the values at the ends of the interval. A differentiable function's largest and smallest values on a closed interval are among those candidates.

What each symbol means

x
the side of the square cut from each corner of the sheet, in cm
r
the radius of the can, in cm; its height then follows from the volume
k
what a cm² of end costs, measured in cm² of wall
Assumes
The sheet is square and the box has no lid. The can is a closed cylinder, and its metal is counted by area alone: no seams, no rims, no allowance for the thickness of the sheet.

Problems solved in full

  1. The best box from a 24 cm square 3 steps

    Cut equal squares from the corners of a 24 cm square sheet and fold up the sides. Which cut gives the box of largest volume, and what does it hold?

    Open this problem in the tool

    1. Write the volume in the cut x. The cut cannot pass half the side:

    2. Differentiate with the product rule and take out the common factor:

    3. Both roots are candidates, and so are the two ends of the range:

    Answer

    Cut 4 cm from each corner. The box is 16 cm square and 4 cm deep, and holds 1,024 cm³. The cut is a sixth of the side, as it is on every square sheet. The root x = 12 is a candidate too, and gives no box at all: the two cuts on each side meet and leave no base.

  2. The same sheet, at most 3 cm deep 3 steps

    The box from the 24 cm sheet has to fit a shelf, so it can be at most 3 cm deep. What is the best cut now, and is the derivative zero there?

    Open this problem in the tool

    Show solution
    1. The volume is the same function on a shorter range:

    2. Both factors of V′ stay positive across the range:

    3. So the volume rises all the way to the limit, and the best box is at the end:

    Answer

    Cut 3 cm. The box holds 972 cm³, and the rate there is 108 cm³ per cm, not zero. Setting V′ = 0 gives x = 4, which is ruled out. The largest value sits at an end of the interval, and only checking the ends finds it.

  3. The can of least metal 3 steps

    A closed cylindrical can must hold 1000 cm³, and its ends are cut from the same sheet as its wall. Which radius uses the least metal, and how tall is that can?

    Open this problem in the tool

    Show solution
    1. The volume fixes the height, which leaves the metal as a function of r alone:

    2. Set M′(r) = 0:

    3. The height and the metal. M′ is negative below this radius and positive above it, so this is the minimum:

    Answer

    r ≈ 5.42 cm and h ≈ 10.84 cm: the can is as tall as it is wide, and uses 553.6 cm² of metal. h = 2r is exact, not a coincidence of rounding: with πr³ = 500, h = 1000/(πr²) = 2r.

  4. Lids stamped from squares 3 steps

    The same 1000 cm³ can, but each end is stamped from a square of side 2r and the corners are thrown away. Counting the whole squares, which radius uses the least metal now?

    Open this problem in the tool

    Show solution
    1. A cm² of end now costs the square’s area over the circle’s, 4/π, so the ends weigh more:

    2. Set M′(r) = 0:

    3. The metal, and the height:

    Answer

    r = 5 cm, 600 cm² of metal, and the can is 12.73 cm tall. The ends take 200 cm² and the wall 400 cm², half, as at every best can. Dearer ends make the best can narrower and taller: 1.27 diameters, which is 4/π.

  5. The best box from a sheet of A4 4 steps

    A sheet of A4 paper is 21 cm by 29.7 cm. Cut the same square from each corner, fold up the sides, and find the cut that gives the box of largest volume, and that volume. The page's sheets are square. Press A4's short side to see a 21 cm square, whose best cut is 3.5 cm and whose box holds 686 cm³.

    Open this problem in the tool

    Show solution
    1. With a cut of x the base is 21 − 2x by 29.7 − 2x and the box is x deep. Multiplied out, for cuts up to half the short side:

    2. Differentiate term by term:

    3. Set V′(x) = 0 and use the quadratic formula. The number under the root is 16 × 699.39, which tidies it:

    4. The second root is past 10.5 cm, where the short side is used up, so it is not a box. At both ends of the range the volume is 0, so the best box comes from the first root:

    Answer

    Cut 4.04 cm from each corner: the box is 12.92 cm by 21.62 cm and 4.04 cm deep, and it holds about 1,128.5 cm³, a little over a litre. The cut lies between a sixth of the short side, 3.5 cm, and a sixth of the long side, 4.95 cm, and is neither. For a sheet a by b the best cut is (a + b − √(a² − ab + b²))/6. On a square sheet the root is just a, and the formula collapses to the page's L/6.

Miss the best cut by a fifth and the box loses about 3% 🖖

At the best cut the rate V′ is zero, so a small miss costs very little. Press Best box, then Cut 4 cm: a cut 20% too shallow loses 3.2% of the volume, and the table shows a cut 20% too deep losing 2.8%. On any square sheet, missing by a fraction δ loses δ²(3 − δ)/4 of the volume. The square is there because the curve is level at the top, and the −δ is why cutting too deep costs a little less than cutting too shallow.

A depth limit moves the best box to the edge, where the slope is not zero 🖖

Press At most 4 cm deep. Only cuts up to 4 cm are allowed now, and the grey band covers the rest. V′ = 0 still points at 5 cm, which is ruled out. Across the allowed range V′ is positive, so the volume climbs all the way to the limit: the best box is the 4 cm one, and the rate there is still 132. V′ = 0 finds where the curve is level, and a best point at the edge of the allowed range need not be level at all. That is why the steps check the ends of the range as well. On a 30 cm sheet any limit under 5 cm binds this way, and any limit of 5 cm or more changes nothing.

At the can of least metal, the ends cost half as much as the wall 🖖

Widen the can a little and its ends grow while its wall shrinks. The best radius is where the two rates balance, 4kπr = 2V/r², and multiplying by r/2 turns that into 2kπr² = V/r: the ends cost exactly half of the wall’s 2V/r. Press Lids from squares, where each lid is stamped from a square and the corners are scrap, and the card still reads 0.5. It does for every volume and every price of end metal. The price changes the shape instead: the best can is k diameters tall, as tall as it is wide when the ends are wall metal, 1.27 diameters with square-stamped lids. A wrong shape is cheap, for the same reason as the box: Tall can is 1.5 diameters and uses only 1.75% more metal.

Learning path

Differentiation: how rates combine

References (2)