\section{Integration by Parts}\index{integration! by parts}
Just as the Chain Rule for differentiation leads to the useful Method of Substitution for solving integrals, so too does the Product Rule result in a useful method for solving integrals. Starting with the Product Rule
\[\frac{d}{dx}\left[f(x)g(x)\right]=f'(x)g(x)+f(x)g'(x)\ ,\]
one can integrate both sides of the equation to get:
\[\int\frac{d}{dx}\left[f(x)g(x)\right]dx=\int f'(x)g(x)\,dx+\int f(x)g'(x)\,dx\]
An antiderivative of the derivative of a function is just the function itself so the left-hand side becomes $f(x)g(x)+C$.  The constant $C$ may be absorbed into the indefinite integrals on the right and so one has:
\[f(x)g(x)=\int f'(x)g(x)\,dx+\int f(x)g'(x)\,dx\ .\]
Reordering the terms gives
\[\int f(x)g'(x)\,dx = f(x)g(x)-\int f'(x)g(x)\,dx\ .\]
The formula suggests that a useful strategy for evaluating an integral is to consider an integrand as a product of two terms, one of which may be differentiated ($f(x)$) and one which may be integrated ($g'(x)$) to produce a new integral that is perhaps more easy to evaluate than the original.  It is customary to define $u=f(x)$ and $v=g(x)$.  One then has the corresponding differentials $du=f'(x)dx$ and $dv=g'(x)dx$.  The formula becomes:
\[\int\! u\,dv=uv-\int\! v\,du\]
This is the \textbf{Integration by Parts} formula.

\begin{example}
Integrate $\int x^2\ln x\,dx$.

The fact that $\ln x$ is easily differentiated and $x^2$ easily integrated suggests we reorder the terms and identify $u$ and $dv$ as follows:
\[\int \underbrace{\ln x}_{=u}\underbrace{x^2\,dx}_{=dv}\]
Then $u=\ln x$ implies (differentiating) that $du=\frac{1}{x}\,dx$.  The differential $dv=x^2\,dx$ is integrated to give $v=\frac{1}{3}x^3$.  The Integration by Parts formula $\int u\,dv=uv-\int v\,du$ implies:

\begin{eqnarray*}
\int \left(\ln x\right)\cdot\left(x^2\,dx\right) & = & \left(\ln x\right)\cdot\left(\frac{1}{3}x^3\right)-\int \left(\frac{1}{3}x^3\right)\cdot\left(\frac{1}{x}\,dx\right)\\
& = & \frac{1}{3}x^3\ln x-\frac{1}{3}\int x^2\,dx \\
& = & \frac{1}{3}x^3\ln x-\frac{1}{3}\cdot\frac{1}{3}x^3+C \\
& = & \frac{1}{3}x^3\ln x-\frac{1}{9}x^3+C
\end{eqnarray*}
\end{example}

\textbook{\clearpage}
In general, to apply Integration by Parts select $u$ and $dv$ so that
\begin{enumerate}
\item The product $u\,dv$ is equal to the original integrand.
\item $dv$ can be integrated.
\item The new integral $\int v\,du$ is easier than the original integral.
\item For integrals involving $x^pe^{ax}$ try $u=x^p$, $dv=e^{ax}\, dx$ .
\item For integrals involving $x^p(\ln x)^q$ try $u=(\ln x)^q$, $dv=x^p\,dx$ .
\end{enumerate}
As with assigning $u$ to $\ln x$ in the last suggestion, we often will assign $u$ to an inverse function because its derivative is known.  Integration by Parts can then (hopefully) convert the expression into something that can be integrated.

An integral may have several ways it can be broken into $u$ and $dv$ that can be tried when applying Integration by Parts.  Only one of these, or indeed none of these, may actually work to allow integration of the function.

\begin{example}
  Evaluate the following integrals:
  \begin{multicols}{3}
    \begin{enumerate}
    \item $\displaystyle \int(x^{2}+x)e^{-x}dx$ 
    \item $\displaystyle \int e^{2x}\sin x\, dx $
    \item $\displaystyle \int_{0}^{1}\sin^{-1}x\,dx$
    \end{enumerate}
  \end{multicols}
\begin{solution*}
\begin{enumerate}
\item Let $u=x^{2}+x$ so $du=(2x+1)dx$ and $dv=e^{-x}dx$. Integrating the latter (using the substitution $w=-x$ if needed) gives  $v=-e^{-x}$.  Integration by Parts gives:
\begin{align*}
  \int(x^{2}+x)e^{-x}dx=(x^{2}+x)\left(-e^{-x}\right)-\int\left(-e^{-x}\right) (2x+1)dx \\
  =-(x^{2}+x)e^{-x}+\int(2x+1)e^{-x}dx 
\end{align*}
Use Integration by Parts again.  Let $u=(2x+1)$ so $du=2dx$ and $dv=e^{-x}$ so $v=-e^{-x}$ again to get:
\begin{align*}
  \int (x^{2}+x)e^{-x}dx &=-(x^{2}+x)e^{-x}+(2x+1)\left(-e^{-x}\right) -\int \left(-e^{-x}\right)2\,dx \\
                         &=-(x^{2}+x)e^{-x}-(2x+1)e^{-x}+2\int e^{-x}dx \\
                         &=-(x^{2}+x)e^{-x}-(2x+1)e^{-x}-2e^{-x}+ C\\
                         &=(-x^{2}-3x-3)e^{-x}+ C                           
\end{align*}
\item Let $u=e^{2x}$ so $du=2e^{2x}dx$ and $dv=\sin x\,dx$ so (integrating)  $v=-\cos x$.  Using Integration by Parts gives:  
\begin{align*}
\int e^{2x}\sin x\,dx= e^{2x}(-\cos x)-\int (-\cos x)e^{2x}\,dx= -e^{2x}\cos x+2\int e^{2x}\cos x \,dx
\end{align*}
Use Integration by Parts on the final integral with $u=e^{2x}$ so $du=2e^{2x}$ and $dv=\cos x\,dx$ so $v=\sin x$ to get
\begin{align*}
  \int e^{2x}\sin x\, dx&= -e^{2x}\cos x +2\left[e^{2x}\sin x -\int (\sin x)\left(2e^{2x}\right)\, dx\right]\\
                          &= -e^{2x}\cos x +2e^{2x}\sin x -4\int e^{2x}\sin x\, dx 
\end{align*}
This is a wrap-around integral in that we have produced the same integral with which we have started.  Solve for the integral as we would any variable: 
\begin{align*}
&\int e^{2x}\sin x\,dx +4\int e^{2x}\sin x\,dx=-e^{2x}\cos x+2e^{2x}\sin x \\
&\implies 5\int e^{2x} \sin x\,dx= -e^{2x}\cos x+2e^{2x}\sin x \\
&\implies \int e^{2x}\sin x\,dx= -\frac{1}{5}e^{2x}\cos x+ \frac{2}{5}e^{2x}\sin x + C 
\end{align*}
Here a constant of integration must be included, as with any indefinite integral, to provide the most general solution.
\item Let $u=\sin^{-1}x$ so $\displaystyle du=\frac{1}{\sqrt{1-x^{2}}}\, dx$ and $dv=dx$ so $v=x$:
\begin{align*}
\int_{0}^{1} \sin^{-1}x\,dx=\left.\rule{0em}{1.26em} x\sin^{-1}x \right|_0^1-\int_0^1\frac{x}{\sqrt{1-x^{2}}}\,dx
\end{align*}
Note for Integration by Parts how the limits carry over to the new expression.  They do not change as they would for a substitution.  To evaluate the integral on the right-hand side we do however require a substitution. Let $\displaystyle w=1-x^{2}$ so $dw=-2x\,dx \implies \frac{1}{2}\,dw=-x\,dx$.  The new limits are $x=1\implies w=1-1^2=0$ and $x=0\implies w=1-0^2=1$ and we have:
\begin{align*}
\int \sin^{-1}\!x\,dx &= \left.\rule{0em}{1.26em} x\sin^{-1}\!x\right|_0^1+ \int_1^0 \frac{1}{\sqrt{w}}\frac{dw}{2} \\
                    &=\left. x\sin^{-1}x\right|_0^1 + \left. \sqrt{w}\right|_1^0 \\
                      &=(1)\sin^{-1}(1)-(0)\sin^{-1}(0)+\sqrt{0}-\sqrt{1}=\frac{\pi}{2}-1
\end{align*}
Alternatively, to use the same limits all the way through, evaluate the indefinite integral on the side to get the antiderivative:
\[-\int \frac{x}{\sqrt{1-x^{2}}}\,dx=\int \frac{1}{\sqrt{w}}\frac{dw}{2}=\sqrt{w}+C=\sqrt{1-x^2}+C\]
The original integral becomes:
\begin{align*}
\int_{0}^{1} \sin^{-1}\!x\,dx&=\left.\rule{0em}{1.26em} x\sin^{-1}\!x \right|_0^1-\int_0^1\frac{x}{\sqrt{1-x^{2}}}\,dx =\left[x\sin^{-1}\!x + \sqrt{1-x^2}\right|_0^1\\ 
                             &=\left[(1)\sin^{-1}(1)+\sqrt{1-1^2}\right]-\left[(0)\sin^{-1}(0)-\sqrt{1-0^2}\right] 
=\frac{\pi}{2}-1
\end{align*}
as before.
\end{enumerate}
\end{solution*}

\textbook{\clearpage}
\begin{furtherquestions}
  Evaluate the following integrals:
  \begin{multicols}{2}
    \begin{enumerate}
    \item $\displaystyle\int \ln x\,dx$
    \item $\displaystyle\int xe^x\,dx$
    \item $\displaystyle\int x^2e^{-x}\,dx$
    \item $\displaystyle\int e^x\cos x\,dx$
    \item $\displaystyle\int_0^1\tan^{-1}x\,dx $
    \item $\displaystyle\int x^3(\ln x)^2\,dx $
    \item $\displaystyle\int\sin(\ln x)\,dx $
    \item $\displaystyle\int\theta\sec^2\theta\,d\theta $
    \item $\displaystyle\int x^5e^{-x^3}\,dx $
    \item $\displaystyle\int x\sin(x^2)\,dx $
    \item $\displaystyle\int\cos^2x\,dx $
    \end{enumerate}
  \end{multicols}
\end{furtherquestions}
\end{example}

\begin{exercise}
\input{INTEGRATION_METHODS/integration-by-parts.tex}
\end{exercise}

\section{Trigonometric Integrals}\index{trigonometric integrals} \index{integration! trigonometric}

\subsection*{Strategy for Evaluating $\displaystyle\int\sin^mx\cos^nx\,dx$}
\index{trigonometric integrals! strategies for evaluating}
\begin{enumerate}
\item\label{item:trig1} For an odd power of sine ($m=2k+1$), save one sine factor and express the remaining sine factors in terms of cosine using the identity \mbox{$\sin^2x=1-\cos^2x$}:
\[\int\sin^{2k+1}x\cos^nx\,dx=\int\left(\sin^2x\right)^k\cos^nx\sin x\,dx=\int\left(1-\cos^2x\right)^k\cos^nx\sin x\,dx\]
Then substitute $u=\cos x$~.
\item\label{item:trig2} For an odd power of cosine ($n=2k+1$), save one cosine factor and express the remaining cosine factors in terms of sine using the identity \mbox{$\cos^2x=1-\sin^2x$}:
\[\int\sin^mx\cos^{2k+1}x\,dx=\int\sin^mx\left(\cos^2x\right)^k\cos x\,dx=\int\sin^mx\left(1-\sin^2x\right)^k\cos x\,dx\]
Then substitute $u=\sin x$~.
\item If the powers of both sine and cosine are even, use the trigonometric identities:
\[\sin^2x=\frac{1}{2}\left(1-\cos2x\right)~~~~~\cos^2x=\frac{1}{2}\left(1+\cos2x\right)\]
These may need to be used repeatedly.  The identity \mbox{$\sin x\cos x=\frac{1}{2}\sin2x$} may also be useful.
\end{enumerate}
Either \ref{item:trig1} or \ref{item:trig2} can be used if the powers of sine and cosine are both odd.

\begin{example}
  Evaluate the following integrals:
  \begin{multicols}{2}
    \begin{enumerate}
    \item $\displaystyle \int \sin^{3}\!x \cos^{6}\!x\,dx$ 
    \item $\displaystyle \int \tan^{2}\!x \cos^{5}\!x \,dx$
    \end{enumerate}
  \end{multicols}
\begin{solution*}
\begin{enumerate}
\item  Take one factor of $\sin x$ out of the odd power of sine to become part of the differential and write the remaining powers in terms of cosine: 
\begin{align*}
\int \sin^{3}\!x \cos^{6}\!x \,dx =\int \sin^{2}\!x\cos^{6}\!x\sin x\, dx 
=\int (1-\cos^{2}x)\cos^{6}x \sin x\,dx 
\end{align*}
Then substitute $u=\cos x$
so $du=-\sin x\,dx \implies -du=\sin x\, dx$.  The integral becomes:
\begin{align*}
&=\int(1-u^{2})u^{6}(-du)
=\int (u^{8}-u^{6})du \\
&=\frac{1}{9}u^{9}-\frac{1}{7}u^{7}+ C
=\frac{1}{9}\cos^{9}\!x-\frac{1}{7}\cos^{7}\!x + C 
\end{align*}
\item All trigonometric expressions can be written in terms of sine and cosine.  We try that here.
\begin{align*}
  \int \tan^{2}\!x \cos^{5}\!x \,dx  & =\int \frac{\sin^{2}\!x}{\cos^{2}\!x}\cos^{5}\!x\,dx =\int \sin^{2}\!x \cos^{3}\!x \,dx
\end{align*}
Next take out $\cos x$ from the odd power of cosine to be part of the differential:
\begin{align*}
  = \int \sin^{2}\!x \cos^{2}\!x \cos x\,dx
  =\int \sin^{2}\!x(1-\sin^{2}\!x)\cos x\, dx
\end{align*}
Finally let $u=\sin x$ so  $du=\cos x\,dx$. The integral becomes
\begin{align*}
=\int u^{2}(1-u^{2})\,du 
=\int (u^{2}-u^{4})\,du
=\frac{1}{3}u^{3}-\frac{1}{5}u^{5}+ C 
=\frac{1}{3}\sin^{3}\!x-\frac{1}{5}\sin^{5}\!x + C
\end{align*}
\end{enumerate}
\end{solution*}

\begin{furtherquestions}
Evaluate the following integrals:
\begin{multicols}{2}
  \begin{enumerate}
  \item $\displaystyle \int\sin^4x\cos^3x \,dx$
  \item $\displaystyle \int\sin^3x \,dx$
  \item $\displaystyle \int\cot^5x\sin^2x \,dx$
  \item $\displaystyle \int\sin^2x \,dx$
  \item $\displaystyle \int\sin^4x \,dx$
  \item $\displaystyle \int\cos^2x\sin^2x \,dx$
  \end{enumerate}
  \end{multicols}
\end{furtherquestions}
\end{example}

\subsection*{Strategy for Evaluating $\displaystyle\int\tan^mx\sec^nx\,dx$}
\index{trigonometric integrals! strategies for evaluating}
\begin{enumerate}
\item For an odd power of tangent ($m=2k+1$), save a factor of $\sec x\tan x$ and express the remaining factors of tangent in terms of $\sec x$ using the identity \mbox{$\tan^2x=\sec^2x-1$}:
\[\int\tan^{2k+1}x\sec^nx\,dx=\int\left(\tan^2x\right)^k\sec^{n-1}x\sec x\tan x\,dx=\int\left(\sec^2x-1\right)^k\sec^{n-1}x\sec x\tan x\,dx\]
Then substitute $u=\sec x$~.
\item For an even power of secant ($n=2k$), save a factor of $\sec^2x$ and express the remaining secant factors in terms of $\tan x$ using the identity \mbox{$\sec^2x=1+\tan^2x$}:
\[\int\tan^mx\sec^{2k}x\,dx=\int\tan^mx\left(\sec^2x\right)^{k-1}\sec^2x\,dx=\int\tan^mx\left(1+\tan^2x\right)^{k-1}\sec^2 x\,dx\]
Then substitute $u=\tan x$~.
\item If $m$ is even and $n=0$ (i.e. no factors of secant), convert a single factor of $\tan^2x$ using $\tan^2x=\sec^2x-1$.  The first term will then be integrable and the procedure may be repeated on the second integral of now lower power.
\end{enumerate}

\subsection*{Strategy for Evaluating $\displaystyle\int\cot^mx\csc^nx\,dx$}
\index{trigonometric integrals! strategies for evaluating}
\begin{enumerate}
\item For an odd power of cotangent ($m=2k+1$), save a factor of $\csc x\cot x$ and express the remaining factors of cotangent in terms of $\csc x$ using the identity \mbox{$\cot^2x=\csc^2x-1$}:
\[\int\cot^{2k+1}x\csc^nx\,dx=\int\left(\cot^2x\right)^k\csc^{n-1}x\csc x\cot x\,dx=\int\left(\csc^2x-1\right)^k\csc^{n-1}x\csc x\cot x\,dx\]
Then substitute $u=\csc x$~.
\item For an even power of cosecant ($n=2k$), save a factor of $\csc^2x$ and express the remaining factors of cosecant in terms of $\cot x$ using the identity $\csc^2x=1+\cot^2x$ :
\[\int\cot^mx\csc^{2k}x\,dx=\int\cot^mx\left(\csc^2x\right)^{k-1}\csc^2x\,dx=\int\cot^mx\left(1+\cot^2x\right)^{k-1}\csc^2 x\,dx\]
Then substitute $u=\cot x$~.
\item If $m$ is even and $n=0$ (i.e. no factors of cosecant), convert a single factor of $\cot^2x$ using $\cot^2x=\csc^2x-1$.  The first term will then be integrable and the procedure may be repeated on the second integral of now lower power.
\end{enumerate}
Note: This strategy is identical for that of tangents and secants with the identification $\tan\Rightarrow\cot$ and $\sec\Rightarrow\csc$~.
\begin{example}
  Evaluate the following integrals:
  \begin{multicols}{3}
    \begin{enumerate}
    \item $\displaystyle \int \tan^{5}\!x \sec^{4}\!x \,dx$
    \item $\displaystyle \int \cot^{4}\!x \csc^{4}\!x\,dx$
    \item $\displaystyle \int_0^{\pi/4} \tan x \sec^{5}\!x \,dx$
    \end{enumerate}
  \end{multicols}
\begin{solution*}
\begin{enumerate}
\item Imagining a tangent substitution we pull out a $\sec^2\!x$ to be part of the differential.  The remaining even power of secant can be converted to tangent as needed.
\begin{align*}
\int \tan^{5}\!x \sec^{4}\!x \,dx &=\int \tan^{5}x \sec^{2}x \sec^{2}x\,dx =\int \tan^{5}x(1+\tan^{2}x)\sec^{2}x\,dx \\
&\text{Let $u=\tan x$ so $du=\sec^{2}x$\,:} \\
&=\int u^{5}(1+u^{2})\,du =\int (u^{5}+u^{7})\,du \\
&=\frac{1}{6}u^{6}+\frac{1}{8}u^{8}+ C =\frac{1}{6}\tan^{6}x +\frac{1}{8}\tan^{8}x+ C 
\end{align*}
It is to be noted here that a secant substitution will also work here as pulling out $\sec x\tan x$ to be part of the differential leaves an even power of tangent which can be converted to secant.  The final answer, in terms of secant, will differ at most by a constant from the answer above.
\item Envisioning a cotangent substitution we try pulling out $\csc^2\!x$ to be part of the differential.  The remaining even power of cosecant can be converted to cotangent:
\begin{align*}
\int \cot^{4}\!x \csc^{4}\!x\,dx & =\int \cot^{4}x\csc^{2}\!x\csc^{2}\!x\,dx 
=\int \cot^{4}\!x(1+\cot^{2}\!x)\csc^{2}\!x\,dx \\
&\text{Let $u=\cot x$ so $du=-\csc^{2}\!x\,dx$:} \\
&=\int u^{4}(1+u^{2})(-du)=\int (-u^{4}-u^{6})\,du \\
&=-\frac{1}{5}u^{5}-\frac{1}{7}u^{7}+ C =-\frac{1}{5}\cot^{5}\!x-\frac{1}{7}\cot^{7}\!x+ C 
\end{align*}
Note that removing $\csc x\cot x$ for the differential for a $\csc x$ substitution will not work here as the remaining power of cotangent would be odd.
\item Anticipating a secant substitution we separate $\sec x\tan x$ for the differential:
\begin{align*}
\int_0^{\pi/4} \tan x \sec^{5}\!x \,dx& =\int_0^{\pi/4} \sec^{4}\!x \sec x \tan x\,dx \\
                                      & \text{Let $u=\sec x$ so $du=\sec x \tan x\,dx$. The limits become:} \\
    & x=\pi/4\implies u=\sec(\pi/4)=\frac{1}{\cos(\pi/4)}=\frac{1}{1/\sqrt{2}}=\sqrt{2} \\
    & x=0\implies u=\sec(0)=\frac{1}{\cos(0)}=\frac{1}{1}=1 \\
&=\int_1^{\sqrt{2}} u^{4}\,du= \left.\frac{1}{5}u^{5}\right|_1^{\sqrt{2}}=\frac{1}{5}\left[(\sqrt{2})^5-1^5\right]=\frac{4\sqrt{2}-1}{5}
\end{align*}
\end{enumerate}
\end{solution*}

\begin{furtherquestions}
Evaluate the following integrals:
\begin{multicols}{2}
  \begin{enumerate}
  \item$\displaystyle\int \tan^3x\sec^3x\,dx$
  \item$\displaystyle\int \tan^2x\sec^4x\,dx$
  \item$\displaystyle\int \tan^3x\,dx$
  \item$\displaystyle\int \sec x\,dx$
  \item$\displaystyle\int \sec^3x\,dx$
  \item$\displaystyle\int \tan^4x\,dx$
  \item$\displaystyle\int \cot^3x\csc^4x\,dx$
  \item$\displaystyle\int \cot^3x\csc^3x\,dx$
  \item$\displaystyle\int \csc x\,dx$
  \item$\displaystyle\int_{\frac{\pi}{4}}^{\frac{3\pi}{4}} \csc^4 x\,dx$
  \end{enumerate}
  \end{multicols}
\end{furtherquestions}
\end{example}
\subsection*{Strategy for Evaluating $\displaystyle\int\!\sin mx\cos nx\,dx$, $\displaystyle\int\!\sin mx\sin nx\,dx$, $\displaystyle\int\!\cos mx\cos nx\,dx$}
\index{trigonometric integrals! strategies for evaluating}
Apply the corresponding trigonometric identity:
\begin{itemize}
\item $\displaystyle\sin a\cos b=\frac{1}{2}\left[\sin(a-b)+\sin(a+b)\right]$
\item $\displaystyle\sin a\sin b=\frac{1}{2}\left[\cos(a-b)-\cos(a+b)\right]$
\item $\displaystyle\cos a\cos b=\frac{1}{2}\left[\cos(a-b)+\cos(a+b)\right]$
\end{itemize}
with $a=mx$ and $b=nx$~.

\begin{example}
  Evaluate the following integrals:
  \begin{multicols}{2}
    \begin{enumerate}
    \item $\displaystyle \int \sin 3x\cos4x\,dx$ 
    \item $\displaystyle \int_{0}^{\frac{\pi}{2}}\sin 2x\sin 3x\, dx$
    \end{enumerate}
  \end{multicols}
\begin{solution*}
\begin{enumerate}
\item Letting $a=3x$ and $b=4x$ in the appropriate trigonometric identity gives:
\begin{align*}
\int \sin 3x\cos4x\,dx &=\frac{1}{2}\int \left[\sin (3x-4x)+ \sin (3x+4x)\right]\,dx \\
&=\frac{1}{2}\int\left[\sin (-x)+\sin (7x)\right]\,dx
=\frac{1}{2}\int\left(-\sin x+ \sin 7x\right)\,dx \\
&=\frac{1}{2}\left(\cos x-\frac{1}{7}\cos 7x\right) + C
\end{align*}
Note here we used that sine is an odd function to write $\sin(-x)=-\sin x$ before integrating.  We then integrated term by term doing the substitution $u=7x$ in the second integral.
\item Letting $a=2x$ and $b=3x$ in the appropriate trigonometric identity gives:
\begin{align*}
\int_{0}^{\frac{\pi}{2}}\sin 2x\sin 3x\, dx& =\frac{1}{2}\int^{\frac{\pi}{2}}_0\left[\cos (2x-3x)-\cos (2x+3x)\right]\, dx \\
&=\frac{1}{2}\int_{0}^{\frac{\pi}{2}}\left[\cos (-x)-\cos(5x)\right]\,dx
=\frac{1}{2}\int_{0}^{\frac{\pi}{2}}\left(\cos x-\cos 5x\right)\,dx \\
&=\frac{1}{2} \left[\sin x-\frac{1}{5}\sin 5x\right |^{\frac{\pi}{2}}_{0} 
=\frac{1}{2}\left[\sin \frac{\pi}{2}-\frac{1}{5}\sin \frac{5\pi}{2}\right]-\frac{1}{2}\left[\sin 0-\frac{1}{5}\sin 0\right] \\
&=\frac{1}{2}\left[1-\frac{1}{5}(1)\right]=\frac{1}{2}\cdot\frac{5-1}{5}
=\frac{1}{2}\cdot\frac{4}{5}=\frac{2}{5}
\end{align*}
\end{enumerate}
\end{solution*}

\begin{furtherquestions}
  Evaluate the following integrals:
  \begin{multicols}{2}
    \begin{enumerate}
    \item $\displaystyle \int\sin 4x\cos 5x\,dx$
    \item $\displaystyle \int\sin 2x\sin 6x\,dx$
    \item $\displaystyle \int_0^{\frac{\pi}{4}}\cos 2x\cos 4x\,dx$
    \item $\displaystyle \int\sin 2x\sin 6x\cos 2x\,dx$
    \end{enumerate}
  \end{multicols}
\end{furtherquestions}
\end{example}

\subsection*{A Note on Trigonometric Identities}
Note that the various trigonometric identities require in this section follow readily from the three basic identities:

a) $\sin^2x+\cos^2x=1$\newline
b) $\sin(x\pm y)=\sin x\cos y\pm\cos x\sin y$\newline
c) $\cos(x\pm y)=\cos x\cos y\mp\sin x\sin y$

