[MUSIC] Integrating requires patience. Sometimes you can start attacking the monster, but it might take a little bit of time before you start to see success. Prepare to persevere. Let's attack the indefinite integral of cosx times e to the x dx. There's a metaphor here. There's really different ways to win the battle. Suppose this is you, and this is the integral that you're trying to attack. One way, is you know, to try and do it by hand, right. To take your shield and to take your sword, and just to evaluate that integral directly by, say going back to the definition of Riemann sum. But we almost never attack integrals in this way. Instead of using, you know, swords and shields, we're really using, you know, magic. Right? We're putting on our wizard hat. And instead of trying to kill the intregral, right? We use something like u substitution to transform that integration problem into a friendly integration problem that we can actually deal with, right? We're never attacking integrals directly we're just transforming integrals by doing u substitutions or parts. So let's try to transform the integration that we're attacking here. Let's tranform e to the x cosx to something else. So I'll use what u, I'll make u be e to the x. because I don't really mind differentiating that. And I'll make dv cosx dx. Now in that case, the derivative of e to the x is just e to the x. And what's an anti-derivative of cosine? An anti-derivative of cosine is sine. Now what is integration by parts say. So then anti-derivative of cosx e to the x dx is U times V, so e to the x sinx minus the intergral of V du So, sinx, e to the x dx. Well that didn't really help matters. But the word of the day is persevere. So let's persevere, and transform that integral into yet another monster. So the monster in this case is this thing here. let's try the same trick on that new integral. So U will be e to the x again and dv here, will be just what's left over, sine x dx. And in that case, if U is e to the x, then du is e to the x dx. And, if dv is sin x dx, well, I've got other choices for more anti-derivative, but I'll have v be minus cosx. Now, I've put this into the integration by parts formula. So the antiderivative of sinx e to the x dx is uv, so minus e to the x cosx minus vdu. So my-, the integral of vdu, so v is cosx, and du is e to the x dx. Now what's happened thus far in the battle? I'm attacking this integral. I used integration by parts to transform the monster into something else. It didn't help, so I used that magical weapon again. I used integration by parts again to transform the integration problem into yet another integration problem and it didn't help. Or did it? What happens if I put these two integration facts together? Well, and then I've got here, the integral of cosx, e to the x dx, is equal to e to the x sin x minus the integral of sinx, e to the x, dx, which is down here. So minus negative e to x cos x plus the integral of cosine x e to the dx. Lets persevere, lets keep going. So this is saying the integral of cos x e to the x dx is e to the x sin x plus e to the x, cosine x, minus the integral of cosine x, e to the x, dx. Now I'm going to add the integral of cos x e to the x, dx to both sides. And what I'll then get is 2 times the integral of cos x e to the x, dx is equal to, well what's left on the righthand side, e to the x sin x plus e to the x, cos x. And then I'll divide both sides by 2, and if I divide this side by 2 and this side by 2 well then these 2's cancel, and I find out that an antiderivative of cosine x e to the x Is e to the x sin x plus z to the x cos x all over 2. What we did here is one of my favorite applications of integration by parts. We didn't use integration by parts to solve, to evaluate the integral directly. Instead, I applied parts twice and ended up with a clone of the original monster. So how did that go? Well, here you are, right, and you're a wizard, so here's your wizard hat, and here's the integral that we wanted to attack. But we didn't attack this integral directly. We didn't' even transform this integral by using U substitution. Instead, we used parts twice and it seemed like that was a terrible idea because when I applied parts twice, I ended up with a clone of the original monster. The same integral ended up appearing. But, that other integral came with a minus sign. And, consequently that monster ends up defeating itself and we're able to evaluate the integral without actually integrating at all. If anything suggests that there's creativity in the battles ahead of us, I think integration by parts is telling us, to be prepared to be amazed.