# Riemann Sums

By Murray Bourne, 14 Jun 2010

Integration is a process in mathematics that can tell us:

- The area of a curved 2-D object (the sides aren't straight, and there is no simple formula)
- The volume of a curved 3-D object (once again, the sides aren't straight)
- The velocity of an object if we know its acceleration at time
*t*(which means the acceleration changes all the time, as does its velocity) - The displacement of an object if we know its velocity at time
*t*(the velocity and displacement change over time, so there is no simple formula) - The pressure on an object deep under water (the pressure varies as we go down)

In integration we spend a lot of time talking about **areas under curves** because such areas can be used to represent any of the quantities given above.

Most of the time in math class we use integration to find the areas under curves. We are told the area under some curve *f*(*x*) can be found by finding the definite integral between certain lower and upper limits, *a* and* b* as follows:

However, it turns out that is not always possible to find such an integral.

## Our Problem

I need to find the area under the following curve, between *x* = 3.1 and *x* = 6.

The required area is shaded green in the following graph.

So we write the following integral to represent the required area:

However, it is not possible to find the above integral using normal algebraic integration.

What to do? Well, we need to find the result **numerically**, just like mathematicians had to do for all integrations before Isaac Newton and Gottfried Leibniz developed calculus in the 17th century.

One way of doing this is to draw a grid over the shaded area and then count the little squares:

However, you can imagine this would get very tedious very quickly, especially if you had to find many such areas. And remember, if you want a more accurate approximation, you have to use smaller squares and that involves more counting.

There is a better way.

[Please note that what we are about to do is the way computers find integrals numerically.]

## Riemann Sums

Riemann Sums give us a systematic way to find the area of a curved surface when we know the mathematical function for that curve. They are named after the mathematician Bernhard Riemann (pronounced "ree-man", since in German "ie" is pronounced "ee").

The following interactive javascript graph allows you to investigate the area under a simple parabola (*y* = *x*^{2}). The actual area is also displayed for comparison.

In the following graph, you can change:

- The
**type**of Riemann Sum at the top of the graph, - The
**number of rectangles**(or trapezoids) by dragging the slider, - The
**start and end**points of the graph, by dragging the sliders.

## Simple Example

**Update (May 2014):** This applet has been updated, improved and moved, and you can now find it here: Riemann Sums.

## Explanation

What you were doing above was as follows.

We can form equal width rectangles between the start and end points of the area we need to find.

If we add up the areas of the rectangles, we will have a good approximation for the area.

We can either place the rectangles so the curve is on the **left** or **right** as follows. Depending on the curve one or the other gives a reasonable approximation.

You can see in the above examples, the "left" approximation will be too small (the sum of the rectangle areas is less than the area below the curve), while the "right" one will be too large.

Another, and better option is to place the rectangles so the curve passes through the **mid-points** of each rectangle, as follows:

Another option is to create trapezoids. When the number of trapezoids is very high, they cover nearly all of the area under the curve.

The final 2 options we can use are **lower** (where the rectangles are completely below the curve) and **upper** (where the rectangles are completely above the curve).

## The Solution to Our Problem

Earlier, we wanted to find the area under the curve *y* = |0.3*x*^{3} sin *x*| between *x* = 3.1 and *x* = 6.

You can use the following interactive graph to find the answer using Riemann Sums.

Choose Riemann sum type:

You can see that even with 50 steps, we don't even get 1 decimal place accuracy for this problem, not with any of the possible methods. (The answer is just over 64 square units.)

Remember 300 years ago, they had to do these calculations by hand! No wonder they were keen to develop aids for calculation, like logarithms.

## What's Missing?

1. The most accurate numerical integration method is missing from the list above. Instead of using straight lines to connect points on the graph (the trapezoid approach), we could approximate the curve by a series of **parabolas** (one for each division). This gives us Simpson's Rule.

2. The integral only gives us the area if the curve is completely above the *x*-axis (as in each of my examples above). You need to use absolute value of the integral for the parts of the curve below the *x*-axis. For more detail, see Area under curves.

## Summary

This article showed you an important concept in calculus. The area under a curve can represent the solution for many "real life" problems, from finding velocities to volumes.

The way it was done before calculus was developed was to use a **numerical approach** where we add up the areas of very thin rectangles (or trapezoids) to get a good approximation.

We get a better approximation by taking even more rectangles.

See the 18 Comments below.