fbpx

Integrals with Riemann Sums

Imagine we're traveling out west for a hiking trip, and throughout the entire road trip, we were traveling a constant 30mph, represented by f(x) below:

Considering that this function represents our velocity, the area under the function represents our total distance traveled throughout the trip.

For example, during the first 20 hours of the trip, this blue area represents our total distance traveled.

This makes sense, because if we were traveling a constant 30mph, then 20 hours traveling at that velocity means we've covered a total of 600 miles. Visually, we could calculate that with a rectangle like so:

What if... instead of traveling a constant 30mph, our function representing out velocity throughout the road trip looked like this?

How could we visually determine our total distance traveled, considering that this function is not a straight line?

Herein lies the value of Riemann Sums!

Riemann Sums are utilized to estimate an integral visually utilizing rectangles.

How to use Riemann Sums

There's a couple crucial understandings to grasp...

The more rectangles, the better!

With our new function representing velocity, we could estimate the total distance traveled with the following 4 rectangles...

...or if we wanted to get an even more accurate representation of total distance traveled, we could double our rectangles to 8 like so!

This represents a crucial understanding of Riemann Sums:

The more rectangles that you have, the more accurate your estimation!

Calculating area

We can mathematically write the area of these 4 rectangles...

...representing our estimation of the integral of f(x) from 0 to 20 (which would look like so)...

...with the following 4 "base * height" equations (used to calculate the area of a rectangle).

These values for base (b) and height (h) can be visualized here!

Determining the base

Each of these rectangles has the same base value. We can calculate the base with the following equation...

...with b representing the upper bound (20) and a representing the lower bound (0)...

...and n = 4 (since we're using 4 rectangles in this Riemann Sums)...

...resulting in a base of 5!

We can visualize this like so...

...and means that we can update each of the base (b) values in our equation to be 5!

Now, let's figure out how we can apply the Left, Right, and Midpoint Riemann Sum strategies to estimate the integral for f(x)!

Left Riemann Sums

Notice how the top-left corner of these rectangles lines up with the function?

That means we're working with Left Riemann Sums!

Left Riemann Sums means the top-left corner of the rectangles line up with the function.

To find the height of these rectangles, we need to determine the value of f(x) at each of the corners that touch the function.

We can represent this mathematically in our Left Riemann Sums equation like so:

When we calculate these height values, we get the following...

...which can be plugged into our Left Riemann Sums equation like so:

When we solve, we get the following final estimation for the integral of f(x) between 0 and 20 of 143.75!

Right Riemann Sums

What if instead, the top-right corner of these rectangles lined up with the function?

That'd mean we're working with Right Riemann Sums!

Right Riemann Sums means the top-right corner of the rectangles line up with the function.

To find the height of these rectangles, we need to determine the value of f(x) at each of the corners that touch the function.

We can represent this mathematically in our Right Riemann Sums equation like so:

When we calculate these height values, we get the following...

...which can be plugged into our Right Riemann Sums equation like so:

When we solve, we get the following final estimation for the integral of f(x) between 0 and 20 of 193.75!

Midpoint Riemann Sums

A (typically) more accurate (but more pain-in-the-ass) way to utilize rectangles to estimate the integral is with a midpoint Riemann Sums!

This means that the midpoint of the top of the rectangle lines up with the function!

Midpoint Riemann Sums means the top-midpoint of the rectangles line up with the function.

To find the height of these rectangles, we need to determine the value of f(x) at each of the midpoints that touch the function.

We can represent this mathematically in our Midpoint Riemann Sums equation like so:

When we calculate these height values, we get the following...

...which can be plugged into our Midpoint Riemann Sums equation like so:

When we solve, we get the following final estimation for the integral of f(x) between 0 and 20 of 165.625!

Which is more accurate?

We gathered the following values from Left, Right, and Midpoint Riemann Sums... (I've included the actual answer as well for full visibility)

MethodSolution
Left Riemann Sums143.75
Right Riemann Sums193.75
Midpoint Riemann Sums165.625
Exact Answer166.667

Notice how the Left-Hand Rectangles underestimated...

...and the Right-Hand Rectangles overestimated.

The Midpoint Rectangles were pretty close to the exact answer. That's because that method does a good job of canceling out underestimates & overestimates, and is therefore typically closer to the actual answer.

What you must take away from this is that...

Different methods provide differing levels of accuracy dependent on the function itself.

Left Riemann Sums do not always underestimate, nor do Right Riemann Sums always overestimate. It depends on the concavity of the function!

Leave a Comment