What would you do? Well, you could work out the exact formula:

and plug in n=100 to get 5050.

But we just want a rough answer. You have a list of numbers, they follow a simple pattern, and want a quick estimate. What to do?

The "easy" way (well, the Calculus way) is to realize 1 + 2 + 3 + 4 is about the same as f(x) = x. The first element is f(1) = 1, the second is f(2) = 2, and so on.

From here, we can take the integral:

We usually see the integral as a formal, elegant operation, which artfully accumulates one function and returns another. Informally, we're squashing everything together in that bad mamma-jamma and seeing how much there is.

The result frac(1)(2) x^{2} should be pretty close to what we want.

The *exact* total is our staircase-like pattern, which accumulates to 5050.

The *approximate* answer is the area of that triangle, frac(1)(2) base · height = frac(1)(2) 100 · 100 = 5000. The difference is because of the corners in the staircase which overhang. frac(x)(2) is one-half, x times (the size of overhang (1/2) times the number of pieces (x)).

The net result is using a smooth, easy-to-measure shape to approximate a jagged, tedious-to-measure one. (This is a bit of Calculus inception, since we usually use rectangles to approximate smooth shapes.)

This tactic works for other sequences:

**What's the sum of the first 10 square numbers? 1 + 4 + 9 + 16 + 25 + ... + 100 = ?**

Hrm. The formula is probably tricky to work out. But without our Calculus-infused Arithmetic, a quick guess would be:

Our first hunch should be "one third of 10^3" or 333. But as we saw before, there's an "overhang" that we missed. Let's call it 10%, for an estimate of 330 + 10% ~ 370.

The exact answer is 385. Not bad! The actual formula is:

I'd say frac(x^{3})(3) isn't bad for a few seconds of work.

**Data doubles every year. What does lifetime usage look like?**

The integral (squashed-together total) of an exponential is an exponential. In Calculus terms,

The key insight is that all exponential growth is just a variation of e^{x}. If e^{x} accumulates exponentially, so will 2^{x}.

So the total usage to date will also follow an exponential pattern, doubling every year also. Contrast this with a usage pattern of "1 + 2 + 3 + 4 ..." -- we grow linearly (f(x) = x), but total usage accumulates quadratically (frac(1)(2)x^{2}).

My goal is to incorporate math thinking into everyday scenarios. We start with an arithmetic question, convert it to a geometry puzzle (how big is the staircase?), and then use calculus to approximate it.

I know a concept is clicking when I can switch between a few styles of thought. Imagine the problem as a script: how would Spielberg, Tarantino, or Scorsese direct it? Each field takes a different look. (To learn how to think with Calculus, check out the Calculus Guide.)

Happy math.

]]>But it's really about empathy and reading your audience. What does the other person know? Are they getting lost? Are they having fun? (Am *I* having fun?)

What looks like a communication obstacle to an alien observer is an *enjoyable experience* for the human participants. Sure, there's an idea to convey, but maybe there's a clever, funny, or astoundingly simple way to convey it. Aha!

Math teaching should be the same: convey ideas with empathy for your audience.

I use the ADEPT method to remind me of what helps me learn: an Analogy, Diagram, Example, Plain English, Technical Definition.

But when *sharing* a math idea, I have a different mental checklist. No convenient acronym, just a list of questions to ponder:

If an idea was debated for centuries before being accepted, shouldn't that be taught?

Sure. Ok. How many of you know that negative numbers were called *numeri absurdi*? Only accepted (in the West) in the 1800s?

When we have struggles with new concepts (like imaginary numbers, also considered absurd), reference similar struggles in the past. *Hey, you're confused? Good. So was everyone else, and here's how we resolved it.*

Hey you (yes you, the teacher) -- what struggles did you have when learning?

Did imaginary numbers click instantly, without doubt? Did the Fourier Transform just snap into place on your first reading?

