*Spoiler for New Scientist Enigma 1715:*

I started with a rectangular piece of card a whole number of centimetres long by a whole number of centimetres wide, one of those numbers being a prime. Then I cut out an identical small square from each corner of the card and discarded the four squares. I folded up the four “flaps” on the remaining piece of card to form an open-topped box, choosing the size of the cut squares so that the volume of this open box was the biggest possible. Having made the box, I found that the length of its rectangular base was four times its width.

What were the dimensions of the original piece of card?

Simple calculus problem this time. If the original card was *L* by *W* cm, and the cut off squares were *X* cm on a side, then the final box had dimensions (*L*–2*X*) by (*W*–2*X*) by *X*; its volume was *V* = (*L*–2*X*)(*W*–2*X*)*X* = 4*X*^{3}–2(*L*+*W*)*X*^{2}+*LW**X*. The derivative is d*V*/d*X* = 12*X*^{2}–4(*L*+*W*)*X*+*LW*.

But (*L*–2*X*) = 4(*W*–2*X*), so *L* = 4(*W*–2*X*)+2*X* = 4*W*–6*X* and d*V*/d*X* = 12*X*^{2}–4(5*W*–6*X*)*X*+(4*W*–6*X*)*W* = 36*X*^{2}–26*WX*+4*W ^{2}*.

(The one tricky thing is you have to make this substitution *after* doing the derivative, not before.)

Set this to zero and solve: *X* = 2*W*/9 or *W*/2. The latter gives the minimum volume as you can see by looking at the sign of the second derivative or just by noticing (*W*–2*X*) = 0 so the “box” has zero volume! The former gives the maximum volume. In that case *L* = 4*W*–6*X* = 8/3*W*. The only solution with one side prime is *W* = 3, *L* = 8.* *