\chapter[Techniques of Integration II]{Techniques of Integration II: Integration by Parts}

A general principle is that any derivative rule has a corresponding
integration rule.  For example, a derivative formula such as $\frac{d}{
dx}\sin x=\cos x$ has a corresponding antiderivative formula $\int\cos
x\,dx=\sin x+C$.  The \index{$u$-substitution technique of integration} $u$-substitution technique of integration comes from
the chain rule for differentiation: if you check an antiderivative
obtained by $u$-substitution in order to be sure that its derivative is the
function you wanted to integrate, you use the chain rule.  For example, in
the top integral of Example 12.1 in the last section, to check that $50\ln
u=50\ln(1+0.01x^2)$ is the antiderivative of $x/(1+0.01x^2)$, you use the
chain rule: $$\frac{d}{ dx}50\ln u=\frac{50}{ u}\frac{du}{ dx}=\frac{50}{
1+0.01x^2}(0.02x)=\frac{x}{ 1+0.01x^2}.$$

\smallskip

The product rule for derivatives also gives rise to a very useful
integration rule, called {\bf \index{integration by parts} integration by parts}.  To get this rule, we
recall the product rule, which says that the derivative of $u(x)v(x)$ is
$u(x)v'(x)+u'(x)v(x)$.  We shall omit the $(x)$, and write simply
$(uv)'=uv'+u'v$.  Now solve this equality for $uv'$, and then take the
antiderivative of both sides.  Since the antiderivative of $(uv)'$ is
just $uv$, we obtain: $\int uv'=uv-\int u'v$.  This is the integration by
parts rule in shorthand form.  Written out completely, it is: 
\[
       \int u(x)v'(x)dx=u(x)v(x)-\int u'(x)v(x)dx
\qquad(\text{indefinite~integral~
form)}.
\]
For definite integrals, we put in the limits of integration:
\[
        \int_a^bu(x)v'(x)dx=u(x)v(x)\biggm|_a^b-\int_a^bu'(x)v(x)dx
\qquad(\text{definite~integral~form)}.
\]

\smallskip

At first, this might seem to be useless: the rule says that our integral is
equal to $uv$ minus some other integral, and so we still have an integral
to compute.  However, for an important class of functions $f(x)$ it is
possible to choose $u(x)$ and $v(x)$ in such a way that $f(x)= u(x)v'(x)$
and the integral on the right --- namely, $\int u'(x)v(x)dx$ --- is easier
to evaluate than $\int f(x)dx$.  This section is devoted to explaining how
this is done.  We first give a series of examples, and then we make up a
table summarizing the \index{main uses of integration by parts} main uses of integration by parts.


\begin{example}
%{\bf Example 1.} 
Find $\int x\,\cos x\,dx$, and then find the
$x$-coordinate of the center of mass of the flat plate bounded by the $x$-
and $y$-axes and the cosine curve in the first quadrant.

\smallskip

We choose $u(x)=x$ and $v'(x)=\cos x$.  The first thing we must do is find
$v(x)$, which is an antiderivative of $\cos x$.  So we take $v(x)=\sin x$.
In an integration by parts problem, $v'(x)$ must always be a function whose
antiderivative you can find right away.  (The integration by parts would
work just as well if we took any other antiderivative of the form $\sin x
+C$; but to avoid unnecessary work we shall always choose $v(x)$ by setting
the constant of integration equal to 0.)  Using $u(x)=x$ and $v(x)=\sin x$
in the integration by parts rule, we obtain: $$\int x\,\cos x\,dx=x\,\sin
x-\int 1\cdot\sin x\,dx=x\,\sin x-(-\cos x) +C= x\,\sin x+\cos x +C.$$

\smallskip

It is instructive to check our answer by taking the derivative of $x\,\sin
x+\cos x$.  As always in an integration by parts problem, our answer has
two parts: a product of two functions (namely $x\,\sin x$) and another
function which can be thought of as a ``correction term'' (namely, $\cos
x$).  When we take the derivative of the product, the product rule gives us
two terms.  One of them is our original function inside the integral, and
the other is a term we don't want.  The derivative of the ``correction
term'' precisely cancels out the term we don't want.  We see how this works
when we check our answer to Example 13.1: 
\[
\frac{d}{ dx}(x\,\sin x+\cos x)
= (x\,\cos x+1\cdot\sin x)-\sin x=x\,\cos x.
\]

