8.4b. Integration by parts (a special trick)

Our aim here is to find $\displaystyle \int \mathrm{e}^x \sin 2x \; \mathrm{d}x$. Since it is a product of two functions, using integration by parts make sense. The trick here is that the exponential function is similar regardless of whether we differentiate or integrate it. The same goes for the trigonometric functions sine and cosine. Differentiate $\sin x$ and we get $\cos x$. Integrate it and you get $-\cos x$. Differentiate/integrate twice, and we get $-\sin x$, almost the same thing with the just an additional constant.

For our example, we will let $u = \sin 2x$ and differentiate it to get $2 \cos 2x$. We let $\displaystyle \frac{\mathrm{d}v}{\mathrm{d}x} = \mathrm{e}^x$ and integrate to get $\mathrm{e}^x$. (It actually doesn't matter the order at this stage: we could reverse our choice and can still get to the same answer). Applying the by parts formula gives us $\displaystyle \int \mathrm{e}^x \sin 2x \; \mathrm{d}x = \mathrm{e}^x \sin 2x - 2 \int \mathrm{e}^x \cos 2x \; \mathrm{d}x $.

We will apply the by parts formula one more time to $\displaystyle \int \mathrm{e}^x \cos 2x \; \mathrm{d}x$. This time, it is important to keep the same choice of $u$ and $\displaystyle \frac{\mathrm{d}v}{\mathrm{d}x}$ as before: let $u=\cos 2x$ and $\displaystyle \frac{\mathrm{d}v}{\mathrm{d}x} = \mathrm{e}^x $. This gives us $\displaystyle \mathrm{e}^x \sin 2x - 2 \left ( \mathrm{e}^x \cos 2x - 2 \int \mathrm{e}^x (-2 \sin 2x) \; \mathrm{d}x \right )$.

Remark: If we reverse the choices at the second step from the first, we will get back our original question with no progress. This will be like first putting on your shoe, then taking it off at the next step. So make sure we continue with the same choice for our "parts".

Let us simplify our working and take stock. We now have
$\displaystyle \int \mathrm{e}^x \sin 2x \; \mathrm{d}x = \mathrm{e}^x \sin 2x - 2 \mathrm{e}^x \cos 2x - 4 \int \mathrm{e}^x \sin 2x \; \mathrm{d}x$.
Notice the integral on the right side of the equation is exactly the same as the original question. We move it over to the left to get
$\displaystyle \int \mathrm{e}^x \sin 2x \; \mathrm{d}x + 4 \int \mathrm{e}^x \sin 2x \; \mathrm{d}x = \mathrm{e}^x \sin 2x - 2 \mathrm{e}^x \cos 2x $.
Combining gives us
$\displaystyle 5 \int \mathrm{e}^x \sin 2x \; \mathrm{d}x = \mathrm{e}^x \sin 2x - 2 \mathrm{e}^x \cos 2x$.

Observe that we no longer have an integral on the right side of the equation. In other words, we have found what the integral is and solved the question (once we move the constant 5 over to the other side and add a constant of integration). Thus $\displaystyle \int \mathrm{e}^x \sin 2x \; \mathrm{d}x = \frac{\mathrm{e}^x \sin 2x - 2 \mathrm{e}^x \cos 2x}{5} + C$.

To summarize, when we encounter integrals involving the exponential function multiplied by a sine or cosine function, integrate by parts twice and move the resulting integral back to the left.