Video: Riemann Sums

In this video, we will learn how to approximate the area under the curve of a function using right, left, and midpoint Riemann sums.

17:36

Video Transcript

In this video, we’re going to learn how definite integrals can be estimated by using rectangles. And this is a process called finding Riemann sums. We’ll discover how to split the area between the curve and the 𝑥-axis into rectangles of varying points. And consider how accurate these approximations are by looking at a number of examples of various degrees of difficulty.

Let’s suppose we’re looking to find the area between the curve of 𝑦 equals 𝑥 squared, the 𝑥-axis, and the vertical lines 𝑥 equals one and 𝑥 equals three. We know that we can find the exact area using definite integration. We evaluate the integral of 𝑥 squared between the limits of one and three with respect to 𝑥. The integral of 𝑥 squared is 𝑥 cubed over three. Evaluating this between the limits of one and three, and we obtained three cubed over three minus one cubed over three, which is 26 over three or roughly 8.67 square units. The problem is, integrating a function is not always that simple. And we might just need to approximate the area between the curve and the 𝑥-axis.

To do that, we have a number of options. And in this video, we’re going to use something called Riemann sums. In this case, we’re going to split the area under the curve into rectangles and then find the area of each. There are three ways we could do this. We could find the height of the rectangles by using the value of the function at the left endpoint of each rectangle, at the right endpoint of each rectangle, or at the midpoint of each rectangle. And on occasion, we might even choose to use unequally sized subintervals, though that’s quite rare. Let’s go back to this example.

We’re going to imagine we want to split the area into four subintervals, four equally sized rectangles. To find the width of each rectangle, we find the difference between the bounds of our area. And we share that into 𝑛 pieces, where 𝑛 is the number of subintervals. Here, that’s three minus one all divided by four, which is of course one-half. Each sub interval is therefore 0.5 units wide. Formaly, we say that the width of each rectangle, 𝛥𝑥, is equal to 𝑏 minus 𝑎 over 𝑛. Where 𝑏 and 𝑎 are the endpoints of the interval and 𝑛 is the number of subintervals. Let’s estimate the area by using the right endpoint of each sub interval. In other words, we’re going to find the height of each rectangle by considering the function value at the right endpoint of each of our subintervals.

Starting at the beginning of our interval, we add 0.5 to one. And we see that the height of this rectangle is equal to the function value at 𝑥 equals 1.5. That’s 𝑓 of 1.5, which is of course 1.5 squared, which is equal to 2.25. Since the area of a rectangle is found by multiplying the length of its base by its height, we find the area of this one by multiplying 0.5 by 2.25. Which gives us 1.125 square units. Next, we add another 0.5 to 1.5 to give us two. The height of this rectangle is the value of the function at 𝑥 equals two. That’s 𝑓 of two which is two squared which is, of course, equal to four. This time, the area of the rectangle is four times 0.5, which is two square units. We add then another 0.5 to two to give us 2.5. And when we see that the height of this rectangle would be the value of 𝑓 at 2.5. 𝑓 of 2.5 is 2.5 squared, which is 6.25. And so, the area of our third rectangle is 6.25 times 0.5, which is 3.125 square units.

Finally, if we add another 0.5, we get to three. That’s the ends of our interval. And it’s the fourth rectangle as required. This time, its height is 𝑓 of three. That’s three squared, which is nine. And therefore, the area of our final rectangle is nine times 0.5, which is 4.5 square units. To find an estimate for the total area under the curve and therefore an estimate to the definite integral between one and three of 𝑥 squared, we add these together. An estimate then to that integral is 1.125 plus two plus 3.125 plus 4.5, which is 10.75 square units.

Remember, the answer that we got when we evaluated the integral itself was 8.67. And if we look carefully, we can see that our rectangles are all a little bit bigger than the area required. So we would have been expecting an overestimate. We could, of course, make our approximation more accurate by splitting the rectangles into smaller subintervals. And, in fact, as the number of subintervals 𝑛 approaches infinity, the Riemann sum approaches the definite integral of the function between the endpoints. It’s important to remember, though, that if the function takes on both positive and negative values as shown here. Then the Riemann sum is the sum of the areas of the rectangles that lie above the 𝑥-axis and the negatives of the areas of the rectangles that lie below the 𝑥-axis. In this case, that would be the area of the pink rectangles minus the area of the yellow rectangles. We’re now going to look at a more formal example of this process, this time using left endpoints.

Given that 𝑓 of 𝑥 is equal to four cos 𝑥 and that 𝑥 is greater than or equal to zero and less than or equal to 𝜋 by four, evaluate, to the nearest six decimal places, the Riemann sum for 𝑓 with six subintervals, taking the sample points to be left endpoints.

