\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}

## Integration by parts

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

Example:
    \[ \int x\cos(x) dx = \int \sin'(x)x dx = \sin(x)x - \int \sin(x) 1 dx =
    x\sin(x) + \cos(x) + C .\]

Remark:
  Setting $u=f(x)$ and $v=g(x)$ \(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 .\]

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

## Trigonometric integrals
    ***) $\int \sin^4(x) dx$
      \[\includegraphics[width=0.5\textwidth]{graphs/sin4.pdf}\]
    ** $\int \sin^2(x)\cos(x) dx$
    ** $\int \sin^3(x) dx$
    ** $\int \sin^4(x)\cos^3(x) dx$
    ** $\int \tan(x)\sec^2(x) dx$
    ** $\int \tan^3(x)\sec^3(x) dx$
    *e)*

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

## 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(\theta)$,
  \[ \int \sqrt{1-x^2} \dx = \int \cos(\theta) \dx .\]

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

So *\[a* \int \sqrt{1-x^2} \dx
    &= \int \cos(\theta)\cos(\theta) \dth \\
    &= \int \cos^2(\theta) \dth \\
    &= \rcp{2}\int (1+\cos(2\theta)) \dth
    &= \rcp{2}(\theta + \rcp{2}\sin(2\theta)) + C  \\
    &= \rcp{2}(\arcsin(x) + \sin(\theta)\cos(\theta)) + C  \\
    &= \rcp{2}(\arcsin(x) + x\sqrt{1-x^2}) + C  .*a\]*

So e.g. we recover
  \[\int_{-1}^1 \sqrt{1-x^2} \dx = \rcp{2}(\frac{\pi}{2} + 1\sqrt{1-1^2} -
  (-\frac{\pi}{2} + (-1)\sqrt{1-(-1)^2})) = \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(\theta)$:
    \[ \int a\cos(\theta) a\cos(\theta) \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 (a\sin(\theta))^3(a\cos(\theta))(a\cos(\theta)) \dth \]

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

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

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

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

  ** $\sqrt{-x^2-a^2}$:
      never defined!
  *e)*

Examples:
  ***) $\int_2^4 x^2\sqrt{x^2-4} \dx$
  ** $\int_2^4 x\sqrt{x^2-4} \dx$
  ** $\int x(x^2-2+\pi)^{\frac{3}{2}}\dx$
  *e)*
  

\end{document}
