# 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:

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:

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

And some graphs where made:

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.

******SPOILER ALERT******

*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 (d*DatingPool*/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?”

Kanta Sangchuntr February 15, 2014 - 1:45 pm

This is a totally awesome! I am wondering though, for those of us out there without access to technology in the classroom other than smartboards and calculators, is there a way you would recommend of adapting the lesson? I’m trying to find an exploratory activity for optimization and would love to use this problem!

Janelle January 2, 2014 - 3:25 pm

This may be a dumb question, but how did your students find the zeros of the derivative function? Did you allow them to use their graphing calculator functions or did they have to use something like Newton’s Method?

Shawn Cornally January 9, 2014 - 10:02 am

Logger Pro

Trial By Blogging October 9, 2012 - 9:46 pm

THIS is awesome. I’ll be making this into a Calculus lab activity (we use Mathematica) but I can have them use Excel as well. Good stuff!

Shawn Cornally October 10, 2012 - 10:21 am

This is the best compliment. Thanks. It also means you have to come back here and share the Mathematica setup and how they respond. What school are you at?

Trial By Blogging October 10, 2012 - 9:12 pm

I teach at a small liberal arts college in Pennsylvania. This semester (and next) I’m teaching two sections of Calculus I (with labs). I’m also currently developing/teaching a course titled “The Mathematics of Games and Gambling” which is a distribution course for non-majors. I’ve been trying to make my lessons better in terms of activity, engagement, and (because I believe it helps), student enjoyment! Your blog has been an awesome find for me, I only wish I would have discovered similar resources four or five years ago when I started teaching!

TrialByBlogging October 15, 2012 - 6:20 pm

Where did you find the age breakdown for the number of single people? The best I can find is age brackets (not good enough if you ask me)!

Shawn Cornally October 17, 2012 - 9:46 pm

Students found it by dividing the ranges of people filing as “single” up using demographic data for size of those populations.

Trial By Blogging October 17, 2012 - 11:03 pm

Thanks. I spent most of yesterday learning how to import Excel files into Mathematica – and the how to parse said Excel files!

Jonathan Newman October 9, 2012 - 9:05 pm

So I’m definitely using this soon (and hopefully will be able to blog about it) because we’ve been talking a lot about functions and I just want them to model some good ‘ole functions and discuss input/output, domain/range, *what does this graph mean* etc.

Did you prompt them with any kind of question to get the discussion started? I’m just imagining that if I put this at the front of my class, some students would laugh, but I’m not sure that students would start talking about this on their own–especially first thing in the morning, which is when I teach this particular class.

Shawn Cornally October 10, 2012 - 10:17 am

My kids ran with it from the linear equation given in the comic. The conversation naturally went to the minimum of the older person.

Aaron Carpenter October 9, 2012 - 2:05 pm

Did you students make the connection that the min and max were inverse functions?

Shawn Cornally October 9, 2012 - 8:44 pm

Not in those words, but the definition of inverse function got stated by a bunch of kids, so I hope that’ll pop up when we talk about exp() and ln() formally later, which is where I usually drop that vocab.

Hillby October 8, 2012 - 8:22 pm

This is awesome, and in a way that I can see myself as a student going from totally excited to totally frustrated and back to excited again. Something where working in a group really feels worthwhile.

So what I’m wondering is, what kind of skills were you seeing the students use that I might need to ensure pop up at some point before this lesson? The way you write it, it seems like this lesson didn’t use much more than a high comfort level in making equations.

Shawn Cornally October 9, 2012 - 10:09 am

It was a lot of stop-and-check-that-equation-at-interesting-values math. They don’t think in functions yet, more so in ordered pairs. The Excel work got dicey for a while, too. We fit a function to the Singles vs. Age histogram, and that took a long time, and then we realized that function didn’t matter.

Sue VanHattum October 8, 2012 - 6:03 pm

First off, thanks for a lesson I can use/steal without learning all that fancy tech stuff. (Excel I already know.)

I’ll be doing optimization in a few weeks, and I’ll definitely go with this.

As a lesbian, I’ve thought often about my dating pool. I never worried about the age range as much as … If 1 in 10 women are gay (wait, can’t I add in the bi women?!), and 1 in 10 are geeky intellectuals like me, and 1 in 5 are as radical as me, and … Will there be more than 1 in my area?

I don’t usually have reason to mention my orientation in math class, but this project will bring it up. Se la vie. ;^)

Shawn Cornally October 9, 2012 - 10:07 am

That’s a really interesting point that I bet college students will dig into more. There’s way more analysis to be done in the spread sheet that has all the singles listed, for exactly the reasons you just brought up. How can you factor in the just-not-feelin-it factor?