top of page

12 Days of Xmas: How Many Gifts?

Updated: Aug 5, 2021

A new take on a classic Christmas carol from Olaf, one of our top Maths tutors.

Medical School application tips

In the song The Twelve Days of Christmas the narrator lists all the gifts their true love has given them. The song raises a few questions - not least of which the morality and legality of giving lords and milkmaids as ‘gifts’ - but today I’m just going to look at one of them: how many gifts were given altogether?


Well, on the first day there was a single gift: a partridge in a pear tree (let’s assume the partridge is very attached to its tree and won’t leave it, so this does just count as one gift!). On the second day we have two turtle doves and a partridge, making three. So, that’s four gifts altogether so far. On the third day we get three French hens, two move doves, and yet another partridge: six gifts, which added to the four from before makes ten so far. Now on the fourth day…


And we could go on like this counting all the gifts by hand until we get to day twelve, but it would get a bit tedious. Could there be a better way? After all, the song follows a very predictable pattern so it seems like maybe there should be a way to use that pattern to find out how many gifts are given each day. Let’s say we’re looking at day number n, where n represents some number. Then the number gifts given on that day will be the result of the sum:


1 + 2 + 3 + … + n


A formula for each day’s gifts

To work out what this adds up to I’m going to lay out the sums for the first four days in a diagram.

Notice how each day’s number of gifts fits neatly into a triangle? For that reason, these are called the triangular numbers. You don’t hear about triangular numbers nearly as often as square numbers, but they’re actually quite closely related. To see how, let’s look at just one of our diagrams, say the one for day four. I’m going to take two copies of it and put them side by side, with one copy upside-down.

Now what would we get if we pushed these two triangles together? Something a little bit like a square? In fact it’s a rectangle that’s slightly wider than it is tall, because the two triangles ‘overlap’ at the sides but not the top and bottom. So the number of dots it contains is four times five, twenty. And since it’s made of two copies of that the day four triangle, that means the original triangle had ten dots.

Of course, we already knew that day four had ten gifts as it wasn’t very hard to count them without all this rotating and combining triangles. But now that we’ve seen how this works, we can apply a similar argument to any day’s number. Let’s say we’re on day number n, so our triangle has n rows of dots with one dot at the top and n on the bottom row (this is called the ‘nth triangular number’). Again we take two copies of this triangle and fit them together and get a rectangle that’s almost - but not quite - a square. This time the height will be n, and the width n+1. Remembering to divide by two for the two triangles, this tells us that the nth triangular number is:


n x (n+1) ÷ 2


Or


(n² + n) ÷ 2


(These two both give the same result, but the second way of writing it shows the relationship between triangular numbers and square numbers.)


A formula for the total gifts

Ok, time to get back to the song. We now know that the number of gifts received on day number n is (n² + n) ÷ 2. So on day twelve, for example, there are (12² + 12) ÷ 2 = 78 gifts. Quite a lot, considering how many of them are people or animals or trees!

But remember that’s just the number of gifts given on the last day - what about the number of gifts given altogether, on days one to twelve (or days one to n)? To find that, we’ll need to take those triangular numbers which represent each day and add those up:


(1² + 1) ÷ 2 Day one’s gifts

+ (2² + 2) ÷ 2 Day two’s gifts

+ (3² + 3) ÷ 2 Day three’s gifts

+ ....

+ (n² + n) ÷ 2 Day n’s gifts


The numbers we get from this also have a name: tetradhedral numbers. That’s because when we add triangular numbers together we can picture stacking them on top of each other to get a triangular pyramid, called a tetrahedron.



Now let’s try to find a formula for this sum. To start with, we rearrange the order of the sum a bit:


(1 + 2 + 3 + … + n + 1² + 2² + 3² + … + n²) ÷ 2


This has all the same numbers as the version above, just added in a different order. Now the first part of this, 1 + 2 + 3 + … + n, might seem familiar. It’s exactly the sum we did to get the nth triangular number! So this bit just adds up to (n² + n) ÷ 2.


What about the second part, 1² + 2² + 3² + … + n²? This is similar to the sum we did before, but this time every number is squared before we add them up. There’s a formula for this one too. It’s a little trickier to prove than the first one so I’ll just quote it here (but if you’re interested, read to the bottom of this post for some hints on how to prove it!):


1² + 2² + 3² + … + n² = n x (n+1) x (2n + 1) ÷ 6.


So, what we’ve found is that we need to add this formula to the triangular number formula and divide the whole thing by 2 to get the total number of gifts on days one to n. This gives us the final formula:


