# Worked example: Rewriting definite integral as limit of Riemann sum

## Video udskrift

- [Instructor] Let's get some practice rewriting definite integrals as the limit of a Riemann sum. So let's say I wanted to take the definite integral from pi to two pi of cosine of x dx. And I what I wanna do is I wanna write it as the limit as n approaches infinity of a Riemann sum. So it's gonna take the form of the limit as n approaches infinity, and we can have our Sigma notation right over here, and I would say from, let's say i is equal to one all the way to n. Let me scroll down a little bit so it doesn't get all squashed up at the top. Of, and so let's me draw what's actually going on so that we can get a better sense of what to write here within the Sigma notation. So let me do it large. So if this is pi right over here, this would be three pi over two and this would be two pi right over here, two pi. Now what does the graph of cosine of x do? Well, at pi cosine of pi is negative one. So that's negative one there. And cosine of two pi is one. And so the graph is gonna do something like this, and this is obviously just a hand-drawn version of it, but you have seen cosine functions before, this is just part of it. And so this definite integral represents the area from pi to two pi between the curve and the x axis. And you might already know that this area is going to be, or this part of the definite integral'd be negative and this would be positive, and it will cancel out and this would all actually end up being zero in this case. But this exercise for this video is to rewrite this as a limit as n approaches infinity of a Riemann sum. So there's a Riemann sum, what we wanna do is think about breaking this up into a bunch of rectangles. So let's say, or I should say n rectangles. So that's our first one right over there, then this might be our second one, and let's do right Riemann sum where the right boundary of our rectangle, what the value of the function is at that point, that's what defines the height. So that's our second one all the way until this one right over here is going to be our n-th one. So this is one, let me write it this way. This is i is equal to one, this is i is equal to two, all the way until we get to i is equal to n. And then if we take the limit as n approaches infinity, the sum of the areas of these rectangles are gonna get better and better and better. And so let's first think about it, what is the width of each of these rectangles going to be? Well, I am taking this interval from pi to two pi and I'm gonna divide it into n equal intervals. So the width of each of these, the width of each of these is going to be two pi minus pi, so I'm just taking the difference between my bounds of integration, and I am dividing by n, which is equal to pi over n. So that's the width of each of these. That's pi over n, this is pi over n, this is pi of n. And what's the height of each of these rectangles? Remember this is a right Riemann sum. So it's going to be the right end of our rectangle is going to define the height. So this right over here, what would this height be? Well, this height, this value I should say, this is going to be equal to f of what? Well, this was pi and this is going to be pi plus the length of our interval right over here, the base of the rectangle. So we started at pi, so it's gonna be pi plus, this was going to be pi over n, I could say times one. That's this height right over here. What's this one going to be right over here? Well, this one is going to be f of pi, our first start, plus pi over n times what? We're gonna have pi over n two times. Pi over n times two. So the general form of the right boundary is going to be, so for example, this height right over here, this is going to be f of, we started at pi plus, we're doing the right Riemann sum, so we're gonna add pi over n n times by this point. Pi over n times n. Or, if we wanted to say it generally, if we're talking about the i-th rectangle, remember we sum them all up, what's the height? Well, the height is going to be, in this case it's going to be cosine of pi plus, if we're with the i-th rectangle, we are going to add pi over n i times. Pi over n times i. And then, that's the height of each of our rectangles. And then what's the width? Well, we already figured that out. Times pi over n. And if you wanna be careful and make sure that this Sigma notation applies to the whole thing, there you have it. We have just re-expressed this definite integral as the limit of a right Riemann sum.