The half-angle identities follow from c) setting $y=x$ and then replacing alternately $\sin^2x$ or $\cos^2x$ using a).  Dividing a) by $\cos^2x$ gives the identity involving tangent and secant, while dividing a) by $\sin^2x$ gives the identity involving cotangent and cosecant.  The last three identities on this page follow by solving for the various products using the $+$ and $-$ equations from the appropriate angle addition formula b) or c).

\textbook{\clearpage}
\begin{exercise}
\input{INTEGRATION_METHODS/trigonometric-integrals.tex}
\end{exercise}

\section{Trigonometric Substitution}\index{trigonometric substitution} \index{integration! trigonometric substitution}
Some integrals, typically involving roots, may be resolved by using the Substitution Method where the old variable is defined in terms of a new variable via a trigonometric function.

%Note that some texts (Stewart) discuss this process as ``Inverse
%Substitution'' Others (Zill) omit such discussion.  What I have said
%is rigorous enough. i.e.  if we define \theta=\sin^{-1}(x/a) that IS
%the forward substitution and one can shows that dx=a\sin\theta
%d\theta by solving for \sin\theta.  The whole point here is to make
%that ``guess'' less opaque.
\begin{example}
Find the indefinite integral $\displaystyle\int\sqrt{4-x^2}\,dx$~.  We consider the substitution $\theta(x)$ defined via
\[x=2\sin\theta\]
(and so $dx=2\cos\theta\,d\theta$). Unlike our usual application of
the substitution method here we have defined $\theta$ implicitly.  To make
$\theta(x)$ unique as required we add the additional constraint $-\frac{\pi}{2}\le\theta\le\frac{\pi}{2}$.  (Equivalently we recognize that the explicit substitution which has been done is just $\theta=\sin^{-1}\left(\frac{x}{2}\right)$ which, recall, is defined with this range.) The integral becomes
\begin{eqnarray*}
\int\sqrt{4-x^2}\,dx & = & \int \sqrt{4-4\sin^2\theta}\cdot2\cos\theta\,d\theta \\
& = &  \int \sqrt{4}\sqrt{1-\sin^2\theta}\cdot2\cos\theta\,d\theta \\
& = &  4\int\cos\theta\cos\theta\,d\theta = 4\int\cos^2\theta\,d\theta \\
& = &  4\int\frac{1}{2}\left(1+\cos2\theta\right)\,d\theta =2\int d\theta+2\int\cos 2\theta\,d\theta\\
& = & 2\theta+\sin2\theta+ C = 2\theta+2\sin\theta\cos\theta+ C \\
& = & 2\sin^{-1}\left(\frac{x}{2}\right)+2\left(\frac{x}{2}\right)\frac{1}{2}\sqrt{4-x^2}+C \\
& = & 2\sin^{-1}\left(\frac{x}{2}\right)+\frac{1}{2}x\sqrt{4-x^2}+C
\end{eqnarray*}
\end{example}
Note that when we solved the identity $1-\sin^2\theta=\cos^2\theta$ for $\cos\theta$ we used that $-\frac{\pi}{2}\le\theta\le\frac{\pi}{2}$ to get $\cos\theta=\sqrt{1-\sin^2\theta}$ since $\cos\theta$ is indeed positive on the interval. This choice of positive sign was also used in our final step where again $\cos\theta$ was represented by a positive value:
\[\cos\theta=\sqrt{1-\sin^2\theta}=\sqrt{1-x^2/4}=\sqrt{(4-x^2)/4}=\sqrt{4-x^2}\sqrt{1/4}=\frac{1}{2}\sqrt{4-x^2}\]
\parbox{.8\textwidth}{The restriction of the domain for $\theta$ here means that other trigonometric functions appearing in the expression may always be evaluated using an acute triangle.  Here, for example, since $\sin\theta=x/2$, we can draw a right triangle with angle $\theta$ and length $x$ opposite and hypotenuse of 2 to work out $\cos\theta=\frac{\sqrt{4-x^2}}{2}$.}\hfill\raisebox{-3em}{\includegraphics[width=.15\textwidth]{graphics/triangle0}}

