 Welcome back everyone. What I want to do in this video is use both the trapezoidal rule and the midpoint rule to approximate the area under, well, to approximate the integral from one to two of the function one over x dx. That is, we want to find the area under the curve one over x from one to two here. And with the trapezoidal midpoint rule, we're going to use five subdivisions. This is mostly just to estimate, just to show you the method, and we're not honestly worried about being too precise in practice, one might need a much larger number of steps to do that. So for the trapezoidal rule, remember, if we're calculating T five, what we need to do is we need to calculate delta x over two times f of x not plus two times f of x one. And I guess, yeah, and we keep on going here to f of x two plus two f of x three plus two f of x four. And then finally, we get f of x five. So this is what we need to compute. So the first thing to consider are what are our x values here. So if we take our x axis, we think of it like this right here. x zero is always going to be the lower bound that is this number on the bottom side of the interval. So we're going to get a one right here. The upper bound is going to be two, which is our B value. Be aware that this is this is what we mean here by x zero. Here's what we mean by x five. So we have an x one that we need to do x two, x three, and x four. All right, now to find more specific values here, we need to calculate our delta x. So recall that delta x delta x is supposed to be the last number minus the first number divided by how many subdivisions we want. So we have one fifth or point two, if you prefer a decimal here. And so what this tells us is that x one will just be point two plus one. So one point two, we get one point four, one point six, one point eight for for x four and then two for x five there. So those are going to be our x values there. And so putting these all in here, we're going to take point two divided by two. That's the first part. Don't forget to divide by two. Then we need to take the function in here, our function f of x is the reciprocal function one over x the function we're integrating. So we need to take here one over one, that's of course a one, we need to take two times one over one point two, plus two times one over one point four, plus two times one over one point six. And then two times one over one point eight, and then make sure you take only one times one over two, which is their one half. And so notice here that none of these calculations are necessarily too difficult. I mean, we have to divide something like one over one point six. Although it's doable, we can do it by hand. It can go a little bit tedious feel free to use a calculator in these calculations please don't be a hero. The arithmetic it's very tedious, but we do want to be accurate so use a character to help you do one point, one over one point two and one over one point four etc right. Multiply these things out at them together. I'm just going to kind of, I'm just going to kind of just summarize what this turns out to be in the end this calculation. Let me double check will be approximately 0.695635. Like so so this is the estimate get when we put those numbers together. And so this is the estimate given to us from the trapezoidal rule. Now if we switch things up a little bit and we switch it to the midpoint rule, I want to keep the trapezoidal rule on the screen here. The midpoint rule is going to be very similar. We're going to take delta x, and we have to multiply this by f of x one bar, plus f of x two bar, plus f of x three bar, plus f of x four bar, plus f of x five bar, like so. Now and the delta x is going to be identical than it was before is the exact same delta x. So we're going to get 1.2 there, excuse me. And so what are our x i bars this is giving the midpoint between them so between x one x one and x zero one and 1.2 you're going to go 1.1 that's our first one there between 1.2 and 1.4 you give 1.3 between 1.4 1.5 1.6 you get 1.5 between 1.6 and 1.8 you get 1.7 and then the last midpoint would be 1.9. And so those are what we're going to do here we're going to do one over 1.1 evaluate the function 1.1 plus one over 1.3 plus one over 1.5 plus one over 1.7 and then finally oops one over 1.9 like so. So the midpoint rule although it takes a little bit harder to find the midpoints it's a fairly clean calculation comparison again you should calculate to help you with things like one over 1.1 one over 1.3 etc. But when you add those together and times it by the points two you are going to end up with approximately this is our answer 0.691908 whoops 08 like so. So you can see that the two answers are fairly close and if you look at the first two decimal places we both get a 0.69 one round this one wants to course round up to 0.70 this one would round down to 0.69. So we're about accurate to two decimal places right here and that was that was easily done with only five subdivisions to our to our interval there. Now the reason we chose this example is because this is actually an integral that we know how to compute because after all the anti derivative one over X is the natural log of X as we go from one to two. And so this is going to be the natural log of two minus the natural log of one but I want to remind you that the natural log of one is actually just zero. So the true area under the curve is going to be the natural log of two. And if we were to consult a calculator. What is our approximation for the square root of two. We're going to get point zero point 693147. And so this right here actually represents the area under the curve while the other ones were estimates and we calculate the natural log of two using a different technique than what we see right here. And so I want to compare how good were these techniques right here. So if we calculate the error, the error of the trapezoid rule t five we'll just to denote this as e sub t for the most part. The error of the trapezoid rule. This is going to be the difference between the true value, which was the natural log of two. Minus a little back up, we'll write this as the integral from one to two of one over x dx. So we take the total value, the true value minus t five. And we're going to take the difference inside absolute values because we're we might not know whether t five is bigger or smaller and we can do it here. And if you take the value we had from before, which was point 695635 and you subtract that from the true value of the natural value, you get up, you get approximately 0.002488. And so that's an S. Well, this is this measures how good our estimate was our estimate I said it was accurate to do decimal places it's almost accurate to three right to be three decimal places two one zero zero one right there so we're pretty close there. On the other hand, if we compare the midpoint rule so the error, the error of m five, we'll call that em for short. And so same basic idea we're going to take the absolute value of the integral one to two of one over x dx minus from it in five. So our estimate before the midpoint rule calculated the error of the curve as point 691908 subtract that from the point 693147 that the calculator gave us, and this would give us an error point 001239. We didn't see that in this situation the midpoint rule did better than the estimate we got from the trapezoid rule. And in fact it did about twice as it was twice as good, because our error is about half of what we had the error from the from the trapezoid rule as well. And so we see in this we see in this example one could calculate the well we could see here that one could calculate the this error, because we know how to calculate the integral directly using the final term of calculus. This might seem a little bit weird it's like well why in the world, would we estimate the error, if we can actually calculate the true area in practice we generally won't be able to do that and we'll talk about that a little bit more in the next video. But to finish up this video I do want to mention to us that well I included the error here to show you how comparatively they work here and we're going to see that in on average the midpoint rule is actually twice as accurate as the trapezoid rule. But these calculations as we saw they involve a lot of arithmetic, it's not necessarily hard calculations, just long tedious calculations where precision is desirable here. So feel free to use technology to help you with this use your use your calculators a scientific calculator sufficient. But for the sake of your homework and quizzes if you want to feel free to use computer software to help you out here because no living creatures should be expected to do these tedious calculations that you're going to see in the homework. So I'm actually provided some links in this lecture video see the description below to some websites that offer free online Riemann some calculators and the one I'm going to show you can be found at emathhelp.net. This one I like and hate at the same time and I like it because it shows you basically all the work that one needs to do. Just the other hand though is this this this website. It's ad based and the ads are extremely annoying. You're not going to see them as in this video because my ad blockers are superb. But without them you're going to be hit with very annoying ads all the time. So if we want to repeat this exercise we could type in our function so enter a function F we type in one over X. We want to go from one to two and we want five subdivisions so into the data right there. Then you have to choose a type and we see the four types of going about the left end points the right end points the midpoint rule and the trapezoid rule. If we hit the trapezoid rule. And then hit calculate to see the answer if this box here the show steps box is checked. That means that it'll show you all of the work necessary to do this one this can be a very useful thing for students as they're learning about these Riemann some approximations. Now I do apologize that on this screen the font is a little bit small there's not a whole lot I can do about that. Of course with your on your web browser you can enlarge this if it's too small for you. So it proceeds to explain you know what we're trying to calculate we want to calculate the integral from one to two of one over X DX. We're going to do it using five rectangles using the trapezoid rule. It gives you a quick reminder of what the trapezoid rule is it tells you the data you've done. And so now notice what we have to do we have to do one times X F of X zero which was one two times F of X one, which was it will see is going to be five over three, or it gives the decimal approximation. We're going to do two over F of X two to over two of F of X three, two of F of X four and then one times F of X five and has all those calculations and adds those together at the very end it spits out the final answer. What you can see highlighted right here point 695634 on the answer I wrote earlier on the screen was just what I rounded this estimate right here we can get much more precise if we wanted to. The show works it's pretty nice and again it shows all the steps you can repeat the process by unclicking the show the steps part. And then when you calculate it'll just give you the answer if you don't want all the extra fluff. But again I do like how you can see the steps in case you want to. You know to help you learn as a student right it's not just about the answer we want to understand how we got that answer. I broke the computer so we'll go back. It works it works pretty well you can do it for the point rule as well but like I said, apparently my internet just crashed so we're not going to see the midpoint rule but it'll give you an answer similar to what we saw before.