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 max⁡[a,b]f, min⁡[a,b]f∈ { f(a), f(b) } ∪ { f(c): f′(c)=0 }\begin{aligned}&\max_{[a,b]}f,\ \min_{[a,b]}f\\ &\quad\in\ \{\,f(a),\ f(b)\,\}\ \cup\ \{\,f(c):\ f'(c)=0\,\}\end{aligned}
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. A can's radius may be any positive number, so there are no ends to compare, and the sign of the derivative decides instead: negative at every point before the critical one and positive at every point after, the function falls and then rises, and the critical point is its least value on the whole range.

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:

      V(x)=x (24−2x)2,0≤x≤12V(x)=x\,(24-2x)^{2},\qquad 0\le x\le12
    2. Differentiate with the product rule and take out the common factor:

      V′(x)=(24−2x)2+x⋅2(24−2x)(−2)=(24−2x)(24−6x)V'(x)=(24-2x)^{2}+x\cdot2(24-2x)(-2)=(24-2x)(24-6x)
    3. Both roots are candidates, and so are the two ends of the range:

      V′(x)=0 ⇒ x=4 or x=12,V(0)=V(12)=0,V(4)=4×162=1,024V'(x)=0\ \Rightarrow\ x=4\ \text{or}\ x=12,\qquad V(0)=V(12)=0,\qquad V(4)=4\times16^{2}=1{,}024

    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.

    x=4 cm,V=1,024 cm3x=4\ \mathrm{cm},\qquad V=1{,}024\ \mathrm{cm^{3}}
  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:

      V(x)=x (24−2x)2,0≤x≤3V(x)=x\,(24-2x)^{2},\qquad 0\le x\le3
    2. Both factors of V′ stay positive across the range:

      0≤x≤3:24−2x≥18>0,24−6x≥6>0 ⇒ V′(x)>00\le x\le3:\qquad 24-2x\ge18>0,\quad 24-6x\ge6>0\ \Rightarrow\ V'(x)>0
    3. So the volume rises all the way to the limit, and the best box is at the end:

      V(3)=3×182=972,V′(3)=18×6=108V(3)=3\times18^{2}=972,\qquad V'(3)=18\times6=108

    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.

    x=3 cm,V=972 cm3,V′(3)=108≠0x=3\ \mathrm{cm},\qquad V=972\ \mathrm{cm^{3}},\qquad V'(3)=108\neq0
  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:

      πr2h=1000 ⇒ h=1000πr2,M(r)=2πr2+2πrh=2πr2+2000r\pi r^{2}h=1000\ \Rightarrow\ h=\frac{1000}{\pi r^{2}},\qquad M(r)=2\pi r^{2}+2\pi r h=2\pi r^{2}+\frac{2000}{r}
    2. Set M′(r) = 0:

      M′(r)=4πr−2000r2=0 ⇒ r3=500π ⇒ r=5.419 cmM'(r)=4\pi r-\frac{2000}{r^{2}}=0\ \Rightarrow\ r^{3}=\frac{500}{\pi}\ \Rightarrow\ r=5{.}419\ \mathrm{cm}
    3. The height and the metal. M′ is negative below this radius and positive above it, so this is the minimum:

      h=1000π×5.4192=10.84=2r,M=2π(5.419)2+20005.419=553.6 cm2h=\frac{1000}{\pi\times5{.}419^{2}}=10{.}84=2r,\qquad M=2\pi(5{.}419)^{2}+\frac{2000}{5{.}419}=553{.}6\ \mathrm{cm^{2}}

    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.

    r≈5.42 cm,h=2r≈10.84 cm,M≈553.6 cm2r\approx5{.}42\ \mathrm{cm},\qquad h=2r\approx10{.}84\ \mathrm{cm},\qquad M\approx553{.}6\ \mathrm{cm^{2}}
  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:

      k=(2r)2πr2=4π,M(r)=2kπr2+2000r=8r2+2000rk=\frac{(2r)^{2}}{\pi r^{2}}=\frac{4}{\pi},\qquad M(r)=2k\pi r^{2}+\frac{2000}{r}=8r^{2}+\frac{2000}{r}
    2. Set M′(r) = 0:

      M′(r)=16r−2000r2=0 ⇒ r3=125 ⇒ r=5 cmM'(r)=16r-\frac{2000}{r^{2}}=0\ \Rightarrow\ r^{3}=125\ \Rightarrow\ r=5\ \mathrm{cm}
    3. The metal, and the height:

      M(5)=8×25+20005=200+400=600,h=100025π=12.73 cmM(5)=8\times25+\frac{2000}{5}=200+400=600,\qquad h=\frac{1000}{25\pi}=12{.}73\ \mathrm{cm}

    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/π.

    r=5 cm,M=600 cm2,200400=0.5r=5\ \mathrm{cm},\qquad M=600\ \mathrm{cm^{2}},\qquad \frac{200}{400}=0{.}5
  5. Fencing against a wall 3 steps

    A farmer has 60 m of fence to make a rectangular pen against a long wall, which serves as the fourth side. Which dimensions give the largest area?

    x x 60 − 2x A
    Show solution
    1. Let x be each side running out from the wall. The fence left for the side parallel to it is 60 − 2x, so the area is a function of x alone, on the range the fence allows:

      A(x)=x (60−2x)=60x−2x20≤x≤30\begin{aligned}&A(x)=x\,(60-2x)=60x-2x^{2}\\&0\le x\le30\end{aligned}
    2. Set A′ = 0:

      A′(x)=60−4x=0 ⇒ x=15A'(x)=60-4x=0\ \Rightarrow\ x=15
    3. Compare with the ends, where the pen has no area:

      A(15)=15⋅30=450A(0)=A(30)=0\begin{aligned}&A(15)=15\cdot30=450\\&A(0)=A(30)=0\end{aligned}

    Answer

    15 m out from the wall and 30 m along it, for 450 m². The side along the wall is twice the others. Without the wall the best pen is a square 15 m on a side, for only 225 m²: the wall saves a whole side of fence.

    x=15 m,60−2x=30 mA=450 m2\begin{aligned}&x=15\ \mathrm{m},\quad60-2x=30\ \mathrm{m}\\&A=450\ \mathrm{m^{2}}\end{aligned}
  6. The point of y = √x nearest (3, 0) 3 steps

    Find the point on the curve y = √x closest to the point (3, 0), and its distance.

    1 2 3 4 1 2 x y y = √x (x, √x) D (3, 0)
    Show solution
    1. The distance from (3, 0) to (x, √x) has a root in it. Its square is smallest where the distance is, and has no root:

      D2=(x−3)2+(x)2=(x−3)2+x,x≥0\begin{aligned}D^{2}&=(x-3)^{2}+\left(\sqrt{x}\right)^{2}\\&=(x-3)^{2}+x,\qquad x\ge0\end{aligned}
    2. Differentiate and set it to zero:

      ddxD2=2(x−3)+1=0 ⇒ x=52\dfrac{d}{dx}D^{2}=2(x-3)+1=0\ \Rightarrow\ x=\tfrac52
    3. The range has one end, x = 0. On the other side D² grows without bound, so compare the critical point with that end:

      D2 ⁣(52)=14+52=114,D2(0)=9D^{2}\!\left(\tfrac52\right)=\tfrac14+\tfrac52=\tfrac{11}{4},\qquad D^{2}(0)=9

    Answer

    The nearest point is (2.5, √2.5) ≈ (2.5, 1.5811), at a distance √11/2 ≈ 1.6583. Minimising D² in place of D is allowed because the square root only ever grows, so both are smallest at the same x. Differentiating D itself by the chain rule gives the same x, with a root in every line.

    (52, 52),D=112≈1.6583\left(\tfrac52,\ \sqrt{\tfrac52}\right),\qquad D=\dfrac{\sqrt{11}}{2}\approx1{.}6583
  7. 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:

      V(x)=x (21−2x)(29.7−2x)=4x3−101.4x2+623.7x,0≤x≤10.5V(x)=x\,(21-2x)(29{.}7-2x)=4x^{3}-101{.}4x^{2}+623{.}7x,\qquad 0\le x\le10{.}5
    2. Differentiate term by term:

      V′(x)=12x2−202.8x+623.7V'(x)=12x^{2}-202{.}8x+623{.}7
    3. Set V′(x) = 0 and use the quadratic formula. The number under the root is 16 × 699.39, which tidies it:

      x=202.8∓202.82−4⋅12⋅623.724=50.7∓699.396,x1=4.0423,x2=12.8577x=\frac{202{.}8\mp\sqrt{202{.}8^{2}-4\cdot12\cdot623{.}7}}{24}=\frac{50{.}7\mp\sqrt{699{.}39}}{6},\qquad x_1=4{.}0423,\quad x_2=12{.}8577
    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:

      V(4.0423)=4.0423×12.9153×21.6153=1,128.5V(4{.}0423)=4{.}0423\times12{.}9153\times21{.}6153=1{,}128{.}5

    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.

    x≈4.04,V≈1,128.5x\approx4{.}04,\qquad V\approx1{,}128{.}5

Supplementary problems, answers only

  1. Two positive numbers add up to 20. Which pair has the largest product?

    Show answer

    10 and 10, with product 100

    10+10=20,10⋅10=10010+10=20,\qquad10\cdot10=100
  2. Of all rectangles with a perimeter of 40 cm, which has the largest area?

    Show answer

    The 10 cm square, 100 cm²

    10×10 cm,A=100 cm210\times10\ \mathrm{cm},\qquad A=100\ \mathrm{cm^{2}}
  3. An open-topped box with a square base must hold 32 m³. Which dimensions use the least material?

    Show answer

    A base 4 m by 4 m and a height of 2 m, using 48 m²

    4×4×2 m,S=48 m24\times4\times2\ \mathrm{m},\qquad S=48\ \mathrm{m^{2}}
  4. A firm’s profit from q units is P(q) = −2q² + 120q − 1000. Which output maximises the profit, and what is it?

    Show answer

    q = 30, with a profit of 800

    q=30,P(30)=800q=30,\qquad P(30)=800
  5. Find the points of y = x² closest to (0, 2).

    Show answer

    (±√(3/2), 3/2), at a distance √7/2 ≈ 1.3229. The origin, where the derivative of D² is also zero, is a local maximum of the distance, at 2.

    (±32, 32),D=72≈1.3229\left(\pm\sqrt{\tfrac32},\ \tfrac32\right),\qquad D=\dfrac{\sqrt{7}}{2}\approx1{.}3229
  6. Find the largest value of x e^(−x) for x ≥ 0.

    Show answer

    1/e ≈ 0.3679, at x = 1

    x=1,max⁡=1e≈0.3679x=1,\qquad\max=\tfrac1e\approx0{.}3679

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)