## 12 days of Christmas: an exploration in counting presents

A popular winter Math problem is the counting of presents given during the 12 days of Christmas.

On the 1st day of Christmas my true love gave to me a partridge in a pear tree.

On the 2nd day of Christmas my true love gave to me 2 turtle doves, and a partridge in a pear tree.

On the 3rd day of Christmas my true love gave to me 3 french hens, 2 turtle doves, and a partridge in a pear tree.

... and so on through day 12.

The problem is to count the number of presents received during the 12 days, and for the truly masochistic, the cost of the twelve day's worth of presents in today's dollars.

I love this type of problem because it's an algebra problem and it involves sums of series, two favorite subjects of mine.

The problem is to compute this sum:

1 +

1+2 +

1+2+3 +

1+2+3+4 +

1+2+3+4+5 +

.....

1+2+3+4+5+6+7+8+9+10+11+12

One nice approach to doing the computation is here. But, what I don't like about this approach is that it doesn't quite connect the dots about how you can use Pascal's triangle to solve this problem for the general case. So, I came up with my own approach.

The first part of my approach is to determine what 1+2+3+...+n is, for each of the 12 lines of numbers we want to add up. It turns out that 1+2+3+...+n = n(n+1)/2. But, don't take my word for it. You can see it for yourself with Gauss' approach:

If the sum of the first n consecutive integers is S then:

S=1+2+3+...+n

But, you can reverse the terms in the series and get the same sum:

S=n+(n-1)+(n-2)+...+1

Add up the two series:

2S = (1+n)+(2+n-1)+(3+n-2)+...+(n+1)

There are n terms in 2S, and each term adds up to n+1, so:

2S = n(n+1), or:

S= n(n+1)/2

So, the 1st sum we need to compute is 1, or 1(2)/2 by the formula we just derived.

The 2nd sum is 1+2, which is 2(3)/2 by the formula.

The 3rd sum is 1+2+3, or 3(4)/2.

The 4th sum is 1+2+3+4, or 4(5)/2, and so on.

Now, let's look at the sum of the 12 sums, calling it B for big sum:

B = 1(2)/2 + 2(3)/2 + 3(4)/2 + 4(5)/2 + ... + 12(13)/2 by applying the formula we derived for the sum of each row.

Then, 2B = 1(2) + 2(3) + 3(4) + 4(5) + 5(6) + ... + 12(13)

But, 2B = 1(1+1) + 2(2+1) + 3(3+1) + 4(4+1) + 5(5+1) + ... + 12(12+1)

We can rewrite 2B as 1^2 + 1 + 2^2 +2 + 3^2 + 3 + 4^2+4 + 5^2 + 5 + ... + 12^12 + 12

Now, rearrange the terms in 2B and we get:

2B = (1^2 + 2^2 + 3^2 + 4^2 + 5^2 + ... + 12^2) + (1 + 2 + 3 + 4 + 5 + ... + 12)

Well, we're closer to our answer, really, but we still have some work to do.

We can use our formula again for the sum of the first n consecutive integers and determine that:

1 + 2 + 3 + 4 + 5 + 6 ... + 12 = 12(13)/2 = 78

But, now we have to determine the sum of the squares of the first 12 positive integers.

The formula for the sum of the squares of the first n consecutive integers is this:

n(n+1)(2n+1)/6

But, I hear you asking where this formula came from. This is not very intuitive. I agree and I'm all about intuitive. So, I found this nice visual "proof" of this formula here. It's not a proof at all but it illustrates very visually how you can compute the sum of the first n squares.

Now, back to our big sum:

2B = the sum of the first 12 squares plus the sum of the first 12 integers, or if we replace each sum with its corresponding formula:

2B = 12(13)(25)/6 + 12(13)/2 = 650 + 78 = 728.

So, B = 728/2 = 364

That's almost one present for every day of the year!

As a final exercise, let's generalize the formula for any number of days, n.

2B = the sum of the first n squares plus the sum of the first n integers.

2B = n(n+1)(2n+1)/6 + n(n+1)/2

We multiply the second part of the sum by 3/3:

2B = n(n+1)(2n+1)/6 + 3n(n+1)/6, or:

2B = [n(n+1)(2n+1) + 3n(n+1)] / 6, or:

B = [n(n+1)(2n+1) + 3n(n+1)] / 12. Factor out n(n+1) from both sides and we get:

B = n(n+1)[(2n+1) +3] / 12 =

[n(n+1)(2n+4)]/12

So, now you're ready. If someone asks you how many presents you'd get if there were 24 days of Christmas you'd compute, hopefully using mental Math tricks, (24)(25)(52)/12 = (2)(25)(52) =(50)(52) = 2600.

If you want to do a little more exploration convince yourself that this formula we just derived for counting presents is algebraically equivalent to the element in Pascal's triangle illustrated in the article I referenced earlier. To do this you will need to know that there's a correspondence between entries in Pascal's triangle and binomial coefficients and how to compute binomial coefficients. You can read more about this connection here.

Merry Christmas, everyone!

Robert @ reason4smileDecember 24th, 2007 - 18:31

Wow, Christmas has some to do with math as well =)

Nice post, Sol!

Merry Christmas to you!

Brent YorgeyDecember 27th, 2007 - 23:03

You know, you can cancel a factor of 2 from that last formula, yielding the much nicer form [n(n+1)(n+2)]/6. =)

SolDecember 27th, 2007 - 23:25

@Robert – Thanks for the kind wishes.

@Brent – Duh! I did all the hard work and missed the factor of 2 I could pull out. Nice catch.

Brent YorgeyDecember 27th, 2007 - 23:32

Sol, the only reason I caught it is that I knew it was supposed to come out to a binomial coefficient — (n+2) choose 3 to be exact. So when it didn’t look like that, I went “huh?” and then noticed why it looked funny. =)

SolDecember 29th, 2007 - 00:22

Brent,

Good catch. I must have been tired when I wrote the post because I also knew and wrote that it was a binomial coefficient which would have had some consecutive integers as the numerator and a factorial as the denominator. Makes perfect sense that you noticed it looked funny.

NathanaelFebruary 5th, 2011 - 19:14

“You know, you can cancel a factor of 2 from that last formula, yielding the much nicer form [n(n+1)(n+2)]/6. = x)”

Or you can approach it from a slightly different direction, and get:

x = (((n+1)^3)/6)-(n+1)/6

Figured it out by graphing the result in three dimensions. Don’t know algebraically why it works, but it does.

Naveed QureishiDecember 20th, 2011 - 20:53

Formula for 12 days of christmas # of gifts is n(n-1)/2 + n where n is the number of days…

On the 12th days of christmas you will get 78 gifts…

adminDecember 20th, 2011 - 23:22

Naveed – Your formula simplifies to n(n+1)/2 which does tell you how many gifts you get on the nth day. The article explored the TOTAL number of gifts receiived between day 1 and day n. That is more complicated.

JamesDecember 21st, 2012 - 09:34

Last night a friend asked me if there was an equation to figure out the number of presents in the 12 days of Christmas, and this is what I came up with:

T(d) = Sum(n(d+1-n)), {1,d}

T(d) = the total presents in d days

d = the total natural number of days (12)

n = the days from 1 to d, {1,d}

So if d = 12, then

T(12) = Sum(n(13-n)), {1,12}

Thoughts?