This method is called \textbf{Trigonometric Substitution}.  More generally if an integrand contains one of $\sqrt{a^2-x^2}$, $\sqrt{a^2+x^2}$, or $\sqrt{x^2-a^2}$ (where $a>0$ is constant) then the radical sign can be removed via the appropriate substitution:
\index{trigonometric substitution! table of}
\[\begin{array}{c|l|c}
\mbox{Expression} & \hfill\mbox{Substitution}\hfill & \mbox{Identity} \\\hline
& & \\[-1em]
\sqrt{a^2-x^2} & x=a\sin\theta \ \ \left(-\frac{\pi}{2}\le\theta\le\frac{\pi}{2}\right) & 1-\sin^2\theta=\cos^2\theta \\[.25em]
\sqrt{a^2+x^2} & x=a\tan\theta \ \ \left(-\frac{\pi}{2}<\theta<\frac{\pi}{2}\right) & 1+\tan^2\theta=\sec^2\theta \\[.25em]
\sqrt{x^2-a^2} & x=a\sec\theta \ \ \left(0\le\theta<\frac{\pi}{2}\ \mbox{or}\ \pi\le\theta<\frac{3\pi}{2}\right) & \sec^2\theta-1=\tan^2\theta \\
\end{array}
\]

Note that all the ranges of $\theta$ have been chosen so that $\theta$ will equal the relevant inverse trigonometric function with argument $x/a$.

\begin{example}
Prove the Archimedian result that the area of a circle of radius $R$ is $A=\pi R^2$.
  
