\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*{Integration by parts}

\[ \ddx f\left(x\right)g\left(x\right) = f'\left(x\right)g\left(x\right) + f\left(x\right)g'\left(x\right) \]
so
\[ \int \left(f'\left(x\right)g\left(x\right) + f\left(x\right)g'\left(x\right)\right)dx = f\left(x\right)g\left(x\right) + C \]
so
\[ \int f'\left(x\right)g\left(x\right)dx = f\left(x\right)g\left(x\right) - \int f\left(x\right)g'\left(x\right)dx .\]

\paragraph{Example:}
    \[ \int x\cos\left(x\right) dx = \int \sin'\left(x\right)x dx = \sin\left(x\right)x - \int \sin\left(x\right) 1 dx =
    x\sin\left(x\right) + \cos\left(x\right) + C .\]

\paragraph{Remark:}
  Setting $u=f\left(x\right)$ and $v=g\left(x\right)$ (and assuming $u$ is a function of $v$ and
  $v$ is a function of $u$) we can use the Substitution rule to rewrite this
  as \[ \int v\du = uv - \int u\dv .\]

\paragraph{Examples:}
\begin{itemize}\item $\int xe^x dx$
    \[\includegraphics[width=0.5\textwidth]{graphs/xexp.pdf}\]
\item $\int_0^1 x^2e^x dx$
    \[\includegraphics[width=0.5\textwidth]{graphs/xxexp.pdf}\]
\item $\int \ln x dx$
    \[\includegraphics[width=0.5\textwidth]{graphs/lnx.pdf}\]
\item $\int \arctan x dx$
    \[\includegraphics[width=0.5\textwidth]{graphs/arctan.pdf}\]
\end{itemize}

\section*{Trigonometric integrals}
\begin{itemize}\item $\int \sin^4\left(x\right) dx$
      \[\includegraphics[width=0.5\textwidth]{graphs/sin4.pdf}\]
\item $\int \sin^2\left(x\right)\cos\left(x\right) dx$
\item $\int \sin^3\left(x\right) dx$
\item $\int \sin^4\left(x\right)\cos^3\left(x\right) dx$
\item $\int \tan\left(x\right)\sec^2\left(x\right) dx$
\item $\int \tan^3\left(x\right)\sec^3\left(x\right) dx$
\end{itemize}

    (Recall: $\sin^2\left(x\right) + \cos^2\left(x\right) = 1,
    \sin\left(2x\right) = 2\sin\left(x\right)\cos\left(x\right)$, $\cos\left(2x\right)=\cos^2\left(x\right)-\sin^2\left(x\right)$)

\section*{Trigonometric substitution}
Consider (again) $\int \sqrt{1-x^2} \dx$.
      \[ \includegraphics[width=0.6\textwidth]{graphs/sinsubs.pdf}\]

Note this only makes sense for $x$ in $[-1,1]$.

Recall Pythagoras.

So if $x=\sin\left(\theta\right)$,
  \[ \int \sqrt{1-x^2} \dx = \int \cos\left(\theta\right) \dx .\]

To get an integral involving only $\theta$, we can use the substitution rule
backwards. $\dxdth = \cos\left(\theta\right)$, so by the substitution rule
  \begin{align*} \int \cos\left(\theta\right)\cos\left(\theta\right) \dth
      &= \int \sqrt{1-x^2}\dxdth \dth \\
      &= \int \sqrt{1-x^2} \dx . \end{align*}

So \begin{align*} \int \sqrt{1-x^2} \dx
    &= \int \cos\left(\theta\right)\cos\left(\theta\right) \dth \\
    &= \int \cos^2\left(\theta\right) \dth \\
    &= \rcp{2}\int \left(1+\cos\left(2\theta\right)\right) \dth
    &= \rcp{2}\left(\theta + \rcp{2}\sin\left(2\theta\right)\right) + C  \\
    &= \rcp{2}\left(\arcsin\left(x\right) + \sin\left(\theta\right)\cos\left(\theta\right)\right) + C  \\
    &= \rcp{2}\left(\arcsin\left(x\right) + x\sqrt{1-x^2}\right) + C  .\end{align*}

So e.g. we recover
  \[\int_{-1}^1 \sqrt{1-x^2} \dx = \rcp{2}\left(\frac{\pi}{2} + 1\sqrt{1-1^2} -
  \left(-\frac{\pi}{2} + \left(-1\right)\sqrt{1-\left(-1\right)^2}\right)\right) = \frac{\pi}{2} .\]


\paragraph{$\int \sqrt{c-x^2} \dx$ with $c$ positive:}
  Let $a=\sqrt{c}$, so $\sqrt{c-x^2}=\sqrt{a^2-x^2}$, think about a circle
  of radius $a$, and do inverse substitution with $x=a\sin\left(\theta\right)$:
    \[ \int a\cos\left(\theta\right) a\cos\left(\theta\right) \dth = \int \sqrt{a^2-x^2} \dx \]

\paragraph{Functions involving $\sqrt{a^2-x^2}$:}
  e.g.
  \[ \int x^3\sqrt{a^2-x^2} \dx = \int \left(a\sin\left(\theta\right)\right)^3\left(a\cos\left(\theta\right)\right)\left(a\cos\left(\theta\right)\right) \dth \]

\paragraph{Definite integrals:}
  \[ \int_b^c x^3\sqrt{a^2-x^2} \dx = \int_{\arcsin\left(b/a\right)}^{\arcsin\left(c/a\right)} \left(a\sin\left(\theta\right)\right)^3\left(a\cos\left(\theta\right)\right)a\cos\left(\theta\right) \dth \]
  where recall we chose $\arcsin$ to have range $[-\frac{\pi}{2},\frac{\pi}{2}]$.

\paragraph{Handling other signs:}
\begin{itemize}\item $\sqrt{a^2+x^2}$:
      \[ \includegraphics[width=0.6\textwidth]{graphs/tansubs.pdf}\]
    try inverse substitution $x=a\tan\left(\theta\right)$; so $\sqrt{a^2+x^2} = a\sec\left(\theta\right)$.

    (Using $\tan^2+1=\sec^2$)

\item $\sqrt{x^2-a^2}$:
      \[ \includegraphics[width=0.6\textwidth]{graphs/secsubs.pdf}\]
    try inverse substitution $x=a\sec\left(\theta\right)$; so $\sqrt{x^2-a^2} =
      a\tan\left(\theta\right)$.

\item $\sqrt{-x^2-a^2}$:
      never defined!
\end{itemize}

\paragraph{Examples:}
\begin{itemize}\item $\int_2^4 x^2\sqrt{x^2-4} \dx$
\item $\int_2^4 x\sqrt{x^2-4} \dx$
\item $\int x\left(x^2-2+\pi\right)^{\frac{3}{2}}\dx$
\end{itemize}
  

\end{document}
