 Let us try to use error bounds for the trapezoid and midpoint rule to help us predict how many subdivisions do we need to be guaranteed a certain level of precision. So specifically, how large should we take in in order to guarantee that the trapezoid rule and the midpoint rule can approximate the integral one to two, one over x to x, accurate to 0.001, as we want to be accurate to four decimal places. How can we guarantee that level of precision? Well, it comes down to the error bounds that we had seen before. We know that the error associated to the trapezoid rule is gonna be bounded above by k b minus a cubed over 12 and squared right here. For which case we know b minus a, it's just gonna be one and two. So these are the bounds of the integral. So you're gonna get k times two minus one cubed. This sits above 12 and squared. We don't know what n is, that's what we're trying to figure out. Let's think about this k for a second. Remember the bounds, this k here is supposed to be a bound on the second derivative, the second derivative on the interval here one to two, for which case the second derivative of our function, it's gonna be two over x cubed. And as this is a decreasing function, its graph looks something like this from one to two. The biggest value is gonna occur here on the left endpoint because it's decreasing you. So you get one comma two. We can take k to be this number two. Using this above, we now look at two. So notice two minus one is one, one cubed is one. So the numerator is gonna be two. We have a 12 and squared. This is our error bound for the trapezoidal rule. And what we want this to do is we want this to be less than or equal to 0.0001. Or if you prefer, you can think of it as a fraction, one over 10,000, like so. And so we wanna solve this inequality for n right here. So what we can do is we can take reciprocals. So just flip this thing upside down. We're gonna get 12 n squared over two is gonna be greater than or equal to one over 10,000. I didn't flip the fraction, sorry, 10,000 itself. Now notice that as I took the reciprocal, the order of the inequality gets swapped around. Notice, for example, that two was less than three, but on the other hand, one half is greater than one third. When you take reciprocals, it flips the direction of these things. So make sure that you reflect that right here. Two does go into 12 exactly six times, in which case we get six n squared is greater than or equal to 10,000. Divide both sides by six. We get that n squared should be greater than or equal to 10,000 over six, and there is a factor of two that's common to 10,006. I'm not gonna bother with that right now because we're gonna need a calculator to help us out here because the next step is to take the pods of square root n needs to be greater than or equal to the square root of 10,000 over six. And so using a calculator to help us out with that, we're gonna end up, this number is gonna be approximately 40.8. Now notice that in itself has to be a whole number, it has to be an integer, because this is the number of subdivisions we have to do. So 40.8 doesn't quite work. We need to choose n to be the next integer greater than 40.8, which is gonna be 41. So to guarantee that we're accurate to four decimal places using the trapezoidal rule, we need to use at least 41 subdivisions. Now, if we were to change this to the midpoint rule as we were assigned to do, it doesn't really change the calculation that much. The only difference is the error bound, we don't use 12, we actually have a 24. And if we carry that throughout 24 there, you'll use the same bounds two to one, you'll use the same k value, which is two. Again, it's just this constant coefficient on the bottom is 24. And then so it's proceeding to solve this, two goes into 24, 12 times. So you get a 12 right here, bring this back down. You end up with a 12, you end up here with a 12. And if you take the square root of 10,000 divided by 12, you don't get 40.8 that time, you're gonna end up with, well, rounding this thing, you'll get approximately 29. Again, I took the liberty of rounding this up to the next integer, because we're looking at 50 over the square root of three. And so I want you to compare these two right here. The number, in order to gain four levels, four decimal places of accuracy with this estimate, it takes 41 calculations to do it for the trapezoid rule and only 29, just about 30 for the midpoint rule. And so for a human, these are both pretty tedious, right? We don't wanna do either one of them. For a calculation, it's not such a big deal, right? You're doing about an extra 10 calculations. Again, for a computer, it's not such a big deal. But the thing is the midpoint rule has, on average, we anticipate about 75% savings on cost of how much computational efforts necessary to put. And so if we're working with very complicated algorithms that have to approximate things really quickly and there's millions, maybe billions of calculations to do, these cost savings start to become significant amounts of times. We potentially could solve a problem two weeks faster on a supercomputer using one method over the other. And so this is why these type of error bounds are relevant to us, is we wanna know how good our answer is and we wanna compare the different strategies. And on average, we will anticipate that the midpoint rule is gonna be much, much faster. And you do see in this example, you see about a 75% reduction. I'm sorry, what I'm saying here with the 75 figures, 29 is approximately 75% of 41. And therefore the midpoint rule will give us about a 25% gain that will use about 25% less amount of time. And that's what I was trying to say there. So it's good to try to analyze how good our approximations are, how efficient they are, because sometimes we have to compute with approximations because the integral otherwise is just too difficult to do. Now that brings us to the end of our lecture here, lecture 17. We're gonna proceed to talk about some different approximation techniques in the next one, number 18. We're very similar to this, but we'll introduce something called Simpson's rule, which apparently will make, it'll make the midpoint and trapezoid rules obsolete in comparison. So stay tuned.