It's not hard to wrap a box if you don't care how much wrapping paper or tape you use, but what if you care about efficiency? What if your aim is to use only what you need?

Mathematician Sara Santos, who specializes in finding entertaining ways to popularize math, worked out the formula for a wrap that uses paper and tape most efficiently. If you have a three dimensional box you can solve for the dimensions of the two dimensional square of paper that makes for the best wrap.

For a square box, it works out to be the diagonal added to one and a half times the height of the box. This video by Aimee Daniells offers a beautiful demonstration:

For a rectangular box, things get more complicated. You can still figure it out by solving for the following:

Not only does the power of math let you optimize for paper and tape usage, it also lets you prettily match up the pattern on the wrapping paper where the edges meet. Check out the magic at the 3 minute mark on this video from BBC's The One Show:

Now get out your rulers, spreadsheets, and calculators, and get to work on your most satisfyingly exact giftwrapping season ever!