n x (n+1) x (n + 2) ÷ 6


Testing the formula out

Alright, let’s put our formula to the test! Back at the start we worked out by hand that by the end of day one there’s been one gift, by the end of day two there are four, and by the end of day three there are ten. Does our formula give these results correctly?


For n=1:

1 x (1+1) x (1 + 2) ÷ 6 = 1 x 2 x 3 ÷ 6 = 6 ÷ 6 = 1


For n=2:

2 x (2+1) x (2 + 2) ÷ 6 = 2 x 3 x 4 ÷ 6 = 4 ÷ 6 = 4


For n=3:

3 x (3+1) x (3 + 2) ÷ 6 = 3 x 4 x 5 ÷ 6 = 60 ÷ 6 = 10


It looks like it works! So, at last, we’re ready to use our formula to work out the answer to our original question: how many gifts are given up to and including day twelve?


For n=12:

12 x (12+1) x (12+2) ÷ 6 = 12 x 13 x 14 ÷ 6 = 2184 ÷ 6 = 364


Almost enough gifts for one a day the whole year!


Now, as I said earlier, we could have worked this out just by adding up the gifts for each day by hand. It might not even have taken as long as this method, but I hope you agree that this method is more interesting! Also, now that we have the formula we can easily work out what would happen if we changed the question a bit. This is one of the great triumphs of maths: by looking at a few simple cases of something you can often predict what pattern it’s going to follow, work out a general rule, and get answers for the really hard questions with a fraction of the work it would take to do them by hand.


To demonstrate this, how many gifts would we have if the song carried on for thirty whole days of gift giving?


For n=30:

30 x (30+1) x (30+2) ÷ 6 = 30 x 31 x 32 ÷ 6 = 29,760 ÷ 6 = 2184 ÷ 6 = 4960


And what if we wanted to combine the Twelve Days of Christmas with ‘I Wish It Could Be Christmas Every Day’, and go for a whole year of increasing gift giving?


For n=365:

365 x (365+1) x (365+2) ÷ 6 = 365 x 366 x 367 ÷ 6 = 49,027,530 ÷ 6 = 2184 ÷ 6 = 8,171,255


That’s almost exactly enough presents to give one to each person in London! I don’t know about you, but if given the choice I’d probably pick to be one of the people who gets a gold ring.


Bonus

The one place above I asked you to just trust me was when I said that if you add up all the square numbers from 1² to n², you get this formula:


n x (n+1) x (2n + 1) ÷ 6


If you’d like to have a go at working out where this comes from, here are some hints to help you get started!


1. First, if k is some whole number, work out what (k+1)³ - k³ is by multiplying out the brackets


2. Now think about this sum:


2³ - 1³

+ 3³ - 2³

+ 4³ - 3³

+ ...

+ (n+1)³ - n³


You can replace each line of it with what you worked out in step 1 above. But you can also simplify this sum down a lot by cancelling out most of the cubes. Doing both of these should let you create a new equation since both must give the same thing.


3. Now have a look at the equation you’ve made. Part of it should contain the sum 1 + 2 + … + n, which we already know the answer to from before. And it should also contain 1² + 2² + … + n², which is exactly what we want to find! By rearranging you should be able to get that second sum on its own on one side.


4. Finally you need to simplify the other side to get the expression I gave above. You might be tempted to multiply the whole thing out, but that will give a cubic which is a bit nasty to work with. Try looking for a factor which all your terms have in common and taking that outside.


"But how will this apply to me when it's not Christmas?!"

If you're studying GCSE Maths, then one of the topics you'll cover will be looking at patterns like this (which are called sequences) and working out a formula for the nth term in terms of n. The ones you study at GCSE will be quite a bit simpler than these though! And if you're thinking of doing A Level Maths, then the formula for the nth triangular number and for the sum of the first n square numbers will both appear, and you'll learn how to combine them in similar ways to what I did above to derive expressions for more complicated sequences.


Good luck!


Blog Post Crafted by Olaf

Olaf studied Maths at Cambridge University, and went on to do a Masters degree at Cambridge. Since then he has been tutoring while pursuing a part-time PhD at Oxford University, where he has also been involved in teaching undergraduates and setting and marking exams. His research project uses supercomputers to create simulations of dark matter. Olaf has four degus (a type of rodent from South America) and is currently teaching them to play football. Check out Olaf's article about the Science of Snowflakes in our Xmas brochure!

bottom of page