This problem can be solved by a little bit of math no more complicated than multiplication, but this being my blog I'm going to complicate things unnecessarily for fun. Let's call an arbitrary day of Christmas

*n*(where \(1\leq n \leq12\)). The number of gifts given for the first time on that day is then also

*n*(one partridge in a pear tree on the first day, two turtle doves on the second day, etc.). Then the total number of each gift is simply

*n*times the number of times that gift is given. A little thought shows that this number is simply \(13-n\) (a partridge in a pear tree will end up being given on all twelve days, while the twelve drummers will end up being given only once on the twelfth day).

Putting these facts together, we arrive at a function (I'll call it "g" for "gifts") that will give us the total number of gifts of a particular type received, given a day of Christmas as input. Symbolically:

\[\text{g}(n)=n\cdot(13-n)=-n^2+13n\]This is a simple quadratic equation (a parabola, to be exact); I've marked the locations of integer value inputs in the plot below with annotations to show what each one is.

Looking at this plot, we see that the number of each gift begins at a minimum of twelve, rises to a maximum of forty-two for days 6 & 7, and drops off again to twelve on the twelfth day.

This leaves us with the question of how many

*total*gifts you would receive from all this. Luckily, this is very simple: since the number of gifts is symmetrical after the sixth day, we can simply evaluation the following equation:

\[\text{Total gifts}=2\cdot(12+22+30+36+40+42)=364\]which, I think we can agree, is a whole lot of gifts. A hui hou!

Edit (1/16/2016): Of course, what escaped me at the time is that the song is actually about discrete gifts, not continuous ones, and thus trying to represent it as a continuous function as I did above makes pretty much zero sense.

I'd actually originally planned to do some calculus and integrate under the curve where the gray shaded part is and show how it came out to 364 as well…except it doesn't. I couldn't figure out why at the time and thus just sort of ignored it while leaving the talk leading up to the subject intact, leading to a somewhat disjointed blog post. Sometime later I realized that it's because this is a situation where you

*can't*describe something with a continuous function; instead of a parabola, each point should be connected by a straight line—and then the area underneath that collections of points and lines should add up to 364.