Wraptimisation

It’s that time of year again where I am forced to come face to face with my one and only flaw: wrapping presents. Yes, the great staff of Debenhams may as well be superheroes to me, expertly taping seams and tying ribbons while I look on with envious bewilderment. My efforts in comparison look like they’ve washed ashore after six months at sea due to a tragically festive shipping accident. In an attempt to reclaim some Christmas pride then, let’s see if there is anything interesting in the present wrapping process, without, you know, actually doing any wrapping.

To keep things simple, let’s consider the wrapping of a cuboid present with side lengths a, b, c:

Box

We also make the prescription that this box has a well defined volume V, so V = abc (easy as 1,2,3?). I will also use my own, most likely inefficient, wrapping procedure:

FoldOrderFirst I take two opposite edges and fold them over the top of the box to meet on the upper surface. I then take the other edges and fold them up to cover the vertical sides of the box, not needing to cover the upper surface this time. Let’s assume we’re being lazy and just cutting out rectangles of wrapping paper. The layout of the wrapping paper then looks like the following, from which we can deduce how much paper we need:

PaperLayoutAs expected, my chosen wrapping procedure is quite wasteful, but maybe there is a shape of present where the wastage is minimised (spoiler alert: yes).

The side lengths of the rectangle are a + 2c and 2(b + c), so the total area of the paper is then

A = 2(b+c)(a+2c)

We’d like to know the minimum possible area of paper we need for a present of volume V. This condition allows us to express c = V/ab where V is fixed, so this three-dimensional problem is reduced to a two-dimensional problem. We need to do a bit of calculus then, and find the point where

\frac{\partial A}{\partial a} = \frac{\partial A}{\partial b} = 0

Doing the algebra we arrive at the coupled cubic equations for a and b:

a^3 - \frac{2V}{b}a - \frac{4V^2}{b^3} = 0

b^3 - \frac{V}{a}b - \frac{4V^2}{a^3}=0

Oh dear, this looks a bit evil to solve which is a shame. However, curiously there is a way to arrive at a solution without needing to solve any nasty cubics, it just requires a bit more mathematical machinery.

The problem we’re having is that we have to substitute in for c, which is giving us an extra power of a and b in our equations and making them difficult to solve. We need to do this to enforce our constraint of constant volume. Lets then look at a different way of enforcing this constraint, with the use of a Lagrange multiplier.

Instead of finding a stationary point of A, we will find a stationary point of an auxiliary function

F(a,b,c) = A(a,b,c) + \lambda V(a,b,c)

where V is the volume of the box and the constant \lambda is known as a Lagrange multiplier. It isn’t immediately obvious why we should do this, but you can think of the constraint V(a,b,c) = constant as representing a surface in 3D (a,b,c) space. The area of our wrapping paper is a function which fills this space like a gas, but we are only interested in its values where it touches the surface V(a,b,c) = constant. With enough squinting (and reading Wikipedia pages), you can convince yourself that at the stationary point, the gradients of the function and the constraint are in the same direction, so by minimising a linear combination of both we find the point where the gradients are parallel (and the correct value of \lambda along the way).

Chundering along then, we have

F(a,b,c) = 2(ab + ac + 2bc + 2c^2) + \lambda abc

and we now need to find a stationary point of F, i.e. where

\frac{\partial F}{\partial a} = \frac{\partial F}{\partial b} = \frac{\partial F}{\partial c} = 0

Doing this, we have 3 equations in 4 unknowns:

2(b + c) + \lambda bc = 0

2(a + 2c) + \lambda ac = 0

2(a + 2b + 4c) + \lambda ab = 0

but now we remember our constraint c = V/ab, allowing us to substitute for c. We can then solve for \lambda in the first of our equations:

\lambda = - \frac{2a}{V}\left(b + \frac{V}{ab}\right)

and substitute in the second to find a. Amazingly, lots of things cancel and we get the simple result

a = 2b

Lovely. Continuing to the third equation, we end up at

b^6 - \frac{V}{2}b^3 - \frac{V^2}{2} = 0

which at first glance looks horrible. We’ve done our GCSE maths though, and noticed this sneaky exam question before: substitute x = b^3 and solve the simple quadratic in x. We do this, end up with 6 solutions, discard those which are negative or imaginary, and finally arrive at

a = 2V^{1/3}

b = V^{1/3}

c = \frac{1}{2}V^{1/3}

So for a box of fixed volume, to use as little wrapping paper as possible with my naive method, it should have sides in the ratio 1:2:4, and the area of paper will be 9V^{2/3}. Simple!

As always, we should double-check to make sure we’ve found a minimum rather than a maximum, but rather than do any more algebra I’ll simply do it numerically. For a range of a and b, I calculate the required paper area, and find the result we calculated:

AIf there is a more optimal wrapping procedure I’d like to hear about it, it will change the ‘optimal’ box shape. This technique will also extend itself naturally to higher-dimensional gifts, appropriate for that mathematician in your life. Unfortunately I can’t convince Sainsburys to sell me a festively-decorated holiday hypersurface with which to wrap such a gift, perhaps when the Christmas industry catches up we can revisit this topic in the future.

Thanks for reading, have a great holiday break and a decidedly optimal new year.

Advertisements

10 thoughts on “Wraptimisation

  1. I believe that I get a slightly better result with the following method. Wrap a sheet around bottom, left, top, and right of the cuboid, and make sure that there is enough sticking out at all sides to cover the front and back. That means that the length of the paper needs to be 2b + 2c, and the width needs to be a + 2 * 1/2 * min(b, c). Since the procedure is symmetrical in b and c, we may assume wlog that b <= c to obtain a paper area of 2*(b+c)*(a+b). The minimum area subject to a*b*c = V is now attained if a:b:c = 2:1:2. If we take the length of b as a unit, we get A=18 and V=4, so A/V^(2/3) is 18 / 16^(1/3) is approximately 7.14.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s