# Integration by parts order question + integration question

In integration by parts, does it matter which of your terms is v (or, rather $f(x)$) and which term is du (or, rather $f'(x)$?

Also, I'm having trouble finding $\int e^{2x} \cos(3x)dx$. I keep getting $$\frac {2e^{2x}(6\sin(3x) - \cos(3x))}{37}$$ when $u=e^{2x}$ and $dv = \cos(3x) dx$.

Thanks!

• Often, it very much matters. In this case, which is quite special, it happens not to matter which way you go on the first integration, but one must maintain consistency for the second. – André Nicolas Apr 26 '14 at 18:50
• The following notation is very helpful in calculations (here $G$ is a primitive of $g$): $$\int_a^b \lower6pt\hbox{\matrix{f(x)\cr\downarrow\cr}\matrix{g(x)\cr\uparrow\cr}}\> dx =f(x)G(x)\biggr|_a^b -\int_a^b f'(x)G(x)\>dx\ .$$ – Christian Blatter Apr 26 '14 at 19:40

Regarding which term is which: Yes and no. In $\int u \mathrm{d}v$ the strict requirement is that $\mathrm{d}v$ is something you can successfully integrate and $u$ is something you can successfully differentiate. If some other partition of the integrand gives you a pair that you can do these things to, you should be able to proceed. However, it is required that you get something "simpler", otherwise you will never finish. Consider $\int x \mathrm{e}^x \mathrm{d}x$. If in repeated integration by parts you persist in choosing $u = \mathrm{e}^x$ and then integrating the polynomial, the integral will never get simpler. So to ever finish reducing the integral to simpler terms, you must make choices that make the resulting integrals $\int v \mathrm{du}$ simpler (or at least eventually simpler).

In your particular problem, when $u = \mathrm{e}^{2x}$ and $\mathrm{d}v = \cos(3x) \mathrm{d}x$, you should get $\mathrm{d}u = 2 \mathrm{e}^{2x}\mathrm{d}x$ and $v = \frac{1}{3} \sin(3x)$. So, let $I = \int \mathrm{e}^{2x} \cos(3x) \mathrm{d}x$.
$$I = \frac{1}{3} \mathrm{e}^{2x} \sin(3x) - \frac{2}{3} \int \mathrm{e}^{2x} \sin(3x) \mathrm{d}x$$ We "have a choice". If we set $\mathrm{d}v = \mathrm{e}^{2x} \mathrm{d}x$ and $u = \sin(3x)$, then we exactly undo what we did in the first step, so that will not result in progress. Therefore, we make the choice in the same way as in the first step: $u = \mathrm{e}^{2x}$ and $\mathrm{d}v = \sin(3x) \mathrm{d}x$, giving $\mathrm{d}u = 2 \mathrm{e}^{2x}\mathrm{d}x$ and $v = -\frac{1}{3}\cos(3x)$. Thus, \begin{align*} I &= \frac{1}{3} \mathrm{e}^{2x} \sin(3x) - \frac{2}{3} \left( -\frac{1}{3}\mathrm{e}^{2x}\cos(3x) + \frac{2}{3} \int \mathrm{e}^{2x} \cos(3x) \mathrm{d}x\right) \\ &= \frac{1}{3} \mathrm{e}^{2x} \sin(3x) + \frac{2}{9}\mathrm{e}^{2x}\cos(3x) - \frac{4}{9} I \\ \frac{13}{9}I &= \frac{1}{9} \mathrm{e}^{2x}\left( 3\sin(3x) + 2\cos(3x) \right) \\ I &= \frac{1}{13} \mathrm{e}^{2x}\left( 3\sin(3x) + 2\cos(3x) \right) \end{align*}

In this case, it doesn't matter whether you choose $e^{2x}$ or $\cos3x$ as $u$: after 2 applications of integration by parts you should get something similar back. Your answer doesn't seem to match Wolfram's answer, so let's give it a go. Given your substitution, we have

$$du=2e^{2x},v=\frac13\sin3x$$

$$\int e^{2x}\cos3xdx=\frac13e^{2x}\sin3x-\frac23\int e^{2x}\sin3xdx$$

We'll use the same $u$ to keep from undoing what we're already done. That leaves

$$dv=\sin3xdx,v=-\frac13\cos3x$$

So we have

$$\int e^2x\cos3xdx=\frac13e^{2x}\sin3x-\frac23(-\frac13e^{2x}\cos3x+\frac23\int e^{2x}\cos3xdx)$$ $$\int e^2x\cos3xdx=\frac13e^{2x}\sin3x+\frac29e^{2x}\cos3x-\frac49\int e^{2x}\cos3xdx$$

Adding $\frac49\int e^{2x}\cos3xdx$ to both sides:

$$\frac{13}9\int e^{2x}\cos3xdx=\frac13e^{2x}\sin3x+\frac29e^{2x}\cos3x$$ $$\int e^{2x}\cos3xdx=\frac3{13}e^{2x}\sin3x+\frac2{13}e^{2x}\cos3x$$

Yes, it does matter. You can check Wikipedia's page on integration by parts, and in particular the LIATE rule. In general, you want $u$ to be easier to differentiate, whereas $dv$ to be easier to integrate.

In your example, however, if you follow the rule above, both functions should be $u$. You can overcome this by applying the same choice multiple times. For example, let's set $u = e^{2x}$ and $dv = \cos (3x)\ dx$. Then $du = 2e^{2x}\ dx$ and $v = \frac{\sin 3x}{3}$. So: $$\int e^{2x} \cos (3x)\ dx = \frac{1}{3}e^{2x}\sin 3x - \frac{2}{3} \int \sin(3x) e^{2x}\ dx \tag 1$$ Integrating again, with $u = e^{2x}$ and $dv = \sin(3x)\ dx$ we get that $du = 2 e^{2x}\ dx$ and $v = - \frac{1}{3} \cos 3x$. The latter integral becomes: $$\int \sin(3x) e^{2x}\ dx = -\frac{1}{3}e^{2x}\cos 3x + \frac{2}{3}\int e^{2x}\cos(3x)\ dx$$ Substituting back into $(1)$ we get: $$\int e^{2x} \cos (3x)\ dx = \frac{1}{3}e^{2x}\sin 3x - \frac{2}{3} \left ( -\frac{1}{3}e^{2x}\cos 3x + \frac{2}{3}\int e^{2x}\cos(3x)\ dx\right )$$

and then $$\int e^{2x} \cos (3x)\ dx = \frac{1}{3}e^{2x}\sin 3x + \frac{2}{9} e^{2x}\cos 3x - \frac{4}{9} \int e^{2x}\cos(3x)\ dx$$

Adding $\displaystyle \frac{4}{9} \int e^{2x}\cos(3x)\ dx$ to both sides of the equation: $$\frac{13}{9} \int e^{2x} \cos (3x)\ dx = \frac{1}{3}e^{2x}\sin 3x + \frac{2}{9} e^{2x}\cos 3x$$

Finally: \begin{align*} \int e^{2x} \cos (3x)\ dx &= \frac{3}{13}e^{2x}\sin 3x + \frac{2}{13} e^{2x}\cos 3x + C = \\ &= \frac{1}{13} e^{2x} (3 \sin 3x + 2 \cos 3x) + C \end{align*}.