Remember, we can approximate the definite integral of a function between the limits of, say, 𝑎 and 𝑏 by splitting the area between the curve and the 𝑥-axis into 𝑛 subintervals. Where the width of each rectangle, 𝛥𝑥, is equal to the difference between the upper and lower limits divided by 𝑛, the number of subintervals. In this question, we’re looking to split the area into six subintervals, so we let 𝑛 be equal to six. We let 𝑎 be equal to zero and 𝑏 be equal to 𝜋 by four. So 𝛥𝑥 here and the width of each of our rectangles is 𝜋 by four minus zero over six, which is 𝜋 over 24. Let’s now sketch out the curve of 𝑦 equals four cos 𝑥 between 𝑥 equals zero and 𝜋 by four radians and spilt it into these six subintervals.

This question requires us to use left endpoints. So the height of each of our rectangles will be equal to the value of the function at the left of each subinterval. The sketch is really useful here because we see that each rectangle sits above the 𝑥-axis. So we just need to find the positive area of each. Let’s consider our first rectangle. Its left endpoint is at 𝑥 equals zero. So we find the height of the rectangle by evaluating 𝑓 of zero. 𝑓 of zero is four times cos of zero, which is four. The area of this first rectangle then is therefore 𝜋 by 24, since that’s the width of each rectangle, times four. That’s 𝜋 by six square units.

We now need to find the next endpoint. We achieve this by adding 𝜋 by 24 to zero; that’s 𝜋 by 24. And we can therefore find the height of this rectangle by evaluating 𝑓 of 𝜋 by 24. That’s four cos of 𝜋 by 24, which is approximately 3.965779 and so on. The area of our second rectangle then is width times height or base times height. That’s 𝜋 by 24 times 3.965 and so on, which is roughly 0.51911931 and so on. Now, of course, this question is asking us to evaluate till six decimal places, which is why I’ve left the numbers as I have. We find the next endpoint by adding another 𝜋 by 24 to 𝜋 by 24 and we get 𝜋 by 12. The height of this third rectangle then is 𝑓 of 𝜋 by 12 which is four cos of 𝜋 by 12, which gives us root six plus root two. And then we see that the area of our third rectangle is 𝜋 by 24 multiplied by this value, which gives us an area of roughly 0.505 and so on square units.

We repeat this process by repeatedly adding 𝜋 by 24 to each of our endpoints. And when we do, we find that the left endpoint of each of our rectangles is 𝜋 by eight, 𝜋 by six, and 𝑥 equals five 𝜋 by 24. Their heights are respectively given by 𝑓 of 𝜋 by eight, 𝑓 of 𝜋 by six, and 𝑓 of five 𝜋 by 24. And when we multiply each of these values by the width, 𝜋 by 24, we find that the area of our fourth rectangle is roughly 0.4837. Our fifth rectangle is roughly 0.4534. And our sixth is approximately 0.4153. Remember, the Riemann sum is the total area of these six rectangles. It’s 2.901 and so on. That’s 2.901067 correct to six decimal places.

In our next example, we’re going to look at how to find the Riemann sum using midpoints.

Given 𝑓 of 𝑥 is equal to 𝑥 squared minus four and 𝑥 is greater than or equal to negative four and less than or equal to two, evaluate the Riemann sum for 𝑓 with six subintervals, taking sample points to be midpoints.

Remember, we can approximate the definite integral of a function between the limits 𝑎 and 𝑏 by splitting the area between the curve and the 𝑥-axis into 𝑛 subintervals. The width of each rectangle is given by 𝛥𝑥, which is found by subtracting 𝑎 from 𝑏 and dividing this value by 𝑛. In this example, we want to split the area into six subintervals. So we let 𝑛 be equal to six, and then 𝑎 is negative four and 𝑏 is two. The width of each of our subintervals is given then by two minus negative four over six, which is equal to one. Next, we’re going to sketch the curve of 𝑦 equals 𝑥 squared minus four between the endpoints negative four and two. And we’re going to split this into six subintervals.

This question requires us to use midpoints. So the height of each rectangle will be equal to the value of the function at the middle of each subinterval. That’s going to look a little something like this. Now, we can work out the 𝑥-value at the end of each rectangle by repeatedly adding one to four. And that gives us each of these values. We can then see that the midpoints are going to be negative 3.5, 𝑥 equals negative 2.5, negative 1.5, and so on.

Now, we’re going to need to be extra careful here. We see that some of our rectangles sit below the 𝑥-axis. This means we’re going to find the negative value of their area. In other words, we’ll subtract the total area of the rectangles that sit below the 𝑥-axis from the total area of the rectangles that sit above the 𝑥-axis. Let’s begin by finding the function values at each midpoint. And that will tell us the height of each rectangle. That’s 𝑓 of negative 3.5, 𝑓 of negative 2.5, 𝑓 of negative 1.5, and so on. And, of course, our function is 𝑥 squared minus four. And when we substitute each of these values into that function, we get 8.25, 2.25, negative 1.75, negative 3.75, another negative 3.75, and another negative 1.75. We then obtain the area of our first rectangle here to be 8.25 times one.

