🤡

Clown school

Riemann Sums

We know that finding the area under a function reverses the derivative, which is useful for solving problems. But some areas are harder to calculate than others.

For example, consider the following car. It begins its journy travelling at a rate of 60mph, and then slows down over time.

00.511.522.530mph10mph20mph30mph40mph50mph60mph
Car driving at 60 mph
6003010204050

The velocity at any given time is represented by the following function:

v(t)=60t+1v(t) = \frac{60}{t+1}

To find the total distance the car travels in 3 hours, we need to find the shaded area under the function.

Area Estimation

Finding this area seems... hard, to say the least. For all of the previous car examples, we had some area formula we could use. But now we don't!

Still, you might be able to estimate the area. In fact, give it a try! Take a look at the following graph and type in your best guess for the area under the curve.

00.511.522.530mph10mph20mph30mph40mph50mph60mph
Best estimate of total distance travelled:
Area = miles

Hint: Each grid square has an area of 5 miles. Can you count (roughly) how many grid squares are covered?

A Structured Estimation Process

You didn't type in an estimate in the previous section! Maybe you didn't notice the box. Maybe you were just feeling lazy. Or maybe, just maybe, you knew that we would discover a better method, so spending your time on the first attempt wasn't actually that important. Well played.

Let's try estimating the area using vertical rectangles only. This estimate won't be perfect, and you might be able to think of ways to improve it. But it has two crucial benefits that we'll discuss soon.

00.511.522.530mph10mph20mph30mph40mph50mph60mph123456

On the graph above I've placed some vertical rectangles. Use the table below to calculate their areas.

Width (hours)
Height (mph)
Area (miles)
1
×\times
=
0
2
×\times
=
0
3
×\times
=
0
4
×\times
=
0
5
×\times
=
0
6
×\times
=
0
Remember that
v(t)=60t+1v(t) = \frac{60}{t+1}
Total: 0

Take a look at the area estimate produced by using the method above. Do you think that it is too high or too low? How does it compare to your original guess?

Why'd We Do That?

Alright, we have a structured way to make estimates. This strategy is called a Riemann sum. But why do it this way, rather than by some other method?

Riemann sums have two main benefits:

  • It's easy to calculate the height of each rectangle based on the function.
  • It's easy to change the number of rectangles.

If you want to get a better estimate, being able to increase the number of rectangles is key. Try changing the number of rectangles using the slider below and watch what happens.

00.511.522.530mph10mph20mph30mph40mph50mph60mph123456
N = 6
Total Area: 95.6

Hmmm... As the number of rectangles increases, the estimate improves. In fact, it seems to be converging to a "perfect" answer.

Approaching Something Good

We new have an estimate that can become arbitrarily good simply by increasing N, the number of rectangles. That's really powerful! No matter how close you want to get to the "true" area, you can do it simply by increasing N.

But what if you don't want an estimate. Can we find the exact answer?

Spider man thinking hard

This is where your calculus spidey senses might start tingling.

When you have an estimate that's getting closer and closer and closer to some exact answer, what do you do? Take a limit, of course!

Let's Get Mathy

We want to take the following limit:

Actual Area=limNArea Estimate\text{Actual Area} = \lim_{N \rightarrow \infty} \text{Area Estimate}

This is great in theory, but we need a way to represent our area estimate as math so that we can actually take the limit.

The area estimate is the sum of a bunch of rectangle areas, where each area is a height times a width. Each width is one Nth of the full width and each height is the value of the function on the left-hand side of the rectangle.

Let's go ahead and try to convert each part of this definition into math. I'll lay out the options, and you arrange the fridge magnets to make it all work:

DescriptionMath
The sum of a bunch of rectangle areas...
Where each area is a height times a width...
Each width is one Nth of the full width...
And each height is the value of the function...
On the left-hand side of the rectangle.
hi=f(xi)h_i = f(x_i)
xi=a+iΔxx_i = a + i \cdot \Delta x
Ai=hi×ΔxA_i = h_i \times \Delta x
i=1NAi\sum_{i=1}^N A_i
Δx=baN\Delta x = \frac{b - a}{N}

When you put all of these parts together, you get the following:

Area Estimate=i=1Nf(a+ibaN)baN\text{Area Estimate} = \sum_{i=1}^N f\left(a + i \cdot \frac{b-a}{N}\right) \cdot \frac{b-a}{N}

Amazing! Now we just look back to our original goal... We wanted to take the limit of this estimate as NN \rightarrow \infty of the area estimate to get the actual area:

Actual Area=limN[i=1Nf(a+ibaN)baN]\text{Actual Area} = \lim_{N \rightarrow \infty} \left[ \sum_{i=1}^N f\left(a + i \cdot \frac{b-a}{N}\right) \cdot \frac{b-a}{N} \right ]

What Infinity Buys Us

Now that we can take a limit, we can let NN \rightarrow \infty. This means we can get an exact answer for the area under the function, which gives us the exact distance that the car travelled.

Drag the slider all the way to the end for the satisfaction of seeing infinity:

00.511.522.530mph10mph20mph30mph40mph50mph60mph
N=20N = 20
Total Area: 86.7

So it turns out that the exact answer is ≈83.178.