Lesson Video: Numerical Integration: Riemann Sums | Nagwa Lesson Video: Numerical Integration: Riemann Sums | Nagwa

Lesson Video: Numerical Integration: Riemann Sums Mathematics

In this video, we will learn how to use right, left, and midpoint Riemann sums to numerically approximate definite integrals.

14:56

Video Transcript

In this video, we’ll learn how to use right, left, and midpoint Riemann sums to numerically approximate definite integrals. Up until this stage, you’ve probably estimated the area between the curve and the π‘₯-axis by splitting into rectangles and finding their combined sum. We’ll now see how this process links to calculus and how it can help us to numerically approximate definite integrals.

Suppose we’re looking to find the area between the curve 𝑦 equals 𝑓 of π‘₯, the π‘₯-axis, and the vertical lines, denoted π‘₯ equals π‘Ž and π‘₯ equals 𝑏. The region might look a little like this one shown, though it is possible that the function values could also be both positive and negative. The Riemann sums give us an approximation of this area by splitting it up into equal-sized rectangles. The heights of these rectangles will either be given by the function value at the left endpoint of each interval. That’s a left Riemann sum, the right endpoint for a right Riemann sum, or the midpoint of each interval.

The formulae for the right and left Riemann sums are as shown. And remember, when we’re writing a right Riemann sum, we take values of 𝑖 from one to 𝑛. And when we’re writing a left Riemann sum, we take values of 𝑖 from zero to 𝑛 minus one. And that gives us the value of 𝑓 at the left endpoint of each rectangle. Now, here, Ξ”π‘₯ is 𝑏 minus π‘Ž divided by 𝑛. π‘Ž and 𝑏 are the beginning and end points of the interval and 𝑛 is the number of subintervals, in other words, the number of rectangles we’re splitting the region into. Then, π‘₯𝑖 looks a little bit confusing. But it’s π‘Ž plus 𝑖 lots of Ξ”π‘₯. In other words, we start at the lower limit of our interval. And we repeatedly add Ξ”π‘₯, the width of each rectangle.

Now, let’s imagine we’re splitting the region into, let’s say, two rectangles. Here, I’ve chosen the height of each rectangle to be the value of the function of the left endpoint. Now, it follows that this is not going to give us a very good estimate for the area between the curve and the π‘₯-axis. But if we were to split further into, say, four rectangles, our estimate will be closer to the exact area. And splitting it further into eight rectangles, for example, and our estimate would be even closer. In fact, as the number of rectangles or subintervals, 𝑛, approaches infinity, the approximate area approaches the exact area between the curve and the π‘₯-axis.

When evaluating right Riemann sums, we can say that the area π‘Ž of the region that lies under the graph of a continuous function 𝑓 is the limit as 𝑛 approaches infinity of the sum of Ξ”π‘₯ times 𝑓 of π‘₯𝑖 for values of 𝑖 from one to 𝑛. And when evaluating left Riemann sums, we say that the area of the region that lies under the graph of a continuous function 𝑓 is the limit of the sum of Ξ”π‘₯ times 𝑓 of π‘₯𝑖 for values of 𝑖 from zero to 𝑛 minus one. And in fact, instead of using left or right endpoints, we could even take the height of the 𝑖th rectangle to be the value of 𝑓 at any number π‘₯𝑖 star in the 𝑖th subinterval from π‘₯𝑖 minus one to π‘₯𝑖. Recall π‘₯𝑖 star the sample point. In this case, we can generalize our formula, as shown.

But then, we move on to yet another definition. And this is the definition of a definite integral. And you might have seen this before. If 𝑓 is a function defined on the close interval π‘Ž to 𝑏, we divide that interval into 𝑛 subintervals of equal width. That’s Ξ”π‘₯, where π‘₯ nought, π‘₯ one, π‘₯ two, and so on are endpoints of the subintervals. Then, π‘₯ one star, π‘₯ two star, up to π‘₯𝑛 sample points in the subintervals so that π‘₯𝑖 star lies in the 𝑖 subinterval. Then, the definite integral of 𝑓 from π‘Ž to 𝑏 is the limit as 𝑛 approaches ∞ of the sum of Ξ”π‘₯ times 𝑓 of π‘₯𝑖 star for values of 𝑖 from one to 𝑛. That is, of course, providing this limit exists and gives us the same value for all possible choices of sample points.

But hang on a minute! We just said that the area between the curve of 𝑦 equals 𝑓 of π‘₯ and the π‘₯-axis between π‘₯ equals π‘Ž and π‘₯ equals 𝑏 is equal to this limit. So that must mean that the definite integral between the limits of π‘Ž and 𝑏 of our function is the exact area. And that’s great because yes, there are some functions we can integrate easily. And therefore, we can evaluate the definite integral to find the exact area between the curve and the π‘₯-axis. But if we can’t, we now know that we can use Riemann sums to help approximate it.

Let’s see what this might look like.

The table shows the values of a function obtained from an experiment. Estimate the definite integral between five and 17 of 𝑓 of π‘₯ with respect to π‘₯ using three equal subintervals with left endpoints.

