\documentclass[letter,12pt]{article}
\usepackage[margin=0.5in,hmargin=4cm]{geometry}
\pagestyle{headings}
\usepackage{amssymb,amsmath,hyperref,enumerate}
\usepackage{graphicx}
\begin{document}
\providecommand{\R}{\mathbb{R}}
\providecommand{\at}{\restriction}
\providecommand{\evalat}[3]{\left[ #1 \right]_{#2}^{#3}}
\providecommand{\dx}{\operatorname{dx}}
\providecommand{\dy}{\operatorname{dy}}
\providecommand{\dt}{\operatorname{dt}}
\providecommand{\dth}{\operatorname{d}\theta}
\providecommand{\du}{\operatorname{du}}
\providecommand{\dv}{\operatorname{dv}}
\providecommand{\ddx}{\frac{d}{\dx}}
\providecommand{\dydx}{\frac{\dy}{\dx}}
\providecommand{\dudx}{\frac{\du}{\dx}}
\providecommand{\dthdx}{\frac{\dth}{\dx}}
\providecommand{\dxdth}{\frac{\dx}{\dth}}
\renewcommand{\o}{\circ}
\providecommand{\rcp}[1]{\frac{1}{#1}}
\providecommand{\dom}{\operatorname{dom}}
\def\dividelen#1#2{\@tempdima=#1 \divide\@tempdima by #2 \@tempdima}

\section*{Partial fractions}

\paragraph{Definition:}
    A \underline{rational function} is one of the form $\frac{P\left(x\right)}{Q\left(x\right)}$ where P and Q
    are polynomials.

    e.g. $\frac{x^3-2x+1}{x^2-7}, x^2, \frac{1}{x^9+1}$

We already know how to integrate some of these.

\paragraph{Recall:}
\begin{itemize}\item $\int x^n \dx = \frac{x^{n+1}}{n+1} + C$ if $n \neq  -1$
\item $\int \rcp{x} \dx = \ln|x| + C$
\item $\int \rcp{x^2+1} \dx = \arctan x + C$
\item $\int \frac{2x}{x^2+1} \dx = \int \rcp{u} du = \ln|x^2+1| + C$
\end{itemize}

How about $\int \rcp{x^2-1} \dx$?

\begin{align*} \int \rcp{x^2-1} \dx &= \int \rcp{\left(x+1\right)\left(x-1\right)} \dx \\
&= \int \rcp{2} \left(\frac{1}{x-1} - \frac{1}{x+1}\right) \dx \\
&= \rcp{2} \left(\int\rcp{x-1}\dx - \int\rcp{x+1}\right)\dx \\
&= \rcp{2} \left(\ln|x-1| - \ln|x+1|\right) \\
&= \ln\sqrt{\frac{|x-1|}{|x+1|}} \end{align*}

The key trick here was to recognise the rational function $\rcp{\left(x+1\right)\left(x-1\right)}$ as being a
linear combination of simpler rational functions (``partial fractions''), namely
$\rcp{2}\left(\rcp{x-1}-\rcp{x+1}\right)$.

We will see that this technique, along with the integrals recalled above and
polynomial division, allows us to integrate {\bf any} rational function.

\paragraph{Example of using polynomial division:}
    \begin{align*} \int \frac{x^3+1}{x^2+1} \dx &= \int \frac{x\left(x^2+1\right) - x + 1}{x^2+1} \\
    &= \int \left(x + \frac{1-x}{x^2+1}\right) \dx \\
    &= \int \left(x + \rcp{x^2+1} - \frac{x}{x^2+1}\right) \dx\\
    &= \frac{x^2}{2} + \arctan\left(x\right) - \frac{\ln|x^2+1|}{2} + C
    \end{align*}

\paragraph{Fact I:}
    Any polynomial over the reals can be factored as a product of linear and
    quadratic factors.
\paragraph{Proof:}
    Consequence of the ``Fundamental Theorem of Algebra'' - ask your 1ZC3
    lecturer about it next semester.

\paragraph{Examples:}
\begin{itemize}\item $x^3+1 = \left(x+1\right)\left(x^2-x+1\right)$
\item $x^4-1 = \left(x^2+1\right)\left(x^2-1\right) = \left(x^2+1\right)\left(x+1\right)\left(x-1\right)$
\end{itemize}

\paragraph{Fact II:}
    Given $\frac{P\left(x\right)}{Q\left(x\right)}$ with $\deg\left(P\right) < \deg\left(Q\right)$, if $Q\left(x\right)$ factors into
    distinct irreducible factors
	\[ Q\left(x\right) = q_1\left(x\right)q_2\left(x\right)...q_n\left(x\right) \]
    (each $q_i$ linear or irreducible quadratic)
    then there exist $p_i\left(x\right)$ with $deg\left(p_i\right)<deg\left(q_i\right)$ such that
    \[ \frac{P\left(x\right)}{Q\left(x\right)} = \sum_i \frac{p_i\left(x\right)}{q_i\left(x\right)} .\]
\paragraph{Proof:}
    Can be proven quite easily with linear algebra. Ask your 1ZC3 lecturer
    about this too!

\paragraph{Examples:}
\begin{itemize}\item $\frac{1}{x^3-x}$
	\vspace{3cm}
\item $\frac{x^2-4}{x^4-1}$
	\vspace{3cm}
\end{itemize}

\paragraph{General technique for integrating rational functions:}
\begin{itemize}\item if the top has greater degree than the bottom, first use polynomial
	division to fix this;
\item factor the bottom;
\item split up in to partial fractions;
\item integrate each.
\end{itemize}

\paragraph{Examples:}
\begin{itemize}\item $\int\frac{x^2-4}{x^4+1} \dx$
\item $\int\frac{x^4-x^2+1}{x^3-x} \dx$
\end{itemize}

\paragraph{Repeated factors:}
    If $Q\left(x\right)$ has repeated factors, e.g. $Q\left(x\right)=x^3-2x^2+x=x\left(x-1\right)^2$, then we
    can still use partial fractions but we need a new trick:

    If $\left(x-a\right)^n$ is a factor of $Q\left(x\right)$, in the partial fractions expression we
    should use
	\[ \frac{A_1}{x-a} + \frac{A_2}{\left(x-a\right)^2} + ... + \frac{A_n}{\left(x-a\right)^n} \]

\paragraph{Example:}
    $\int \frac{x^2+1}{x^3-2x^2+x} dx$

\end{document}