The area of a semi-circle of radius $R$ is the area under the curve $y=\sqrt{R^2-x^2}$ between $x=-R$ and $x=R$ and so the area of a circle is
\[A = 2\int_{-R}^R\sqrt{R^2-x^2}\,dx\]
Using substitution $x=R\sin\theta$,  with $-\frac{\pi}{2}\le\theta\le\frac{\pi}{2}$ gives $dx=R\cos\theta\,d\theta$.  So $\theta=\sin^{-1}(x/R)$ and the limits become, for $x=R$, $\theta=\sin^{-1}(R/R)=\sin^{-1}(1)=\pi/2$ and for $x=-R$, $\theta=\sin^{-1}(-R/R)=\sin^{-1}(-1)=-\pi/2$.  The solution of the integral follows, similar to the last example,
\begin{eqnarray*}
A=2\int_{-R}^R\sqrt{R^2-x^2}\,dx & = & \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \sqrt{R^2-R^2\sin^2\theta}\cdot R\cos\theta\,d\theta \\
& = &  2\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \sqrt{R^2}\sqrt{1-\sin^2\theta}\cdot R\cos\theta\,d\theta \\
& = &  2R^2\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\cos\theta\cos\theta\,d\theta = 2R^2\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\cos^2\theta\,d\theta \\
& = &  2R^2\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\frac{1}{2}\left(1+\cos2\theta\right)d\theta
= R^2\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\left(1+\cos2\theta\right)d\theta \\
& = & R^2\left[\theta+\frac{1}{2}\sin2\theta\right|_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \\
& = & R^2\left\{\left[\frac{\pi}{2}+\frac{1}{2}\sin\pi\right]-\left[-\frac{\pi}{2}+\frac{1}{2}\sin(-\pi)\right]\right\} \\
& = & \pi R^2
\end{eqnarray*}
\end{example}

\begin{example}
  Evaluate the following integrals:
  \begin{multicols}{3}
    \begin{enumerate}
    \item $\displaystyle \int \frac{1}{(9-x^{2})^\frac{3}{2}}\,dx $ 
    \item $\displaystyle \int \frac{x^{3}}{\sqrt{4+x^{2}}}\,dx$
    \item $\displaystyle \int \frac{1}{\sqrt{x^{2}-4x-1}}\,dx$
    \end{enumerate}
  \end{multicols}
\begin{solution*}
\begin{enumerate}
\item Recognizing the form $\sqrt{a^2-x^2}$, let $x=3\sin \theta$ so $dx=3\cos\theta\,d\theta$. 
\begin{align*}
\int \frac{1}{(9-x^{2})^\frac{3}{2}}\,dx 
&= \int \frac{1}{(9-9\sin^{2}\!\theta)^\frac{3}{2}} 3\cos \theta\,d\theta 
=\int \frac{3\cos\theta}{\left[9(1-\sin^{2}\!\theta)\right]^\frac{3}{2}}\,d\theta \\
&=\int \frac{3\cos\theta}{\left[9\cos^{2}\!\theta\right]^\frac{3}{2}}\,d\theta 
=\int \frac{3\cos\theta}{27\cos^{3}\!\theta}\,d\theta 
=\frac{1}{9}\int \frac{1}{\cos^{2}\!\theta}\,d\theta \\
&=\frac{1}{9}\int \sec^{2}\!\theta\,d\theta 
= \frac{1}{9}\tan\theta + C 
=\frac{1}{9}\frac{x}{\sqrt{9-x^{2}}}+ C
\end{align*}
\parbox{.7\textwidth}{In the final step $\tan\theta$ is returned to $x$ by noting that, by the substitution $\sin\theta=\frac{x}{3}$, so a triangle can be drawn with opposite side length of $x$ and hypotenuse length of $3$.  The remaining side is solved for using the Pythagorean Theorem and then $\tan\theta$ evaluated as the opposite side length over the adjacent.  Any other trigonometric function of $\theta$ may be evaluated in this manner.  If $\theta$ is required note that $\theta=\sin^{-1}\left(\frac{x}{3}\right)$.}\hfill\raisebox{-3em}{\includegraphics[width=.2\textwidth]{graphics/triangle1}}
\item Recognizing the form $\sqrt{a^2+x^2}$, let $x=2\tan\theta$ so $dx=2\sec^{2}\theta\,d\theta$.
\begin{align*}
\int \frac{x^{3}}{\sqrt{4+x^{2}}}\,dx  & = \frac{8\tan^{3}\!\theta}{\sqrt{4+4\tan^{2}\!\theta}}2\sec^{2}\!\theta\,d\theta 
=\int\frac{16\tan^{3}\!\theta\sec^{2}\theta}{\sqrt{4(1+\tan^{2}\!\theta)}}\,d\theta \\
& =\int \frac{16\tan^{3}\!\theta\sec^{2}\!\theta}{\sqrt{4\sec^{2}\!\theta}}\,d\theta 
= \int \frac{16\tan^{3}\!\theta\sec^{2}\!\theta}{\sqrt{4\sec^{2}\!\theta}}\,d\theta 
=\int \frac{16\tan^{3}\!\theta\sec^{2}\!\theta}{2\sec\theta}\,d\theta  \\
&=8\int\tan^{3}\!\theta\sec\theta\,d\theta 
=8\int \tan^{2}\!\theta\sec\theta\tan\theta\,d\theta 
=8\int (\sec^{2}\!\theta-1)\sec\theta\tan\theta\,d\theta
\end{align*}
In the last step we recognized a trigonometric integral and reorganized it anticipating the substitution $u=\sec\theta$ so $du=\sec\theta\tan\theta\,d\theta$. The integral becomes: 
\begin{align*}
&=8\int (u^{2}-1)\,du=8\left[\frac{1}{3}u^{3}-u\right]+ C 
 =\frac{8}{3}\sec^{3}\theta-8\sec\theta + C \\
&=\frac{8}{3}\left(\frac{\sqrt{4+x^{2}}}{2}\right)^{3}-8\frac{\sqrt{4+x^{2}}}{2}+ C
=\frac{1}{3}(4+x^{2})^{\frac{3}{2}}-4\sqrt{4+x^{2}}+ C
\end{align*}
\parbox{.7\textwidth}{Here $\sec\theta$ is returned to $x$ by noting that, by the substitution $\tan\theta=\frac{x}{2}$, so a triangle can be drawn with opposite side of length $x$ and adjacent side of length $2$.  The remaining side is solved for using the Pythagorean Theorem and then $\sec\theta=1/\cos\theta$ is evaluated as the hypotenuse side length over that of the adjacent.}\hfill\raisebox{-3em}{\includegraphics[width=.2\textwidth]{graphics/triangle2}}
\item For this integral we must first remove the linear ($x$) term by \emph{completing the square}. The polynomial $x^2-4x-1$ has $b=-4$ so dividing that by $2$, adding it to $x$, and squaring gives:
  \[\left(x+\left(-4/2\right)\right)^2=(x-2)^2=x^2-4x+4\implies x^2-4x=(x-2)^2-4\implies x^2-4x-1=(x-2)^2-5\,.\]
The integral becomes
\begin{align*}
\int \frac{1}{\sqrt{x^{2}-4x-1}}\,dx 
&=\int \frac{1}{\sqrt{(x-2)^{2}-5}}\,dx
=\int \frac{1}{\sqrt{u^{2}-5}}\,du 
\end{align*}
where here we did the substitution $u=x-2$, so $du=dx$, to get the integral into a form ready for a trigonometric substitution.  Recognizing the form $\sqrt{u^2-a^2}$. Let $u=\sqrt{5}\sec\theta$ so $du=\sqrt{5}\sec\theta\tan\theta\,d\theta$. The integral becomes:
\begin{align*}
&=\int \frac{1}{\sqrt{5\sec^{2}\theta-5}}\sqrt{5}\sec\theta\tan\theta\,d\theta 
=\int \frac{1}{\sqrt{5(\sec^{2}\theta-1)}}\sqrt{5}\sec\theta\tan\theta\,d\theta \\
&=\int \frac{\sqrt{5}\sec\theta\tan\theta}{\sqrt{5\tan^{2}\theta}}\,d\theta 
=\int \frac{\sqrt{5}\sec\theta\tan\theta}{\sqrt{5}\tan\theta}\,d\theta
=\int\sec\theta\,d\theta \ \ \ (\leftarrow\ \text{Use the known result.})\\
&=\ln\left|\sec\theta+\tan\theta\right| + C 
=\ln\left|\frac{u}{\sqrt{5}}+ \frac{\sqrt{u^{2}-5}}{\sqrt{5}}\right| + C 
=\ln \left|\frac{x-2}{\sqrt{5}}+ \frac{\sqrt{x^{2}-4x-1}}{\sqrt{5}}\right| + C
\end{align*}
\parbox{.7\textwidth}{To return to $u$ note that the substitution implies $\sec\theta=\frac{u}{\sqrt{5}}$.  To find $\tan\theta$ a triangle can be drawn, since secant is the reciprocal of cosine, with adjacent side of length $\sqrt{5}$ and hypotenuse of length $u$.  The remaining side is solved for using the Pythagorean Theorem and then the result follows by evaluating the opposite side length over the adjacent side length.  Finally we return to $x$ using $u=x-2$\,.}\hfill\raisebox{-3em}{\includegraphics[width=.2\textwidth]{graphics/triangle3}}
\end{enumerate}
\end{solution*}

\textbook{\clearpage}
\begin{furtherquestions}
Evaluate the following integrals:
\begin{multicols}{2}
  \begin{enumerate}
  \item $\displaystyle\int_1^2\frac{1}{x^2\sqrt{16-x^2}}\,dx$
  \item $\displaystyle\int\frac{\sqrt{x^2-9}}{x^4}\,dx$
  \item $\displaystyle\int\frac{1}{\left(x^2+2x+2\right)^2}\,dx$
  \item $\displaystyle\int\frac{2x-3}{x^2-4x+8}\,dx$
  \item $\displaystyle\int\frac{1}{x^3\sqrt{x^2-25}}\,dx$
% Another example which does not need trig substitution:
%\item $\displaystyle\int\frac{3x-5}{\sqrt{1-x^2}}\,dx$
  \item $\displaystyle\int\frac{x^2}{\left(2-9x^2\right)^{\frac{3}{2}}}\,dx$
  \item $\displaystyle\int\frac{1}{\left(5-4x-x^2\right)^{\frac{5}{2}}}\,dx$
  \item $\displaystyle\int\frac{\sqrt{x-4}}{x}\,dx$
  \end{enumerate}
  \end{multicols}
\end{furtherquestions}
\end{example}

\begin{exercise}
\input{INTEGRATION_METHODS/trigonometric-substitution.tex}
\end{exercise}

\section{Partial Fraction Decomposition} \index{partial fraction decomposition} \index{integration! by  partial fraction decomposition}

The rational function $\displaystyle\frac{x+2}{x^3-x^2}$ can be shown to be equal to $\displaystyle-\frac{3}{x}-\frac{2}{x^2}+\frac{3}{x-1}$.  Therefore the integral of the former rational function is:
\[\int\frac{x+2}{x^3-x^2}\,dx=\int\left(-\frac{3}{x}-\frac{2}{x^2}+\frac{3}{x-1}\right)dx=-3\ln|x|+\frac{2}{x}+3\ln|x-1|+C\]
This example suggests that determining a technique to decompose a rational function in this way would provide a method for its integration.

A polynomial $P(x)=a_0+a_1x+a_2x^2+\ldots+a_nx^n$, $a_n\neq0$ is said to have degree $n$.  A function $f(x)=\frac{P(x)}{Q(x)}$ where $P(x)$ and $Q(x)$ are polynomials is a rational function.

The rational number $\frac{7}{4}$ is called improper because the numerator is larger than the denominator.  Through division of 4 into 7 one can write $\frac{7}{4}$ as $1\frac{3}{4}$ where the fractional part, $\frac{3}{4}$ is a proper fraction.  Analagous definitions are made for rational functions.

\definition{A rational function $f(x)=\frac{P(x)}{Q(x)}$ is called \textbf{proper} if the degree of $P$ is less than the degree of $Q$.  Otherwise $f(x)$ is called \textbf{improper} if $\deg(P)\ge\deg(Q)$.}

Note:
\begin{enumerate}
\item If $f(x)=P(x)/Q(x)$ is proper then it is possible to express it as a sum of simpler fractional functions called \textbf{partial fractions}\index{partial fractions} which are integrable.
\item If $f(x)$ is improper, then use long division to divide $P$ by $Q$ until a remainder $R(x)$ is obtained such that $\deg R<\deg Q$.  Then
\[f(x)=\frac{P(x)}{Q(x)}=S(x)+\frac{R(x)}{Q(x)}\]
where $S(x)$ and $R(x)$ are polynomials.  $S(x)$ is then integrable as it is a polynomial while the proper rational function $R(x)/Q(x)$ can in turn be integrated by the method of partial fractions thereby making $f(x)$ integrable.
\end{enumerate}

\begin{example}
For the following rational functions determine if they are proper or improper. For those that are improper write them as a polynomial plus a proper rational function.
\begin{multicols}{2}
  \begin{enumerate}
  \item $\displaystyle\frac{x^3+2}{(x^2+4)^2}$
  \item $\displaystyle\frac{3x^4+2x^2+x+7}{x^2+2}$
  \end{enumerate}
\end{multicols}
\begin{solution*}
  \begin{enumerate}
  \item The numerator $P(x)=x^3+2$ so $\deg P=3$. Expanding the denominator gives
    \[Q(x)=(x^2+4)^2=x^4+8x^2+16\]
    showing that $\deg Q=4$ so $\deg P < \deg Q$ and the rational function is proper.
  \item Since $P(x)=3x^4+2x^2+x+7$ and $Q(x)=x^2+2$ we have $4=\deg P\ge\deg Q=2$ so the rational function $P(x)/Q(x)$ is improper.  Polynomial long division of $P(x)$ by $Q(x)$ gives
    \[\polylongdiv{3x^4+2x^2+x+7}{x^2+2}\]
    and it follows that
    \[\frac{3x^4+2x^2+x+7}{x^2+2}=\underbrace{3x^2-4}_{S(x)}+\underbrace{\frac{x+15}{x^2+2}}_{R(x)/Q(x)}\,.\]
  \end{enumerate}
\end{solution*}

\begin{furtherquestions}
  For the following rational functions determine if they are proper or improper.  For those that are improper write them as a polynomial plus a proper rational function.
  \begin{multicols}{3}
    \begin{enumerate}
    \item $\displaystyle f(x)=\frac{x+1}{x^3-3x^2+2}$
    \item $\displaystyle f(x)=\frac{x^2+1}{x^2+3x}$
    \item $\displaystyle f(x)=\frac{x^4+5x^2+1}{x^2+2}$
    \end{enumerate}
  \end{multicols}
\end{furtherquestions}
\end{example}

\definition{Let $g(x)=ax^2+bx+c$ be a quadratic function with real coefficients.  If $b^2-4ac\ge0$ then $g(x)$ is called \textbf{reducible} \index{reducible} because it can be written as a product of linear factors with real coefficients.   If $b^2-4ac<0$ then $g(x)$ is called \textbf{irreducible} \index{irreducible} because it cannot be written as a product of linear factors with real coefficients.}

\begin{example}
\begin{enumerate}
\item The function $g(x)=x^2+5x+6$ has $b^2-4ac=25-24=1>0$ and so is reducible.  It clearly factors as $g(x)=(x+2)(x+3)$.
\item The function $g(x)=2x^2+4x+5$ has $b^2-4ac=16-40=-24<0$ and is irreducible.
\end{enumerate}
\end{example}

Note: It can be shown, as a consequence of the \emph{Fundamental Theorem of Algebra}, that any polynomial $Q(x)$ with real coefficients can be factored as a product of linear factors of the form $(ax+b)$ and/or quadratic irreducible factors of the form $ax^2+bx+c$, where $a$, $b$, and $c$ are real numbers.

\theorem{If $P(x)$ and $Q(x)$ are polynomials and $\deg P<\deg Q$ the it follows that
\[\frac{P(x)}{Q(x)}=F_1+F_2+\ldots+F_n\]
where each $F_i$ has one of the forms
\[\frac{A}{(ax+b)^i}\ \ \mbox{or}\ \ \frac{Ax+B}{(ax^2+bx+c)^j}\]
for some nonnegative integers $i$ and $j$.  The sum $F_1+F_2+\ldots+F_n$ is called the \textbf{partial fraction decomposition} of $\frac{P(x)}{Q(x)}$ and each $F_i$ is called a \textbf{partial fraction}. The denominator polynomials are real linear functions and irreducible quadratics respectively.}

\subsection*{Steps for finding Partial Fraction Decomposition} \index{partial fraction decomposition! steps of}
To decompose $f(x)=\frac{P(x)}{Q(x)}$ into partial fractions do the following:
\begin{enumerate}
\item If $\deg P\ge\deg Q$ then use long division to get
\[\frac{P(x)}{Q(x)}=S(x)+\frac{R(x)}{Q(x)}\]
\item Express $Q(x)$ as a product of linear and/or quadratic irreducible factors.
\item Express the proper rational function ( $P(x)/Q(x)$ or $R(x)/Q(x)$ ) as a sum of partial fractions of the form
\[\frac{A}{(ax+b)^i}\ \ \mbox{and/or}\ \ \frac{Ax+B}{(ax^2+bx+c)^j}\]
\item Evaluate the constants.
\end{enumerate}
Once the partial fraction decomposition has been accomplished the
necessary integration may be completed.


Upon factoring $Q(x)$ there are four cases that are logically possible.

\subsection*{Case I: $Q(x)$ contains a nonrepeated linear factor.}
If $Q(x)$ has a nonrepeated linear factor $ax+b$ then the partial fraction decomposition will have the following term due to that factor:
\[\frac{A}{ax+b}\]
where $A$ is constant.

For example, suppose that
\[Q(x)=(a_1x+b_1)(a_2x+b_2)\ldots(a_kx+b_k)\]
where no linear factor is repeated.  Then there exist constants $A_1$, $A_2$, \ldots $A_k$ such that
\[\frac{P(x)}{Q(x)} \left(\mbox{or}\ \frac{R(x)}{Q(x)}\ \right)=\frac{A_1}{a_1x+b_1}+\frac{A_2}{a_2x+b_2}+\ldots+\frac{A_k}{a_kx+b_k}\]

\begin{example}
  Evaluate the following integrals:
  \begin{multicols}{2}
    \begin{enumerate}
    \item $\displaystyle \int \frac{x+9}{x^{2}-3x-10}\,dx $
    \item $\displaystyle \int \frac{x^{2}+3x+4}{x(x+1)(x-2)}\,dx $
    \end{enumerate}
  \end{multicols}
\begin{solution*}
\begin{enumerate}
\item The denominator of the rational function factors as $x^2-3x-10=(x-5)(x+2)$, two linear distinct factors, so the partial fraction decomposition will have the form: 
\begin{align*}
  \frac{x+9}{(x-5)(x+2)}=\frac{A}{x-5}+ \frac{B}{x+2}& \implies \frac{x+9}{(x-5)(x+2)}=\frac{A}{x-5}\cdot\frac{x+2}{x+2}+\frac{B}{x+2}\cdot\frac{x-5}{x-5} \\
   &\implies \frac{x+9}{(x-5)(x+2)}=\frac{A(x+2)+B(x-5)}{(x-5)(x+2)}
\end{align*}
Here we combined the two fractions on the right by getting a common denominator. Equating the numerators we have:
\[x+9=A(x+2)+ B(x-5)\]
which must be true for all $x$. (Given the rational function is not defined at $x=5$ or $x=-2$ one might argue these values should be excluded, but in this case the limits as $x\to-2$ and $x\to5$ on both sides of the equation would need to be equal, and, as these are polynomials, this amounts to the functions themselves being equal at these two values.)  Two methods can be used to find $A$ and $B$.
\begin{itemize}
\item Method 1: Choose $x$ values and solve for constants.\\
  Since the numerator equation is true for all $x$ we can choose any $x$ and solve for the constants.  The form of the equation suggests using $x=-2$ and $x=5$ since then only one constant remains:
\begin{align*}
x=-2 &\implies  -2+9 =A(-2+2)+B(-2-5) \\
&\implies 7 =-7B \implies B=-1 \\
x=5 &\implies 5+9 =A(5+2)+B(5-5) \\
&\implies 14 = 7A \implies A=2 
\end{align*}
\item Method 2: Equate polynomial coefficients.\\
  Since $x+9=A(x+2)+B(x-5)$ is true for all $x$ the polynomials on both sides must be  equal.  Expanding the right-hand side and collecting like powers of $x$ gives:
  \[1x+9=(A+B)x+(2A-5B)\]
  Equating coefficients of like powers of $x$ implies:
  \begin{align*}
    x^0: 9& =2A-5B\\
    x^1: 1& = A+B
  \end{align*}
  This is a linear system of two equations in two unknowns for which many strategies can be used for solution.  Multiplying the second equation by $2$ gives $2=2A+2B$.  Subtracting that on both sides from the first equation gives
  \[9-2=2A-5B-(2A+2B)\implies 7=-7B\implies B=-1\]
  Inserting $B=-1$ in the first equation gives for $A$:
  \[9=2A-5(-1)\implies 4=2A\implies A=2\]
\end{itemize}
Having $A=2$ and $B=-1$ our decomposition is then $\displaystyle\frac{x+9}{x^{2}-3x-10}=\frac{2}{x-5}+\frac{-1}{x+2}$ and the integral is easily solved:
\begin{align*}
\int \frac{x+9}{x^{2}-3x-10}\,dx&= \int \left(\frac{2}{x-5}-\frac{1}{x+2}\right)\,dx
                                =2\ln|x-5|-\ln|x+2|+ C\,,
\end{align*}
where here we integrated term by term with substitution $u=x-5$ and $u=x+2$ respectively.
\textbook{\clearpage}
\item Here we have three linear factors and the  partial fraction decomposition will have the form:
\begin{align*}
  \frac{x^{2}+3x+4}{x(x+1)(x-2)}= \frac{A}{x}+\frac{B}{x+1}+\frac{C}{x-2}
\end{align*}
Get a common denominator on the right-hand side and equate numerators:
\begin{align*}
\implies \frac{x^{2}+3x+4}{x(x+1)(x-2)}&=\frac{A(x+1)(x-2)+Bx(x-2)+Cx(x+1)}{x(x+1)(x-2)} \\
  \implies x^{2}+3x+4 &= A(x+1)(x-2)+ Bx(x-2)+ Cx(x+1)
\end{align*}
Evaluate the constants $A$, $B$, and $C$ by evaluating the numerator equation at different values of $x$:
\begin{align*}
x&=0 \implies 4=-2A \implies A=-2 \\
x&=-1 \implies 1-3+4= B(-1)(-3)\implies 2=3 B\implies B=\frac{2}{3} \\
x&=2 \implies 4+6+4= C(2)(3) \implies 14=16C \implies C=\frac{14}{6} 
   \implies C=\frac{7}{3}
\end{align*}
Therefore:
\begin{align*}
\int \frac{x^{2}+3x+4}{x(x+1)(x-2)}\,dx &= \int \left[\frac{-2}{x}+\frac{2}{3}\cdot\frac{1}{x+1}+\frac{7}{3}\cdot\frac{1}{x-2}\right]\,dx \\
&=-2\ln|x|+\frac{2}{3}\ln|x+1|+\frac{7}{3}\ln|x-2|+ C
\end{align*}
\end{enumerate}
\end{solution*}

\begin{furtherquestions}
  Evaluate the following integrals:
  \begin{multicols}{3}
    \begin{enumerate}
    \item $\displaystyle\int\frac{1}{x^2+2x-3}\,dx$
    \item $\displaystyle\int\frac{4x^2+13x-9}{x^3+2x^2-3x}\,dx$
    \item $\displaystyle\int\frac{4x^2+3x+1}{x^2-1}\,dx$
    \end{enumerate}
  \end{multicols}
\end{furtherquestions}
\end{example}

\subsection*{Case II: $Q(x)$ contains a repeated linear factor.}
If $Q(x)$ has a factor $(ax+b)^r$ then the partial fraction decomposition will have the following terms due to that factor:
\[\frac{A_1}{ax+b}+\frac{A_2}{(ax+b)^2}+\ldots+\frac{A_r}{(ax+b)^r}\]
where $A_1$, $A_2$, \ldots $A_r$ are constants.  Use distinct constants (i.e. $A$, $B$, $C$, etc.) for each such factor.

\begin{example}
The (proper) rational function $\displaystyle\frac{x^4+1}{x(3x+2)^3(2x-1)^2}$ decomposes into
\[\frac{x^4+1}{x(3x+2)^3(2x-1)^2}=\frac{A}{x}+\frac{B_1}{3x+2}+\frac{B_2}{(3x+2)^2}+\frac{B_3}{(3x+2)^3}+\frac{C_1}{2x-1}+\frac{C_2}{(2x-1)^2}\]
where the constants $A$, $B_1$, $B_2$, $B_3$, $C_1$,  and $C_2$ would then have to be determined.
\end{example}

\begin{example}
Evaluate the integral:
\[\int \frac{x^{2}+4}{x^{2}(2x+1)}\,dx\]
\begin{solution*}

Since the denominator has linear, repeated factors, the partial fraction decomposition will have the following form:
\begin{align*}
\frac{x^{2}+4}{x^{2}(2x+1)}&=\frac{A_1}{x}+ \frac{A_2}{x^{2}}+ \frac{B}{2x+1} \\
\implies \frac{x^{2}+4}{x^{2}(2x+1)}&=\frac{A_1x(2x+1)+A_2(2x+1)+ Bx^{2}}{x^{2}(2x+1)}\\
\implies  x^{2}+4 & =A_{1}x(2x+1)+A_{2}(2x+1)+Bx^{2}
\end{align*}
Evaluating at $x=0$ and $2x+1=0\implies x=-1/2$ are obvious choices for finding two of our constants.  Due to the repeated $x$ factor we need to choose another arbitrary value to find the remaining constant. We can use the previous results as shown below to find the last constant.
\begin{align*}
x=0 & \implies 0+4=A_{1}(0) + A_{2}(0+1) + B(0) \\
& \implies 4= A_{2} \implies A_{2}=4 \\
x=-\frac{1}{2} & \implies \frac{1}{4}+4= A_1(0)+A_2(0)+B\frac{1}{4} \\
& \implies \frac{17}{4}=\frac{1}{4}B \implies B=17 \\
x=1 & \implies 1+4=A_{1}(1)(3)+A_{2}(3)+B \\
& \implies 5=3A_{1}+3(4) + 17 \\
    & \implies 5=3A_{1} + 29 \implies 3A_{1}=-24 \implies A_{1}=-8
\end{align*}
Note here we could have also used our second method of expanding the right-hand side of our numerator equation and equating polynomial coefficients to get a linear system of equations:
\begin{align*}
  x^{2}+4 =(2A_{1}+B)x^2+(A_1+2A_2)x+A_2\implies\left\{\begin{array}{rr}A_2&=4\\
                                                         A_1+2A_2&=0 \\
                                                         2A_1+B&=1
                                                       \end{array}\right.
\end{align*}
and solved to get $A_1=-8, A_2=4, B=17$ as before.
Therefore
\begin{align*}
\int \frac{x^{2}+4}{x^{2}(2x+1)}\,dx&=\int \left[\frac{-8}{x}+\frac{4}{x^{2}}+\frac{17}{2x+1}\right]\,dx \\
&=-8\ln|x|-\frac{4}{x}+\frac{17}{2}\ln|2x+1| + C\,
\end{align*}
where we integrated term by term and used the substitution $u=2x+1$, so $du=2\,dx$, in the last integral.
\end{solution*}

\begin{furtherquestions}
  Evaluate the following integrals:
  \begin{multicols}{2}
    \begin{enumerate}
    \item $\displaystyle\int\frac{x^3-4x-1}{x(x-1)^3}\,dx$
    \item $\displaystyle\int\frac{3x^2+5x-10}{x^2(3x-5)}\,dx$
    \end{enumerate}
  \end{multicols}
\end{furtherquestions}
\end{example}

\subsection*{Case III: $Q(x)$ contains a nonrepeated irreducible quadratic factor.}
If $Q(x)$ has a nonrepeated irreducible factor $ax^2+bx+c$ (so $b^2-4ac<0$), then the partial fraction decomposition will have the following term due to that factor:
\[\frac{Ax+B}{ax^2+bx+c}\]
where $A$ and $B$ are constants.

\begin{example}
  Evaluate the integral:
\[\int \frac{2x^{4}+7x^2+6}{x^{3}+3x}\,dx\]
\begin{solution}
  Since the degree of the numerator~(4) is greater than or equal to the degree of the denominator~(3), this is an improper rational function. Performing polynomial long division one has
  \[\polylongdiv{2x^4+7x^2+6}{x^3+3x}\]
and the integral can be written as:
\begin{align*}
 \int \frac{2x^{4}+7x^2+6}{x^{3}+3x}\,dx=\int \left(2x+ \frac{x^2+6}{x^3+3x}\right)\, dx
\end{align*}
The denominator can be factorized as $x(x^2+3)$. Here $x^2+3=1x^2+0x+3$ is an irreducible quadratic since $b^2-4ac=-12<0$. Therefore, the partial fraction decomposition takes the form: 
\begin{align*}
  \frac{x^2+6}{x(x^2+3)}=\frac{A}{x}+\frac{Bx+ C}{x^2+3} &\implies x^2+6= A(x^2+3)+Bx^2 + Cx
\end{align*}
Because the factor of $x$ is repeated and the irreducible quadratic vanishes for no real value of $x$ the second method of finding constants is preferred. Expanding the polynomial gives:
\begin{align*}
\implies x^2+6&=(A+B)x^2 + Cx + 3A \implies\left\{\begin{array}{rr}A+B&=1\\
                                                         C&=0 \\
                                                         3A&=6
                                                  \end{array}\right.
\end{align*}
The solution is straightforward:
\begin{align*}
  3A&=6 \implies A=2 \\
  C &=0 \\
  A+B&=1 \implies B=1-A \implies B=1-2 \implies B =-1
\end{align*}
Therefore
\begin{align*}
\int \frac{2x^{4}+7x^{2}+6}{x^{3}+3x}\,dx 
=\int \left(2x+\frac{2}{x}-\frac{x}{x^2+3}\right)\, dx
=x^2 +2\ln|x|-\frac{1}{2}\ln|x^2+3| + C,
\end{align*}
where substitution $u=x^2+3$, so $du=2x\,dx$, was used on the final term of the integral.
\end{solution}

\begin{furtherquestion}
  Evaluate the following integral:
  \[\int\frac{x^3-4x^2+2}{\left(x^2+1\right)\left(x^2+2\right)}\,dx\]
\end{furtherquestion}
\end{example}

\subsection*{Case IV: $Q(x)$ contains a repeated irreducible quadratic factor.}
If $Q(x)$ has an irreducible factor $\left(ax^2+bx+c\right)^r$ then the partial fraction decomposition will have the following terms due to that factor:
\[\frac{A_1x+B_1}{ax^2+bx+c}+\frac{A_2x+B_2}{\left(ax^2+bx+c\right)^2}+\ldots+\frac{A_rx+B_r}{\left(ax^2+bx+c\right)^r}\]
where $A_1$, $A_2$, \ldots, $A_r$, and $B_1$, $B_2$, \ldots, $B_r$ are constants.

\begin{example}
  Evaluate the integral:
  \[\int \frac{2x+8}{x(x^2+4)^2}\, dx\]
  \begin{solution}
    The repeated quadratic $x^2+4$ is irreducible since $0^2-4(1)(4)=-16<0$. The partial fraction decomposition will therefore have the following form:
\begin{align*}
\frac{2x+8}{x(x^{2}+4)^{2}}&=\frac{A}{x}+ \frac{B_{1}x+C_{1}}{x^{2}+4}+\frac{B_{2}x+C_{2}}{(x^{2}+4)^{2}} \\
\implies 2x+8&=A(x^{2}+4)^{2}+ (B_{1}x+ C_{1})x(x^{2}+4)+B_{2}x^{2}+C_{2}x \\
  \implies 2x+8&=A(x^{4}+8x^{2}+16)+ B_{1}x^{4}+4B_{1}x^{2}+ C_{1}x^{3}+4C_{1}x+ B_{2}x^{2}+ C_{2}x\\
  \implies 2x+8&=(A+B_1)x^4+C_1x^3+(8A+4B_1+B_2)x^2+(4C_1+C_2)x+16A
\end{align*}
Solving the system of equations generated by equating coefficients of $x^n$ gives:
\begin{align*}
  16A&=8 \implies A=\frac{1}{2} \\
  A+B_{1}&=0 \implies B_{1}=-A \implies B_{1}=-\frac{1}{2} \\
  8A+ 4B_{1} + B_{2}&=0 \implies 4-2+B_{2}=0 \implies B_{2}=-2 \\
  C_{1}&=0 \\
  4C_{1}+C_{2}&=2 \implies 4(0)+C_2=0 \implies C_{2}=2
  \end{align*}
  Therefore
  \begin{align*}
    \int\frac{2x+8}{x(x^{2}+4)^{2}}\,dx&=\int \left[\frac{1}{2}\cdot\frac{1}{x}-\frac{1}{2}\cdot\frac{x}{x^{2}+4}-\frac{2x}{(x^{2}+4)^{2}}+\frac{2}{(x^{2}+4)^{2}}\right]\,dx \\
                                       &=\frac{1}{2}\ln|x|-\frac{1}{2}\int\frac{x}{x^2+4}-\int \frac{2x}{(x^{2}+4)^{2}}\,dx + \int \frac{2}{(x^{2}+4)^{2}}\,dx
  \end{align*}
  Note that the last partial fraction has been broken into two pieces anticipating the two different integration techniques required. To evaluate the second and third integrals use the substitution $u=x^{2}+4$ so $du=2x\,dx$\,:
\begin{align*}
-\frac{1}{2}\int\frac{x}{x^{2}+4}\,dx&=-\frac{1}{4}\int \frac{1}{u}\,du=-\frac{1}{4}\ln|u|+ C=-\frac{1}{4}\ln|x^{2}+4|+ C\\
-\int \frac{2x}{(x^{2}+4)^{2}}\,dx&=-\int \frac{1}{u^{2}}\,du=\frac{1}{u}+ C=\frac{1}{x^{2}+4}+ C
\end{align*}
To evaluate $\displaystyle \int \frac{2}{(x^{2}+4)^{2}}\,dx$ use the trigonometric substitution $x=2\tan\theta$ so $dx=2\sec^{2}\!\theta\,d\theta$\,:
\begin{align*}
\int \frac{2}{(x^{2}+4)^{2}}\,dx &=2\int \frac{1}{(4\tan^{2}\!\theta+4)^{2}}\cdot 2\sec^{2}\!\theta\,d\theta =4\int \frac{\sec^{2}\!\theta}{16\sec^{4}\!\theta}\,d\theta =\frac{1}{4}\int \frac{1}{\sec^{2}\!\theta}\,d\theta \\
&=\frac{1}{4}\int \cos^{2}\!\theta \,d\theta=\frac{1}{8}\int \left(1+\cos 2\theta\right)\,d\theta \\ 
                                 &=\frac{1}{8}\theta +\frac{1}{16}\sin 2\theta + C= \frac{1}{8}\theta + \frac{1}{8}\sin \theta \cos \theta + C
\end{align*}
  \parbox{.7\textwidth}{Note the identity for $\sin2\theta$ is used to get functions of only the angle~$\theta$.  Return to $x$ by noting that, by the substitution $\tan\theta=\frac{x}{2}$, a triangle can be drawn with opposite side length of $x$ and adjacent length of~$2$.  The remaining side is solved for using the Pythagorean Theorem and then $\sin\theta$ and $\cos\theta$ are evaluated using their definitions and the triangle. In this integral $\theta$ itself is required and we note that $\theta=\tan^{-1}\left(\frac{x}{2}\right)$ by the original substitution. The integral becomes:}\hfill\raisebox{-3em}{\includegraphics[width=.2\textwidth]{graphics/triangle4}}
\begin{align*}
&=\frac{1}{8}\tan^{-1}\left(\frac{x}{2}\right)+\frac{1}{8}\cdot \frac{x}{\sqrt{x^{2}+4}}\cdot \frac{2}{\sqrt{x^{2}+4}}+C \\
&=\frac{1}{8}\tan^{-1}\left(\frac{x}{2}\right)+\frac{1}{4}\cdot \frac{x}{x^{2}+4}+ C
\end{align*}
Putting all the components together gives for the original integral:
\begin{align*}
\int \frac {2x+8}{x(x^{2}+4)^{2}}\,dx &=\frac{1}{2}\ln|x|-\frac{1}{4}\ln|x^{2}+4| + \frac{1}{x^{2}+4}+\frac{1}{8}\tan^{-1}\left(\frac{x}{2}\right) + \frac{1}{4}\cdot\frac{x}{x^{2}+4} + C  \\
&=\frac{1}{2}\ln|x|-\frac{1}{4}\ln|x^{2}+4| +\frac{1}{4}\cdot \frac{x+4}{x^{2}+4}+ \frac{1}{8}\tan^{-1}\left(\frac{x}{2}\right) + C
\end{align*}
\end{solution}

\begin{furtherquestion}
  Evaluate the following integral:
  \[\int\frac{2x^6+5x^4+2x^2+1}{x\left(x^2+1\right)^2}\,dx\]
\end{furtherquestion}
\end{example}

Note the following:
\begin{itemize}
\item Use distinct constants (i.e. $A$, $B$, $C$, etc.) in each partial fraction.

\item Factors in $Q(x)$ are considered the same if they differ only by a multiplicative constant.  For example $(3x-1)$ and $(x-1/3)$ are repeated linear factors.
\end{itemize}


\textbook{\clearpage}
Having looked at all the cases we can write down the partial fraction decomposition of arbitrary rational functions.

\begin{example}
After factoring the denominator $Q(x)$ suppose a (proper) rational function equals
\[\frac{x^2+5x+1}{x\left( x-1\right)\left(3x+2\right)^3\left(x^2+2x+4\right)\left(x^2+9\right)^2}\ .\]
Then it will have the following partial fraction decomposition

\[=\frac{A}{x}+\frac{B}{x-1}+\frac{C_1}{3x+2}+\frac{C_2}{(3x+2)^2}+\frac{C_3}{(3x+2)^3}+\frac{Dx+E}{x^2+2x+4}+\frac{F_1x+G_1}{x^2+9}+\frac{F_2x+G_2}{(x^2+9)^2}\ .\]

Here we had two unrepeated linear factors, $x$ and $(x-1)$, a repeated linear factor $(3x+2)^3$, an unrepeated irreducible quadratic factor ($x^2+2x+4$), and a repeated irreducible quadratic factor $(x^2+9)^2$.

We would now proceed to solve for the constants ($A$, $B$, $C_1$, $C_2$, $C_3$, $D$, $E$, $F_1$, $G_1$, $F_2$, and $G_2$) by combining the partial fractions and equating numerators as discussed above.  Once this was done the original rational function could be integrated by integrating the partial fraction decomposition term by term.

\begin{furtherquestions}
Write down the form of the partial fraction decomposition of the following rational functions.  Do not evaluate the constants.
  \begin{multicols}{2}
    \begin{enumerate}
    \item $\displaystyle\frac{x^2-x-21}{2x^3-x^2+8x-4}$
    \item $\displaystyle\frac{x^3+2}{\left(x^2+4\right)^2}$
    \item $\displaystyle\frac{x^6+5x^3+x-1}{x^4+5x^2+4}$
    \item $\displaystyle\frac{x+1}{\left(x^2-4\right)^2\left(x^2+3\right)}$
    \end{enumerate}
  \end{multicols}
\end{furtherquestions}

\end{example}

\subsection*{Rationalizing Substitutions}\index{integration! by a rationalizing substitution}
Some nonrational functions can be changed into rational functions by means of a substitution.
\begin{example}
Evaluate the integral:
\[\int \frac{1}{e^{2x}-1}\,dx\]
\begin{solution}
Noting $e^{2x}=\left(e^x\right)^2$ we try the rationalizing substitution $u=e^x$ so $du=e^{x}dx \implies \displaystyle \frac{1}{u}du=dx$\,:
\begin{align*}
\int \frac{1}{e^{2x}-1}\,dx = \int \frac{1}{u}\cdot \frac{1}{u^{2}-1}\,du =\int \frac{1}{u(u+1)(u-1)}\,du
\end{align*}
The partial fraction decomposition takes the form:
\begin{align*}
\frac{1}{u(u+1)(u-1)}&=\frac{A}{u}+\frac{B}{u+1}+ \frac{C}{u-1} \\
  \implies 1 &=A(u+1)(u-1)+Bu(u-1)+ Cu(u+1)
\end{align*}
Evaluate coefficients by choosing $u$ as follows:
\begin{align*} 
u&=0 \implies 1=-A \implies A=-1 \\
u&=1 \implies 1=C(1)(1+1) \implies C= \frac{1}{2} \\
u&= -1 \implies 1=B(-1)(-1-1) \implies B=\frac{1}{2}
\end{align*}
Therefore:
\begin{align*}
\int \frac{1}{e^{2x}-1}\,dx &=\int \frac{1}{u(u+1)(u-1)}\,du 
=\int \left(-\frac{1}{u}+\frac{1}{2}\cdot \frac{1}{u+1}+\frac{1}{2}\cdot\frac{1}{u-1}\right)\,du \\
&=-\ln|u|+\frac{1}{2}\ln|u+1|+\frac{1}{2}\ln|u-1|+ C \\
&=-\ln|e^x|+\frac{1}{2}\ln|e^{x}+1|+\frac{1}{2}\ln|e^{x}-1|+ C \\
&=-x+ \frac{1}{2}\ln|e^{x}+1| +\frac{1}{2}\ln|e^{x}-1|+ C
\end{align*}
\end{solution}

\begin{furtherquestion}
  Evaluate the following integral:
  \[\int\frac{4\sqrt{x}}{x-2}\,dx\]
\end{furtherquestion}
\end{example}

\begin{exercise}
\input{INTEGRATION_METHODS/partial-fraction-decomposition.tex}
\end{exercise}

\section{General Strategies for Integration}\index{integration! general strategies}
Unlike differentiation which is largely a deterministic application of rules, integration is an art, with many indefinite integrals not even having an antiderivative that may be written in terms of known functions.

The following basic strategies have been seen
\begin{enumerate}
\item Basic Formulas of Integration
\item Substitution
\item Integration by Parts
\item Trigonometric Integrals
\item Trigonometric Substitution
\item Partial Fraction Decomposition
\item Rationalizing Substitution
\end{enumerate}
One or more of these strategies along with using functional identities to rewrite the integrand may need to be applied to evaluate an integral.

\begin{example}
Evaluate the following integrals:
\begin{multicols}{3}
\begin{enumerate}
\item $\displaystyle \int \frac{1}{x^{2}+6x+16}\,dx $
\item $\displaystyle \int \frac{1}{x^{\frac{3}{2}}-4x^{\frac{1}{2}}}\,dx$
\item $\displaystyle \int \frac{e^{x}}{\sqrt{e^{2x}+2e^{x}-5}}\,dx$
\end{enumerate}
\end{multicols}
\begin{solution*}
\begin{enumerate}
\item We observe that $6^2-4(1)(16)=-28<0$ indicates that $x^2+6x+16$ is an irreducible quadratic so this rational function cannot be decomposed further.  To integrate it, first complete the square to remove the $x$ term.
\begin{align*}
  \int \frac{1}{x^{2}+6x+16}\,dx &=\int \frac{1}{(x+3)^{2}-9+16}\,dx=\int \frac{1}{(x+3)^{2}+7}\,dx
\end{align*}
Next substitute $u=x+3$ so $du=dx$ and the integral becomes:
\begin{align*}
  &=\int \frac{1}{u^{2}+7}\,du =\frac{1}{7}\int \frac{1}{\frac{u^{2}}{7}+1}\,du =\frac{1}{7}\int \frac{1}{(\frac{u}{\sqrt{7}})^{2}+1}\,du
\end{align*}
Let $\displaystyle w=\frac{u}{\sqrt{7}}$ so $\displaystyle dw=\frac{du}{\sqrt{7}}\implies du=\sqrt{7}dw$ to get our integrable form:
\begin{align*}
=\frac{\sqrt{7}}{7}\int\frac{1}{w^2+1}dw=\frac{1}{\sqrt{7}}\tan^{-1}(w)+C=\frac{1}{\sqrt{7}}\tan^{-1}\!\left(\frac{u}{\sqrt{7}}\right)+ C=\frac{1}{\sqrt{7}}\tan^{-1}\!\left(\frac{x+3}{\sqrt{7}}\right) + C \\
\end{align*}
Alternatively we could have used the general integral $\int \frac{1}{u^2+a^2}=\frac{1}{a}\tan^{-1}(\frac{x}{a})$ with $a=\sqrt{7}$ to avoid the $w$ substitution.
\item Perform the rationalizing substitution $\displaystyle u=x^{\frac{1}{2}}$ so $du= \frac{1}{2}x^{-\frac{1}{2}}\,dx\implies 2u\,du=dx$:
\begin{align*}
\int \frac{1}{x^{\frac{3}{2}}-4x^{\frac{1}{2}}}\,dx=\int \frac{1}{u^{3}-4u}\cdot 2u\,du =\int \frac{2}{u^{2}-4}\,du =\int \frac{2}{(u+2)(u-2)}\,du 
\end{align*}
The partial fraction decomposition is
\begin{align*}
\frac{2}{(u+2)(u-2)}=\frac{A}{u+2}+ \frac{B}{u-2}&\implies \frac{2}{(u+2)(u-2)}= \frac{A(u-2)+B(u+2)}{(u+2)(u-2)} \\
  &\implies 2= A(u-2)+ B(u+2)
\end{align*}
Evaluate the constants:
\begin{align*}
u=2 & \implies 2=4B \implies B = \frac{1}{2} \\
  u=-2 &\implies 2=-4A \implies A = -\frac{1}{2}
\end{align*}
Therefore
\begin{align*}
\int \frac{1}{x^{\frac{3}{2}}-4x^{\frac{1}{2}}}\,dx&= \int \frac{2}{(u+2)(u-2)}\,du = \int \left(-\frac{1}{2}\cdot\frac{1}{u+2}+\frac{1}{2}\cdot\frac{1}{u-2}\right)du \\
&= -\frac{1}{2}\ln|u+2|+\frac{1}{2}\ln|u-2| + C
= -\frac{1}{2}\ln|\sqrt{x}+2| +\frac{1}{2}\ln|\sqrt{x}-2|+ C 
\end{align*}
\item Let $u=e^{x}$ so $du=e^{x}\,dx$ and then complete the square:
\begin{align*}
  \int \frac{e^{x}}{\sqrt{e^{2x}+2e^{x}-5}}\,dx=\int \frac{1}{\sqrt{u^{2}+2u-5}}\,du =\int \frac{1} {\sqrt{(u+1)^{2}-1-5}}\, dx =\int \frac{1} {\sqrt{(u+1)^{2}-6}}\, dx
  \end{align*}
  Let $w=u+1$ so $dw=du$\,:
  \begin{align*}
    &=\int \frac{1}{\sqrt{w^{2}-6}}\,dw
  \end{align*}
  For $\sqrt{w^2-a^2}$ do the trigonometric substitution $w=\sqrt{6}\sec\theta$ so $dw=\sqrt{6}\sec\theta\tan\theta\,d\theta$\,:
\begin{align*}
&=\int \frac{1}{\sqrt{6\sec^{2}\theta-6}}\cdot\sqrt{6}\sec\theta\tan\theta\,d\theta 
                 =\int \frac{\sqrt{6}\tan\theta\sec\theta}{\sqrt{6}\tan\theta}\,d\theta= \int \sec\theta\,d\theta
                 =\ln|\sec\theta+ \tan\theta| + C
\end{align*}
\parbox{.7\textwidth}{To return to $w$ note that the substitution implies $\sec\theta=\frac{w}{\sqrt{6}}$.  To find $\tan\theta$ a triangle can be drawn, since secant is the reciprocal of cosine, with adjacent side of length $\sqrt{6}$ and hypotenuse of length $w$.  The remaining side is solved for using the Pythagorean Theorem and then the result follows by evaluating the opposite side length over the adjacent side length.  Finally we return to $u$ using $w=u+1$ and to $x$ using $u=e^x$\,:}\hfill\raisebox{-3em}{\includegraphics[width=.2\textwidth]{graphics/triangle5}}
\begin{align*}
\int \frac{e^{x}}{\sqrt{e^{2x}+2e^{x}-5}}\,dx &=\ln\left|\frac{w}{\sqrt{6}}+\frac{\sqrt{w^{2}-6}}{\sqrt{6}}\right| + C
=\ln\left|\frac{u+1}{\sqrt{6}}+\frac{\sqrt{(u+1)^{2}-6}}{\sqrt{6}}\right| + C\\
&=\ln\left|\frac{e^{x}+1}{\sqrt{6}}+\frac{\sqrt{e^{2x}+2e^{x}-5}}{\sqrt{6}}\right| + C=\ln\left|e^{x}+1+\sqrt{e^{2x}+2e^{x}-5}\right| + D
\end{align*}
In the final simplification we used that $\ln|a/\sqrt{6}|=\ln|a|-\ln(\sqrt{6})$ and then combined the latter constant with $C$ to get a new arbitrary constant $D$.
\end{enumerate}
\end{solution*}

\begin{furtherquestions}
  Evaluate the following integrals:
  \begin{multicols}{2}
    \begin{enumerate}
    \item $\displaystyle\int\frac{e^{3t}}{1+e^{6t}}\,dt$
    \item $\displaystyle\int e^{x+e^x}\,dx$
    \item $\displaystyle\int\frac{1+e^x}{1-e^x}\,dx$
    \item $\displaystyle\int x^2\ln(1+x)\,dx$
    \item $\displaystyle\int\tan x\sec^6x\,dx$
    \item $\displaystyle\int\frac{e^{3x}}{1+e^x}\,dx$
    \item $\displaystyle\int\frac{\cos^3 x}{\sqrt{1+\sin x}}\,dx$
    \item $\displaystyle\int\frac{x}{\csc\left(5x^2\right)}\,dx$
    \item $\displaystyle\int\left(2x+2^x+2^{\pi}\right)\,dx$
    \item $\displaystyle\int\frac{7x^2+20x+65}{x^4+4x^3+13x^2}\,dx$
    \end{enumerate}
  \end{multicols}
\end{furtherquestions}
\end{example}

\begin{exercise}
\input{INTEGRATION_METHODS/general-strategies-for-integration.tex}
\end{exercise}

\section{Improper Integrals} \index{integral(s)!improper}
The definite integral due to Riemann which we use involves functions integrated over a closed interval $[a,b]$.  Functions which are piecewise continuous where there are only a finite number of jump discontinuities are integrable.  We now consider \emph{improper integrals} where these restrictions do not hold.  We consider two cases:
\begin{description}
\item[Improper Integrals of the First Kind]: The interval of integration is infinite.
\item[Improper Integrals of the Second Kind]: The interval of integration contains an infinite discontinuity.
\end{description}
We can define definite integrals under these circumstances by considering suitable limits of integrals over closed intervals.

\subsection{Improper Integrals of the First Kind} \index{improper integrals of the first kind}
Suppose we wish to find the area under the curve $y=\frac{1}{x^3}$ over the interval $[1,\infty)$ shaded in the following diagram.
\begin{center}
\includegraphics{graphics/integration_methods1}%
\end{center}

Intuitively one would find the area by evaluating the area under the curve (the definite integral) over the closed interval $[1,t]$, and then consider the limit of that as $t\rightarrow\infty$~:
\begin{center}
\includegraphics{graphics/integration_methods2}%
\end{center}
Should such a (finite) limit exist we would define that to be the area under the curve over the open interval $[1,\infty)$.

The previous discussion prompts the following definition for the improper integral over an infinite interval $[a,\infty)$ and, similarly, over intervals $(-\infty,b]$, and $(-\infty,\infty)$.
\definition{Define the following improper integrals of the first kind \index{improper integrals of the first kind! definition of}:
\begin{enumerate}[label=\alph*)]
\item$\displaystyle\int_a^\infty f(x)\,dx=\lim_{t\rightarrow\infty}\int_a^tf(x)\,dx$ ~~~~(Where the latter integrals must exist for every $t\ge a$.)
\item$\displaystyle\int_{-\infty}^b f(x)\,dx=\lim_{t\rightarrow-\infty}\int_t^bf(x)\,dx$ ~~~~(Where the latter integrals must exist for every $t\le b$.)
\item$\displaystyle\int_{-\infty}^\infty f(x)\,dx=\int_{-\infty}^a f(x)\,dx+\int_a^\infty f(x)\,dx$~~~~(Where $a$ is any real number.)
\end{enumerate}
The improper integrals in a) and b) are \textbf{convergent}\index{convergent} if the limit exists (i.e. is finite) and \textbf{divergent} \index{divergent} otherwise.  For c) the integral is convergent if and only if both integrals on the right side are convergent.}

