 Welcome back lecture four. The plan this week is to do new material. We reviewed last week kind of some sections that may have been covered quickly at the end of 141. A little bit more with that this morning but not much and we'll dive into chapter five section nine. Numerical integration, a couple of techniques, trapezoidal approximation and Simpson's rule and then we also are covering improper integrals this week. There are a couple more problems that I flagged on my final exam for from 141. Let's just take a brief look at one of them. It's kind of what we're in the middle of doing right now is kind of getting everybody on the same page from one leaving 141 and going into 241. Any suggestions, recommendations and why would you suggest or recommend that? Divide. Okay. Why would you say that? Okay ought to be one of the things you check. This is x squared over x. If it were the reverse then we might have a candidate for natural log but you're never going to have u over du so that's not going to get us anywhere. That's what this big bar right there means is to divide. So because we have x squared over x we'll do the division. How many times will x go into 3x squared? 3x times 3x times 4 with the 12x. What do we do with that stuff that we bring down? Subtract it. Kind of regular old long division. It's just long division with polynomials. The first term should drop out. That was the intent. Minus 5x minus 12 more x. How many times will x go into negative 17x? Negative 17 times. Negative 17 times 4. What is that? Negative 68. That sounds right. Again we subtract what we bring down. So the x's drop out. Kind of made that happen. 2 minus a negative 68 is 2 plus 68 which is 70. What happens to the 70? Right. Remainder over divisor. So this integral problem we did the division. It should be the same thing as and then now we can integrate each piece and I think it's relatively basic. At this point what's the integral of 3x with respect to x? 3 halves x squared. Integral of negative 17 with respect to x. And then we've got this integral. I don't know that I need to write that down again. Got a constant over a linear term. 70 natural log absolute value x plus 4. Saw that a lot in 141. We're going to continue to see that. So that one ought to be one that works pretty readily for us. Questions on that? Degree of the numerator larger than the degree of the denominator might help. Probably will help to do the long division and then we can integrate it. Let's see. From the old exam. We did the table of integrals. That'll probably suffice. Anybody stumble across a problem from trig substitution, trig integrals, partial fractions, decomposition or table of integrals that you want to make sure you clear up before we go ahead. Yes sir. Number 10 on WebAssign. 5.8 or something. 5.7 maybe. And it was 1 over x minus root x plus 2. Minus here. Minus root x plus 2. I remember that one vaguely. Does anybody have their WebAssign printed out and you can tell me where this one is? 5.7? Yeah, that's it. Okay, so probably is not table of integrals. I don't think you're going to find anything like that in the table of integrals anyway. So we've got trig substitution possibly. It's not a trig integral. That's for sure. Maybe partial fractions after a substitution. Anybody, I think I know what I want to try. Anybody want to make a recommendation that you think has a chance of working? The way I did it, I used to do substitution. Okay, I think I'll get us started. What did you? I did it. I did it in u equals the square root of x plus 2 and then change that to be u squared equals x. Okay, I think that'll work. This seems to be kind of the stubborn term in this integrand. And the fact it's not the x plus 2. That's the bad part. It's the square root of that quantity x plus 2. So let's see if we can get rid of the radical all together. So if we let u equal square root of x plus 2, then we've got a first degree thing representing the ugly radical. And that maybe will make x a little better to represent as well. So let's see. Square both sides. And we've got two reasons to square both sides. Give me one good reason why we should square both sides. Okay. But what purpose do we have? Why do we want u squared? Because eventually that would be an x squared. Yeah. Yeah. Something will be squared. We want to get rid of the x in the denominator. Okay. Because we have an x, right? So we need to plug in something for x. So until we square this radical, we're not going to have anything to plug in for x. What's another reason? Since we did so well with that one. Don't we also need dx? Right? So there's two good reasons why we need to get x out from under this radical beyond our initial substitution. So what is x equal to? What is 2? And what is dx equal to? One half squared. One half. 2u. Yeah. du. Just take the derivative of the right side, which is dx. Derivative of the left side, which is 2u du. So du is equal 2. So let's start plugging things that you could solve for du, but we really just need dx, right? So let's transform. So in the numerator we have 1 dx. So dx is 2u du. In the denominator we have x. There's x. And also we have minus square root of x plus 2, that quantity. So that's really what? Minus u. Let's leave it there. Is that any better? I'm not saying it's kind of in a form where we can integrate it, but is it better than what we started with? Possibly. If we can now deal with this, how do you think we might want to deal with this? Partial fractions. Partial fractions. If it factors, that would be nice. I think it does. What is that quadratic denominator factored into two linear factors? Minus 2 plus 1. Is that work? So let's take this, decompose it into partial fractions. This is all a jump start on this problem, so we're still jump starting. We'll get to a point where I want you to take it over. How does that break down into partial fractions? A over u minus 2. Okay, thank you. And what would be the procedure from here? Set the numerator equal to each other. Get a common denominator, which is going to be the product of those two linear terms. After you get a common denominator, equate the numerators, solve for A and B. Isn't this going to be a natural log? I don't care what A is. If A is 17, 13th, A could be really ugly, but you can bring that out in front. This is going to be a natural log when you integrate it. This is also going to be a natural log. And then we have to kind of re-substitute back to our original letters. Okay, now the denominators are equal. Equate the numerators, solve for A and B. Once you get the solution for A and B, the integration should be pretty quick. And then substitute back wherever you see a u in your answer. You should have a square root of x plus 2. Since that's a web-assigned problem, just kind of talk through the end of it and I'll leave that up to you. Is that all right? Is that a place where you can take it? Yes. There's no, like when you combine the numerator with the other denominator thing at the top, there's no single term like for the A and the 2B. Is it equal to 0? Like you're going to do A plus 2B equals something and A plus B equals 2 for the U term. That's right. The other one's equal to 0. That's right. So this is really 2U plus 0. Okay. So this is the linear term. The constant term isn't there, so it's 0. Anything else from that one? Which still helps the cause. You're still going to get an equation. I don't know what that equation is. Let's see if we can figure it out. It's going to be A minus 2B, right? Yeah. Is equal to 0. So you still get an equation. It's not like you don't get any information. It's just equal to 0. It kind of helps really because then you can use that to substitute in the other one. Anything else from this preliminary information that should be for the most part reviewed for another website? All right. So the new, so-called new material for us in this course starts at 5.9. I think this book calls it approximate integration or numerical integration. Make sure that you make part of your regimen to read the material. I think it's 412 to 420. We'll have two distinctly different techniques. We'll also look at kind of the errors associated with them, how close we think we might be getting to the exact method. So numerical or approximate integration. So this would be if we don't have a way to do the problem another way so we can't do the exact method. Why? Because we can't integrate it by some pattern. It's not in the table. We can't do trig substitution, trig integrals. We can't use any of that. None of it's working. So we're going to do an approximation of this area under this curve. Another one. So maybe we have a function that looks like this. And we want to find the area under that curve. So we've got this not too bad. e to the 1 over x. We're not going to be able to integrate that by substitution. Trig integrals. Why wouldn't substitution work? I want to go for one of these. We can integrate that, right? What's the integral of e to the u du? That's just e to the u. So we make that attempt. This isn't going to work by the way. So we let u equal this unattractive exponent. That seems to be working real smoothly. Here's where it falls apart. What's du? Derivative. Not integral. What's the derivative of x to the negative first? Negative one x to the negative second. So that's the derivative. We don't have any of that, do we? We can't manufacture that. We can't change the integrand in terms of variables. We can't change the curve that we're trying to take the area under. So because we don't have any of that, we can't manufacture it. This method is not going to get us anywhere. We don't have a method to do that. So that's why we're going to need some way to approximate the area under this curve. If we needed to be really, really accurate, we could use 100,000 subdivisions. We couldn't, we're not going to do that manually, but we could do it on a machine or a calculator or computer so that we could get really, really close to the area under this curve from one to two. So we can't integrate it or we don't have a function at all. All we have is a data set. So we know what, where the y value is when x is 0, we know where it is when x is 0.5, we know where it is when x is 1, when x is 1.5, and so on. So we have a data set. In fact, we don't even know if these dots are connect, how these dots are connected. Is it connected like this or is it connected like this or is it a straight line? We don't even have the curve. We don't even know the function. So here we at least know the function. Here we don't know the function at all. We just have some data points. So we want to, let's say this is a velocity curve, and we want to find a distance or height or position from it. Let's say distance. What do we do to velocity in order to get distance? Integrate it. So we want to integrate it, but we don't even have a function. We just have a set of data. So we want the area under this curve, but yet we don't have the curve. We don't even have a description of the curve. So we have a non-integrable function, or we don't have a function at all. What can we do to find the area under the curve? So that's the two methods we're going to cover in 5.9. So the first method, and you'll probably remember something from high school geometry that'll be helpful here. That is the area of a trapezoid. That'll be helpful to us. So this is trapezoidal approximation. So we've got this curve. I'm going to call that our starting point, x sub 0. Then we'll hopefully be able to kind of write a little formula or function that deals with kind of where we stop along the way and how far up we go to get to the curve. So this distance from the x-axis up to the point on the curve, so arbitrary curve, f of x. This would be the f of x0, right? This distance from here to here. Let's go to our next place, which to get from x0 to x1, we're going to move over delta x units. And we'll decide on delta x by taking where we end completely minus where we started and divide it by n, however many of these things we want. So x sub 1 is really x sub 0 plus 1 delta x. x sub 2 is going to be x sub 0 plus 2 delta x's and so on. So we're going to add a delta x each time we go over to a new x value. So we're going to use a trapezoid to find the area of this region. It's not exactly what we want because it's not a straight line from here to here. It's actually a curve, right? But the straight line will, depending on how many of these we actually construct, somewhat imitate what's going on as we go from this point to this point. So here's our trapezoid. Normally we see trapezoids that look like this. This is really one of those. It's just kind of standing up on its end. What's the area of a trapezoid? Good old geometry review this morning. Good. One half times the sum of the bases. Let's call this one of the bases. In this one, the other. There's a good way to remember this by the way. One half the sum of two things is really their average. So it's the average of the bases times the height. Isn't every four-sided figure that we want to find the area of isn't it always kind of base times height, right? Square is base times height. It's actually easier because the base and the height are the same. Rectangle's base times height. Here's a trapezoid. It's base. Well, how do you choose which base? We've got two of them. Let's just average them, right? Average of the bases times the height. So here's our height. Well, let's translate that to this shaded region up here. What would that look like? What's base one? Well, here's base one. How would you find that? Good. F of x, 0. And here's base two. F of x, 1. And our h is this distance from here to here. Which is delta x. Does that work? So for that single trapezoidal region, then we would translate our old geometry formula into what applies on this particular diagram. Now we're going to go to the next one. We're going to go over delta x more over to x2. We're going to connect this dot to this dot with a straight line. I know it's not exactly the curve, but remember this is approximate integration. You probably want to be a whole lot smaller than I'm being here. Wouldn't that make the process better, right? Just like we did with skinny little rectangles in the area under curve. The more you had, the more accurate it is. Same thing here. So what this is, here's the area of our first rectangle. Let's figure out the second, that's not a rectangle, sorry, it's trapezoid. Our second trapezoid would be one-half. Well, here's our initial base, right? F of x1. And then the second base, the bases are the parallel sides in a trapezoid times delta x, right? Don't these two share a side? Right? This side right here is one of the bases in our first trapezoid. It's also one of the bases of the second trapezoid. Won't that process continue? Right? That this base x2, or actually f of x2, will be a base of this trapezoid and also a base of the next trapezoid. And we'll just, we'll do the next one and then kind of see what we think's going to happen in general. Connect the top here to the top over here. A3, f of x2 plus f of x3 times delta x, I guess I better label where x3 is. And the duration of the sub-interval, we want to do the same thing till we get to x sub n, which happens to be our last value, which is the same as b. So x0 is the same as a from this diagram. So what's that going to look like? So the area under the curve, and this is approximation, going to be that. Now that's the first trapezoid. Now we move on to the next one. Now we move on to the next one. And so on. However many we need. And that'll be either given to us or we get to decide based on kind of the sub-interval that we're handed. So what do all these have in common? They all have delta x and what else? Okay, so one-half delta x and it's okay if you want to call delta x h. It's the same thing. Now let's add everything else that remains. So after we factored out delta x and a half, out of every one of them, what's left? f of x0, good. We got this one and it's there again. Why? Because that was a base of two different trapezoids. Is that right? So we've got f of x1 and we have another f of x1. Do we have the same thing with f of x2? Yes. Here's one of them. Here's another one. So it's in there twice. In fact, isn't every other base of every other trapezoid shared, right, until we get to the last one? Is that right? So we're going to have every one of these intermediate coefficients is going to be two. And the next one that's going to be only in there once, besides the first one, f of x0, is f of xn, where I'll let n be our last one. And I left room for the predecessor. What would the predecessor of x sub n be? n minus 1. Yes. So there's our trapezoidal rule for approximating the area under a curve. N minus 1. Yeah. If this is n, the predecessor would be one less than that. So the first base, if you want to call it that, and the last base are only in one trapezoid. Every other base that we picture in the figure is in two trapezoids. That's why it's present twice. So let me put a little sub t there. That's our approximation for the area using trapezoids. Let's do, as our first example, a problem that we can check and see how good our answer is, because we have an exact way to do the problem. This problem, we don't actually need numerical integration or trapezoidal rule approximation to get us a solution, because we already know how to integrate 1 over x. What is that? Natural log absolute value of x. We don't need the absolute value in this problem, because everything is positive, but it might come into play in another problem. So natural log 2 minus natural log 1, and this is exact, by the way. Natural log 2, I don't know what that is, but I do know what natural log of 1 is, 0. That's the power you'd raise e to get 1. You'd raise e to the 0 to get 1, so I'm not going to write that down. So our exact answer is the natural log of 2 for this problem, and if you punch that into your calculator, what is the natural log of 2? 0.693, what's the next decimal place? 1. So we know. We have an idea where the answer should be, but let's see what the trapezoidal approximation is going to look like. So we have this function, 1 over x. We want the area under this function from 1 to 2. Let's use 4 to get a higher level of accuracy we could use more trapezoids. It gets a little ridiculous with kind of manual computation. So let's use 4, and a is 1. We're starting at 1, and we're ending at 2. So our delta x is what? 1, 4. b minus a over n, 2 minus 1 over n, n is 4, 1, 4. The first one we've done, I guess I could make a picture. So y equals 1 over x, looks something like this. Let's say this is 1. It'd be nice to make it a 1 instead of 2. And here's 2. So we're breaking this thing up into 4 subintervals. We know what delta x is. We're going to crawl along a quarter of a unit at a time. That's a pretty good way to get from 1 to 2 when we have 4 subintervals, right? So our x sub 0 is going to be 1. x sub 1 is going to be 1.25, 5 fourths, x sub 2, 1.5, 3 halves, x3, and that should be 2. So we should have advanced delta x or 1 quarter of a unit getting from x1 to x2, x2 to x3, and so on. So I think we have everything we need. I could finish the picture, and we want a trapezoid here, and another one here, and another one here, and another one here. Probably going to be fairly accurate. I mean, eventually, no matter how steep the curve, can't you reduce it to the point where it's practically linear if you chop it up into small enough pieces, right? I mean, this curve right here, that doesn't look very linear. But isn't it pretty linear from here to here? Right? We're not going to deviate too much from the curve if we drew a straight line from here to here. So that's in essence what we do when we want to gain accuracy, so we have more of these regions. So the area by, and let me, I can't remember if this is a maple designation. So we're doing trapezoidal approximation, and we've got four subintervals, four trapezoids. So what did we factor out in front of that formula? One half, and a delta x, right? So there's half h or half delta x. f of x0 should be f of 1, 2, f of 1.25 or 5 fourths. All these intermediate coefficients too, right? f of 3 halves, f of 7 fourths, and now we're at the last one. That technically is only in one trapezoid, the same as this one is only in one trapezoid. f of 2, so we've got a 1 eighth. So f of 1, what's our f of x? Is it f of x 1 over x, right? So it's 1 over 1. We've got 2 f of 5 fourths. What's the f of 5 fourths? 4 fifths. Is that right? 1 over 5 fourths. Got 2 of the next one. f of 3 halves is 1 over 3 halves, which is 2 thirds. f of 7 fourths is 1 over 7 fourths, which is 4 sevenths. And f of 2 is 1 over 2, which is very conveniently just 1 over 2. So we can integrate it. We did that on this problem. We wouldn't have to do numerical or trapezoidal approximation, but we're just kind of making this seem believable on this example. So we've got 1 plus 8 fifths plus 4 thirds plus 8 sevenths plus a half. It's approximation anyway. So let's not kill ourselves with like denominators. Let's use our calculator to add these up. Divide by 8. And we better get something fairly close to 0.693. I think it's 0.697. Is that right? To the third decimal place. That's pretty good. Pretty good level of accuracy if our first error is in the third decimal place. 4, really, only 4 trapezoids and not any really unbelievable, unbelievably complex calculations. Fairly good level of accuracy. So we should at least trust it. Not that that proves that it's going to work all the time. The other one, let's get to start with the other one today as well, is Simpson's Rule. And instead of drawing a straight line, so here's kind of the basic difference between, here's trapezoid. We take this dot and this dot and connect them with a straight line. Okay? Simpson's Rule, the pattern ends up being just as easy to work with. Actually, it's still a little more difficult to get there. So here's our starting point. Here's our first stopping place is we are going to fit instead of a straight line to the lid of this region. We're going to fit a parabola that connects this dot to this dot. Now there's a better chance of being able to match this region with an actual curve than it is with a straight line. That's probably not a straight line from here to here. It's probably curved. So we'll take an arbitrary parabola and granted it's probably not parabolic, but we can match it with a parabola as we go from here to here. Now the procedure's actually subtly different from that because to get a better fit we're actually going to have to not only take the kind of the first point and the last point we're also going to have to take a point that's in the metal. That allows us to to fit the parabola a little better to this region. I mean if we just use the first and last point there's a whole lot of parabolas that catch the first point and the last point. So we're going to do a much better job if we force that parabola to catch the point that's in the metal as well. So it'll look like our regions are kind of twice as large with the same amount of subdivisions but we're kind of forcing this thing to catch the point in the metal as well. So we're going to use some arbitrary, so there's our function that's going to serve as the lid to this region. The problem is we don't know A, we don't know B, and we don't know C to make it fit to that region and it might change as we go from one region to the next region because the curves change, one could be concave down, it could change to concave up, and we want to match it with a different kind of parabola. So some of this is in your book, I actually got most of this from another text. Here's what we want to do with Simpson's rule. So we've got this region, we want it to catch this point, this point, and this point. So we want to find an arbitrary parabola that's going to do that, some y equals x squared plus bx plus c. Notice we are catching the point in the middle in this distance from the initial point to this point in the middle that we want to force the parabola to capture is still going to be h. So that's in essence what we're doing, we want the top to be parabolic. We will need not only the x values to where we're stopping along the way, x sub zero, y sub zero, we'll get that on the next sheet, what is y sub zero, it is going to be the f of x sub zero, we're going to need x sub one, that's easy, y sub one is going to be the f of kind of how we got there, x sub zero plus h. So here's x sub zero. So as we kind of crawl along to the different points where we want this arbitrary parabola to catch, we're basically going to go back to our starting point and continue to add h as we go. So y sub two is really f of x sub zero plus two h. So for this region, let me just write this down here before we leave, here's what we really want to get the area of this region. We want the area under this arbitrary parabola, there's our parabola, and we want to start at x zero and we want to end at x zero plus two h. That's what we want, but that's just this first little parabolic region. Then we'll take the region next to that and the region next to that and so on and make the approach very similar to what we did with trapezoidal. So you don't need to write all of this down, but there are parts of it. So we have these three points that are on the top of the region we're dealing with, we have our arbitrary parabola, x one, how do we get from x zero to x one, we add h, how do we get from x one, actually from x zero to x two, we start with x zero and add h twice. This is kind of a mystery right now, where in the world did that come from? That happens to be the area of this parabolic region. Now what we're going to try to do is convince you that that's actually legitimate without getting too cumbersome with all the stuff behind the scenes. So this is what we want the area of the parabolic region to be. That will really be important, how we get there is relatively important, but you're not going to be asked to reproduce it. All right so we did have y zero, we had the point x zero, y zero, there's what y zero is, that's the f of x zero. Here's y one, which is the f of x zero plus h, everywhere there was an x we're putting in an x zero plus h, and here's y two, which is the f of x zero plus two eight. So wherever there's an x we're going to plug in x zero plus two eight. So why are they doing that? They're trying to kind of validate this formula. So what is y zero? There's y zero, if you plug that in there. What is y one? Actually we don't just want one of them, we want four of them. Here's what y one is equal to, that mass right there. We want to be able to plug that in there. And for y two, this plus this, we're going to be able to plug one of those in there. Now why would we plug it in? Well we're trying to validate the formula, you really don't just plug it in. That's kind of the answer, that's the answer we want. So if that's the answer we want, y zero plus four y ones plus y two, what would that equal to according to what I just wrote down at the bottom of this sheet? So I want this, I want four of these, and I want one of these. What would that look like? Well it would look like this, grouping together all the like terms. That's kind of what we hope we get when we're done with this problem. Here's the problem that I wrote up on the picture earlier. That's what we want. We want the area under this parabolic region from x zero to x zero plus two h. That's what we want. We know how to do that. We integrate, that'd be a x cubed over three, b x squared over two, and c x. We know how to evaluate x zero to x zero plus two h. So we do that. How do we do that? We plug this in and we subtract the other one from it. There was an error in this place where I found this, but if you do that, you cube that, you square that, you distribute everything, and you get rid of like terms, grab together as many terms as you can, you end up with this. That's kind of a mess. That's in terms of a, which we don't know, b, which we don't know, and c, which we don't know. Those are the coefficients on that arbitrary parabola. Notice there's an h over three out in front. Isn't that what we were gearing for? Didn't we want to have an h over three out in front? We did. It's there. What we really would like to have is y zero plus four y ones plus y two. Believe it or not, we have that too. So all this stuff from here to here, somebody discovered this a whole lot smarter than I am. Okay? Probably somebody named Simpson and probably not OJ. He discovered, or she discovered, might be a she, that all this stuff inside the brackets is really what? It's really y zero plus four y ones plus y two. So that's the area of this one parabolic region. Isn't that exciting? But that's just our first region. Aren't we going to add another one to that one? Yes? Let's get to this point and then we'll stop. So we've got this curve. We can't integrate it. We're going to have to use a numerical method. So there's our first parabolic region. Remember, and we're going to try to capture that point that's in the middle. Here's our next parabolic region. Remembering to capture that point that's in the middle. So for our first region, it's going to be h, which h is going to be delta x. So h over three becomes one third delta x. y zero is f of x zero. Four y ones. There's our first region. Okay? And we are out of time. We'll pick right back up from that point. Try to add in the next region, see what the pattern is, and see that Simpson's rule is probably just as easy as Trapezoidal rule. It came in late. Come and see me. I'll change what I have. It's an absence to a tardy.