Our second rectangle has an area of 2.25 times one. Our third rectangle has an area of 1.75 times one, not negative 1.75. Because we’re just dealing with areas at the moment. Our fourth rectangle has an area of 3.75 times one. Base times height with our fifth rectangle is 3.75 times one again. And for our last rectangle, it’s 1.75 times one. The Riemann sum is therefore 8.25 plus 2.25 minus the sum of 1.75, 3.75, 3.75, and another 1.75. And that gives us an approximation to the definite integral between the values of negative four and two of 𝑥 squared minus four. It’s negative 0.5. And, of course, 𝑥 squared minus four is a fairly simple function to integrate. So we can check our answer by evaluating that integral.

When we do, we get 𝑥 cubed over three minus four 𝑥 between the limits of negative four and two, which gives us a value of zero. And our estimate of negative 0.5 is pretty close. So we can assume we’ve probably done this correctly. It’s worth noting that a sketch of the curve won’t always be possible. So instead, we need to notice that when the value of 𝑓 of 𝑥 is less than zero, we subtract the area of the rectangle with that height.

Now that we’ve considered three types of Riemann sums, let’s have a look at how to decide whether we’re finding a lower or upper estimate for our integral.

A table of values for an increasing function 𝑓 is shown. Use Riemann sums to find lower and upper estimates for the definite integral between the limits of zero and 20 of 𝑓 of 𝑥 with respect to 𝑥.

It’s important to know that we’ve been given a table of values for an increasing function. This means that over the closed interval zero to 20, the graph of the function will always be sloping up. It might look a little something like this. Now, we know we can find estimates for the integral given by using Riemann sums. So our job here is to work out which Riemann sum is likely to give the lowest estimate and which is likely to give the highest estimate. If we were to find the Riemann sum using the left endpoints, we see we end up with something a little like this. Almost every rectangle is a little smaller than the actual area. When we use right endpoints, we end up with much more than the actual area. It follows also that using the midpoint would give us something in the middle as would using the trapezoidal rule.

This means that using the left endpoint is going to give us a lower estimate and using the right endpoint will give us an upper estimate. Let’s find both of these approximations. We see that the width of our subintervals is four. So we could say that the width of each rectangle is going to be four units. And the area of our first rectangle is going to be four multiplied by the positive value of the function at the left endpoint; that’s three. The second rectangle will have an area of four times four. The third will have an area of four times nine. Then we have a rectangle with an area of four times 18 and an area of four times 30.

Remembering that the first rectangle sits below the 𝑥-axis, we subtract this from the sum of the other four. And we get a total area of 232 square units. We now repeat this using the right endpoint. And we see that the area of our first rectangle is four times four. The second is four times nine. Then, we have an area of four times 18, four times 30, and four times 35. This time, each of these rectangles sits above the 𝑥-axis. So we add all these values together to get a total of 384 square units. The lower and upper estimates of the definite integral of 𝑓 of 𝑥 evaluated between zero and 20 are therefore 232 and 384, respectively. In fact, we can generalize the result here. We can say that when working with increasing functions. The left Riemann sum will be an underestimate of the area between the curve and the 𝑥-axis. Whereas the right Riemann sum will give an overestimate. The reverse, of course, must be true then for decreasing functions.

Suppose 𝑇, 𝐿, and 𝑅 are approximations for the definite integral between one and three of 𝑥 cubed plus one using the trapezoidal rule, left Riemann sum, and right Riemann sum, respectively, using 10 subintervals. Which of the following is the correct relationship between the three approximations? Is it 𝑅 is less 𝑇 which is less than 𝐿, 𝐿 is less than 𝑇 which is less than 𝑅, 𝑅 is less than 𝐿 which is less than 𝑇, or 𝑇 is less than 𝐿, which is less than 𝑅?

Let’s consider the function 𝑓 of 𝑥 equals 𝑥 cubed plus one. We know by considering the shape of the curve that it’s an increasing function. Though we could check this by differentiating to get three 𝑥 squared which is greater than zero for values of 𝑥 not equal to zero, confirming our suspicions. This really helps because we know that for an increasing function, the left Riemann sum gives an underestimate for the actual area. Let’s call that 𝐴. And the right Riemann sum gives an overestimate for the actual area. We can therefore say that we know that 𝐴 must be greater than 𝐿 which must be less than 𝑅. And this, in turn, means that 𝑅, of course, must be greater than 𝐿.

But where did the estimates for the trapezoidal rule come in here? Well, this uses nothing more than the average of the left and right Riemann sums. So it follows that this approximation must sit between the two. And we obtain that 𝑇 must be greater than 𝐿 but less than 𝑅. The second is the correct relationship between the three approximations.

In this video, we learned that we can approximate definite integrals by splitting the area between the curve and the 𝑥-axis into a number of rectangles. Each rectangle have heights of the value of the function at the subinterval’s right endpoints, left endpoints, or midpoints. We also saw that for increasing functions, the left Riemann sum will give a lesser value than the right Riemann sum. And for decreasing functions, the reverse is true.

Nagwa uses cookies to ensure you get the best experience on our website. Learn more about our Privacy Policy.