Note that $\displaystyle\int_{-\infty}^\infty f(x)\,dx$ is \textbf{not} defined to be $\displaystyle\lim_{t\rightarrow\infty}\int_{-t}^tf(x)\,dx$.  The integral over $(-\infty,\infty)$ by definition must be broken into two pieces for which independent limits must be taken.

\begin{example}
  Determine whether the following integrals are convergent or divergent and evaluate those that are convergent.
  \begin{multicols}{3}
    \begin{enumerate}
    \item $\displaystyle \int_{0}^{\infty} e^{-4x}\,dx $
    \item $\displaystyle \int_{-\infty}^{0}\frac{1}{3-2x}\,dx$
    \item $\displaystyle \int_{-\infty}^{\infty} \frac{e^{x}}{e^{2x}+1}\,dx$
    \end{enumerate}
    \end{multicols}
    \begin{solution*}
      
      These are all improper integrals of the first kind since the $x$ values are approaching $\infty$, $-\infty$, or both.
\begin{enumerate}
\item $\displaystyle \int_{0}^{\infty}e^{-4x}\,dx =\lim_{t \to \infty}\int_{0}^{t}e^{-4x}\,dx$ 
\begin{align*}
&\text{Substitute}\, u=-4x\ \text{so}\  du=-4dx \implies -\frac{1}{4}du =dx \\
&\text{Limits:\ } x=0 \implies u=-4(0)=0,\  x=t \implies u=-4t   
\end{align*}
The integral becomes:
\begin{align*}
=\lim_{t \to \infty} \int_{0}^{-4t}e^{u}\left(-\frac{1}{4}\right)\,du 
=-\frac{1}{4}\lim_{t \to \infty}\left[\rule{0em}{.9em}e^{u}\right|^{-4t}_{0}
&= -\frac{1}{4}\lim_{t \to \infty}\left[e^{-4t}-e^0\right]\\
&= -\frac{1}{4}\lim_{t \to \infty}\left[\frac{1}{e^{4t}}-1\right]
=-\frac{1}{4}\left[0-1\right] = \frac{1}{4} 
\end{align*}
Here we used the known properties of the exponential function, that $\displaystyle\lim_{x\to\infty}e^x=\infty$,  to evaluate the limit.  Therefore the improper integral is convergent with value $\frac{1}{4}$.
\item $\displaystyle \int_{-\infty}^{0}\frac{1}{3-2x}\,dx = \lim_{t \to -\infty} \int_{t}^{0} \frac{1}{3-2x}\,dx$ \\
\begin{align*}
&\text{Substitute}\  u=3-2x\ \text{so}\ du=-2dx \implies -\frac{1}{2}du=dx \\
  &\text{Limits:\ }x=t \implies u=3-2t,\ x=0 \implies u=3-2(0)=3
\end{align*}
The integral becomes:
\begin{align*}
=\lim_{t \to -\infty}\int^{3}_{3-2t} \frac{1}{u}\cdot \left(-\frac{1}{2}\right)\,du &=\left.-\frac{1}{2}\lim_{t \to -\infty} \ln|u|\right|^{3}_{3-2t} \\
&=-\frac{1}{2}\lim_{t \to -\infty}\left[\ln|3|-\ln|3-2t|\right] \\
&=-\frac{1}{2}\left[\ln 3-\infty\right]= \infty
\end{align*}
Here we used the property of the logarithm, that  $\displaystyle\lim_{x\to\infty}\ln x=+\infty$, to evaluate the limit. Therefore the integral is divergent.
\item For this integral we must first break the infinite domain into two separate integrals:
\[\int^{\infty}_{-\infty} \frac{e^{x}}{e^{2x}+1}\,dx =\int_{-\infty}^{0} \frac{e^{x}}{e^{2x}+1}\,dx + \int_{0}^{\infty} \frac{e^{x}}{e^{2x}+1}\,dx\]
Since the integrand is the same for both integrals, let us first evaluate the following indefinite integral with the substitution $u=e^{x}$ so $du=e^{x}dx$\,:
\begin{align*}
  \int \frac{e^{x}}{e^{2x}+1}\,dx =\int \frac{1}{u^{2}+1}\,du= \tan^{-1}\!u + C= \tan^{-1}(e^{x})+ C
\end{align*}
The integrals become:
\begin{align*}
\int_{-\infty}^{0}\frac{e^{x}}{e^{2x}+1}\,dx &= \lim_{t \to -\infty}\int^{0}_{t} \frac{e^{x}}{e^{2x}+1}\,dx
=\lim_{t \to -\infty}\left[\rule{0em}{1em}\tan^{-1}(e^{x})\right|^{0}_{t}\\
&= \lim_{t \to -\infty}\left[\tan^{-1}(e^{0})-\tan^{-1}(e^{t})\right] 
= \lim_{t \to -\infty}\left[\tan^{-1}(1)-\tan^{-1}(e^{t})\right] \\
&=\frac{\pi}{4}-\tan^{-1}(0)= \frac{\pi}{4} \\
\int^{\infty}_{0}\frac{e^{x}}{e^{2x}+1}\,dx&=\lim_{t \to \infty}\int^{t}_{0}\frac{e^{x}}{e^{2x}+1}\,dx
=\lim_{t \to \infty}\left[\rule{0em}{1em}\tan^{-1}(e^{x})\right|^t_0 \\
&=\lim_{t \to \infty}\left[\tan^{-1}(e^{t})-\tan^{-1}(e^{0})\right]
=\lim_{t \to \infty}\tan^{-1}(e^{t})-\tan^{-1}(1) \\
                                             &= \frac{\pi}{2}-\frac{\pi}{4}=\frac{\pi}{4}\,,
\end{align*}
where we used that $\displaystyle\lim_{x\to\infty}\tan^{-1}\!x=\frac{\pi}{2}$. The original integral therefore is
\begin{align*}
  \int^{\infty}_{-\infty} \frac{e^{x}}{e^{2x}+1}\,dx = \frac{\pi}{4}+\frac{\pi}{4}=\frac{\pi}{2}
\end{align*}
and hence convergent.
\end{enumerate}
\end{solution*}

\begin{furtherquestions}
  Determine whether the following integrals converge or diverge.  Find the value of any convergent integral.
  \begin{multicols}{2}
    \begin{enumerate}
    \item $\displaystyle \int_1^\infty\frac{1}{x^3}\,dx$
    \item $\displaystyle \int_2^\infty\frac{1}{x-1}\,dx$
    \item $\displaystyle \int_{-\infty}^0xe^x\,dx$
    \item $\displaystyle \int_{-\infty}^{\infty}\frac{1}{1+x^2}\,dx$
    \item $\displaystyle \int_{-\infty}^0xe^{-x^2}\,dx$
    \item $\displaystyle \int_1^\infty\frac{\ln x}{x}\,dx$
    \end{enumerate}
  \end{multicols}
\end{furtherquestions}
\end{example}
\subsection{Improper Integrals of the Second Kind} \index{improper integrals of the second kind}
In the second case we consider those situations where the function being integrated has an infinite discontinuity at some point over which we want to integrate.  Consider the area under the curve $\displaystyle y=\frac{1}{\sqrt{5-x}}$ between $x=1$ and $x=5$.  The situation is shown in the following diagram.

\begin{center}
\includegraphics{graphics/integration_methods3}%
\end{center}
The function has an infinite discontinuity at the right endpoint ($b=5$). Intuitively we can imagine finding the area under the curve over the closed interval $[1,t]$ with $t<b$ and then consider the limit as $t\rightarrow b$~:
\begin{center}
\includegraphics{graphics/integration_methods4}%
\end{center}
This discussion suggests the following definition for improper integrals involving infinite integrands.  Our example illustrated an integral where the right endpoint had the discontinuity.  Similarly integrals with a discontinuity at the left endpoint or within the interval are defined.
\definition{Define the following improper integrals of the second kind \index{improper integrals of the second kind! definition of}:
\begin{enumerate}[label=\alph*)]
\item Suppose $f(x)$ is continuous on $[a,b)$ but discontinuous at $x=b$ then:\newline
$\displaystyle\int_a^b f(x)\,dx=\lim_{t\rightarrow b^-}\int_a^tf(x)\,dx$
\item Suppose $f(x)$ is continuous on $(a,b]$ but discontinuous at $x=a$ then:\newline
$\displaystyle\int_a^b f(x)\,dx=\lim_{t\rightarrow a^+}\int_t^bf(x)\,dx$
\item Suppose $f(x)$ is continuous on $[a,b]$ except at a value $c$ in $(a,b)$ then:\newline
$\displaystyle\int_a^b f(x)\,dx=\int_a^c f(x)\,dx+\int_c^b f(x)\,dx$
\end{enumerate}
The improper integrals in a) and b) are \textbf{convergent} if the limit exists (i.e. is finite) and \textbf{divergent} otherwise.  For c) the integral is convergent if and only if both integrals on the right side are convergent.}


