Tem's Well of Stuff

HEADER GOES HERE

There's this thing I learned in Calculus class that blew my mind at the time, and stuck with me as one of my favorite math facts ever. I've always wanted to be able to explain it other people, but I feel like doing it justice takes far longer than anyone could reasonably be expected to stand there while I emphatically gesture at them.

Well, now I have a place to post long-form posts, the ability to embed images and the comfort of knowing my audience is no way captive. You can click away at any time, I promise I won't be offended. BUT: I also think where this ends up is really cool. Hopefully I can convey some of that coolness to you.

Okay, here we go.

PART 1: RATE OF CHANGE

This whole post is going to be about rates of change. A rate of change is how much one thing changes when another thing changes. Sixty miles per hour, $15 per month, an apple per day, etc. Time passes, a thing (be it distance, price, or apples consumed) changes. If we know how much something changed and how long it took to change, we can calculate the rate of change.

If Quill walked 6 miles in 2 hours, then he walked at an average rate of 3 miles an hour. If Quill wrote 10 pages of a story in 5 hours, then he wrote at an average rate of 2 pages an hour.

The math for calculating rate of change is so intuitive you probably didn't even need to think about it: you take the thing that changed and divide it by how much time it took to do so. Quill walked 6 miles in 2 hours, so he walked at an average rate of 6 miles/2 hours = 3 miles per hour. Quill wrote 10 pages in 5 hours, so he wrote at an average rate of 10 pages/5 hours = 2 pages per hour.

I'm going to make the math just a tiny bit more involved. Just a tiny bit! Rather than just tell you how much the thing changed and how much time it took, I'm instead going to give you two points in time ask you to calculate from there. That's just subtraction, no big deal.

Here's an example: At 1pm, Quill has 15 pages written. At 6pm, he has 25 pages written. How many pages did he write per hour, on average? I'M SORRY THIS IS JUST A MATH TEXTBOOK WORD PROBLEM. IT'S GOING SOMEWHERE INTERESTING, I SWEAR.

Okay, this is simple. We just need to calculate the difference, so we take the later values and subtract them from the earlier ones. Easy:
25 pages - 15 pages = 10 pages
6pm - 1pm = 5 hours
10 pages / 5 hours = 2 pages per hour

That's it! That's as complicated as the math will get for this post. We can take any two points in time and calculate the rate of change between those two points. If you're still with me, you're in good shape.

Let's very quickly talk about what this looks like visually. By convention, when we graph something, we put the independent variable on the x-axis: as time passes, we move horizontally to the right. We put the dependent variable on the y-axis: as Quill walks further or writes more pages, we move vertically upwards.

Time is the independent variable in this case because we understand Quill making progress as a function of time passing, and not the other way around. If time stops, Quill can't write. Whereas if Quill stops writing, we don't expect time to stop!

Visually, we can understand rate of change to be equivalent to the slope of the line.

As Quill walks, the line moves up and to the right. If he starts running, he'll cover more distance in the same amount of time: which is to say, the line will go up faster as it moves right, creating a steeper slope. If Quill stands still, his distance will remain the same. The line won't go up at all as it travels to the right, instead becoming a perfectly flat line. Zero slope.

Final tiny bit of math notion: if we're talking about multiple points, we can use subscript notation to indicate which point we're talking about. So if we're talking about two points in time, x1 is the earlier point, and x2 is the later point. This lets us write our rate of change formula more abstractly, as:

(y2 - y1) / (x2 - x1) = rate of change

Phew. Okay. Off to a good start. We'll come back to this formula later.

PART 2: REDUCING THE INTERVAL

So far we've been dealing entirely in averages. For Quill's walk, he probably walked at a pretty consistent pace. Maybe he paused for short breaks or trotted faster downhill, but for the most part we can imagine he hewed pretty closely to that 3mph rate we calculated earlier. It is unlikely that he ran 5.99 miles in the first hour and then needed a 2nd hour to cover the final 50 feet of his journey. At any random point in the walk, he was probably walking at about a pace of 3mph.

What about writing, though? Inspiration can come and go, a critical paragraph can take many rewrites to reach a satisfactory state, etc. There will be bursts of productivity followed by stretches of staring at the page or pacing around the room. His average over the entire 5 hour period might not reflect his writing pace for any particular hour you might choose.

For any two points, we can talk about the rate of change between them. Visually, we can calculate the slope of the line that connects those two points.

Let's look at some graphs. I'll start with Quill's walking pace, since that's the simpler situation. Imagine that it looks like this:

Okay, that's simple enough. Quill walks at a really consistent pace, so the graph of his progress looks like a straight line.

Calculating his average pace like we did -- by taking a start point and end point and calculating the rate of change between them -- is equivalent to drawing a point at the beginning and end of the graph and then drawing the straight line that connects them. Like so:

And the thing is, given Quill's consistent pace, the average is basically the same as his actual pace. For whatever particular chunk of time you grab, his pace is going to be about 3mph. If you take the rise (the distance that the line travels up, i.e. his distance traveled) and divide by the run (the distance that the line travels to the right, i.e. the time elapsed), you're going to get 3mph no matter how large or small the interval of time you choose. Like so:

Let's look at a more complicated situation. Let's look at Quill's writing progress over time. Let's say on this particular day, it looks like this:

We can draw an average rate of change line across this wiggly wobbly graph using the same method as before (grab a point at the beginning/end and draw a straight line between them), but it clearly won't be very accurate:

That is the average rate of change, but it's drastically inaccurate, capturing none of Quill's long plateaus of writer's block followed by his steep bursts of inspiration. It doesn't even capture that he got more productive over time: getting as much done in the last two hours as he did in the first three.

If we wanted to capture that, we can just take two averages instead of one: we'll use his progress at the 3 hour mark as a checkpoint, and calculate his rate from change from point 1 to point 2, and then again from point 2 to point 3:

That's better! And if we're still not satisfied with that degree of accuracy, we can keep adding more "checkpoints". By adding more points, we're examining smaller intervals, giving us a more detailed picture. Here's what the average rate of change looks like when calculated hour-by-hour, using six points instead of just two or three:

Yup, that's hewing much closer to Quill's actual progress. It's still not capturing the fine details of the lulls-and-surges, but we can now see exactly which hours were his most productive:

If we want even more accuracy, we could continue to do this -- adding more and more checkpoints, examining smaller and smaller intervals -- to hew ever closer to the original, wobbly line.

Breaking one interval into two can only ever improve the accuracy of the average rate of change, and there's no limit to how many times we can divide up the intervals like that. Imagine breaking the graph above into 5-minute intervals instead of one-hour intervals: the resulting series of "average rate of change" lines would all but sit directly on top of the original line. As long as we're willing to make the intervals arbitrarily small, we can get an arbitrary fine level of detail, and thus an arbitrarily close degree of accuracy.

With that in mind, it's time for me to ask you a weird question.

PART 3: A WEIRD QUESTION

Here it is, here's my weird question: what's the rate of change of a single moment in time? What is the instantaneous rate of change? Does that question even make sense? What's the slope of a single point on the graph? Is that just nonsense?

We can talk about Quill's writing pace between 1:59pm and 2:00pm. We can talk about Quill's writing pace between 2:00pm and 2:01pm. But can we talk about his writing pace AT 2:00pm exactly? Not over the course of a minute, or a second, or even a millisecond, but at a exact moment the time became 2pm? How fast is he writing in that instantaneous freeze-frame moment, his pen hovering above the page?

That's a weird question, right?

I like this question because it depends very much how you think about it. If you see Quill walking by at his usual, dependable pace of 3mph and take a photo of him, you'd probably be comfortable saying the photo shows him walking by at 3mph.

But does it? If you showed the photo to someone else, how could they possibly calculate Quill's pace from that single, frozen moment in time? How do you calculate the rate of change for a single moment, during which, by definition, nothing has changed?

It confounds the other ways we've been thinking about rate of change as well. Visually, we've gone from taking two points and drawing a straight line between them, to taking a single point and... well...

It won't help to trying to use the same math we've been using, either. We don't even have two points to plug into our rate-of-change formula.

Maybe we can try using the same point twice, since nothing has changed? That means x2 = x1 and y2 = y1. Let's see what happens when we try that! (spoiler: nothing good)

(y2 - y1) / (x2 - x1) =

The "second" point is just the first point again, so we can just substitute in its values:

(y1 - y1) / (x1 - x1) =

Anything subtracted from itself is 0. So that leaves us with:

(0 miles) / (0 hours) =
0/0 mph

That's meaningless! Oh no!!

Don't panic. We'll have to figure something else.

PART 4: SOMETHING ELSE

Okay, so we can't calculate a rate of change when there hasn't been any change. We can't connect two points when we don't have two points to connect. What can we do?

Well... maybe we were onto something, when we kept looking at smaller and smaller intervals. Each time we made the interval smaller, we got a more accurate rate of change. We realized that if we made our intervals arbitrarily small, we could get an arbitrarily accurate picture. What if... we found a way of leaping from "arbitrarily small" to "instantaneous"?

Let's simplify things a little to make things easier for us. Let's decide that Quill's walking pace is exactly, perfectly, 3mph. If we're to have any hope of calculating an instantaneous rate change, we have the best chance of starting with a constant pace and then, if we're successful, getting fancier from there.

So now we have a formula: y = 3x, where x is "time elapsed" and y is "distance traveled."

When x = 1, then y = (3 * 1) = 3. After one hour, Quill has walked 3 miles. Good start. When x = 2, then y = (3 * 2) = 6. After two hours, Quill has walked 6 miles. Seems like it's working.

Think about this: Between 1pm and 2pm, Quill was walking at 3mph.
Between 1pm and 1:01pm, Quill was walking at 3mph.
Between 1pm and 1:00:01pm, Quill was walking at 3mph.
If, no matter how arbitrarily close we put that second point to 3pm, we always get a rate of change of 3mph... if that result stays consistent even when the distance between the points gets infinitely close to 0... doesn't it make sense to say that Quill's pace at 1pm is 3mph? I think we can say it does.

