1

I was given the following indefinite integral and asked to solve it using the integration by parts method: $$\int e^x\cos(x)\text{d}x$$ I did so but seemed to get two different answers. The first was: $$\frac12e^x(\sin x+\cos x)+C$$ The other was simply: $$e^x\sin x+e^x\cos x +C$$ The difference in solutions seems to come from how I choose the parts - If I put cosine as my f(x), I end up with a negative sine. However, if I avoid negatives, then my answer is different.
Based on the comments, it seems that my second answer is incorrect. I will show the work I put in for that one, maybe someone can help me understand what I did wrong? $$\int e^x\cos(x)\text{d}x = \cos(x)e^x+\int\sin(x)e^x=\cos(x)e^x+\sin(x)e^x+\int\cos(x)e^x $$ Is this correct? Is there simply a sign error somewhere?

Burt
  • 1,813
  • 3
    You can always check your integration result by differentiating, and seeing if you get the integrand back at you. – Adrian Keister Sep 10 '19 at 23:53
  • $\frac12e^x(\sin x+\cos x)+C$ is correct, and the other one is wrong. – FFjet Sep 10 '19 at 23:54
  • 1
    It's impossible that both be correct, as their difference is not a constant function. – Bernard Sep 10 '19 at 23:54
  • 2
    The first one is correct. We cannot tell what went wrong wit the second method unless you show your entire argument. It is always a good idea to differentiate your answer and see if you get back $e^{x}\cos , x$. – Kavi Rama Murthy Sep 10 '19 at 23:54
  • 1
    Please elaborate on how you got the two answers. Only the first is correct, but without context I cannot pinpoint your error. – Trebor Sep 10 '19 at 23:55
  • Any time you calculate an indefinite integral, a constant can be included, since its derivative is zero. – herb steinberg Sep 10 '19 at 23:57
  • https://math.stackexchange.com/questions/3351012/how-can-i-solve-int-e2-thetasin3-thetad-theta-with-integration-by-parts – lab bhattacharjee Sep 11 '19 at 01:04
  • You can do the tabular method it's a better way to avoid sign errors. – Ali Shadhar Sep 11 '19 at 01:29

2 Answers2

2

The error is that you forgot a minus sign when performing the second integration by parts.

Let $\text{u}=\cos(x)$ and $\text{dv}=e^xdx$ so that $\text{du}=-\sin(x)dx$ and $\text{v}=e^x$. Therefore

$$\int e^x\cos(x)\text{d}x=\mathrm{uv}-\int \mathrm{vdu}=\cos(x)e^x+\int e^x\sin(x){d}x\tag{1}$$

We then need to evaluate

$$\int e^x\sin(x){d}x$$

Let $\text{u}=\sin(x)$ and $\text{dv}=e^xdx$ so that $\text{du}=\cos(x)dx$ and $\text{v}=e^x$. Then

$$\int e^x\sin(x){d}x=\mathrm{uv}-\int \mathrm{vdu}=\sin(x)e^x-\int e^x\cos(x){d}x\tag{2}$$

Combining $(1)$ and $(2)$

$$\int e^x\cos(x)\text{d}x=\cos(x)e^x+\int e^x\sin(x){d}x=\cos(x)e^x+\sin(x)e^x-\int e^x\cos(x){d}x$$

which reduces to

$$\int e^x\cos(x)\text{d}x=\frac{1}{2}e^x\big(\cos(x)+\sin(x) \big)+C$$

Axion004
  • 10,056
0

I did it just now: $$ \begin{aligned} \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 \end{aligned} $$ then $$ 2\int e^x \cos (x) \, dx = e^x \cos(x) + e^x \sin(x) $$ which implies $$ \int e^x \cos (x) \, dx = \frac12e^x(\sin x+\cos x)+C $$ And I don't know in which step you are wrong.

Burt
  • 1,813
FFjet
  • 5,041