(You'd think so, given the unblinking, matter-of-fact treatment in most lessons. Argh!)

If you, the teacher, struggled with an idea, don't hide it: what tripped you up, how did you resolve it, and what issues do you still have?

I needed simulations before I understood the Fourier Transform: playing around with them made it click. Instead of writing down the definition, share the "behind-the-scenes" of what helped.

Learning is a back-and-forth process. If students don't have questions, they either understood it perfectly, or they are scared/uninterested.

In charades, we can easily see if the other player is confused or having a good time.

Academic writing is a bomb shelter, built to be defended from critics. Stable, rock-solid, but not welcoming.

I'd prefer to make a beach bungalow you look forward to visiting. Yeah, the banana-leaf roof is leaky, and no, Dwight, it cannot withstand an aerial assault from AGM-114 Hellfire missiles. But we'll have a great time all the same.

Lessons barricaded with prefaces and caveats indicate you are protecting yourself, not trying to be helpful. (*If students began Calculus without a month studying limits, they might (gasp) not have a rigorously defensible understanding on Day 1!*)

At some point you reinforce the bungalow, don't start there.

Make your students awesome. I want readers to learn things in minutes that took me a decade to untangle. (Kathy Sierra has a great talk about making users awesome.)

Giving impressively rigorous definitions on day 1 doesn't make students awesome. Ignoring historical and personal confusion doesn't make students awesome. Organized chapters of theorem/proof/exercise doesn't make students awesome.

Share what actually worked, in a way you would have liked to see it.

Happy math.

]]>Last time, we saw how abstraction simplifies ideas.

After removing enough detail, a photo of lions turns into the notion of quantity (where *n* happens to be 3 in this case).

Let's apply this to a function like f(x) = x^{2}. What's the simplified essence?

Here were my first thoughts as I worked through the idea:

**Abstraction 1: Multiple shapes**

First, look at a few representations of x^{2}. The common cliche is that it represents a square of side x, but we can be more creative. What about a rectangle with sides frac(1)(2)x and 2x? How about a portion of a circle? (If text(area) = π r^{2} then frac(1)(π) (32%) should leave us with r^{2}.)

**Abstraction 2: Examine the specific changes**

Next, look at the changes that happen with each of our shapes. The square gets equal lengths added to each side. The rectangle gets a "long, skinny" and "short, fat" added to each side. (The corners can be ignored for now.)

The changes to the circle are the simplest, with a small arc being added.

**Abstraction 3: Make the changes general**

Like the lion scenario above, we have a unique representation of each change ("three lion icons"). Let's make the changes generic (three lines) by finding a common format.

Here, we "melt down" each change until it resembles a straight line. Because the square, rectangle, and circle all represent x^{2}, the same line can describe the changes they undergo. Neat!

Now that's some nice abstractin', let's keep it going:

**Abstraction 4: Separate the line**

The orange "change line" is actually a transition between a starting and ending position. If we represent the start and end as blue dots, the height of the line is the amount of change between them.

Notice how we make an angled line as well: the input change (blue line) and output change (orange line) trace out the rate of change (green line).

**Abstraction 5: Show every state and angle**

Rather than picking specific starting and endpoint positions, graph *every* position (blue curve) and *every* rate of change (green line at each point).

The blue curve actually *generates* the green line: at any point, we can draw the tangent line and see the "change angle" to the next neighbor.

Here's where I get excited. On a graph, we're used to literal representations: we need a bigger line to represent a bigger change. But an angle (a certain ratio of height:width) represents every number in the same amount of space!

0:1 is 0 degrees

1:1 is 45 degrees

2:1 is 63.4 degrees (arctan(2) = 63.4)

100:1 is 89.4 degrees (arctan(100) = 89.4)

By using an angle, we've curled the number line into a format that fits into any space. Even a giant number like 10,000,000,000 can be written with the same effort as "1". Must bigger numbers take up more room?

We have a clean abstraction: **The curve shows every possible scenario, and the angle quantifies the rate of change**. In a way, the curve "writes down" its rate of change at every point.

Yowza. Maybe we discussed this in class, but I didn't think of it this way until trying to abstract each step.