Remember, we can estimate a definite integral by using Riemann sums. In this case, we’re estimating the integral between five and 17 of 𝑓 of π‘₯. Now, it doesn’t really matter that we don’t know what the function is. We have enough information in our table to perform the left Riemann sum. The left Riemann sum involves taking the heights of our rectangles as the function value at the left endpoint of the subinterval. We want to use three equally sized subintervals. So let’s recall the formula that allows us to work out the size of each subinterval, in other words, the widths of the rectangle.

It’s Ξ”π‘₯ equals 𝑏 minus π‘Ž over 𝑛, where π‘Ž and 𝑏 are the endpoints of our interval and 𝑛 is the number of subintervals. In our case, we’re looking to evaluate the definite integral between five and 17. So we let π‘Ž be equal to five and 𝑏 be equal to 17. And we want three equal subintervals. So we’ll let 𝑛 be equal to three. Ξ”π‘₯ is then 17 minus five all divided by three, which is simply four. Then when writing a left Riemann sum, we take values of 𝑖 from zero to 𝑛 minus one. It’s the sum of Ξ”π‘₯ times 𝑓 of π‘₯𝑖 for values of 𝑖 from zero to 𝑛 minus one. π‘₯𝑖 is π‘Ž plus 𝑖 lots of Ξ”π‘₯. In this case, we know that π‘Ž is equal to five, and Ξ” π‘₯ is equal to four. So our π‘₯𝑖 value is given by five plus four 𝑖.

Well, since we’re using the left Riemann sum, we begin by letting 𝑖 be equal to zero. We need to work out π‘₯ zero. It’s five plus four times zero, which is simply five. We can find 𝑓 of π‘₯ nought in our table. It’s negative three. Next, we let 𝑖 be equal to one. And we get π‘₯ one to be five plus four times one, which is nine. We look up the value π‘₯ equals nine in our table. And we see that 𝑓 of nine is negative 0.6. Next, we let 𝑖 be equal to two. And remember, we’re looking for values of 𝑖 up to 𝑛 minus one. Well, three minus one is two. So this is the last value of 𝑖 we’re interested in. This time, that’s five plus four times two which is 13. We look up π‘₯ equals 13 in our table. And we get that 𝑓 of 13 and 𝑓 of π‘₯ two is 1.8.

Then, according to our summation formula, we find the sum of the products of Ξ”π‘₯ and these values of 𝑓 of π‘₯𝑖. And so, an estimate for our definite integral is four times negative three plus four times negative 0.6 plus four times 1.8, which is negative 7.2. An estimate for the definite integral between five and 17 of 𝑓 of π‘₯ with respect to π‘₯ using three equal subintervals is negative 7.2.

Now, we don’t need to worry here that our answer is negative. Remember, when we’re working with Riemann sums, we’re looking at areas. But when the function values are negative, the rectangle sits below the π‘₯-axis. And so, its area is subtracted.

Let’s now have a look at how we can use the formulae with right endpoints.

Approximate the definite integral between negative two and two of three π‘₯ squared minus five π‘₯ with respect to π‘₯ using a Riemann sum with right endpoints. Take 𝑛 to be eight.

Remember, we can estimate the solution to a definite integral by using Riemann sums, in this case is the definite integral of three π‘₯ squared minus five π‘₯ between the limits of negative two and two. And we’re going to be using right endpoints. When writing Riemann sums with right endpoints, we take values of 𝑖 from one to 𝑛. It’s the sum of Ξ”π‘₯ times 𝑓 of π‘₯𝑖 for these values of 𝑖, where Ξ”π‘₯ is 𝑏 minus π‘Ž divided by 𝑛. Bear in mind here that 𝑛 is the number of subintervals and π‘₯𝑖 is equal to π‘Ž plus 𝑖 lots of Ξ”π‘₯. So let’s look at what we actually have.

Our limits are from negative two to two. So we’ll let π‘Ž be equal to negative two and 𝑏 be equal to two. We’re told that we need to take 𝑛 to be eight. Geometrically, this tells us the number of rectangles we have. And now, we can work out Ξ”π‘₯. That’s the width of each rectangle. According to our formula, Ξ”π‘₯ is 𝑏 minus π‘Ž over 𝑛. That’s two minus negative two over eight, which is one-half. And once we have Ξ”π‘₯, we can then work out π‘₯𝑖. It’s π‘Ž which we said is negative two plus Ξ”π‘₯. That’s half times 𝑖. In other words, π‘₯𝑖 is negative two plus 𝑖 over two.

Now, for our Riemann sum, we need to work out 𝑓 of π‘₯𝑖. That’s clearly 𝑓 of negative two plus 𝑖 over two. We achieve this by substituting negative two plus 𝑖 over two into our formula three π‘₯ squared minus five π‘₯. And if we distribute our parentheses and simplify, we see that 𝑓 of π‘₯𝑖 is three-quarters 𝑖 squared minus 17 over two 𝑖 plus 22. Let’s now substitute Ξ”π‘₯ and 𝑓 of π‘₯𝑖 into our summation formula. We now see that an approximation to our definite interval is the sum of a half times three-quarters 𝑖 squared minus 17 over two 𝑖 plus 22 for values of 𝑖 from one to eight. Now, actually, this constant factor a half is independent of 𝑖. So we could actually take it outside of the sum. And now, whilst this step isn’t entirely necessary, it can’t simplify things on occasion.

