If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Integration by parts: ∫𝑒ˣ⋅cos(x)dx

In the video, we learn about integration by parts to find the antiderivative of e^x * cos(x). We assign f(x) = e^x and g'(x) = cos(x), then apply integration by parts twice. The result is the antiderivative e^x * sin(x) + e^x * cos(x) / 2 + C. Created by Sal Khan.

Want to join the conversation?

Video transcript

Let's see if we can use integration by parts to find the antiderivative of e to the x cosine of x, dx. And whenever we talk about integration by parts, we always say, well, which of these functions-- we're taking a product of two of these-- which of these functions, either the x or cosine of x, that if I were to take its derivative, becomes simpler. And in this case neither of them become simpler. And neither of them become dramatically more complicated when I take their antiderivative. So here, it's kind of a toss up which one I assign to f of x and which one I assign to g prime of x. And actually, you can solve this problem either way. So let's just assign this one. Let's assign f of x equaling e to the x. And let's assign g prime of x as equaling cosine of x. So let me write it down. We are saying f of x is equal to e to the x, or f prime of x is equal to e to the x. Derivative of e to the x is just e to the x. And we can say that g-- we're making the assignment-- g prime of x is equal to cosine of x. And the antiderivative of that g of x is also. Or the antiderivative of cosine of x is just going to be equal to sine of x. So now let's apply integration by parts. So this thing is going to be equal to f of x times g of x, which is equal to e to the x times sine of x, minus the antiderivative of f prime of x-- f prime of x is e to the x. e to the x times g of x, which is once again, sine of x. Now, it doesn't look like we've made a lot of progress, now we have an indefinite integral that involves a sine of x. So let's see if we can solve that, let's see if we solve this one separately. So let's say if we were trying to find the antiderivative. The antiderivative of e to the x, sine of x dx. How could we do that? Well, similarly, we can set f of x as equal to e to the x. So, and now this is we're reassigning, although we're happening to make the exact same reassignment. So we're saying f of x is equal to e to the x. f prime of x is equal to just the derivative of that, which is still e to the x. And then we could say g of x, in this case, is equal to sine of x. We'll put these assignments in the back of our brain for now. And then-- let me make this clear-- g prime of x, let me, woops, there you go-- so we have g prime of x is equal to sine of x, which means that its antiderivative is negative cosine of x. Derivative of cosine is negative sine, derivative of negative cosine is positive sine. So once again, let's apply integration by parts. So we have f of x times g of x. f of x times g of x is negative-- is I'll put the negative out front-- it's negative e to the x times cosine of x, minus the antiderivative of f prime of xg of x. F prime of x is e to x. And then g of x is negative cosine of x. So I'll put the cosine of x right over here, and then the negative, we can take it out of the integral sign. And so we're subtracting a negative. That becomes a positive. And of course, we have our dx right over there. And you might say, Sal, we're not making any progress. This thing right over here, we now expressed in terms of an integral that was our original integral. We've come back full circle. But let's try to do something interesting. Let's substitute back this-- all right, let me write it this way. Let's substitute back this thing up here. Or actually, let me write it a different way. Let's substitute this for this in our original equation. And let's see if we got anything interesting. So what we'll get is our original integral, on the left hand side here. The indefinite integral or the antiderivative of e to the x cosine of x dx is equal to e to the x sine of x, minus all of this business. So let's just subtract all of this business. We're subtracting all of this. So if you subtract negative e to the x cosine of x, it's going to be positive. It's going to be positive e to the x, cosine of x. And then remember, we're subtracting all of this. So then we're going to subtract. So then we have minus the antiderivative of e to the x, cosine of x,dx. Now this is interesting. Just remember all we did is, we took this part right over here. We said, we used integration by parts to figure out that it's the same thing as this. So we substituted this back in. When you subtracted it. When you subtracted this from this, we got this business right over here. Now what's interesting here is we have essentially an equation where we have our expression, our original expression, twice. We could even assign this to a variable and essentially solve for that variable. So why don't we just add this thing to both sides of the equation? Let me make it clear. Let's just add the integral of e to the x cosine of x dx to both sides. e to the x, cosine of x, dx. And what do you get? Well, on the left hand side, you have two times our original integral. e to the x, cosine of x, dx is equal to all of this business. Is equal to this. I'll copy and paste it. So copy and paste. It's equal to all of that. And then this part, this part right over here, cancels out. And now we can solve for our original expression. The antiderivative of e to the x cosine of x dx. We just have to divide both sides of this, essentially an equation, by 2. So if you divide the left hand side by two, you're left with our original expression. The antiderivative of e to the x cosine of x dx. And on the right hand side you have what it must be equal to. e to the x sine of x, plus e to the x cosine of x over 2. And now we want to be careful because this is an antiderivative of our original expression, but it's not the only one. We always have to remember, even though we've worked hard and we've done-- we've used integration by parts twice. And we've had to back substitute in. We have to remember we should still have a constant here. So if you take the derivative of this business, regardless of what the constant is, you will get e to the x cosine of x. And it's actually a pretty neat looking expression.