Single Variable Calculus: Integration by Parts
Integration by Parts
Transcript: The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To make a donation, or to view additional materials from hundreds of MIT courses, visit MIT OpenCourseWare at ocw.mit.edu.
PROFESSOR: Now, to start out today we're going to finish up what we did last time. Which has to do with partial fractions. I told you how to do partial fractions in several special cases and everybody was trying to figure out what the general picture was. But I'd like to lay that out. I'll still only do it for an example. But it will be somehow a bigger example so that you can see what the general pattern is. Partial fractions, remember, is a method for breaking up so-called rational functions. Which are ratios of polynomials. And it shows you that you can always integrate them. That's really the theme here. And this is what's reassuring is that it always works. That's really the bottom line. And that's good because there are a lot of integrals that don't have formulas and these do. It always works. But, maybe with lots of help. So maybe slowly.
Now, there's a little bit of bad news, and I have to be totally honest and tell you what all the bad news is. Along with the good news. The first step, which maybe I should be calling Step 0, I had a Step 1, 2 and 3 last time, is long division. That's the step where you take your polynomial divided by your other polynomial, and you find the quotient plus some remainder. And you do that by long division. And the quotient is easy to take the antiderivative of up because it's just a polynomial. And the key extra property here is that the degree of the numerator now over here, this remainder, is strictly less than the degree of the denominator. So that you can do the next step. Now, the next step which I called Step 1 last time, that's great imagination, it's right after Step 0, Step 1 was to factor the denominator. And I'm going to illustrate by example what the setup is here. I don't know maybe, we'll do this.
Some polynomial here, maybe cube this one. So here I've factored the denominator. That's what I called Step 1 last time. Now, here's the first piece of bad news. In reality, if somebody gave you a multiplied out degree, whatever polynomial here, you would be very hard pressed to factor it. A lot of them are extremely difficult to factor. And so that's something you would have to give to a machine to do. And it's just basically a hard problem. So obviously, we're only going to give you ones that you can do by hand. So very low degree examples. And that's just the way it is. So this is really a hard step in disguise, in real life. Anyway, we're just going to take it as given. And we have this numerator, which is of degree less than the denominator. So let's count up what its degree has to be. This is 4 + 2 + 6. So this is degree 4 + 2 + 6. I added that up because this is degree 4, this is degree 2 and (x ^2) ^3 is the 6th power. So all together it's this, which is 12. And so this thing is of degree <= 11. All the way up to degree 11, that's the possibilities for the numerator here.
Now, the extra information that I want to impart right now, is just this setup. Which I called Step 2 last time. And the setup is this. Now, it's going to take us a while to do this. We have this factor here. We have another factor. We have another term, with the square. We have another term with the cube. We have another term with the fourth power. So this is what's going to happen whenever you have linear factors. You'll have a collection of terms like this. So you have four constants to take care of. Now, with a quadratic in the denominator, you need a linear function in the numerator. So that's, if you like, B0 x + C0 divided by this quadratic term here. And what I didn't show you last time was how you deal with higher powers of quadratic terms.
So when you have a quadratic term, what's going to happen is you're going to take that first factor here. Just the way you did in this case. But then you're going to have to do the same thing with the next power. Now notice, just as in the case of this top row, I have just a constant here. And even though I increased the degree of the denominator I'm not increasing the numerator. It's staying just a constant. It's not linear up here. It's better than that. It's just a constant. And here it stayed a constant. And here I stayed a constant. Similarly here, even though I'm increasing the degree of the denominator, I'm leaving the numerator, the form of the numerator, alone. It's just a linear factor and a linear factor. So that's the key to this pattern. I don't have quite as jazzy a song on mine.
So this is so long that it runs off the blackboard here. So let's continue it on the next. We've got this B2 x + C2 - sorry, B3 x + C3 / (x ^2 + 4) ^3. I guess I have room for it over here. I'm going to talk about this in just a second. Alright, so here's the pattern. Now, let me just do a count of the number of unknowns we have here. The number of unknowns that we have here is 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12. That 12 is no coincidence. That's the degree of the polynomial. And it's the number of unknowns that we have. And it's the number of degrees of freedom in a polynomial of degree 11. If you have all these free coefficients here, you have the coefficient x^ 0, x ^ 1, all the way up to x^ 11. And through 11 is 12 different coefficients. And so this is a very complicated system of equations for unknowns. This is twelve equations for twelve unknowns. So I'll get rid of this for a second.
So we have twelve equations, twelve unknowns. So that's the other bad news. Machines handle this very well, but human beings have a little trouble with 12. Now, the cover-up method works very neatly and picks out this term here. But that's it. So it reduces it to an 11 by 11. You'll be able to evaluate this in no time. But that's it. That's the only simplification of your previous method. We don't have a method for this. So I'm just showing what the whole method looks like but really you'd have to have a machine to implement this once it gets to be any size at all. Yeah, question.
PROFESSOR: It's one big equation, but it's a polynomial equation. So there's an equation, there's this function r ( x) = a11 x^2 11 + a10 x^ 10... and these things are known. This is a known expression here. And then when you cross-multiply on the other side, what you have is, well, it's a1 times, if you cancel this denominator with that, you're going to get (x + 2) ^3 ( x ^2 + 2x + 3)( x^2 + 4)^3 + the term for a2, etc. It's a monster equation. And then to separate it out into separate equations, you take the coefficient on x^ 11th, x ^ 10, ... all the way down to x^ 0. And all told, that means there are a total of 12 equations. 11 through is 12 equations. Yeah, another question.
PROFESSOR: Should I write down rest of this?
PROFESSOR: Should you write down all this stuff? Well, that's a good question. So you notice I didn't write it down. Why didn't I write it down? Because it's incredibly long. In fact, you probably, so how many pages of writing would this take? This is about a page of writing. So just think of your machine, how much time you want to spend on this. So the answer is that you have to be realistic. You're a human being, not a machine. And so there's certain things that you can write down and other things you should attempt to write down. So do not do this at home.
So that's the first down-side to this method. It gets more and more complicated as time goes on. The second down-side, I want to point out to you, is what's happening with the pieces. So the pieces still need to be integrated. We simplified this problem, but we didn't get rid of it. We still have the problem of integrating the pieces. Now, some of the pieces are very easy. This top row here, the antiderivatives of these, you can just write down. By advanced guessing. I'm going to skip over to the most complicated one over here. For one second here. And what is it that you'd have to deal with for that one. You'd have to deal with, for example, so e.g., for example, I need to deal with the this guy. I've got to get this antiderivative here. Now, this one you're supposed to be able to know. So this is why I'm mentioning this. Because this kind of ingredient is something you already covered. And what is it? Well, you do this one by advanced guessing, although you it as the method of substitution. You realize that it's going to be of the form (x^2 + 4) ^ - 2, roughly speaking. And now we're going to fix that. Because if you differentiate it you get 2x (-2), that's - 4 (x)(x) times this. There's an x in the numerator here. So it's - 1/4 of that will fix the factor. And here's the answer for that one. So that's one you can do.
The second piece is this guy. This is the other piece. Now, this was the piece that came from B3. This is the one that came from B3. And this is the one that's coming from C3. This is coming from C3. We still need to get this one out there. So C3 times that will be the correct answer, once we've found these numbers. So how do we do this? How's this one integrated?
STUDENT: Trig substitution?
PROFESSOR: Trig substitution. So the trig substitution here is x = 2 tan u. Or 2 tan theta. And when you do that, there are a couple of simplifications. Well, I wouldn't call this a simplification. This is just the differentiation formula. dx = 2 sec^2 u du. And then you have to plug in, and you're using the fact that when you plug in the tan^2, 4 tan ^2 + 4, you'll get a sec ^2. So altogether, this thing is, 2 sec^2 u du. And then there's a (4 sec^2 u) ^3, in the denominator. So that's what happens when you change variables here. And now look, this keeps on going. This is not the end of the problem. Because what does that simplify to? That is, let's see, it's 2/64, the integral of sec^6 and sec^2. That's the same as cos^4.
And now, you did a trig substitution but you still have a trig integral. The trig integral now, there's a method for this. The method for this is when it's an even power, you have to use the double angle formula. So that's this guy here. And you're still not done. You have to square this thing out. And then you'll still get a cos^2 2u. And it keeps on going. So this thing goes on for a long time. But I'm not even going to finish this, but I just want to show you. The point is, we're not showing you how to do any complicated problem. We're just showing you all the little ingredients. And you have to string them together a long, long, long process to get to the final answer of one of these questions.
So it always works, but maybe slowly. By the way, there's even another horrible thing that happens. Which is, if you handle this guy here, what's the technique. This is another technique that you learned, supposedly within the last few days. Completing the square. So this, it turns out, you have to rewrite it this way. And then the evaluation is going to be expressed in terms of, I'm going to jump to the end. It's going to turn out to be expressed in terms of this. That's what will eventually show up in the formula. And not only that, but if you deal with ones involving x as well, you'll also need to deal with something like ln of this denominator here. So all of these things will be involved. So now, the last message that I have for you is just this. This thing is very complicated. We're certainly never going to ask you to do it. But you should just be aware that this level of complexity, we are absolutely stuck with in this problem.
And the reason why we're stuck with it is that this is what the formulas look like in the end. If the answers look like this, the formulas have to be this complicated. If you differentiate this, you get your polynomial, your ratio of polynomials. If you differentiate this, you get some ratio of polynomials. These are the things that come up when you take antiderivatives of those rational functions. So we're just stuck with these guys. And so don't let it get to you too much. I mean, it's not so bad. In fact, there are computer programs that will do this for you anytime you want. And you just have to be not intimidated by them. They're like other functions. OK, that's it for the general comments on partial fractions.
Now we're going to change subjects to our last technique. This is one more technical thing to get you familiar with functions. And this technique is called integration by parts. Please, just because its name sort of sounds like partial fractions, don't think it's the same thing. It's totally different. It's not the same. So this one is called integration by parts. Now, unlike the previous case, where I couldn't actually justify to you that the linear algebra always works. I claimed it worked, but I wasn't able to prove it. That's a complicated theorem which I'm not able to do in this class. Here I can explain to you what's going on with integration by parts. It's just the fundamental theorem of calculus, if you like, coupled with the product formula. Sort of unwound and read in reverse. And here's how that works. If you take the product of two functions and you differentiate them, then we know that the product rule says that this is u' v + uv'.
And now I'm just going to rearrange in the following way. I'm going to solve for uv'. That is, this term here. So what is this term? It's this other term, (uv)'. Minus the other piece. So I just rewrote this equation. And now I'm going to integrate it. So here's the formula. The integral of the left-hand side is equal to the integral of the right-hand side. Well when I integrate a derivative, of I get back the function itself. That's the fundamental theorem. So this it. Sorry, I missed the dx, which is important. I apologize. Let's put that in there. So this is the integration by parts formula. I'm going to write it one more time with the limits stuck in. It's also written this way, when you have a definite integral. Just the same formula, written twice.
Alright, now I'm going to show you how it works on a few examples. And I have to give you a flavor for how it works. But it'll grow as we get more and more experience. The first example that I'm going to take is one that looks intractable on the face of it. Which is the integral of ln x dx. Now, it looks like there's sort of nothing we can do with this. And we don't know what the solution is. However, I claim that if we fit it into this form, we can figure out what the integral is relatively easily. By some little magic of cancellation it happens. The idea is the following. If I consider this function to be u, then what's going to appear on the other side in the integrated form is the function u', which is -- so, if you like, u = ln x. So u' = 1 / x. Now, 1 / x is a more manageable function than ln x. What we're using is that when we differentiate the function, it's getting nicer. It's getting more tractable for us.
In order for this to fit into this pattern, however, I need a function v. So what in the world am I going to put here for v? The answer is, well, dx is almost the right answer. The answer turns out to be x. And the reason is that that makes v' = 1. It makes v' = 1. So that means that this is u, but it's also uv'. Which was what I had on the left-hand side. So it's both u and uv'. So this is the setup. And now all I'm going to do is read off what the formula says. What it says is, this is equal to u v. So u is this and v is that. So it's x ln x, minus, so that again, this is uv. Except in the other order, vu. And then I'm integrating, and what do I have to integrate? u ' v. So look up there. u' v with a minus sign here. u' = 1 / x, and v = x. So it's 1 / x, that's u'. And here is x, that's v, dx. Now, that one is easy to integrate. Because (1/x) x = 1. And the integral of 1 dx is x + c, if you like. So the antiderivative of 1 is x. And so here's our answer. Our answer is that this is x ln x - x + c.
I'm going to do two more slightly more complicated examples. And then really, the main thing is to get yourself used to this method. And there's no one way of doing that. Just practice makes perfect. And so we'll just do a few more examples. And illustrate them. The second example that I'm going to use is the integral of (ln x) ^2 dx. And this is just slightly more recalcitrant. Namely, I'm going to let u be (ln x)^2. And again, v = to x. So that matches up here. That is, v' = 1. So this is u v'. So this thing is u v'. And then we'll just see what happens. Now, the game that we get is that when I differentiate the logarithm squared, I'm going to to get something simpler. It's not going to win us the whole battle, but it will get us started.
So here we get u'. And that's 2 ln x ( 1 / x). Applying the chain rule. And so the formula is that this is x (ln x)^2, minus the integral of, well it's u' v, right, that's what I have to put over here. So u' = 2 ln x ( 1 / x), and v = x. And so now, you notice something interesting happening here. So let me just demarcate this a little bit. And let you see what it is that I'm doing here. So notice, this is the same integral. So here we have x (ln x) ^2. We've already solve that part. But now know notice that the 1 / x and the x cancel. So we're back to the previous case. We didn't win all the way, but actually we reduced ourselves to this integral. To the integral of ln x, which we already know. So here, I can copy that down. That's - 2 (x ln x - x), and then I have to throw in a constant, c. And that's the end of the problem here. That's it. So this piece, I got from Example 1.
Now, this illustrates a principle which is a little bit more complicated than just the one of integration by parts. Which is a sort of a general principle which I'll call my Example 3, which is something which is called a reduction formula. A reduction formula is a case where we apply some rule and we figure out one of these integrals in terms of something else. Which is a little bit simpler. And eventually we'll get down to the end, but it may take us n steps from the beginning. So the example is l(n x^ n) dx. . And the claim is that if I do what I did in Example 2, to this case, I'll get a simpler one which will involve the n - 1st power. And that way I can get all the way back down to the final answer. So here's what happens. We take u as ln x^ n. This is the same discussion as before, v = x. And then u' is n l(n x) ^ n - 1( 1 / x). And v' is 1. And so the setup is similar. We have here x ( ln x)^ n minus the integral. And there's n times, it turns out to be (ln x)^ n - 1. And then there's a 1 / x and an x, which cancel.
So I'm going to explain this also abstractly a little bit just to show you what's happening here. If you use the notation Fn (x) is the integral of (ln x)^n dx, and we're going to forget the constant here. Then the relationship that we have here is that Fn (x) = n ln, I'm sorry, x (ln x)^ n. That's the first term over here. Minus n times the preceding one. This one here. And the idea is that eventually we can get down. If we start with the nth one, we have a formula that includes, so the reduction is to the n - 1st. Then we can reduce to the n - 2nd, and so on. Until we reduce to the 1, the first 1. And then in fact we can even go down to the 0th one. So this is the idea of a reduction formula. And let me illustrate it exactly in the context of Examples 1 and 2.
So the first step would be to evaluate the first one. Which is, if you like, (ln x)^ dx. That's very easy, that's x. And then F1 ( x) = x ln x - F0 (x). Now, that's applying this rule. So let me just put it in a box here. This is the method of induction. Here's the rule. And I'm applying it for n = 1. I plugged in n = 1 here. So here, I have x ln x ^ 1 - 1 ( F0 ( x). And that's what I put right here, on the right-hand side. And that's going to generate for me the formula that I want, which is x ln x - x. That's the answer to this problem over here. This was Example 1. Notice I dropped the constants because I can add them in at the end. So I'll put in parentheses here, (+ c). That's what would happen at the end of the problem.
The next step, so that was Example 1, and now Example 2 works more or less the same way. I'm just summarizing what I did on that blackboard right up here. The same thing, but in much more compact notation. If I take F2 ( x), that's going to be equal to x (ln x)^2 - 2 F1 ( x). Again, this is box for n = 2. And if I plug it in, what I'm getting here is x (ln x) ^2 - twice this stuff here. Which is right here. x ln x - x. If you like, + c. So I'll leave the c off. So this is how reduction formulas work in general. I'm going to give you one more example of a reduction formula.
So I guess we have to call this Example 4. Let's be fancy, let's make it the sine. No no, no, let's be fancier still. Let's make it e^ x. So this would also work for cosine x and sine x. The same sort of thing. And I should mention that on your homework, you have to do it for cosine of x. I decided to change my mind on the spur of the moment. I'm not going to do it for cosine because you have to work it out on your homework for cosine. In a later homework you'll even do this case. So it's fine. You need the practice.
OK, so how am I going to do it this time. This is again, a reduction formula. And the trick here is to pick u to be this function here. And the reason is the following. So it's very important to pick which function is the u and which function is the v. That's the only decision you have to make if you're going to apply integration by parts. When I pick this function as the u, the advantage that I have is that u' is simpler. How is it simpler? It's simpler because it's one degree down. So that's making progress for us. On the other hand, this function here is going to be what I'll use for v. And if I differentiated that, if I did it the other way around and I differentiated that, I would just get the same level of complexity. Differentiating e^x just gives you back e ^ x. So that's boring. It doesn't make any progress in this process. And so I'm going to instead let v = e ^ x and, sorry this is v '. Make it v ' = e ^ x. And then v = e ^x. At least it isn't any worse when I went backwards like that.
So now, I have u and v ', and now I get (x ^ n)( e ^ x). This again is u, and this is v. So it happens that v = t v ' so it's a little confusing here. But this is the one we're calling v '. And here's v. And now minus the integral and I have here nx ^ n - 1. And I have here e ^ x. So this is u ' and this is v dx. So this recurrence is a new recurrence. And let me summarize it here. It's saying that Gn ( x) should be the integral of (x ^ n)( e ^ x) dx. Again, I'm dropping the c. And then the reduction formula is that Gn (x) = this expression here, (x ^ n)( e ^ x) - n Gn - 1 (x). So here's our reduction formula.
And to illustrate this, if I take G0 (x), if you think about it for a second that's just, there's nothing here. The antiderivative of e ^ x, that's going to be e ^ x, that getting started at the real basement here. Again, as always, is my favorite number. Not 1. I always start with the easiest one, if possible. And now G1, applying this formula, is going to be equal to x e ^ x - G0 ( x). Which is just right, because n is 1 and n - 1 is 0. And so that's just x e ^ x - e^ x. So this is a very, very fancy way of saying the following fact. I'll put it over on this other board.
Which is that the integral of x e^ x dx = x e^ x - x + c. Yeah, question.
PROFESSOR: The question is, why is this true. Why is this statement true. Why is G = e^ x. I did that in my head. What I did was, I first wrote down the formula for G0. Which was G0 is equal to the integral of e^ x dx. Because there's an x to the power in there, which is just 1. And then I know the antiderivative of e ^ x. It's e ^x.
PROFESSOR: How do you know when this method will work? The answer is only by experience. You must get practice doing this. If you look in your textbook, you'll see hints as to what to do. The other hint that I want to say is that if you find that you have one factor in your expression which when you differentiate it, it gets easier. And when you antidifferentiate the other half, it doesn't get any worse, then that's when this method has a chance of helping. And there is there's no general thing. The thing is, though, if you it with x^ n (e^ x), x ^ n cosine x, especially on sine x, those are examples where it works. This power of the ln. I'll give you er one more example here. So this was G1 ( x), right.
I'll give you one more example in a second. Yeah.
PROFESSOR: Thank you. There's a mistake here. That's bad. I was thinking in the back of my head of the following formula. Which is another one which we've just done. So these are the types of formulas that you can get out of integration by parts. There's also another way of getting these, which I'm not going to say anything about. Which is called advance guessing. You guess in advance what the form is, you differentiate it and you check. That does work too, with many of these cases.
I want to give you an illustration. Just because you these formulas are somewhat dry. So I want to give you just at least one application. We're almost done with the idea of these formulas. And we're going to get back now to being able to handle lots more integrals than we could before. And what's satisfying is that now we can get numbers out instead of being stuck and hamstrung with only a few techniques. Now we have all of the techniques of integration that anybody has. And so we can do pretty much anything we want that's possible to do.
So here's, if you like, an application that illustrates how integration by parts can be helpful. And we're going to find the volume of an exponential wine glass here. Again, don't try this at home, but. So let's see. It's going to be this beautiful guy here. I think. OK, so what's it going to be. This graph is going to be y = e^ x. Then we're going to rotate it around the y axis. And this level here is the height y = 1. And the top, let's say, is y = e. So that the horizontal here, coming down, is x = 1.
Now, there are two ways to set up this problem. And so there are two methods. And this is also a good review because, of course, we did this in the last unit. The two methods are horizontal and vertical slices. Those are the two ways we can do this. Now, if we do it with, so let's start out with the horizontal ones. That's this shape here. And we're going like that. And the horizontal slices mean that this little bit here is a thickness dy. And then we're going to wrap that around. So this is going to become a disk. This is the method of disks. And what's this distance here? Well, this place is x. And so the disk has area pi x ^2. And we're going to add up the thickness of the disks and we're going to integrate from 1 to e. So here's our volume. And now we have one last little item of business before we can evaluate this integral. And that is that we need to know the relationship here on the curve, that y = e ^ x. So that means x = ln y. And in order to evaluate this integral, we have to evaluate x correctly as a function of y. So that's the integral from 1 to e of (ln y)^2, times pi, dy.
So now you see that this is an integral that we did calculate already. And in fact, it's sitting right here. Except with the variable x instead of the variable y. So the answer, which we already had, is this F2 ( y) here. So maybe I'll write it that way. So this is F2 (y) between 1 and e. And now let's figure out what it is. It's written over there. It's y (ln y) ^2 - 2(y ln y - y). The whole thing evaluated at 1e. And that is, if I plug in e here, I get e. Except there's a factor of pi there, sorry. Missed the pi factor. So there's an e here. And then I subtract off, well, at 1 this is e - e. So it cancels. There's nothing left. And then at 1, I get ln 1 is 0, ln 1 is 0, there's only one term left, which is 2. So it's - 2. That's the answer.
Now we get to compare that with what happens if we do it the other way. So what's the vertical? So by vertical slicing, we get shells. And that starts, that's in the x variable. It starts at and ends at 1 and it's dx. And what are the shells? Well, the shells are, if I can draw the picture again, they start, the top value is e. And the bottom value is, I need a little bit of room for this. The bottom value is y. And then we have 2 pi x is the circumference, as we sweep it around dx. So here's our new volume. Expressed in this different way.
So now I'm going to plug in what this is. It's the integral from to 1 of e - e ^ x. That's the formula for y. 2 pi x dx. And what you see is that you get the integral from to 1 of 2 pi e x dx. That's easy, right? That's just 2 pi e ( 1/2). This one is just the area of a triangle. If I factor out the 2 pi e. And then the other piece is the integral of 2 pi x e^ x dx. From to 1.
PROFESSOR: Are you asking me whether I need an x ^2 here? I just evaluated the integral. I just did it geometrically. I said, this is the area of a triangle. I didn't antidifferentiate and evaluate it, I just told you the number. Because it's a definite integral. So now, this one here, I can read off from right up here. Above it, this is G1. So this is equal to, let's check it out here. So this is pi e, right, - 2 pi G1 ( x), evaluated at and 1. So let's make sure that it's the same as what we had before. It's pi e - 2 pi times here's g1. So it's x e ^ x - e^ x. So at x = 1, that cancels. But at the bottom end, it's e^ 0. So it's - 1 here. Is that right? Yep. So it's pi e - 2. It's the same. Question.
PROFESSOR: From here to here, is that the question?
PROFESSOR: So the step here is just the distributive law. This is e 2 pi x, that's this term. And the other terms, the minus sign is outside. The 2 pi I factored out. And the x and the e ^x stayed inside the integral sign. Thank you.
The correction is that there was a missing minus sign, last time. When I integrated from to 1 x e^ x dx, I had a x e^ x - e^x. Evaluated at and 1. And that's equal to + 1. I was missing this minus sign. The place where it came in was in this wineglass example. We had the integral of 2 pi x e - e ^x dx. And that was 2 pi e integral of x dx, from to 1, - 2 pi, integral from to 1 of x e^x dx. And then I worked this out and it was pi e. And then this one was - 2 pi, and what I wrote down was - 1. But there should have been an extra minus sign there. So it's this. The final answer was correct, but this minus sign was missing. Right there. So just, right there.