\smallskip

Finally, $\overline{x}$ in this example is equal to 
\begin{align*}
\int_0^{\pi/2}x\,\cos x\,dx&\biggm/\int_0^{\pi/2}\cos x\,dx
 = (x\,\sin x+\cos x)\bigm|_0^{\pi/2}\biggm/\sin x\bigm|_0^{\pi/2}\\
 &= (\pi/2-1)/1=\frac{\pi}{ 2}-1=0.5708.
\end{align*}

\end{example}

 
\begin{example}
%{\bf Example 2.} 
Find $\int xe^{5x}dx.$

\smallskip

Again choose $u(x)=x$.  Let $v'(x)=e^{5x}$, so that $v(x)=\frac{1}{
5}e^{5x}$.  Then $$\int xe^{5x}dx=x\cdot\frac{1}{ 5}e^{5x}-\int 1\cdot\frac{1}{
5}e^{5x}dx=\frac{1}{ 5}xe^{5x}-\frac{1}{ 5}\int e^{5x}dx=\frac{1}{
5}xe^{5x}-\frac{1}{ 25} e^{5x}+C.$$

\end{example}


\begin{example}
%{\bf Example 3.} 
Find the improper integral $\int_0^\infty x^{10}e^{-x}dx$.

\smallskip

We shall apply the definite integral version of integration by parts.
Having upper limit of integration $\infty$ means that we can take a finite
upper limit of integration $b$ and then let $b\longrightarrow\infty$.

\smallskip

Before doing this problem, we shall digress for a minute, and show that
$x^ne^{-kx}$ always approaches 0 as $x\longrightarrow\infty$, for any $n$
and any positive constant $k$.  Look at the $\ln$ of this expression:
$\ln(x^ne^{-kx})=\ln(x^n)+\ln(e^{-kx})=(n\ln x)-kx$.  That is, we get a
constant multiple of $\ln x$ minus a constant multiple of $x$.  When $x$ is
large $\ln x$ is much smaller than $x$, and so eventually this difference
must approach $-\infty$.  Hence, our original expression $x^ne^{-kx}$,
which is $e^{n\ln x-kx}$, is $e$ to a power that approaches $-\infty$, and
this approaches zero, as claimed.

\smallskip

We shall apply this limit fact when we evaluate expressions of the form
$x^ne^{-x}$ at infinity (i.e., at $b$ and then take $b\longrightarrow
\infty$).  That is, when we evaluate $x^ne^{-x}$ at infinity we get 0.
In our integral we take $u(x)=x^{10}$ and $v'(x)=e^{-x}$, so that
$v(x)=-e^{-x}$.  Then
\[
  \int_0^{\infty}x^{10}e^{-x}\,dx
=-x^{10}e^{-x}\biggm|_0^\infty-\int_0^\infty 10x^9\left(-e^{-x}\right)\,dx
=0-0+10\int_0^\infty x^9e^{-x}\,dx.  
\] 
The last integral is like the one we started with; however, the power of
$x$ has been reduced by 1.  So we must apply integration by parts again,
this time with $u(x)=x^9$.  The result is: $\int_0^\infty x^9e^{-x}dx=9
\int_0^\infty x^8e^{-x}dx$.  Continuing in this way, we obtain
\begin{align*}
\int_0^\infty x^{10}e^{-x}dx
    &=10\int_0^\infty x^9e^{-x}dx=10\cdot 9 \int_0^\infty x^8e^{-x}dx\\
    &=\cdots=10\cdot 9\cdot 8\cdots 2\cdot 1\cdot
\int_0^\infty e^{-x}dx.
\end{align*}

But $\int_0^\infty e^{-x}dx=-e^{-x}\Bigm|_0^\infty=1$, so that our final
answer is $10\cdot 9\cdot 8\cdot 7\cdot 6\cdot 5\cdot 4\cdot 3\cdot 2\cdot
1=3628800$.  (The product of all numbers from 1 to 10 is called ``10
factorial,'' and is written $10!$.)

\end{example}

\begin{example}
%{\bf Example 4.} 
Find $\int_0^1x^3\ln x\,dx.$

\smallskip

