From New Scientist #2882, 15th September 2012 [link] [link]
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?
[enigma1715]
The following Python does a bit of calculus to find solutions.
To check cards up to 300cm in size it takes 93ms.
Solution: The card is 3 cm × 8 cm.
If you can’t do differentiation you can get the SymPy library to do it for you.
If you don’t know calculus here’s a solution that uses numerical approximations to find the maximum volume for the box. It runs in 215ms.
Only the first turning point of the graph of volume vs. square length,s, needs to be considered, as the graph always has the form shown in this diagram:
Of course, I should have included 2 in the list of primes, but initially had assumed that the square length was restricted to being a whole number of centimetres.
Another way of approaching the problem is as follows:
Starting from the formula for volume, v = (a-2s)(b-2s)s , ( a,b are the sides of the original rectangle, s is the length of the square cut out from each corner),
The maximum volume is the first turning point of the function, i.e. the lower root of
dv/ds = 12s^2 -4(a+b)s + ab = 0
which is s= ( (a+b) – sqrt(a^2 + b^2 – ab) )/6
Assuming a<b, the lengths of the rectangular box is 4 times the width gives the equation
4(a-2s) = b-2s
produces the equation
sqrt(a^2 + b^2 – ab) = 2b – 3a
so (a^2 + b^2 – ab) is a perfect square. The solution can be found from this information with the following code:
Or even more simply, avoiding the need to generate a list of squares:
Or you can plug it into Wolfram Alpha [link] (I could get it to do the calculus separately, but not along with the other constraints), which tells you the solution is:
b = 8a/3, c = 2a/9
Additionally a and b must be positive integers and one of them must be prime.
From the formula for b it follows that a must be a multiple of 3 (as 8 is not divisible by 3), and b must be composite (as 8 is), hence a must be prime, and a multiple of 3.
So: a = 3, b = 8, c = 2/3.
You can do this in your head, doesn’t need any calculus. Start with base L = W/4. Height = h.
If you increment the small square, h goes up increasing volume. L goes down, decreasing volume by twice as much. W decreases volume by 4 times as much, so volume stays constant when h = 0.1L. That makes the card 1.2L x 0.45L, ratio of card sides 120/45 reduces to 8/3 one of which is prime
I think I see your argument, and it seems that this is a similar technique to differentiation from first principles. It’s been a long while since I did this at school, but I think you would formalise it like this:
At the maximum volume the base of the box is w × 4w and has height h.
So the volume is: v = w × 4w × h = 4w²h.
The dimensions of the card are: a = w + 2h, b = 4w + 2h, 0 < h < a/2.
If the height is changed by a small amount, e, the volume of the box becomes:
v' = (w − 2e) × (4w − 2e) × (h + e)
expanding:
v' = 4w²h − 10ewh + 4e²h + 4ew² − 10e²w + 4e³
So: (v' − v) / e = −10wh + 4eh + 4w² − 10ew + 4e²
As e tends to 0 this tends to the derivative: −10wh + 4w²
As the volume is at a maximum we set the derivative to zero, hence:
0 = 4w² − 10wh = 2w(2w − 5h)
As w is non-zero it follows that at the maximum 2w = 5h, hence: h = 2w/5.
So considering the ratio a : b:
a : b = w + 2h : 4w + 2h
= w + 4w/5 : 4w + 4w/5
= 9w/5 : 24w/5
= 3 : 8
and the solution follows.
Well done for being able to do this in your head!