# How to integrate when integration by parts never ends?

So I have the following integration: $\int{e^{-x}\sin{x}}$

I let u be the $e^{-x}$ and $dv = \sin{x} dx$

After doing the integration by parts I get:$(e^{-x})(-\cos{x})-\int{-e^{-x}*(-\cos{x})}$

From what it looks like, if I continue integration by parts, will it just continue going on forever?

• Just do that one more tine you got your question on RHS then make your question subject of equation
– Yaar
Commented May 14, 2015 at 0:32
• @LeBtz, where exactly?
– user224997
Commented May 14, 2015 at 0:40

For integration by parts, you will need to do it twice to get the same integral that you started with. When that happens, you substitute it for L, M, or some other letter. So we start by taking your original integral and begin the process as shown below.

Now using the formula

We get the following sequence, and we do another round of integration by parts.

So we end up the integral part that is the same as your original equation like so:

Now we substitute your original integral with the letter L like so...

...and replace every occurrence so the equation looks like the following:

Then we solve for L as shown below.

So your complete solution is this:

Hope this helps.

If you continue (do integration by part for $\int e^{-x}\cos x\,dx$) you will get $\int e^{-x}\sin x \,dx= f(x) - \int e^{-x}\sin x\, dx$, therefore $\int e^{-x}\sin x\, dx= \frac12 f(x)$.

Every time you integrate by part you will get an extra minus, but you integrating $\sin x$ twice get one minus, that's why in this case doing integration twice works.

Edit: You also made a mistake. (Editted) $\int udv = uv -\int vdu$, so you should get

$$\int e^{-x} \sin x \,dx = -e^{-x}\cos x - \int e^{-x} \cos x \, dx$$

• why is the cosine not negative, I thought the integral of the sinx which is the dv, is -cosx?
– user224997
Commented May 14, 2015 at 0:49
• For the first term, integrating $\sin x$ gives you a minus, and I put it at the front. For the second term, integrating $\sin x$ gives you a minus, differentiating $e^{-x}$ gives you a minus, the integration by part rule gives you a minus, together it is negative, and I put the sign at the front. Commented May 14, 2015 at 0:52

\begin{align} &\int e^{-x}\sin(x)\,\mathrm{d}x\tag{1}\\ &=-\int\sin(x)\,\mathrm{d}e^{-x}\tag{2}\\ &=-e^{-x}\sin(x)+\int e^{-x}\cos(x)\,\mathrm{d}x\tag{3}\\ &=-e^{-x}\sin(x)-\int\cos(x)\,\mathrm{d}e^{-x}\tag{4}\\ &=-e^{-x}\sin(x)-e^{-x}\cos(x)-\int e^{-x}\sin(x)\,\mathrm{d}x\tag{5}\\ &=-\frac12e^{-x}(\sin(x)+\cos(x))\tag{6} \end{align} Explanation:
$(2)$: $-\mathrm{d}e^{-x}=e^{-x}\,\mathrm{d}x$
$(3)$: integrate by parts
$(4)$: $-\mathrm{d}e^{-x}=e^{-x}\,\mathrm{d}x$
$(5)$: integrate by parts
$(6)$: average $(1)$ and $(5)$

You actually regenerate the original integral: $$I = \int e^{-x} \sin{x} \, dx = -e^{-x} \sin{x} + \int e^{-x} \cos{x} \, dx \\ = -e^{-x} \sin{x} -e^{-x} \cos{x} -(-1)\int e^{-x} (-\sin{x}) \, dx \\ = -e^{-x} \sin{x} -e^{-x} \cos{x} - I,$$ so $$I = \frac{1}{2}(-e^{-x} \sin{x} -e^{-x} \cos{x}) + C.$$

Or, you can go the other way: $$I = \int e^{-x} \sin{x} \, dx = e^{-x}(-\cos{x} ) - \int (-e^{-x})(-\cos{x}) \, dx \\ = -e^{-x} \cos{x} -\int e^{-x} \cos{x} \, dx \\ = -e^{-x} \cos{x} - e^{-x}\sin{x} -(-1) \int (-e^{-x}) \sin{x} \, dx \\ = -e^{-x} \cos{x} - e^{-x} \sin{x} - I$$

$$\int e^{-x}\sin x\,dx= \frac{1}{2i}\int e^{-x}(e^{ix}-e^{-ix})\,dx= \frac{1}{2i}\left(\frac{e^{(-1+i)x}}{-1+i}-\frac{e^{(-1-i)x}}{-1-i}\right)+C= \frac{e^{-x}}{4i}\left(e^{ix}(-1-i)-e^{-ix}(-1+i)\right)+C= \frac{e^{-x}}{2}\left(-\frac{e^{ix}-e^{-ix}}{2i}-\frac{e^{ix}+e^{-ix}}{2}\right)+C=\frac{e^{-x}}{2}\left(-\sin x -\cos x\right)+C$$

• Overkill much? ${}$
– Teoc
Commented May 14, 2015 at 1:18
• Just a simple strightforward way applicable almost everywhere on $\sin$ or $\cos$. Commented May 14, 2015 at 2:42

perhaps a less painful way takes advantage of the fact that we can do the integration by parts along two routes. first clear the negative by noting that if

$$f(x) = \int^x e^{-t}\sin t dt$$ then $$f(-x) = \int^{-x} e^{-t}\sin t dt = \int^x e^t\sin (-t) d(-t) =\int^x e^t \sin t dt$$ now, by the first route $$f(-x) = [e^t \sin t]^x - \int^x e^t \cos t dt \tag{1}$$ and by the second route $$f(-x) = [-e^t \cos t]^x + \int^x e^t \cos t dt \tag{2}$$ adding (1) and (2) $$2f(-x) = e^x(\sin x - \cos x) +C$$ so $$f(x) = \frac12 e^{-x}( \sin(-x) -\cos(-x)) +C \\ = -\frac12 e^{-x}(\sin x + \cos x) + C$$