First note that the function $x^3\ln x$ is negative between 0 and 1
(because $\ln x$ is negative there), has value 0 when $x=1$, and approaches
the limit 0 as $x\longrightarrow 0$.  (For the latter fact, see Problem
9(a) in the section on $\ln$.) Thus, the function we're integrating in
Example 13.4 has the following appearance:

\begin{center}
%-figure MA -----------------------------
\begin{psfigure}{4in}{0.9in}{figMA.ps}
%\putcrosshair{0,0}
\puttext{0, -28}{\small$\displaystyle y = x^3\,\ln x$}
\end{psfigure}\\
%------------------------------
\end{center}

\noindent
We now use integration by parts.  If we try to proceed as in Example 13.3,
setting $u(x)$ equal to $x^3$, we run into a problem: we would then have to
take $v'(x)$ equal to $\ln x$, and we do not yet know an antiderivative of
$\ln x$.  In an integration problem with $\ln x$, it makes sense to reverse
our choice of $u$ and $v$.  That is, we set $u(x)=\ln x$ and $v'(x)=x^3$,
so that $v(x)=x^4/4$.  This gives us: $$\int_0^1x^3\ln x\,dx=\frac{1}{
4}x^4\ln x\biggm|_0^1-\int_0^1\frac{1}{ 4}x^4
\cdot\frac{1}{ x}\,dx.$$
Notice what happened in the integral at the right: we have nothing more
than a power of $x$ to integrate.  The point is that integration by parts
can be viewed as a trade-off, where in the integral on the right you get to
replace $u$ by its derivative $u'$ (which should be a simpler function),
but at the expense of replacing $v'$ by its antiderivative $v$.  In this
problem we had to replace $x^3$ by a higher power $x^4$, but in return we
got to replace $\ln x$ by the much simpler function $1/x$ which is its
derivative.  Returning to our computation, we find that $x^4\ln x$ gives 0
when evaluated at either 1 or 0, and hence $$\int_0^1x^3\ln x\,dx=-\frac{1}{
4}\int_0^1x^3\,dx=-\frac{1}{ 4}\cdot\frac{1}{ 4}=-\frac{1}{ 16}.$$

\end{example}

\begin{example}
%{\bf Example 5.} 
Find the antiderivative of $\ln x$.

\smallskip

At first it might seem that the integral $\int\ln x\,dx$ should have
nothing to do with integration by parts, since the function inside the
integral is not a product.  However, we can treat this integral in the same
way as we treated $\int x^3\ln x\,dx$ in Example 13.4.  Namely, we view $\ln
x$ as the product $1\cdot\ln x=x^0\ln x$, and we set $u(x)=\ln x$ and
$v'(x)=1$, so that $v(x)=x$.  Then:
\[
\int\ln x\,dx=x\ln x-\int x\cdot\frac{1}{ x}dx=x\ln x-\int 1\,dx= x\ln x-x+C.
\]

\end{example}

\begin{example}
%{\bf Example 6.} 
Find the antiderivative of $\arcsin\,x$.

\smallskip

This antiderivative (and also the antiderivative of Arctan) can be
computed in the same way as the antiderivative of $\ln x$ in Example 13.5.
Namely, we take $u(x)=\arcsin\,x$, $v'(x)=1$, $v(x)=x$, so that
$u'(x)=1/\sqrt{1-x^2}$, and
\[
\int\arcsin\,x\,dx=x\,\arcsin\,x-\int x\frac{1}{\sqrt{1-x^2}}dx
=x\,\arcsin\,x-\int\frac{x\,dx}{\sqrt{1-x^2}}.
\] 
The last integral can
be evaluated using a $u$-substitution.  That is, for the rest of the
problem we forget about integration by parts, and use the letter $u$ for an
entirely different purpose.  Namely, if we set $u$ equal to the expression
under the radical, we see that $du$ is essentially what we have in the
numerator.  More precisely, $u=1-x^2$, $du=-2xdx$, so that
\begin{align*}
 \int\arcsin\,x\,dx &=x\,\arcsin\,x+\int\frac{du}{ 2\sqrt u} \\
                    &=x\,\arcsin\,x+\sqrt{u}+C=x\,\arcsin\,x+\sqrt{1-x^2}+C.
\end{align*}
 The reader should check this answer by taking its derivative and seeing
that, after cancelation, you get $\arcsin\,x$.

\end{example}


