Integration of cos(x)e^x dx

Dinoduck94

New member
Joined
May 15, 2019
Messages
22
When I integrate this function, I consistently get the same answer - I don't feel like I missed any steps or added any extra ones, but I just can't seem to get the right answer.
Can someone help my understanding, please?

I used Integration by Parts for this function, where after the first step I get the below function:

cos(x)ex - ∫-sin(x)ex + C

Using Integration by Parts again, for the 2nd half of the function, I get the below:

cos(x)ex - (-sin(x)ex + cos(x)ex) + C

This then simplifies to:

cos(x)ex + sin(x)ex - cos(x)ex + C

Which then simplifies to:
sin(x)ex + C



However, I am being told that the correct answer is:
(1/2)*(sin(x)ex + cos(x)ex) + C


Where did I go wrong?
 
You dropped the integral in the second integration by parts.
[math]I = \int e^x ~ cos(x) ~dx = e^x ~ cos(x) + \int e^x ~ sin(x) ~dx = e^x ~cos(x) + e^x ~sin(x) - \int e^x ~ cos(x) ~dx[/math]
But the last term is just I again, so let's move it over to the LHS:
[math]I + I = e^x ~ cos(x) + e^x ~ sin(x)[/math]
So [math]I = \dfrac{1}{2} e^x (sin(x) + cos(x))[/math] (and, of course, now put in the arbitrary constant.)

-Dan
 
When I integrate this function, I consistently get the same answer - I don't feel like I missed any steps or added any extra ones, but I just can't seem to get the right answer.
Can someone help my understanding, please?

I used Integration by Parts for this function, where after the first step I get the below function:

cos(x)ex - ∫-sin(x)ex + C
Using Integration by Parts again, for the 2nd half of the function, I get the below:
(x)ex - (-sin(x)ex + cos(x)ex) + C
Where did I go wrong?
\(\displaystyle \begin{gathered} \int {{e^x}\cos (x)dx} = {e^x}\cos (x) + \int {{e^x}\sin (x)dx} \hfill \\
= {e^x}\cos (x) + {e^x}\sin (x) - \int {{e^x}\cos (x)dx} \hfill \\
2\int {{e^x}\cos (x)dx} = {e^x}\cos (x) + {e^x}\sin (x) \hfill \\
\end{gathered} \)
 
You dropped the integral in the second integration by parts.
[math]I = \int e^x ~ cos(x) ~dx = e^x ~ cos(x) + \int e^x ~ sin(x) ~dx = e^x ~cos(x) + e^x ~sin(x) - \int e^x ~ cos(x) ~dx[/math]
But the last term is just I again, so let's move it over to the LHS:
[math]I + I = e^x ~ cos(x) + e^x ~ sin(x)[/math]
So [math]I = \dfrac{1}{2} e^x (sin(x) + cos(x))[/math] (and, of course, now put in the arbitrary constant.)

-Dan

Oh I see... So with including the integral that I missed; it becomes:

[math]\int e^x ~ cos(x) dx + \int e^x ~ cos(x) ~dx = e^x ~cos(x) + e^x ~sin(x)[/math]
Which is effectively [math]2y = e^x ~cos(x) + e^x ~sin(x)[/math]
and then you rearrange to make 'y' the subject, and hey presto you have the answer.

Thanks for your help

One other question, why is the integral kept after the 2nd integration by parts?
My apologies for the ignorance; in the material that I've learnt, and all previous question examples that I've done, once the 2nd integration by parts is done the integral isn't kept - following that, that's why my original answer was:

[math]\int cos(x)~e^x = cos(x)~e^x + sin(x)~e^x - cos(x)~e^x + C[/math]
So why is it the below, instead? What rule means that the integral is kept?

[math]\int cos(x)~e^x = cos(x)~e^x + sin(x)~e^x - \int cos(x)~e^x + C[/math]
 
Oh I see... So with including the integral that I missed; it becomes:

[math]\int e^x ~ cos(x) dx + \int e^x ~ cos(x) ~dx = e^x ~cos(x) + e^x ~sin(x)[/math]
Which is effectively [math]2y = e^x ~cos(x) + e^x ~sin(x)[/math]
and then you rearrange to make 'y' the subject, and hey presto you have the answer.

Thanks for your help

One other question, why is the integral kept after the 2nd integration by parts?
My apologies for the ignorance; in the material that I've learnt, and all previous question examples that I've done, once the 2nd integration by parts is done the integral isn't kept - following that, that's why my original answer was:

[math]\int cos(x)~e^x = cos(x)~e^x + sin(x)~e^x - cos(x)~e^x + C[/math]
So why is it the below, instead? What rule means that the integral is kept?

[math]\int cos(x)~e^x = cos(x)~e^x + sin(x)~e^x - \int cos(x)~e^x + C[/math]
".. once the 2nd integration by parts is done the integral isn't kept..."

Please share a complete example of a problem where the integral is not kept - then we can show you the difference!
 
".. once the 2nd integration by parts is done the integral isn't kept..."

Please share a complete example of a problem where the integral is not kept - then we can show you the difference!

One of the other question that I've done is:

[math]\int x ~ ln(x) dx [/math]
By doing integration by parts, in the first instance, I got:

[math]\int x ~ ln(x) dx = \dfrac{x^2}{2} ~ ln(x) - \int (\dfrac{1}{x} ~ \dfrac{x^2}{2}) = \dfrac{x^2}{2} ~ ln(x) - \int \dfrac{x}{2}) +C [/math]
Then, with doing the 2nd integration by parts, I get the following solution (here, the integral isn't kept):

[math]\int x ~ ln(x) dx = \dfrac{x^2}{2} ~ ln(x) - \dfrac{x^2}{4} + C [/math]
The above, was marked as correct, although I was told I should have simplified it into a factor:

[math]\int x ~ ln(x) dx = \dfrac{x^2 ~ (2~ln(x)-1)}{4} + C [/math]
 
The difference is that when you integrated [math]\int \dfrac{x}{2}~dx = x^2 + C[/math] directly. It's only when you have to use integration by parts that you have an integral left over.

-Dan
 
The difference is that when you integrated [math]\int \dfrac{x}{2}~dx = x^2 + C[/math] directly. It's only when you have to use integration by parts that you have an integral left over.

-Dan

So the difference is only that there are multiple functions of 'x' left in that part of the function after integrating by parts for the 2nd time?

Okay, I think I understand, thanks for your help!
 
Top