Friday, December 26, 2014

The Twelve Days of Christmas: Fun with Algebra

If you're like me, after hearing the song "The Twelve Days of Christmas" for the umpteenth time, you start wondering how all those gifts stack up. How many lords-a-leaping do you end up with at the end, anyway? What do you have the most of? And what's the total?

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.

Thursday, December 18, 2014

Endings and Beginnings

It's been a little quiet here on the blog front lately as I've been dealing with the passing of my sister Esther a week before Thanksgiving.

Esther had a very rare genetic condition known as Aicardi Syndrome which left her severely developmentally handicapped from birth, and given the severity with which she had it it was really only a question of time (though that's true of all of us, in the end). I don't want to dwell on it as my family is dealing with it and continuing on with life, but I do think an explanation is warranted for this longest-yet break between posts.

Being a naturally cheerful person, I don't like ending a post on a downer note, so here's something I found funny: while back home for the memorial service I picked up one of our new Polish roosters to show a visiting uncle and aunt. My mom happened to have a hair band on hand and decided to put his head feathers up in a pony tail, and the resulting picture was just too funny not to share.

(And to explain the "beginnings" part of the title, I was privileged to be able to attend the wedding of one of my cousins this past weekend.)