Before doing more examples, we give a table that summarizes the most common
uses of integration by parts.  They all relate to functions which are the
product of a power of $x$ and either an exponential function, sine or
cosine, or else one of the inverse functions $\ln$, Arcsin, Arctan.


\section{How to Choose $u$ and $v$}

\noindent
I.~In the following cases choose $u(x)=x^n$ and $v'(x)=$the other function.
Here $n$ is a positive integer, and $k$, $a$, and $b$ are constants.
$$
\int f(x)dx,\qquad~\text{where~}f(x)~\text{is~a~product~}x^n\cdot
\begin{cases}
e^{kx},&\\
~~\\\sin(ax+b),&\\
~~\\
\cos(ax+b).
\end{cases}
$$

\noindent
II.~In the following cases choose $v'(x)=x^n$ and $u(x)=$ the other
function. Here $n$ is a positive integer or 0, $m$ is a positive integer,
and $a$ and $b$ are constants.  
$$\int f(x)dx,\qquad~\text{where~}f(x)~\text{is~a~product~}x^n\cdot
\begin{cases}
\ln(ax+b),\\
~~\\
\ln^m(ax+b),\\
~~\\
\arcsin(ax+b),\\~~
\\
\arctan(ax+b).
\end{cases}
$$

\medskip

One type of problem in part II which has not yet occurred in the examples
is $x^n\cdot\ln^m(ax+b)$.  We now give an example of this.


\begin{example}
%{\bf Example 7.} 
Suppose that the shape in Example 13.4 is revolved around the
$x$-axis to form a solid.  Find its volume.

\smallskip

Since $\left(x^3\ln x\right)^2=x^6\ln^2x$, we choose $u(x)=\ln^2x$ and
$v'(x)=x^6$.  Then $v(x)=x^7/7$, and $u'(x)=2(\ln x)/x$.  We have:
\begin{align*}
\text{Vol}&=\pi\int_0^1x^6\ln^2x\,dx
=\pi\left(\frac{1}{ 7}x^7\ln^2x\biggm|_0^1 -\int_0^1\frac{1}{ 7}x^7\cdot 2(\ln
x)\frac{1}{ x}\,dx\right)\\
&=\pi\left( 0-0-\frac{2}{ 7}\int_0^1x^6\ln x\,dx\right).
\end{align*}
We now have to use integration by parts a second time.  (In general, to
integrate $x^n\ln^mx$, you'll need to use integration by parts $m$ times,
each time lowering the power of $\ln x$ by one.)  We obtain:
\begin{align*}
\text{Vol}
&=-\frac{2\pi}{ 7}\int_0^1x^6\ln x\,dx
=-\frac{2\pi}{ 7}\left(\frac{1}{ 7}x^7\ln x\biggm|_0^1
   -\int_0^1\frac{1}{ 7}x^7\cdot\frac{1}{ x}\,dx\right)\\
&=\frac{2\pi}{ 7}\cdot\frac{1}{ 7}\int_0^1x^6\,dx=\frac{2\pi}{ 343}
 =0.01832.
\end{align*}
\end{example}


\begin{example}
%{\bf Example 8.} 
Find both coordinates of the center of mass of the flat
plate bounded by the $x$- and $y$-axes and the curve $y=e^{-x}$ in the
first quadrant (out to infinity).

\smallskip

The denominator in $\overline{x}$ and $\overline{y}$ is the area, which is
$\int_0^\infty e^{-x}dx=1$, as we saw in Example 13.3.  Thus,
\[
\overline{x}=
\int_0^\infty xe^{-x}dx
=-xe^{-x}\biggm|_0^\infty-\int_0^\infty \left(-e^{-x}\right)\cdot 1\,dx
=0-0+\int_0^\infty e^{-x}dx=1.
\]
To compute $\overline{y}$, we must first write $x$ in terms of $y$:
$y=e^{-x}\Longrightarrow x=-\ln y$.  In the $y$-direction, the shape is
contained between $y=0$ and $y=1$.  Thus, 
\[
\overline{y}=\int_0^1 y(-\ln y)dy
=-\left(\frac{1}{ 2}y^2\ln y\biggm|_0^1 
-\int_0^1\frac{1}{2}y^2\cdot\frac{1}{ y}\,dy\right)
=\frac{1}{ 2}\int_0^1 y\,dy
=\frac{1}{ 4}.
\]
So the center of mass is at $(1,0.25)$.

\end{example}

%%---------------------------------------
