[music] I want to be able to compute areas of curved regions. For instance, here I've got the graph of y equals x squared. And between 0 and 4, I could ask for some calculation. Some approximation, at least, of the area above the x axis and below the graph of y equals x squared, right. I want to approximate this area in here. Practically, the only thing that I actually know the area of is rectangles. So, I'm going to replace this curved region with an approximation by rectangles. The first step is to take that interval, 0 to 4, and cut it up into some smaller pieces. I'll partition the interval from 0 to 4 into few pieces. I'll cut it into 3 pieces. Let's cut it into a piece from 0 to 2 and piece from 2 to 3. And then, one more piece from 3 to 4. So, I've partitioned the interval from 0 to 4 into some pieces. 0 to 2, 2 to 3, 3 to 4. Now, I'll pick some points inside each of those sub intervals, points where I'm going to end up sampling the function. So, in this first interval, I'll pick the point 1. In this second interval from 2 to 3, I'll pick the point 2. And in the third interval from 3 to 4, I'll pick the point 3.5. Right? So, I'm picking some sample points in each of the pieces of my partition. Now, I'll build a skyscraper picture. A, a bunch of rectangles that approximates my curved region. So, I'll sample my function at these sample points. And I'm going to draw this sort of skyscraper picture. So, I'm going to draw a box over the first interval of height, whatever the sample was. So, there is the height is given by the function's value at the sample point. In my second interval from 2 to 3, I sampled the 2. And I'll draw a little rectangle there. And in my third interval from 3 to 4, I sampled at 3.5. And then, I'll draw one more rectangle right there. So now, my three sub intervals gave rise to three rectangles. Now, what's the area of those rectangles? Well, this first rectangle has a height of 1 square and a width of 2. So, this first wide, but not very tall rectangle, has area 2. This rectangle here has a height of 2 squared and a width of 1. So, this rectangle has area 4. And this last rectangle has a height of 3.5 squared and a width of 1. So, it has area 3.5 squared, which is 12.25 square units. And now, if I add 2 plus 4 plus 12.25, I get then an area of 18.25. And that's suppose to be an approximation to the area of the curved region. Right, I replaced this curved region by these three rectangles. And I can calculate the areas of these three rectangles. It's going to be about 18.25 and that should be not so far off from the true area of this curved region. So, that's an approximation, but we can do better. If we want a better approximation to the area under this curve, I'll just cut the interval between 0 and 4 up into smaller pieces. I could, in this case, consistently choose the left end point to sample that and I can draw a whole bunch of rectangles now. And I could approximate the area under the curve just by calculating the area of these rectangles. And by taking more and more rectangles thinner and thinner, I'll get an increasing good approximation to the true area under this curve. I can also over estimate the curved region's area. I could also try to over estimate this. I could cut this interval from 0 to 4 into a bunch of small intervals. And then, choose the right end point of each of each of these intervals to do my sampling at. And then, build the sort of skyscraper picture. Again, sampling at the right hand end point of each of my little tiny sub intervals and I can build this little skyscraper picture. And by computing the area of the rectangles. Alright, the areas of these rectangles are a pretty good over-approximation to the area under the curve. I'm going to give a name to all these kinds of approximations. The name that were given to these things is a Riemann Sum, right? Riemann was a mathematician. So, what's the procedure for setting up a Riemann Sum? Well it's really a multi-step process, right? Here's a picture that sort of summarizes the whole story. I'm trying to calculate the area under the curve between the points a and b and I'm doing that approximation by approximating the curved area with these rectangles. And I can, of course, calculate the areas of these rectangles and add them up. But what's the first step? Well, the first step is to partition this interval a to b, so that I can decide where to build my little skyscrapers. Alright, so the first step here is to partition the interval a to be and what that involves is choosing x not, which is just a. And x sub n which is b. And then, choosing x1, x2, and so forth in between a and b, alright?. In this picture, I've chosen x1, x2, x3, x4 And I've cut it up into one, two, three, four, five pieces. But, of course, you can choose how many pieces to cut it up into. The point is just to choose how many pieces to cut it up into, and then, choose where you're going to make those, those cuts in the partition. The next step is to choose sample points inside each of those sub intervals. Yeah, after I've decided where to cut up my interval a to b, I've chosen the x sub-I's. Then, I introduce these blue sample points, right, the x sub i stars. So, the next step is to choose sample points x sub i star, and those sample points will then be used to determine the heights of these rectangles. I'm going to be evaluating the function at those sample points. Now, I can write down a formula for the area. Well the area is approximately the areas of all these rectangles added up. Now, how big are each of these rectangles? The heights of these rectangles are coming from the function evaluated at these sample points and the width has to do with how far apart the red cut points are. So, we can write down a, a formula for that, right? I'm going to write down a formula for the area. So, the area is approximately, and this is really Riemann Sum, right? It's the sum, i goes from 1 to n. So, I'm going to add up all of the rectangles. And now, I've got to write down the area of the I for rectangle or the height of the I for rectangle, is the function evaluated at the sample point. And the width of the ith for rectangle is x sub i minus x sub i minus 1. Right? If I take the i cut point and subtract the previous cut point, the difference there will tell me the width of that rectangle. Let me show you on the picture again here. Alright. So, the height of these rectangles are coming from evaluating the function at the sample points and the width of, say, the 1th rectangle, the first rectangle, is x sub 1 minus x sub 0. That's the width times height, that gives me the area. And if I add up the areas of all of the green rectangles, then I get an approximation for the total area under the curve. And just to make it easy to talk about these things, there's some specific names that I want to give to particular kinds of Riemann Sums. For instance, if we pick our ith sample point, so x sub i star, to be the left hand endpoint, x sub i minus 1. Then, I can write down my Riemann Sum like this. It's the sum over all the rectangles of f evaluated at the left hand end point, that's sample point, times the width of that particular rectangle. This is called a left Riemann Sum, just because I've chosen my sample points to be in the left hand side of the interval. Similarly, right? There's a right Riemann Sum where I choose my sample point to be on the right hand side, right? So, this would normally be x sub i star, but my sample point is my right hand endpoint. So, it's just x sub i. I'm going to call this thing a right Riemann Sum.