 Welcome back to our lecture series, Math 1220, Calculus II for students at Southern Utah University. As usual today, I am your professor, Dr. Andrew Missildine. This lecture represents the first part of lecture 17 in our series, for which we're going to get started in section 7.7 of James Stewart's Calculus textbook and talk about when should we approximate the area under the curve. To further explain this idea, as we mentioned in the previous video, not all integrals actually can be evaluated exactly. This is actually because the antiderivative is maybe too difficult or actually impossible to calculate. That is to say, there are many elementary functions which have non-elementary antiderivatives. That is, there's no way to describe the antiderivative using just the operations of algebra, addition, subtraction, multiplication, division, composition, and the standard function families like power functions, transcendental functions like sine, cosine, trigonometry, hyperbolic, exponentials, logarithms, their inverses. The type of functions we talk about all the time in calculus, these are what we call the elementary functions. There are many functions whose antiderivatives are non-elementary. Sort of like a poster child in this regard is we take the integral of e to the x squared dx. This function cannot, we can't find an elementary antiderivative, but it turns out if we stick a negative sign in here, modifications to this function are actually very important for probability as one studies normal distributions and such. So we're still interested in finding the area to the curve, but it can be difficult to do so if we can't use the fundamental theorem of calculus. But the thing is people often conflate the integrals with FTC. That is we spend so much time finding antiderivatives to help us calculate integrals that we sometimes forget that integrals themselves are not antiderivatives. It's the area under the curve and that area could be calculated in another way. And so in this section, I wanna introduce to you methods we can use to approximate the area under the curve because honestly an approximation to a sufficient level of precision will be just as good than some exact answer, right? So in order to talk about how we're gonna approximate integrals, we wanna return to the definition of the integral, the definite integral again, right? And so the idea we have is the following. We have our x-axis, ooh, that's really, really going wrong way there. Take our x-axis and our y-axis, like so. And we have some function F, we'll say it's a continuous function. We get something like this. And we're interested in finding the area of under the curve between two points, A and B. So our strategy for trying to find the area under this continuous function from A to B is we begin by subdividing the integral into N many equal width subintervals. So we get like x1, x2, x3, x4, all the way up till the end. And we want each of these things to be equidistant, right? So each of these little tick marks is x, delta x distance away from each other. And so we see many times in the past, delta x, because it's uniform and its width would be B minus A, which if you take that, it's the whole length of the interval and you divide it by N, the number of subdivisions we took, all right? So each subinterval here has a width of delta x. And these little markers, we can give names x1, x2, x3, continue on somewhere in the middle, we're going to have some xi, its predecessor would be xi minus one. And then we continue on until we get to B. B is of course just xN and A, we can think of as x0, it's the one that precedes the first one there, all right? And so then to find the area under the curve, we take our intervals we created with all these little tick marks and we're gonna form a rectangle associated to each interval, right? The width of the rectangle will be the width of the interval, subinterval, which is delta x. The height of the rectangle is determined by the height of the function. And so how we do this is we pick some representative, which we might call xi star. Xi, star shows up in the ith interval, it's between xi and xi minus one. The star represents that it's not necessarily xi itself, it's some delegate we choose to represent the height of the rectangle because the height of the rectangle will decide to be f of xi star. So we take our delegate, we plug it into the function and that determines how tall the rectangle will be. Now the length of the area of a rectangle is length times width. So its length would be f of xi star, its width would be delta x. And so the product of these two gives us the area of a rectangle. As there are numerous rectangles, we add together all of these areas individually and that will give us the area of all of these in rectangles. And as we've seen in the past, this Riemann sum, so this right here, our Riemann sum, it calculates an approximate area under the curve because we see that there's gonna be situations where the rectangles may be overlap. That is to say they might go over the function, they may be under estimating. And so we don't anticipate this to be a perfect calculation, just an estimate. Now in calculus one, we've seen that these Riemann sums calculate the area of the curve, but we've also seen that if you take more and more subdivisions, you get better and better approximations. You see these kind of rectangles in front of you right now, of course, if we take even skinnier rectangles, right, they fit the curve much better than a thicker rectangle. So certainly by taking larger and larger N, the approximation will become closer and closer to the true value under the curve. Taking the limit of course, which is what the integral is, then gives us the true area under the curve. But the thing is we're in a situation where the limit is too difficult for us to calculate, right? We can't use the fundamental theorem calculus. So how do we decide, since we can't go towards infinity, we're gonna have to stop after some finite number of steps. And so what's sufficiently large in will work for us in our approximation to get as close enough to the true value. Another issue we're gonna have to deal with is how do we know if our approximation is good enough if we don't know what the value is that we're trying to approximate? We'll come into that in a little bit. So we're gonna have to choose some large N for our approximations to be reliable. But it also depends a lot on this choice of Xi star. How we choose Xi star does affect how quickly this approximation works. And so there's three choices of Xi star that I wanna talk about right here in this lecture here. And in many of these we've probably seen before. So the first one is commonly referred to as the right endpoint rule or is denoted Rn for short. And in this situation Xi star is chosen simply just to be Xi. Which remember from the interval we saw before Xi. So if you're considering the second interval like in this picture right here, Xi is always the one on the right. So the second interval has on the right X2. The fourth interval right here has on its right X4. And that's why we get the name the right endpoint rule. Xi star will just select the point on the right of the interval. So we get X1, X2, X3, X4 for the first, second, third and fourth intervals respectively. Now it is helpful to have a formula for this Xi star which is simply just Xi. The idea is that we start on the very most left spot which is A. To get to X1 we take one step to the right which that step has a thickness of delta X. To go to X2 we take a second step to the right which also has a thickness of delta X. And then thirdly we take another step if we wanna get to X3. And so we just take a step to the right of delta X thickness every time we wanna go down the line. And so Xi will be start at A and take I steps to the right. Now it'll get you to Xi, all right? And so then with this definition of Xi star we get the formula for the right endpoint rule. It's gonna be a Riemann sum where we go from one to N. We have N number of rectangles. The height of your rectangle will be F of Xi, the height of the function at that right endpoint. And then the thickness will be delta X like we see right here. You see in this illustration what it would look like to find the right hand approximation of a function. This one has N equals four. It's a continuous function right here. The height of the first interval right here is determined by this point on the right. The height of the second interval will be determined by the height at X2. The third intervals height will be determined at X3 and the fourth interval, the height will be determined by what's happening at F of X of four, right? Like so. Some things I wanna point out about the right endpoint rules. Of course the height's always determined by the right endpoint. But look about the overlap on the underlap right here. As we're going, like if you look on the interval, the first one from X0 to X1, you'll notice that the function was increasing. And because it's increasing, the right endpoint rule actually overestimate the area under the curve. So the right endpoint rule always overestimates when you are increasing. On the other hand, if you go from X3 to X4, the function here is decreasing. It's going down. And as such, the right endpoint rule will underestimate. There's a gap right there between the area under the curve. And so if your function has a lot of going ups and going downs, turns out this potentially can average out. But this is a vulnerability of the right endpoint rule we wanna know. We can actually predict when we'll overestimate, underestimate based upon the monotonicity of the function. Now related to the right endpoint rule is sort of its counterpoint, the left endpoint rule. The idea is basically the same. If we are interested in the second interval right here, we actually choose the endpoint on the left to determine the height of the function. So this would tell us that Xi star is actually selected to be Xi minus one, right? Because again, each interval is gonna be labeled by the point on the right, this is Xi. And hence the one on the other side, Xi minus one will be one less than the interval we're at right there. All right, now the way we compute Xi minus one is it's just like how we did it for Xi, starting at A, we're gonna take I minus one steps to the right and now get us to Xi minus one. And therefore the left endpoint rule is determined as the Riemann sum where we take the sum of f of Xi star. In this case, Xi star is Xi minus one and we get a delta X for the thickness of those things, very similar to the right hand rule. We can see in this graphic right here an illustration of such a thing. So for the first interval, we're gonna choose our point on the left, which is X zero. For the second interval, we choose X one to determine the height of the function. For the third interval, we're gonna choose X two to be the height of the function. And then finally, for the fourth interval, we choose X three, that is f of X three to be the height of the function. So we're always looking at the left endpoint rule there. Now, in contrast to the right endpoint rule, the over and under estimates are actually different from, because this is the exact same function we saw in the previous slide. As you go from X zero to X one, the function was increasing, it's going up, right? And you'll see here, because we choose the left endpoint rule, the left endpoint rule is gonna underestimate the area under the curve when you're increasing. On the other hand, if we go from X three to X four, right, the function is decreasing, it's going down and therefore the left point rule is gonna overestimate the area under the curve. So it's the exact opposite of the right endpoint rule. When you're increasing, right, when you're increasing your right rule, we saw earlier, we'll talk about the left rule as well, the right rule is gonna overestimate. And we see here that the left hand rule is gonna underestimate. And similarly, when you're decreasing, you're going down, you'll see the opposite, the right hand rule will underestimate and the left hand rule is gonna overestimate these things. This actually is an exact opposition of each other. It turns out that the strengths of the right hand rule are the weaknesses of the left hand rule and vice versa. And so it turns out that when we combine these two strategies together, that actually lead to a very fruitful calculation. So we'll get to that in just a moment. Before we talk about the so-called trapezoidal rule, let's look at a third option for a selecting Xi star, which we call the midpoint rule. The midpoint rule, Xi star, will be chosen as the number Xi bar. Where Xi bar, what we do is we're gonna take the right endpoint Xi, take the left endpoint Xi minus one, we add them together and divide by two. That is, we take the midpoint of Xi and Xi minus one. So as you see right here in our graphic, here is our point X3. I'm sorry, that should be... I see what's going on here. That should be a three. That should be a two. That should be one. It's like mislabeling on my graphic there. Sorry about that. So this should be right here, X3. This right here should be X2. And so X3 bar is then the average of X3 and X2. And so it's this point in the middle right there. All right, let me erase those things. All right, well, I need to fix my typo right there. Again, this should be X4, X3, X2 bar and X1 bar. My apologies. And so Xi bar is just the average. It's just the midpoint of our two endpoints. The reason we use a bar is this comes from statistics that putting a bar over a variable typically means you're taking the arithmetic mean, AKA the midpoint in the situation. Now be aware that to find Xi bar, all you have to do is you just go to Xi and then you take a half step backwards. That'll get you to the midpoint. That's a formula way of doing it. There are of course other ways of calculating these things as well. And so when you do the midpoint rule, notice that your Riemann sum will look like the other situations. Your Xi star, you take to be Xi bar. Take the midpoint. And then if it expanded form, you'll take the height at the midpoint for the first one, the second one or one to the last one times everything by delta X. You see it right there. And so all of these strategies A, B and C, we've seen so far the right endpoint, the left endpoint, the midpoint rule. It's all the strategies decided by just picking a good choice of Xi star. And we're gonna see in a future video here that choosing Xi bar to be your Xi star is actually a pretty good choice. It's gonna be in general much more accurate than other selections of Xi star. And why that is, consider the function we had before, right? As you go from X zero to X one, we saw that the function was increasing. And notice what happened with the midpoint rule here. Part of the graph is actually overestimating the first half was, but then the second half is underestimating. So one rectangle, even though it's since it over and underestimates at the same time, it kind of balance itself out. It's not perfect. The overlap does appear bigger than the underlap there, but it does seem that there's a lot of cancellation that happens there. And likewise, when the graph was decreasing from X three to X four, it was going down like this. You'll see that to the left of the midpoint, it was underestimating, but to the right of the endpoint, it was overestimating. And that actually looks pretty close. So it averages out fairly well. And so we'll see that measurably the midpoint rule is a very powerful rule for approximating areas of the curve without a lot of calculations. Now I alluded to this one earlier and I wanna make a mention to this as well, the so-called trapezoid rule. The trapezoidal rule comes about by taking the average, not of X i and X i minus one, we take the average of L in and R in. We take the result from the right hand rule, we take the result from the left hand rule and we average them together. Because like I was saying, when the graph is increasing, one of them is going to overestimate, one's gonna underestimate. If we average those, kind of like the midpoint rule, maybe that kind of balances each other out. And so that's what we do with the trapezoidal rule. Now to be aware, how does one do the right hand rule? Remember, you're gonna get delta X and then you're gonna times this by F of X one, F of X two, all the way down to F of X in. When it comes to the left hand rule, you get delta X times, you're gonna get F of X zero, plus F of X one, all the way down to F of X in minus one. Like so. And so one thing I wanna point out to you is that when you add these together, a lot of these terms are common, right? So F of X one will show up twice in this sum. F of X two will show up twice in this sum. And this will all carry down until you get to F of X minus one, which will show up twice in this term. So all of these terms will show up twice with two exceptions. F of X zero will show up in the left rule, but it won't show up in the right rule. And F of X in, sorry about the penmanship there, I can't really read it very well. F of X in will also show up only once. And so if you keep track of these things, when you take the average of LN and RN, you're gonna get one F of X naught, two F of X ones, two of X of X twos, two of F of X three, two of F of X four, all the way down to two of F of X in minus one. And you'll have a single F of X in right there. So if you keep track of the coefficients, it goes one, two, two, two, two, two, two, two, two, two, like a ballerina down to one at the very end. And so it's important to keep track of those things. So you get this coefficient sequence one, two, two, two, two, two, two, two, two, one. And that way you'll use every single industry. You use what happens at X naught, one, two, three, all the way up to X and use every single one of them. You put a coefficient in front of the bookends, you put a two everywhere else and now calculate your trapezoidal rule. You do have to also times by delta X, but you're gonna get a delta X over two. The delta X is because both LN and RN are divisible at delta X. And then likewise, as we're taking average, we'll divide by two right there. So let me give you some explanation of why we call it the trapezoidal rule. Well, the idea here is if we take the rectangle, the left rectangle, we're gonna get this right here. You get this rectangle. If we take the right hand rule, we get this rectangle right here. And notice they're gonna overlap on the smaller of the two. In which case then the difference, the difference is gonna be this green part you see above. And if we cut that in half, because the midpoint is gonna cut this in half, we're only gonna take half of that rectangle. And so geometrically what this does is this is the same thing as taking the trapezoid who has square roots at the bottom, right? So this is, they're not square roots, I'm sorry, right angles at the bottom. Then the endpoints, the endpoints right here, we're gonna connect the left endpoint with the right endpoint and you form this trapezoid, this right trapezoid, like so. And this trapezoid will have the area of the average of the left rule and the right rule. And so we're using secant lines essentially to approximate the function. With the left rule and the right rule, we're basically approximating the function as a constant. Trapezoid rule is trying to approximate the function using secant lines, which actually improves its accuracy from a geometric point of view very, very much so. Before we start to think that necessarily the trapezoid rule is the best of all the rules out there, if we turn to the midpoint rule, remember, we have this picture right here. I wanna convince you that the midpoint rule likewise can be viewed as a trapezoid rule, but a different type of trapezoid. So we can construct the midpoints using rectangles like we did here, but this picture to the bottom right, I wanna illustrate to you. Turns out as we can actually construct the trapezoid whose slant on the top is determined by the tangent line at the midpoint right here. This is actually equivalent to the rectangles we see on the screen as well. Because this rectangle associated to the midpoint rule you can see right here, highlighting it here in yellow. And so what we're gonna do is we're gonna take the tangent line that goes through the midpoint and we're gonna slice it, slice the line along that point. Because the midpoint F of XI bar is the point of tangency, the tangent line will definitely go through that. It'll slice, it'll slice the rectangle, it'll then cut off some corner, which is a triangle. If we then move it over here, we then construct a trapezoid, has the exact same area as the square, the rectangle we had before. But now this is the trapezoid associated to the tangent line. And as we've seen in the past, tangent lines are gonna be better approximations than secant lines. And so if you redraw the trapezoid rule, or the midpoint rule using these tangential trapezoids, we can see how good this is at approximating the air into the curve. So I've talked about in this video, the general strategies we're gonna use, the left rule, the right rule, the midpoint rule and the trapezoid rule. In calculus one, you talked a lot about the left and right endpoint rules. We're not gonna use them so much in calculus two, because they are inferior to the midpoint rule and trapezoid rule. Mostly introduced them as a reminder and also we find the trapezoid rule, we can find it from the left and right end points. But also like we saw before with the trapezoid rule, if you use the one, two, two, two rule, you can actually compute it directly without the left or right endpoint rules. So in the next video, I'll show you how to use these trapezoid rule and the midpoint rule to calculate air into the curve.