A fun question was put to me yesterday that’s sure to put the math-minded in the holiday spirit:

“How many of each gift is given in the song

The Twelve Days of Christmas?”

Beginning at the beginning, the Partridge in a Pear Tree is on the first day and so is given twelve times. The Turtle Doves are given the second day and so are given eleven times. Continuing on to the end, the Drummers Drumming are only given once, on the twelfth day.

So I thought, “*Total days – day*… 12 – 1 = 11. Nope. *Total days + 1 – day*? 13 – 1 = 12 (partridges); 13 – 2 = 11 (Turtle Doves). Ok, so far so good. But then I remembered that the number of each also depends on the day given (TWO Turtle Doves, THREE French Hens, etc.)

The total number is simply the number given multiplied by the number of times given, and since I had already figured out how to find out how many times each item is given according to the day the solution was straightforward:

**Total items given = day * (13 – day)**

This led, naturally, to a couple of follow up questions:

“So what do you get the most of? And how many gifts is that total?”

The questioner set to work calculating the value for each day, which is fine but boring. If you have a basic calculus course under your belt (or are teaching one and would like a softball example question), you would see that we’re looking for a maximum of an inverse parabola. The solution is then found where

d/d(day) [day * (13 – day)] = 0

ie, where **13 – (2 * day) = 0**

The maximum lies at day 6.5, but remembering that there is no such day, days 6 and 7 should be equal and at the maximum and indeed my true love gives to me 42 Geese-a-Laying and 42 Swans-a-Swimming.

As for the total number, a discrete problem calls for a discrete sum, ie the sum from day 1 to day 12 of day * (13 – day). The solution turns out to be **364**. If my true love also gives me a birthday present, that’s one gift for every day of the year!

I would love to have finished off the story by saying that what we’re really looking for is the area under the curve of day * (13 – day) between 1 and 13 (again, nudge nudge calculus 101 teachers). So instead of tallying up the sum, we could have taken the definite integral of the function from 0 to 12 as

**(13 * 13^2)/2 – (13^3)/3 – (1 * 12^2)/2 – (1^3)/3 = 360**

which, unfortunately, is false, for a reason similar to why the most gifts didn’t come on day 6.5. However, I think it stands as a useful exercise, possibly to highlight the difference between discrete and continuous problems.

Not to mention the problem of what to do with all those birds.

–

*Incidentally, an exact summation function can also be constructed from something like (1+2+3 …+n) * mean(n + 1 – {1,2,3, …n}) that simplifies to:*

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