## Integration by Parts Notes

This is designed to be a fairly complete review of integration by parts using some examples. For the basics, see your text. These examples are more designed to show you how integration by parts is actually done.

A printable version is here: spring2012math2400_examples_7.2 (pdf)

## Classic Examples

Example 1. $\displaystyle \int xe^x\,dx$

Solution: We select $u$ and $v’$ and then $u’$ and $v$ follow.
\begin{align*} u &= x & v'&=e^x\\ u'&= 1 & v &=e^x \end{align*}

\begin{align*} \int xe^x\,dx&=xe^x-\int e^x\,dx\\ &=xe^x-e^x+C \end{align*}

Example 2. $\displaystyle \int x\sin x\,dx$

Solutions:
\begin{align*} u &= x & v'&= \sin x\\ u' &= 1 & v &= -\cos x \end{align*}

\begin{align*} \int x\sin x\,dx &= -x\cos x+\int \cos x\,dx\\ &= -x\cos x+\sin x+ C \end{align*}

## Integration By Parts Multiple Times

Example 3. $\displaystyle \int x^2\sin x\,dx$

Solution: What happens here is that the first application of integration by parts results in another integral that is best approached by using integration by parts.
\begin{align*} u_1&=x^2 & v_1'&=\sin x\\ u_1'&=2x & v_1&=-\cos x \end{align*}
\begin{align*} \int x^2\sin x\,dx &= x^2\cos x+\int 2x\cos x\,dx\\ &=x^2\cos x+2\int x\cos x\,dx \end{align*}
\begin{align*} u_2&=x & v_2'&=\cos x\\ u_2'&=1 & v_2&=\sin x \end{align*}
\begin{align*} &=x^2\cos x+2\left(x\sin x-\int \sin x\,dx\right)\\ &=x^2\cos x+2x\sin x+2\cos x+C \end{align*}

Example 4. $\displaystyle \int x^2 e^x\,dx$

Solution: Again, we use integration by parts twice. The subscripts on the variables below tell us during which application of integration by parts those variables were used.
\begin{align*} u_1&=x^2 & v_1'&=e^x\\ u_1'&=2x & v_1&=e^x\\ u_2&=2x & v_2'&=e^x\\ u_2'&=2 & v_2&=e^x \end{align*}
\begin{align*} \int x^2e^x\,dx &= x^2e^x-\int 2xe^x\,dx\\ &=x^2e^x-\left(2xe^x-\int 2e^x\,dx\right)\\ &= x^2e^x-2xe^x-2e^x+C. \end{align*}

## Definite Integral Examples

Example 5. $\displaystyle \int_1^5\ln x\,dx$

This is also a good example of how you can sometimes use integration by parts with one of the functions being trivial (i.e., $v’=1$).

Solution: When we use integration by parts, we simply keep in mind that we’re evaluating the original integral from 1 to 5. That means that we must evaluate BOTH terms (the $x\ln x$ and the integral) given by integration by parts. Also, it helps to remember here that $\ln 1=0$.
\begin{align*} u&= \ln x & v'&=1\\ u'&=\frac{1}{x} & v&=x \end{align*}
\begin{align*} \int_1^5\ln x\,dx &= x\ln x\Big\vert_1^5-\int_1^5\,dx\\ &=5\ln 5-\ln 1-4\\ &=5\ln 5-4 \end{align*}

## More Complicated Examples

Example 6. $\displaystyle \int \cos^2(3\alpha+1)\,d\alpha$

Solutions: We need to use integration by parts, plus a trig identity, plus substitution in order to compute this integral.
\begin{align*} u&=\cos(3\alpha+1) & v'&=\cos(3\alpha+1)\\ u'&=-3\sin(3\alpha+1) & v&=\frac{1}{3}\sin(3\alpha+1) \end{align*}
\begin{align*} &\int\cos^2(3\alpha+1)\,d\alpha =\int\cos(3\alpha+1)\cos(3\alpha+1)\,d\alpha\\ &=\frac{1}{3}\cos(3\alpha+1)\sin(3\alpha+1)+\int\sin^2(3\alpha+1)\,d\alpha \end{align*}
By using the trig identity $\cos 2\alpha = 1-2\sin^2\alpha$ and solving for $\sin^2\alpha$ we can write the above as
{\small\begin{align*} &=\frac{1}{3}\cos(3\alpha+1)\sin(3\alpha+1)+\int\frac{1}{2}-\frac{1}{2}\cos(6\alpha+2)\,d\alpha \end{align*}}
Using the substitution $w=6\alpha+2$ (and so $dw=6\,d\alpha$) this then becomes
{\small\begin{align*} &=\frac{1}{3}\cos(3\alpha+1)\sin(3\alpha+1)+\frac{1}{4}x^2-\frac{1}{12}\int\cos w\,dw\\ &=\frac{1}{3}\cos(3\alpha+1)\sin(3\alpha+1)+\frac{1}{4}x^2-\frac{1}{12}\sin w+C\\ &=\frac{1}{3}\cos(3\alpha+1)\sin(3\alpha+1)+\frac{1}{4}x^2-\frac{1}{12}\sin(6\alpha+2)+C \end{align*}}

