# How I Teach Calculus: A Comedy (xkcd-Dating Pool, Optimization)

It often starts with something awesome on the Internet. I had no idea how rich this was going to get. My students laughed, they thought, they got frustrated (and liked it), and they actively learned how to program spreadsheets, in addition to the calculus standard that I had in mind: optimization.

This is one of the easiest opening acts I’ve ever used. It plays smoother than a Stevie Wonder LP.

After reading, the kids naturally discussed some points among themselves. This happens a lot, and I think, to most, it looks a lot like kids talking randomly.

I pretty much reject the idea that teachers should guide and focus everything. I bring the kids back to me when I think they can’t make any more progress on their own. Otherwise I just keep my mouth shut and keep Pandora on “no cussing.”

The first thing the students talked about was the standard creepiness rule:

[latex size=3]min=\frac{age}{2}+7[/latex]

They did a few mental calculations to see if they agreed. They questioned the comic’s upper limit. To a lot of students it should have been, for an 18-year old, 16-20 (+/- 2), not 16-22.

Why? They hashed this out with some pretty killer math thought: No! It’s the minimum of the older person that fixes the upper limit for the younger person. The way we handled that with a function was exciting. The students came up with a max function as:

[latex size=3]max=2(age-7)[/latex]

If you think about that long enough, it’s intuitive, but not at first, which is awesome.

The students noticed a few things: Below 14 years, you have no dating range (as it should be); These lines really should be piecewise as your max gets above 100 years. There aren’t many people in the 100-110 decile. Finally, this graph tells us very little about what we actually care about…

## How does your dating pool change as you age?

They stated that. Awesome. And the other foot drops. this becomes a really interesting problem, how can we add up all the singles that live within your dating range? We’re going to need to know the number of singles at any given age.

Quick, to the Census!

About 45 minutes later, and alot A LOT of math-thought later,1 we had this spreadsheet going. If you’re running this lesson on a short time scale, you may want to just seed this with mine. We distributed the load to about 4 age bins per student.

Then, things got even more awesome. One of my students put it perfectly:

I have no idea how to make Excel do this, but I know it can, because I can see it in my head. I want it to take each age’s min and max, go find the population next to that number, and then add them all up until it gets to the max age. Broooosh, I don’t even know…

They all then spent the next 30 minutes digging into Excel forums: awesome.

Here’s the whole thing (.xlsx) worked out.

You may want to figure this out for yourself, and hopefully your students do too. But here’s the answer. You’ll need to move from Google Spreadsheets to MS Excel, or some similar software that supports the SUMIFS() function.

You tell SUMIFS the following

=SUMIFS(rangeToSum, rangeToCheck1, check1, rangeToCheck2, check2)

rangeToSum = The entire column of populations, use dollar signs to hold these cells in place when you do magic drag. (i.e. $B2:$B$88) rangeToCheck1 = The column that has the ages that you want to check to see if they’re between the max or the min. (i.e.$A$2:$A$88) check1 = This is the trickiest part. Excel is SUPER picky about how you concatenate strings and operators. You can’t just say =”>=”C2. You have to create a new cell that reads “>=16” and then use this as a check1 (i.e. Just “F2”). Annoying. The =CONCATENATE() function can put cell data together with some text (string) to create you cells of operators. rangeToCheck2 = The same as rangeToCheck1, in this example, because we want to see if the ages are less than the max age. (i.e.$A$2:$A\$88)

check2 = same shenanigans as check1, but with less than signs and it references the max value.

After all of this awesome Excel programming (my students had no idea about magic drag, or doing cell references of really any depth) we then can actually graph the dating pool as a function of age, which comes out like this:

We end up supporting xkcd’s argument with the real data. The max dating pool appears to occur around 43 years, which is, well… interesting?

# Oh, Yeah, Calculus:

My students then spent the next 90 minutes playing with LoggerPro’s curve fitting tool. We had some pretty serious arguments about what a fit means. Use a quintic? Really? Piecewise fit? Ok, but why?

We got into a very deep and touchy discussion about divorce, which is pretty heavy for a math class. They then optimized (dDatingPool/dAge = 0) to see how well their fit agrees at the most important point: the maximum.

Oh, and by “heavy,” I mean “awesome.”

Please steal this lesson and tell me what your kids do with it.

This is probably the best lesson I’ve ever taught been a part of.

This lesson’s awesome count: 7

1. Math-thought is when people think about patterns, assumptions, and constraints without ever worry about whether a teacher is going to dock half-points for not taking notes correctly. These kids asked things like: “What about gay people?” “What about divorcees?” “What about people who want to be single?”