And that's kind of a solution right there? If we get a consistent result as we get closer and closer and closer to our destination, then maybe we can just call that result a solution even if we can never arrive at our destination.

(This is called "taking the limit" and it's totally legit. Calculating what an expression approaches as one of its variables gets infinitely close to a particular value is valid, even if the variable can never reach that value.)

Even so, wouldn't it be cool to be able to calculate a formula that works for ANY point, without having to manually calculate the difference between two really close points? To get not an "increasingly accurate" answer, but an exact answer? To know where to draw the slope on our single point?

Come on, let's try to calculate a formula!

Let's do something that feels like cheating. Let's define a variable, δ, which is a minuscule, arbitrarily small BUT NOT ZERO number. It is NOT ZERO. Definitely do NOT call it zero, because IT'S NOT.

be cool. we're about to do something sneaky and we don't want the math police to bust us

So if our starting time (like 1pm or whatever) is x, then our ending time is (x + δ), which is DEFINITELY NOT JUST x AGAIN, HA HA! Why would you think that, it's NOT LIKE δ IS ZERO OR ANYTHING. Likewise, our starting position is y = 3x, and our finishing position is y = 3(x+δ) = 3x + 3δ.

Okay, let's try to calculate our rate of change. That's just the change in the dependent variable divided by the change in the independent variable. Rise over run. We can do this.

rate of change = (y2 - y1) / (x2 - x1) =
((3x + 3δ) - 3x) / ((x + δ) - x) =

Okay! This is looking good. We can subtract "3x" from "3x" in the numerator, and we can subtract "x" from "x" in the denominator. Let's see where that leaves us:

3δ / δ =

Oh! This is so neat and tidy! And it's absolutely NOT a problem that we have δ in the denominator, since, as we have established, it's NOT ZERO. It's very close to zero. It's very, very close to zero. It's infinitely close to zero. It might as well be zero! But it's not, and that's what matters.

Quick, let's cancel that δ factor before anyone catches on.

3 = rate of change

Oh! That works out perfectly! It's 3! Which is... exactly what we thought it would be. But now we've proven it mathematically! We can now take any x, plug it into our formula, and get the rate of change at that instant moment in time. Let's try it!

Assume Quill starts his walk at noon. What's Quill's rate of change at 1pm? Let's plug x = 1 into our formula:

3

It's 3mph! Just like we expected! Let's try another one. What's Quill's rate of change at 2pm? Let's plug x = 2 into our formula:

3

Wow!! Nailed it!

...maybe you're not impressed. I mean, we could intuit that easily enough, given we started from the definition "Quill walks at exactly 3mph." Still, this is progress! We have a technique for figuring out formulas!

Well, I did say that if we could succeed with a constant pace, we can try something fancier. Let's imagine that on a particular day, Quill's writing progress can be expressed as y = x2, where x is "hours elapsed since noon" and y is "pages written." He starts off slow, but speeds up over time.

Once again, we'll call our arbitrary starting time x, and our arbitrary ending time x+δ. This time, our arbitrary starting # of pages written is x2, and our arbitrary ending # of pages is (x+δ)2. So, we can go ahead and plug those into our formula:

(y2 - y1) / (x2 - x1) =
((x+δ)2 - x2) / ((x+δ) - x) =

Hmm. Let's expand out that ((x+δ)2 in the numerator:

((x2 + 2xδ + δ2) - x2) / ((x+δ) - x) =

Okay, cool, we can subtract those x2 and x terms, similar to the last time:

(2xδ + δ2) / δ =

Wow, thank goodness δ isn't zero, or having it be the denominator would be a problem. Moving on quickly, we can pull out the δ factor from the numerator...

δ(2x + δ) / δ =

Cancel the δ factors...

(2x + δ) =

Now. Here's the thing. We've been really strident about the whole "δ is not equal to zero," thing. But... when you think about it... if a number is arbitrarily close to zero... if a number is as close to zero as it possibly can be... then it might as well be zero. Right? We're just "taking the limit" again, right?

So... let's just... replace that δ with a 0...

2x = rate of change

Hey we did it!! Perfectly legitimately!! We got a rate of change formula for y = x2!!

...does our formula makes sense? Well, let's think about it a bit:

At noon, Quill has written x2 = 02 = 0 pages. At 1pm, he's written x2 = 12 = 1 page. At 2pm, he's written x2 = 22 = 4 pages. At 3pm, he's written x2 = 32 = 9 pages.

At 1pm, Quill's pace is 2x = (2*1) = 2 pages/hour. That makes sense to me: remember, he is accelerating as he works. He only wrote 1 page during his first hour, but 3 pages in the hour after that. It makes sense his pace AT 1pm would be in-between those.

At 2pm, Quill's pace is 2x = (2*2) = 4 pages/hour. Again, seems about right: he wrote 3 pages in the hour beforehand and he'll write 5 pages in the hour afterwards, so hitting a pace of exactly 4 pages/hour in-between makes sense.

What about visually? Let's see what happens when we plot those slopes.