This was a peek into an organic "aha-finding" technique: start with a specific idea, keep generalizing, and see what insights emerge.

Happy math.

]]>Let's change the generic "Math teaches you to think" to a more specific "Math helps us simplify ideas". We hide detail after detail to reveal an essential truth.

Is this style of thinking necessary? Required for survival? Usually not. But it's often interesting.

What's the simplest drawing you can recognize as a face? What's the simplest joke that's still funny? The simplest exercise that grows a muscle? Would knowing that improve your art, humor, or fitness?

What's in this picture?

A computer says "millions of pixels" and you say "three lions". In seconds you threw away countless details to reveal a deeper insight.

What happened? We abstracted the scenario into something simpler.

- Remove background from foreground
- Remove differences between each animal
- Remove "animal-ness" (treat lions as generic "lines")
- Remove need to count objects with literal lines
- Remove need to specify a fixed number ("n happens to be 3 today")

We tend to call the steps we're explicitly aware of "math". Once it becomes natural, it's just "effortless seeing". (Wouldn't it be nice to move more concepts into the "effortless" category?)

Let's try the "math simplification" on a bigger idea: learning.

What does learning involve? At its bare essence, what do we need?

`Learning = Insight + Enthusiasm`

Insight (for me) comes from Analogies, Diagrams, Examples, Plain English descriptions, and Technical definitions. (Read more about the ADEPT method)

Enthusiasm comes from humor, warmth, empathy, and being treated like a human (not math robot).

A good lesson has both. But wait: is enthusiasm enough by itself? Hrm. Maybe it's better written:

`Learning = Insight * Enthusiasm`

- If you have 0 for either, you aren't really learning.
- "Negative insight" is learning something false.
- "Negative enthusiasm" is hating something, even to the point of discouraging others.
- "Negative insight with negative enthusiasm" could be discouraging others from learning something false (which is good, right?).

This is just playing with words and pseudo-equations. Sure. But seeing how enthusiasm impacts education reveals a truth: an educational experience can become negative when enthusiasm points the wrong way.

The equations above don't have to be "right". They're helping us work through an idea. The math approach is to isolate the key factors and figure out how they're related.

For something like a car, the key elements seem to be:

`Car = Propulsion * Control`

Traditionally, the details of propulsion involve a gas engine, and the details of control require a human driver. But we're interested in abstraction: are these details we can hide?

Maybe propulsion can be electric. Maybe control can be from a computer. A self-driving electric car satisfies the essence of the equation with different details. (Just like 1 apple + 2 apples = 3 apples works as well as 1 lion + 2 lions = 3 lions.)

Asking the right question is difficult, and critical. For this problem, what are the essential variables? What counts, and what can be thrown away?

A lot of people argue that "math helps your programming". Yes, but not in the way you think.

Most programmers don't use anything beyond algebra and basic statistics. (Yes, yes, if you're working on a video game physics engine you can sit down.)

The key lesson from math is how it abstracted the vast complexity of the world. Here are a few fundamental types of "quantity":

- integers (whole numbers)
- floats (decimal numbers)
- hexadecimal numbers (whole numbers with a simpler way to use powers of 2)
- null (an unset number, different from zero)

Programmers don't need math skills so they can crank through arithmetic. They need math to see examples of the world getting simpler.

Any piece of data (text, images, video, etc.) can be expressed as a giant list of numbers, a combination of the above elements. That's pretty simple.

What other metaphors from math (functions, structure, change, chance) can help us simplify our code?

Bret Victor has a wonderful essay on the Ladder Of Abstraction.

If a new concept is difficult for me, I wonder if I'm at the right level of detail. There's no all-purpose answer like "less detail is better". Sometimes you're staring at your feet and need to zoom out, sometimes you're in the clouds and need to zoom in.

Analogies, Diagrams, Examples, Plain English and Technical definitions, throw them at the wall and trial-and-error a way to better understanding. Like getting an eye exam, move closer or further from an idea until it snaps into focus.

Happy math.

]]>