## Recursive Examples

Example 7. $\displaystyle \int e^x\sin x\,dx$

Solution: In this case, neither $e^x$ or $\sin x$ will become simpler when differentiated, and so at the start it doesn’t seem like integration by parts can help. But, something interesting happens.
\begin{align*} u_1&=e^x & v_1'&=\sin x\\ u_1'&=e^x & v_1&=-\cos x\\ u_2&=e^x & v_2'&=\cos x\\ u_2'&=e^x & v_2&=\sin x \end{align*}
\begin{align*} \int e^x\sin x\,dx &= -e^x\cos x+\int e^x\cos x\,dx\\ &=-e^x\cos x+e^x\sin x-\int e^x\sin x\,dx \end{align*}
The main thing to notice here is that the integral we are trying to find is on both sides of the equation, and since the right hand side version is negative, we add it to both sides. We get
\begin{align*} 2\int e^x\sin x\,dx &= -e^x\cos x+e^x\sin x \end{align*}
and dividing both sides by 2 gives
$\int e^x\sin x\,dx =\frac{1}{2}\left(-e^x\cos x+e^x\sin x\right)+C.$

Example 8. $\displaystyle \int \cos^2\theta\,d\theta$

Solution: There are two ways to consider this problem. One is to use the identity
$\cos^2\theta=\frac{1+\cos 2\theta}{2}$
and substitution. The other is to use the Pythagorean identity
$\cos^2\theta = 1-\sin^2\theta$
and integration by parts. The latter is done here.
\begin{align*} u&=\cos\theta & v'&=\cos\theta\\ u'&=-\sin\theta & v&=\sin\theta \end{align*}
\begin{align*} \int\cos^2\theta\,d\theta &= \cos\theta\sin\theta +\int\sin^2\theta\,d\theta\\ &=\cos\theta\sin\theta+\int 1-\cos^2\theta\,d\theta\\ &=\cos\theta\sin\theta+\int 1\,d\theta-\int\cos^2\theta\,d\theta \end{align*}
Adding the integral of $\cos^2\theta$ to both sides gives
\begin{align*} 2\int\cos^2\theta\,d\theta &=\cos\theta\sin\theta+\int 1\,d\theta\\ 2\int\cos^2\theta\,d\theta &=\cos\theta\sin\theta+\theta+C\\ \int\cos^2\theta\,d\theta &=\frac{1}{2}\left(\cos\theta\sin\theta+\theta\right)+C. \end{align*}

## Reduction Formula Example

Example 9. Prove the formula
$\int\sin^n\,dx=-\frac{1}{n}\cos x\sin^{n-1}x+\frac{n-1}{n}\int \sin^{n-2}x\,dx$

Solution: The main idea is to start with one function as $\sin^{n-1}x$ and the other as $\sin x$. Proceed as follows.
\begin{align*} u&=\sin^{n-1}x & v'&=\sin x\\ u'&= (n-1)\sin^{n-2}x\cos x & v&=-\cos x. \end{align*}
\begin{align*} &\ \ \int\sin^nx\,dx\\ &= -\cos x\sin^{n-1}x +\int(n-1)\sin^{n-2}x\cos x\cos x\,dx\\ &= -\cos x\sin^{n-1}x+\int(n-1)\sin^{n-2}x\cos^2 x\,dx\\ &= -\cos x\sin^{n-1}x+\int(n-1)\sin^{n-2}x(1-\sin^2 x)\,dx\\ &= -\cos x\sin^{n-1}x+(n-1)\int \sin^{n-2}x-\sin^nx\,dx\\ &= -\cos x\sin^{n-1}x+(n-1)\int\sin^{n-2}x\,dx-(n-1)\int\sin^{n}x\,dx \end{align*}
Now move the $(n-1)\int\sin^nx\,dx$ to the left side.
\begin{align*} \int\sin^nx\,dx+(n-1)\int\sin^nx\,dx &=-\cos x\sin^{n-1}x+(n-1)\int\sin^{n-2}x\,dx\\ n\int\sin^nx\,dx &=-\cos x\sin^{n-1}x+(n-1)\int\sin^{n-2}x\,dx\\ \int\sin^nx\,dx &=-\frac{1}{n}\cos x\sin^{n-1}x+\frac{n-1}{n}\int\sin^{n-2}x\,dx \end{align*}