\begin{example}
  Determine whether the following integrals are convergent or divergent. Find the value of any convergent integral.
  \begin{multicols}{3}
    \begin{enumerate}
    \item $\displaystyle \int_{0}^{1} \frac{\ln x}{x^{2}}\,dx $
    \item $\displaystyle \int_{-4}^{0}\frac{x}{\sqrt{x+4}}\,dx$
    \item $\displaystyle \int_{0}^{2} \frac{x}{x-1}\,dx$
    \end{enumerate}
  \end{multicols}
  \begin{solution*}
    These are improper integrals of the second kind and we need first to identify where the integrand is discontinuous.
\begin{enumerate}
\item  Here the integrand is undefined at $0$ both because $\ln x$ is undefined there and also because we cannot divide by zero.  The improper integral is therefore defined by
\[\int_{0}^{1} \frac{\ln x}{x^{2}}\,dx = \lim_{t \to 0^{+}}\int_{t}^{1}\frac{\ln x}{x^{2}}\,dx \]
Use Integration by Parts to evaluate the integral:
\begin{align*}
u&=\ln x\ \ \ dv=x^{-2}\,dx \\
\implies du&=\frac{1}{x}\,dx\ \ \ v=-\frac{1}{x}
\end{align*}
The integral then equals
\begin{align*}
  \int_{0}^{1}\frac{\ln x}{x^{2}}\,dx &=\lim_{t \to 0^{+}}\int_{t}^{1} \frac{\ln x}{x^{2}}\,dx