We’re now going to substitute values of 𝑖 from one through to eight into three-quarters 𝑖 squared minus 17 over two 𝑖 plus 22 and find their sum. When 𝑖 is one, we get 0.75 minus 8.5 plus 22, which is 14.25. When 𝑖 is two, we get eight. When 𝑖 is three, we get 3.25. When 𝑖 is four, we get zero. When 𝑖 is five, it’s negative 1.75. When 𝑖 is six, we get negative two. When it’s seven, we get negative 0.75. And when 𝑖 is eight, we get two. Finding the sum of these values and then multiplying it by one-half and we get 23 over two. And so, an approximation to our definite integral we’re using a right Riemann sum with eight subintervals is 23 over two.

So far, we’ve considered how to estimate integrals with left and right Riemann sums. Let’s now look at how we might work using midpoints.

Using the midpoint rule with 𝑛 equals five, round the definite integral from two to five of two π‘₯ over three π‘₯ plus two with respect to π‘₯ to four decimal places.

Remember, we can estimate a definite integral by using Riemann sums. We split the region into subintervals and create a rectangle in each. The total area of the rectangles gives us an estimate to the integral. In a midpoint Riemann sum, the height of each rectangle is equal to the value of the function at the midpoint of its base. Now, working with midpoints isn’t quite as nice as using the left or right Riemann sum. In this case, there’s nothing to stop us evaluating each of the areas in term. And let’s begin by working out the width of each subinterval.

Geometrically, it tells us the width of the rectangles. And it’s given by Ξ”π‘₯ equals 𝑏 minus π‘Ž over 𝑛, where π‘Ž and 𝑏 are the endpoints of the interval and 𝑛 is the number of subintervals. In our case, our lower limit is two and our upper limit is five. We, therefore, let π‘Ž be equal to two and 𝑏 be equal to five. And we’re told that 𝑛 is equal to five. Ξ”π‘₯ is five minus two over five, which is three-fifths or 0.6. And a table can make the next step a little easier. In our table, we’re going to begin by working out each of the subintervals.

We know the lower limit of our definite integral to be two. To find the right endpoint of our first rectangle on our first subinterval, we add 0.6 to two to get 2.6. This means our next rectangle starts at π‘₯ equals 2.6. This time, we add 0.6 again. And we find the right endpoint to be 3.2. The left endpoint of our next rectangle must, therefore, be 3.2. And the right endpoint is 3.2 plus Ξ”π‘₯. That’s 3.8. Our next rectangle begins at 3.8. And adding 0.6, we find that it ends at 4.4. And our fifth and final rectangle β€” Remember, we wanted 𝑛 to be equal to five β€” begins at 4.4 and then ends at 4.4 plus 0.6, which is five. And that’s a really good start because we know the upper limit of our interval is indeed five.

Next, we’re going to work out the midpoint of each of these subintervals. Now, we can probably do this in our head. But if we’re struggling, we add the two values and divide by two. And when we do, we obtain the midpoints to be 2.3, 2.9, 3.5, 4.1, and 4.7, respectively. To work out the height of each rectangle, we need to work out the value of the function at these points. So, for example, in this first row, we’ll start by working out 𝑓 of 2.3. To do that, we substitute 2.3 into our function two π‘₯ over three π‘₯ plus two. And we get 46 over 89. Then, we repeat this process for π‘₯ equals 2.9. When we substitute 3.5 into our function, we get 14 over 25. And the height of our final two rectangles are 82 over 143 and 94 over 161 units, respectively.

And our very final step is to calculate the area of each rectangle by multiplying its width by its height. Of course, the width of each rectangle is Ξ”π‘₯ at 0.6. So we multiply each of these function values by 0.6 and then find their sum. Now, we could do this in turn or we could find their sum and multiply by 0.6. We’ll get the same answer. When we do find the total of all the values in our column titled Ξ”π‘₯ times 𝑓 of π‘₯𝑖, we get 1.66571 and so on. And if we run this correct to four decimal places, we find that an estimate that the definite integral between two and five of two π‘₯ over three π‘₯ plus two with respect to π‘₯ is roughly 1.6657.

In this video, we saw that the definite integral of some function between the limits of π‘Ž and 𝑏 can be approximated using left or right Riemann sums or the midpoint rule. And we used the summation formulae for the left and right Riemann sums. And we also saw that the midpoint rule can be a little more complicated, but that it’s absolutely fine to use a table to estimate the solution.

Join Nagwa Classes

Attend live sessions on Nagwa Classes to boost your learning with guidance and advice from an expert teacher!

  • Interactive Sessions
  • Chat & Messaging
  • Realistic Exam Questions

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