30% off your first 3 months

Get the deal

Optimization: the biggest open box from a square sheet

by DuckyHelperNov 12, 20264 min read
Math

TL;DR:

  • Write the quantity to maximize as a function of one variable, and note its allowed range.

  • Candidates for the maximum are where the derivative is zero, plus the endpoints of the range.

  • For a 12 by 12 sheet, cutting corners of side 2 gives the largest box, with volume 128.

You have a square sheet of card, 12 cm on each side. Cut a small square from each corner, fold up the sides, and you have an open box. Cut tiny squares and the box is wide but shallow. Cut big squares and it is deep but narrow. Somewhere in between is the box that holds the most. Calculus finds it.

Set up the quantity to maximize

Let x be the side of each cut-out square, in centimetres. After cutting, the base is a square with side 12 − 2x, because you lose x from each end. The height of the box is x. The volume is base area times height.

So V(x) = x(12 − 2x)². The variable x can only be between 0 and 6: below 0 there is no cut, and at 6 the base has zero width. The allowed range, called the domain, is 0 ≤ x ≤ 6.

Worked example: cutting x from each corner of a 12 by 12 sheet

  1. Expand the volume: (12 − 2x)² = 144 − 48x + 4x², so V = 144x − 48x² + 4x³.

  2. Differentiate: V′(x) = 144 − 96x + 12x².

  3. Set V′ = 0 and factor out 12: 12(x² − 8x + 12) = 0, so 12(x − 2)(x − 6) = 0.

  4. The critical points are x = 2 and x = 6.

  5. Evaluate V at the critical points and endpoints: V(0) = 0, V(2) = 2 × 8² = 128, V(6) = 6 × 0² = 0.

The largest value is V(2) = 128 cm³. The box has a base of 12 − 4 = 8 by 8 cm and a height of 2 cm, so 8 × 8 × 2 = 128.

Why the endpoints and the second derivative

A maximum can occur where the slope is zero, or at an end of the allowed range, where the graph just stops. That is why we test the endpoints. Here both give volume 0, so the interior point wins.

You can also confirm with the second derivative. V″(x) = 24x − 96. At x = 2, V″ = 48 − 96 = −48. A negative second derivative means the graph curves downwards, like the top of a hill, so x = 2 is a local maximum. At x = 6, V″ = 144 − 96 = 48, positive, a valley (and outside the useful range of values anyway).

Check by trying numbers

x (cm)

Base side

Volume (cm³)

1

10

100

1.5

9

121.5

2

8

128

2.5

7

122.5

3

6

108

Volumes either side of the maximum

The values rise to 128 and fall again, which matches the calculus. The table also shows the maximum is flat: moving the cut by half a centimetre either way loses only a few cubic centimetres. That is typical near a maximum, where the slope is close to zero.

Test with the general sheet

For a square sheet of side L, the same steps give V = x(L − 2x)² and V′ = (L − 2x)(L − 6x). The useful root is x = L/6. For L = 12, that is 2. The best box always cuts out squares of one sixth of the sheet's side. Check with L = 6: x = 1, V = 1 × 4² = 16, and nearby values x = 0.5 and x = 1.5 give 0.5 × 25 = 12.5 and 1.5 × 9 = 13.5. Both are lower.

Try one yourself: the largest fenced rectangle

A farmer has 40 m of fence for a rectangular pen (an example problem). If one side is x, the other is 20 − x, because two of each add to 40. The area is A(x) = x(20 − x) = 20x − x², for 0 ≤ x ≤ 20.

Differentiate: A′ = 20 − 2x. Set it to zero: x = 10. The area is 10 × 10 = 100 m², a square. The second derivative is A″ = −2, negative, so it is a maximum. Check nearby: x = 9 gives 9 × 11 = 99, and x = 11 gives 11 × 9 = 99. Both are smaller. The endpoints give 0.

The recipe is the same as for the box: choose a variable, write one formula, find the allowed range, differentiate, test the candidates, and say the answer in the words of the question, here a 10 m by 10 m pen of area 100 m².

How to check your answer

  • Domain. Is your x between 0 and 6?

  • Endpoints. Did you test them?

  • Plug in. Compute volumes for nearby values, as in the table.

  • Units. Volume in cm³, lengths in cm.

Common mistakes

  • Writing the base as 12 − x instead of 12 − 2x. Two cuts are lost, one from each end.

  • Forgetting to set the derivative to zero before solving.

  • Reporting x instead of the volume, or the volume instead of the dimensions asked.

  • Ignoring the endpoints.

  • Choosing x = 6 because it is a root, though it gives zero volume.

Where you will use it next

Optimization uses derivatives of expressions like those in related rates: the sliding ladder. The next big idea is accumulation, introduced in what an integral adds up. You might also write a solved example like this one on a one-page sheet, which is a good way to revise the method.

Frequently asked questions

What if there are several critical points?

Evaluate the function at each, and at the endpoints, then compare. The largest value is the maximum.

What does the second derivative add?

It tells you whether a critical point is a peak or a valley, without testing numbers on either side.

Get started

DuckyHelper can
do more

It sees your screen and works in any app you use. Try it for 10 minutes, no card.

Get it for Mac, Windows or Linux

Share

Questions and jobs

Do anything

Ask it a question or hand it a job, in any app.

Doing jobs for you is in early access on Mac. Asking works on Mac, Windows and Linux.