= \lim_{t \to 0^{+}}\left[\left.-\frac{\ln x}{x}\right|_t^1+\int_t^1\frac{1}{x^{2}}\,dx\right]\\
&=\lim_{t \to 0^{+}}\left[-\frac{\ln x}{x}-\frac{1}{x}\right|^{1}_{t}
= \lim_{t \to 0^{+}}\left[\frac{-\ln 1}{1}-\frac{1}{1}+\frac{\ln t}{t}+\frac{1}{t}\right] \\
&=-0-1+\lim_{t \to 0^{+}}\left(\frac{\ln t}{t}+\frac{1}{t}\right)\ \ \ (-\infty+\infty\ \text{form})\\
                                      &=-1+\lim_{t \to 0^{+}}\frac{\ln(t)+1}{t}\ \ \ \left(\frac{\infty}{\infty}\ \text{form}\right)\\
  & \underset{\lh}=-1+\lim_{t\to0^+}\frac{1/t}{1}= \infty
\end{align*}
Therefore the integral is divergent.
\item The integrand is discontinuous at $x=-4$ so the improper integral is defined by
  \[\int_{-4}^{0}\frac{x}{\sqrt{x+4}}\,dx=\lim_{t \to -4^{+}}\int^{0}_{t}\frac{x}{\sqrt{x+4}}\,dx\]
\begin{align*}
&\text{Substitute}\ u=x+4\ \text{so}\ du=dx,\ x=u-4 \\
&\text{Limits}:\ x=0 \implies u=0+4=4, \, x=t \implies u=t+4 
\end{align*}
The integral becomes:
\begin{align*}
\int^{0}_{-4}\frac{x}{\sqrt{x+4}}\,dx&= \lim_{t \to -4^{+}}\int^{0}_{t}\frac{x}{\sqrt{x+4}}\,dx
=\lim_{t \to -4^{+}}\int^{4}_{t+4}\frac{u-4}{\sqrt{u}}\,du
=\lim_{t \to -4^{+}}\int^{4}_{t+4}\left(\sqrt{u}-4u^{-\frac{1}{2}}\right)\,du \\
&=\lim_{t \to -4^{+}}\left[\frac{2}{3}u^{\frac{3}{2}}-8u^{\frac{1}{2}}\right|^{4}_{t+4}
=\lim_{t \to -4^{+}}\left[\frac{2}{3}(4)^{\frac{3}{2}}-8(4)^{\frac{1}{2}}-\frac{2}{3}(t+4)^{\frac{3}{2}}+8(t+4)^{\frac{1}{2}}\right] \\
&=\frac{2}{3}(8)-8(2)-\frac{2}{3}(-4+4)^{\frac{3}{2}}+8(-4+4)^{\frac{1}{2}}=\frac{16}{3}-16 -0+0=\frac{16-48}{3} \\
                                     &=-\frac{32}{3}
\end{align*}
Therefore it is convergent.
\item The integrand is undefined at $x=1$ so we must break the improper integral into two integrals:
\[\int^{2}_{0}\frac{x}{x-1}\,dx=\int^{1}_{0}\frac{x}{x-1}\,dx +\int_{1}^{2} \frac{x}{x-1}\,dx\]
Evaluate the first integral:
\begin{align*}
\int^{1}_{0}\frac{x}{x-1}\,dx&=\lim_{t \to 1^{-}}\int^{t}_{0}\frac{x}{x-1}\,dx\ \ \ (\leftarrow\ \text{an improper rational function}) \\
&=\lim_{t \to 1^{-}}\int^{t}_{0}\frac{x-1+1}{x-1}\,dx
=\lim_{t \to 1^{-}}\int^{t}_{0}\left(\frac{x-1}{x-1}+\frac{1}{x-1}\right)\,dx \\
&=\lim_{t \to 1^{-}}\int^{t}_{0}\left(1+\frac{1}{x-1}\right)\,dx 
=\lim_{t \to 1^{-}}\left[\rule{0em}{1em}x+ \ln|x-1|\right|^{t}_{0} \\
&=\lim_{t \to 1^{-}}\left[\rule{0em}{1em}t+\ln|t-1|-0-\ln|-1|\right] \\
                             &=1 -\infty-0-0=-\infty\,,
\end{align*}
where here we used that $\displaystyle \lim_{x\to0^+}\ln x=-\infty$. 
Since the fist integral is divergent the given integral $\displaystyle\int_{0}^{2}\frac{x}{x-1}\,dx$ is also divergent. (There is no need to evaluate the second composite integral.)
\end{enumerate}
\end{solution*}

\begin{furtherquestions}
  Determine whether the following integrals converge or diverge.  Find the value of any convergent integral.
  \begin{multicols}{2}
    \begin{enumerate}
    \item $\displaystyle \int_1^5\frac{1}{\sqrt{5-x}}\,dx$
    \item $\displaystyle \int_0^1x\ln x\,dx$
    \item $\displaystyle \int_{-2}^7\frac{1}{(x+1)^{\frac{2}{3}}}\,dx$
    \item $\displaystyle \int_0^2\frac{1}{x^2-4x+3}\,dx$
    \end{enumerate}
  \end{multicols}
\end{furtherquestions}
\end{example}

\textbook{\clearpage}
A consideration of the areas represented by improper integrals in the following diagram makes the following theorem plausible:
\begin{center}
\includegraphics{graphics/integration_methods5}%
\end{center}
\theorem{\label{thm:impropercomparison}Let $f$ and $g$ be continuous functions satisfying $f(x)\ge g(x)\ge 0$  for all $x\ge a$.  If $\int_a^\infty f(x)\,dx$ is convergent then $\int_a^\infty g(x)\,dx$ is convergent.  If $\int_a^\infty g(x)\,dx$ is divergent then $\int_a^\infty f(x)\,dx$ is divergent.}

Analagous theorems for the infinite intervals $(-\infty,b]$ and $(-\infty,\infty)$ as well as for improper integrals of the second kind may also be written.  The theorems are useful for determining convergence or divergence of functions that are difficult to integrate.

\begin{example}
Determine whether the following integrals are convergent or divergent.
\begin{multicols}{2}
\begin{enumerate}
\item $\displaystyle \int_{1}^{\infty} \frac{\,dx}{\sqrt{x^{4}+5}} $
\item $\displaystyle \int_{0}^{1}\frac{e^{x}}{x^{2}}\,dx$
\end{enumerate}
\end{multicols}
\begin{solution*}
\begin{enumerate}
\item  The integrand in the improper integral $\displaystyle \int_{1}^{\infty} \frac{\,dx}{\sqrt{x^{4}+5}}$ has no obvious antiderivative.  However, for $x\geq 1$ we have
\[\sqrt{x^{4}+5}\geq\sqrt{x^{4}}=x^{2}>0
\implies0<\frac{1}{\sqrt{x^{4}+5}}\leq \frac{1}{x^{2}}\,.\]
The following integral
\begin{align*}
\int_{1}^{\infty}\frac{1}{x^{2}}\,dx=\lim_{t \to \infty}\int^{t}_{1}\frac{1}{x^{2}}\,dx =\lim_{t \to \infty}\left[-\frac{1}{x}\right|^{t}_{1}
=\lim_{t \to \infty}\left[-\frac{1}{t}+\frac{1}{1}\right]=0+1=1 
\end{align*}
is convergent. Thus, since our desired positive integrand lies below a function whose integral converges we have, by the Comparison Test for Integrals, that the given integral is convergent. \\
\item  The integral $\displaystyle \int_{0}^{1}\frac{e^{x}}{x^{2}}\,dx$ is improper since the integrand is undefined at zero.  Since the integrand has no obvious antiderivative we try a comparison with an integrable function.  For $0\leq x\leq 1$ we have
\[e^{x} \geq 1 >0 \implies \frac{e^{x}}{x^{2}}\geq \frac{1}{x^{2}}>0\,.\]
The following integral
\begin{align*}
\int^{1}_{0}\frac{1}{x^{2}}\,dx&=\lim_{t \to 0^{+}}\int_{t}^{1}\frac{1}{x^{2}}\,dx
= \lim_{t \to 0^{+}}\left[-\frac{1}{x}\right|^{1}_{t}
=\lim_{t \to 0^{+}}\left[-1 +\frac{1}{t}\right]
= -1+ \infty= \infty
\end{align*}
is divergent.  Since our desired integrand lies above a positive function whose integral diverges, we have, by the Comparison Test for Integrals, that the given integral is also divergent.
\end{enumerate}
\end{solution*}

\begin{furtherquestions}
  Determine whether the following integrals are convergent or divergent.
  \begin{multicols}{2}
    \begin{enumerate}
    \item $\displaystyle\int_1^\infty\frac{1}{\sqrt{x^3+1}}\,dx$
    \item $\displaystyle\int_0^1\frac{e^{-x}}{x^{\frac{2}{3}}}\,dx$
    \end{enumerate}
  \end{multicols}
\end{furtherquestions}
\end{example}

\begin{exercise}
\input{INTEGRATION_METHODS/improper-integrals.tex}
\end{exercise}

\begin{reviewexercise}
\input{INTEGRATION_METHODS/integration-methods-review.tex}
\end{reviewexercise}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "master"
%%% End:
