\section{Antiderivatives}
\label{sec:antiderivatives}

We know how to take a derivative of a function.  If we reverse the
procedure and ask which function when differentiated results in a
given function we are finding an \textbf{antiderivative}.

\definition{If $F'(x)=f(x)$ for all $x$ in an interval $I$ then the
  function $F$ is called an \textbf{antiderivative} of $f$ on $I$.}

\begin{example}
\begin{enumerate}
\item $\displaystyle F(x)=\frac{1}{3}x^3$ is an antiderivative of $f(x)=x^2$ because $\displaystyle F'(x)=\frac{d}{dx}\frac{1}{3}x^3=x^2=f(x)$~.
\item $\displaystyle F(x)=\frac{1}{3}x^3+10$ is also an antiderivative of $f(x)=x^2$ because $\displaystyle\frac{d}{dx}\left(\frac{1}{3}x^3+10\right)=x^2$~.
\item$\displaystyle F(x)=\frac{1}{4}x^4+2x$ is an antiderivative of $f(x)=x^3+2$ since $\displaystyle F'(x)=x^3+2$~.
\end{enumerate}
\end{example}

The first two questions of the last example illustrate the following theorem: 
\theorem{\label{thm:antiderivatives}Let $C$ be an arbitrary constant.  If $F$ is an antiderivative of $f$ on an interval $I$ then $F(x)+C$ is also an antiderivative of $f$ on $I$.  Moreover, all antiderivatives of $f$ on $I$ have this form.}

That $F(x)+C$ is also an antiderivative given $F(x)$ an antiderivative is due to  $\displaystyle \frac{d}{dx}C=0$\,.  Proof that all antiderivatives can be written $F(x)+C$ follows from Theorem~\ref{thm:mvtcorb}\,.  As such the general antiderivative of a function $f$ is a family of curves $F(x)+C$\,.

Consideration of our derivative formulae results in the following table of antiderivatives (up to the additive constant $C$).  Differentiate each answer on the right to confirm the result.

\hfil$\displaystyle\begin{array}{c|l}
\mbox{Function} & \mbox{Antiderivative} \\ \hline
x^n & \frac{1}{n+1}x^{n+1}\ \rule{0em}{1.2em}\mbox{where}\ n\neq -1\\
\cos x & \sin x \\
\sin x & -\cos x \\
\sec^2 x & \tan x \\
\sec x\tan x & \sec x \\
cf(x) & cF(x) \\
f(x)+g(x) & F(x)+G(x)
\end{array}$\hfil

For the last two general formulae we are assuming $F$ and $G$ are
antiderivatives of $f$ and $g$ respectively and that $c$ is an
arbitrary constant.  These last two general formulae show that finding
an antiderivative is a linear operation.  When finding antiderivatives
of a sum of terms we can focus on each term separately and pull any
constant multipliers out front.

\begin{example}
Find the antiderivatives of:
\begin{multicols}{2}
\begin{enumerate}
\item $\displaystyle f(x)=x^3+2\cos x$
\item $\displaystyle f(x)=\sin x+\tan x\sec x$
\item $\displaystyle f(x)=\left(\sqrt{x}+x\right)^2$
\item $\displaystyle f(x)=\frac{2-3\sin x}{\cos^2x}$
\item $\displaystyle f(x)=\frac{(x-1)^2}{x^4}$
\end{enumerate}
\end{multicols}
\end{example}

Note that a function $f$ is an antiderivative of its own derivative
$f'$.  Similarly, since $f''$ is the derivative of $f'$, $f'$ is an
antiderivative of $f''$.

\begin{example}
Find all functions $g$ such that $\displaystyle g'(x)=4\sin x-3x^5+6\sqrt[4]{x}$~.
\end{example}

\begin{example}
If $\displaystyle f''(x)=2+\frac{4}{x^3}$, $f(1)=0$, and $f(2)=3$, find $f(x)$\,.
\end{example}

\begin{example}
An object with mass $2$~kg moving in a straight line feels a force (in Newtons) given by \mbox{$F(t)=12t+16$~N\,.}  If its initial displacement is $s(0)=3$~m and its initial velocity is $v(0)=-2$~m/s, find its position function~$s(t)$\,. (Note that according to Newton's 2\textsuperscript{nd} Law of Motion $F=ma$.)
\end{example}

It will be shown that antidifferentiation is intimately connected with the calculus concept of integration to which we presently turn.

\begin{exercise}
\input{INTEGRATION/antiderivatives}
\end{exercise}

\section{Series}
\definition{A \textbf{sequence} is an ordered list of numbers (called \textbf{terms}).}
\begin{example}
\begin{itemize}
\item $\displaystyle 1, 4, 9, 16, 25, \ldots, 100$
\item $\displaystyle \frac{1}{2}, \frac{1}{4}, \frac{1}{8}, \frac{1}{16},\ldots$
\end{itemize}
\end{example}
As the examples show a sequence may have a finite or infinite number of terms.

A similar concept to a sequence is a series.

\definition{A \textbf{series} is a \textbf{sum} of terms in a sequence.}
\begin{example}
\begin{itemize}
\item $\displaystyle 1 + 4 + 9 + 16 + 25 + \ldots + 100$~~~~(a finite series)
\item $\displaystyle \frac{1}{2} + \frac{1}{4} + \frac{1}{8} + \frac{1}{16} + \ldots$~~~~(an infinite series)
\end{itemize}
\end{example}

\subsection*{Sigma Notation}
When a pattern exists in the terms of a series it can be abbreviated by writing the term as a function of an index.
\begin{example}
In our first series one notices:
\[1^2+2^2+3^2+4^2+\ldots+10^2=\sum_{i=1}^{10}i^2\]
\end{example}
Here the symbol $\sum$ is \emph{sigma}, the Greek capital S, representing a sum.  The $i$ is the index, related to the position in the series. The limits of 1 and 10 indicate the set  of values $i$ ranges over ($1,2,\ldots, 10$).  Just as the $x$ when writing $f(x)$ is arbitrary ($f(u)=u^2$ is the same function as $f(x)=x^2$), we could have written the series as:
\[\sum_{j=1}^{10}j^2\]

\textbook{\clearpage}
In general we have the following:
\definition{Let $a_m$, $a_{m+1}$, \ldots, $a_n$ be a sequence of real numbers (so $m$, $n$ are integers with $m\le n$) then
\[\sum_{i=m}^{n}a_i=a_m+a_{m+1}+\ldots+a_{n-1}+a_n\]
is the \textbf{sigma notation} for the series.  Here $i$ is called the \textbf{index of the summation}. Often we can write the term $a_i$ as a function of the index, $a_i=f(i)$\,.
}
\begin{example}
Write the following in sigma notation:
\begin{enumerate}
\item $\displaystyle \frac{1}{2} + \frac{1}{4} + \frac{1}{8} + \frac{1}{16} + \ldots + \frac{1}{256}$
\item $\displaystyle \frac{1}{2} + \frac{1}{4} + \frac{1}{8} + \frac{1}{16} + \ldots $
\item $\displaystyle 2^3+3^3+\ldots+n^3$
\end{enumerate}
\end{example}

Since a series is just a sum, often the goal is to evaluate it.
\begin{example}
Evaluate the following series:
\begin{enumerate}
\item $\displaystyle\sum_{j=0}^52^j$
\item $\displaystyle\sum_{i=1}^3\frac{i-1}{i^2+3}$
\end{enumerate}
\end{example}

\theorem{The following sums can be evaluated once and for all for positive integer $n$:
\begin{enumerate}
\item $\displaystyle\sum_{i=1}^n 1=n$
\item $\displaystyle\sum_{i=1}^n i=\frac{n(n+1)}{2}=\frac{n^2+n}{2}$
\item $\displaystyle\sum_{i=1}^n i^2=\frac{n(n+1)(2n+1)}{6}=\frac{2n^3+3n^2+n}{6}$
\item $\displaystyle\sum_{i=1}^n i^3=\left[\frac{n(n+1)}{2}\right]^2=\frac{n^4+2n^3+n^2}{4}$
\item $\displaystyle\sum_{i=1}^n i^4=\frac{n(n+1)(2n+1)(3n^2+3n-1)}{30}=\frac{6n^5+15n^4+10n^3-n}{30}$
\end{enumerate}
}

For general sums we have the following theorem:
\theorem{If $c$ is any constant (i.e. independent of $i$) and $\displaystyle\sum_{i=m}^n a_i$ and $\displaystyle\sum_{i=m}^n b_i$ are arbitrary sums (with the same range of indices) then
\begin{enumerate}
\item $\displaystyle \sum_{i=m}^n ca_i=c\sum_{i=m}^n a_i$
\item $\displaystyle \sum_{i=m}^n \left(a_i\pm b_i\right)= \sum_{i=m}^n a_i\pm\sum_{i=m}^n b_i$
\end{enumerate}
}
The theorem shows summation is a linear process like differentiation and antidifferentiation. 

\begin{example}
The following useful result is a consequence of the previous theorems:
\[\sum_{i=1}^nc=nc~,\]
since  $\displaystyle \sum_{i=1}^nc=\sum_{i=1}^nc\cdot 1=c\sum_{i=1}^n 1=cn$~.
\end{example}

More complicated series can be evaluated using the previous results.
\begin{example}
Evaluate the following using the previous theorems.
\begin{multicols}{2}
\begin{enumerate}
\item $\displaystyle \sum_{i=1}^{n}(3+2i)^2$
\item $\displaystyle \sum_{i=1}^{n}\frac{1}{n}\left[\left(\frac{i}{n}\right)^3+2\right]$
\end{enumerate}
\end{multicols}
\end{example}

Sometimes we will want to take the limit of a series as $n\rightarrow\infty$.  Though technically $n$ is only allowed to take integer values, we evaluate the limit in the same way we do when $x\rightarrow\infty$ for a real variable getting arbitrarily large.

\begin{example}
Evaluate the following limits:
\begin{multicols}{2}
\begin{enumerate}
\item $\displaystyle \mylim{n}{\infty}\sum_{i=1}^{n}\frac{1}{n}\left[\left(\frac{i}{n}\right)^3+2\right]$
\item $\displaystyle \mylim{n}{\infty}\sum_{i=1}^{n}\frac{1}{n}\left(\frac{i}{n}\right)^4$
\item $\displaystyle \mylim{n}{\infty}\sum_{i=1}^{n}\frac{1}{n}\left(1+\frac{2}{n}i+\frac{3}{n^2}i^2\right)$
\end{enumerate}
\end{multicols}
\end{example}
Note in the above limits we cannot simply write $\displaystyle \sum_{i=1}^\infty$ because the index upper limit $n$ actually appears in the terms themselves!

\textbook{\clearpage}
\begin{exercise}
\input{INTEGRATION/series}
\end{exercise}

\section{Area Under a Curve}

We know how to find the areas of simple shapes like the rectangle and triangle shown below:

\begin{center}
\parbox[t]{4.6in}{\vspace{0em}{\resizebox{3.6in}{!}{\input{basic_areas.pspdftex}}}}
\end{center}

More complicated polygons with straight edges could be subdivided into triangles to find their areas.

An area bounded by a smooth curve can be resolved using a limiting approach. Consider the general problem of finding the area $S$ of the region that lies under the curve $y=f(x)$ between $x=a$ and $x=b$.  By \emph{under the curve} we mean the area between the curve and the $x$-axis.  The situation is illustrated in the following diagram:
\begin{center}
\begin{asy}
// This imports our locally defined custom asymptote functions
import localcalculus;
size(300,150,IgnoreAspect);
real low=.2, high=.8;
real f(real x) {return (x-.7)^2+.2;}
pair F(real x) {return (x,f(x));}
drawfunc(f,0.1,low,drawpen=red+dashed,fillpen=invisible);
drawfunc(f,high,.9,drawpen=red+dashed,fillpen=invisible);
drawfunc(f,low,high,drawpen=red+1,fillpen=lightgrey);
xaxis("$x$",Arrow(HookHead,size=4),above=true);
yaxis("$y$",Arrow(HookHead,size=4));
real d=.03;
label("$a$", (low,-d),S);
label("$b$", (high,-d),S);
xequals(low,ymin=-.03,ymax=f(low),dashed);
xequals(high,ymin=-.03,ymax=f(high),dashed);
label("$S$", ((low+high)/2,.07),N);
label("$y=f(x)$", F(.15),NE);
\end{asy}
\end{center}

We are going to approximate the area $S$ with the sum of the areas of $n$ thin rectangles.  Letting the number of rectangles increase without bound ($n\rightarrow\infty$) will give us an exact result.  For a concrete example consider finding the area under the curve $y=x^3$ from $x=0$ to $x=1$ shown below.

\begin{center}
\begin{asy}
// This imports our locally defined custom asymptote functions
import localcalculus;
size(200,0);
real low=0, high=1;
real f(real x) {return x^3;}
pair F(real x) {return (x,f(x));}
//drawfunc(f,low-.5,high+.5,drawpen=black+1,fillpen=grey);
drawfunc(f,low,high,drawpen=red+1,fillpen=lightgrey);
xaxis("$x$",0,1.1,Arrow(HookHead,size=4),above=true);
yaxis("$y$",-.03,1,Arrow(HookHead,size=4));
real d=.03;
label("$0$", (low,-d),S);
label("$1$", (high,-d),S);
xequals(high,ymin=-d,ymax=f(high),dashed);
label("$S$", (.75,.2),N);
label("$y=x^3$", F(.9),W);
\end{asy}
\end{center}

Consider dividing the interval $[0,1]$ into 4 equal subintervals each of length $\Delta x=1/4$.  The rectangles have bases that are these subintervals and their heights have been chosen to have the values of the function at the \textbf{right endpoints} of the subintervals.  Diagrammatically they are as follows:

\begin{center}
\begin{asy}
// This imports our locally defined custom asymptote functions
import localcalculus;
size(200,0);
int n=4;
real low=0, high=1;
real f(real x) {return x^3;}
pair F(real x) {return (x,f(x));}
//drawcontinuousbarrange(h(x), n, a, b, shift, drawpen, fillpen)
//shift=0.0 is left endpoint evaluation (default), .5 is midpoint, 1.0 is right.
drawcontinuousbarrange(f, n, low, high, 1.0, black+1, lightgray);
drawfunc(f,low,high,drawpen=red+1,fillpen=invisible);
xaxis("$x$",0,1.1,RightTicks(Step=.25,OmitFormat(0,.25,.5,.75,1),OmitTick(), Size=4),Arrow(HookHead,size=4));
yaxis("$y$",-.03,1,Arrow(HookHead,size=4));
real d=0.02;
label("$0$", (low,-d),S);
label("$\frac{1}{4}$", (1/4,-d),S);
label("$\frac{2}{4}$", (2/4,-d),S);
label("$\frac{3}{4}$", (3/4,-d),S);
label("$1$", (high,-d),S);
\end{asy}
\end{center}

Let $S_4$ be the sum of the areas of the rectangles. Then an approximation of the desired area is
\[S_4=A_1+A_2+A_3+A_4=\frac{1}{4}\left(\frac{1}{4}\right)^3
+\frac{1}{4}\left(\frac{2}{4}\right)^3
+\frac{1}{4}\left(\frac{3}{4}\right)^3
+\frac{1}{4}\left(\frac{4}{4}\right)^3=\left(\frac{1}{4}\right)\left(\frac{100}{64}\right)=\frac{25}{64}\approx0.3906\,.
\]

Clearly, from the diagram, this will be an overestimate of the area $S$.  If we had, instead used left endpoints for the heights we would have underestimated $S$:

\begin{center}
\begin{asy}
// This imports our locally defined custom asymptote functions
import localcalculus;
size(200,0);
int n=4;
real low=0, high=1;
real f(real x) {return x^3;}
pair F(real x) {return (x,f(x));}
//drawcontinuousbarrange(h(x), n, a, b, shift, drawpen, fillpen)
//shift=0.0 is left endpoint evaluation (default), .5 is midpoint, 1.0 is right.
drawcontinuousbarrange(f, n, low, high, 0.0, black+1, lightgray);
drawfunc(f,low,high,drawpen=red+1,fillpen=invisible);
xaxis("$x$",0,1.1,RightTicks(Step=.25,OmitFormat(0,.25,.5,.75,1),OmitTick(), Size=4),Arrow(HookHead,size=4));
yaxis("$y$",-.03,1,Arrow(HookHead,size=4));
real d=0.02;
label("$0$", (low,-d),S);
label("$\frac{1}{4}$", (1/4,-d),S);
label("$\frac{2}{4}$", (2/4,-d),S);
label("$\frac{3}{4}$", (3/4,-d),S);
label("$1$", (high,-d),S);
\end{asy}
\end{center}

\textbook{\clearpage}
To get a more precise estimate divide $[0,1]$ into 8 subintervals of length $\Delta x=1/8$ and let $S_8$ be the sum of their areas, once again using the function evaluated at the right endpoints for the rectangle height:

\begin{center}
\begin{asy}
// This imports our locally defined custom asymptote functions
import localcalculus;
size(200,0);
int n=8;
real low=0, high=1;
real f(real x) {return x^3;}
pair F(real x) {return (x,f(x));}
//drawcontinuousbarrange(h(x), n, a, b, shift, drawpen, fillpen)
//shift=0.0 is left endpoint evaluation (default), .5 is midpoint, 1.0 is right.
drawcontinuousbarrange(f, n, low, high, 1.0, black+1, lightgray);
drawfunc(f,low,high,drawpen=red+1,fillpen=invisible);
xaxis(shift(-7,-10)*Label("$x$",align=E),0,1.1,RightTicks(Step=1, Size=4),Arrow(HookHead,size=4));
yaxis("$y$",-.03,1,Arrow(HookHead,size=4));
\end{asy}
\end{center}
The area estimate of $S$ is
\begin{eqnarray*}
S_8 & = & A_1+A_2+\ldots+A_8 \\
& = & \frac{1}{8}\left[
\left(\frac{1}{8}\right)^3+
\left(\frac{2}{8}\right)^3+
\left(\frac{3}{8}\right)^3+
\left(\frac{4}{8}\right)^3+
\left(\frac{5}{8}\right)^3+
\left(\frac{6}{8}\right)^3+
\left(\frac{7}{8}\right)^3+
\left(\frac{8}{8}\right)^3\right]\\
& = & \left(\frac{1}{8}\right)\left(\frac{1296}{4096}\right)=\frac{81}{256}\approx0.3164
\end{eqnarray*}
Once again this will be an overestimate of $S$ but we expect, based on the graph, that it has less error.

Let us find $S_n$ for any number of intervals $n$.  Divide the interval $[0,1]$ into $n$ equal subintervals of length $\Delta x=1/n$.  That is $[0,1/n]$, $[1/n,2/n]$,\ldots,$[\frac{n-1}{n},1]$. Then
\begin{eqnarray*}
S_n & = & A_1+A_2+\ldots+A_n \\
& = & \frac{1}{n}\left[\left(\frac{1}{n}\right)^3+\left(\frac{2}{n}\right)^3+\ldots+\left(\frac{n}{n}\right)^3\right] \\
& = & \left(\frac{1}{n}\right)\left(\frac{1}{n^3}\right)\left[1^3+2^3+\ldots+n^3\right] \\
& = & \frac{1}{n^4}\sum_{i=1}^{n}i^3 \\
& = & \frac{1}{n^4}\frac{n^4+2n^3+n^2}{4} \\
& = & \frac{n^2+2n+1}{4n^2}
\end{eqnarray*}
As a check note that if $n=4$ we get $S_4=0.3906$ and for $n=8$, $S_8=0.3164$\,.

\textbook{\clearpage}
Now for a larger number of intervals we expect $S_n$ to be a better estimate of $S$.  If we choose $n=16$ intervals for instance we have:
\begin{center}
\begin{asy}
// This imports our locally defined custom asymptote functions
import localcalculus;
size(200,0);
int n=16;
real low=0, high=1;
real f(real x) {return x^3;}
pair F(real x) {return (x,f(x));}
//drawcontinuousbarrange(h(x), n, a, b, shift, drawpen, fillpen)
//shift=0.0 is left endpoint evaluation (default), .5 is midpoint, 1.0 is right.
drawcontinuousbarrange(f, n, low, high, 1.0, black+1, lightgray);
drawfunc(f,low,high,drawpen=red+1,fillpen=invisible);
xaxis(shift(-7,-10)*Label("$x$",align=E),0,1.1,RightTicks(Step=1, Size=4),Arrow(HookHead,size=4));
yaxis("$y$",-.03,1,Arrow(HookHead,size=4));
\end{asy}
\raisebox{100pt}{$\displaystyle\Rightarrow\ S_{16}=\frac{289}{1024}=0.2822$}
\end{center}

So let us let the number of intervals go to infinity ($n\rightarrow\infty$):
\[\mylim{n}{\infty}S_n=\mylim{n}{\infty}\frac{n^2+2n+1}{4n^2}=\frac{1}{4}=0.25\]
As $n$ increases, then $S_n$ becomes a better and better approximation of the area under the curve.  Therefore:
\[\mbox{Area}=S=\mylim{n}{\infty}S_n=\frac{1}{4}\]

In general we want to evaluate the area $A$ under the curve $y=f(x)$, $f(x)\ge0$ from $x=a$ to $b$.  To do so, divide $[a,b]$ into $n$ subintervals of equal width $\Delta x=\frac{b-a}{n}$. Label the endpoints $x_0=a$, $x_1$, $x_2$, \ldots, $x_{n-1}$, $x_n=b$.  Let $x_i^*$ be any point on the subinterval $[x_{i-1},x_i]$.  The area $A$ of the region is the sum of the $n$ rectangles as $n\rightarrow\infty$ ($\Delta x\rightarrow 0$):
\[A=\mylim{n}{\infty}\sum_{i=1}^nf(x_i^*)\,\Delta x\ .\]
Since for a given $n$ the $\Delta x$ is constant, it may be pulled outside of the sum and we get:
\[A=\mylim{n}{\infty}\frac{b-a}{n}\sum_{i=1}^nf(x_i^*)\ .\]


The formula can be made more precise by specifying the position of $x_i^*$ within the interval:
\begin{description}
\item[right endpoint:] If $x_i^*$ is the right endpoint of the interval $[x_{i-1},x_i]$, then $\displaystyle x_i^*=a+i\frac{b-a}{n}$ and the area is given by
\[A=\mylim{n}{\infty}\frac{b-a}{n}\sum_{i=1}^nf\left(a+i\frac{b-a}{n}\right)\]
\item[midpoint:] If $x_i^*$ is the midpoint of the interval $[x_{i-1},x_i]$, then $\displaystyle x_i^*=a+\left(i-\frac{1}{2}\right)\frac{b-a}{n}$ and the area is given by
\[A=\mylim{n}{\infty}\frac{b-a}{n}\sum_{i=1}^nf\left(a+\left(i-\frac{1}{2}\right)\frac{b-a}{n}\right)\]
\item[left endpoint:] If $x_i^*$ is the left endpoint of the interval $[x_{i-1},x_i]$, then $\displaystyle x_i^*=a+(i-1)\frac{b-a}{n}$ and the area is given by
\[A=\mylim{n}{\infty}\frac{b-a}{n}\sum_{i=1}^nf\left(a+(i-1)\frac{b-a}{n}\right)\]
\end{description}

\begin{example}
\begin{enumerate}
\item Find the area under the curve $y=x^2+2$ from $a=1$ to $b=4$.  Take $x_i^*$ to be the right endpoint of the $i^{\mbox{\tiny th}}$ interval.

\item Find the area under the curve $y=x^2+3x-2$ from $a=1$ to $b=4$.  Take $x_i^*$ to be the left endpoint of the $i^{\mbox{\tiny th}}$ interval.
\end{enumerate}
\end{example}

We are assuming that there is no difference in the results of these area formulae, despite the evaluation at different $x_i^*$. It remains to consider what properties the function must have for this to be true.

\textbook{\addtoanswerkey{\clearpage}}
\begin{exercise}
\input{INTEGRATION/area-under-a-curve}
\end{exercise}

\section{The Definite Integral}
Our consideration of the evaluation of the area under a curve leads us to define the definite integral.

\definition{Let $f$ be a function defined on the interval $[a,b]$.  Divide $[a,b]$ into $n$ equal subintervals of width $\Delta x=\frac{b-a}{n}$ with endpoints $x_0=a$, $x_1$, $x_2$, \ldots, $x_{n-1}$, $x_n=b$.  Let $x_i^*$ denote any point in the $i^{\mbox{\tiny th}}$ interval $[x_{i-1},x_i]$.  The \textbf{definite integral of $\bm{f}$ from $\bm{a}$ to $\bm{b}$} is:
\[\int_a^bf(x)\,dx=\mylim{n}{\infty}\sum_{i=1}^n f(x_i^*)\Delta x\]
if the limit exists and is independent of the choice of the $x_i^*$.  If the limit exists, then $f$ is said to be \textbf{integrable} on the interval $[a,b]$.}

We introduce the following terminology for the parts of the definite integral:
\begin{itemize}
\item $\displaystyle\int$ is the \textbf{integral sign}.  It is a script \emph{S} suggesting summation.
\item $f(x)$ is the \textbf{integrand}.
\item $x$ is the \textbf{variable of integration}.\footnote{The choice of integration variable, just as the choice of summation index, is arbitrary, i.e.
\[\int_a^b f(x)\,dx=\int_a^b f(y)\,dy=\int_a^b f(t)\,dt~.\]}
\item $dx$ is the \textbf{differential}.
\item $b$ is the \textbf{upper limit of integration}.
\item $a$ is the \textbf{lower limit of integration}.
\item The series $\displaystyle \sum_{i=1}^n f(x_i^*)\Delta x$ is a \textbf{Riemann sum}.
\end{itemize}

If $f(x)\ge 0$ for all $x$ in $[a,b]$, then $\int_a^b f(x)\,dx$ is the \textbf{area under the curve} $\bm{y=f(x)}$ and above the $x$-axis from $\bm{x=a}$ to $\bm{x=b}$ as we have already seen. For arbitrary $f$, the geometrical meaning of $\int_a^b f(x)\,dx$ is the \textbf{net signed area} between the curve and the $x$-axis on interval $[a,b]$ with areas above the $x$-axis (where $f(x)>0$) counted positively and areas below the $x$-axis (where $f(x)<0$) counted negatively.
\begin{center}
\begin{asy}
// This imports our locally defined custom asymptote functions
import localcalculus;
size(300,150,IgnoreAspect);
real low=.5, high=7.5;
real f(real x) {return sin(x);}
pair F(real x) {return (x,f(x));}
drawfunc(f,0.1,low,drawpen=red+dashed,fillpen=invisible);
drawfunc(f,high+.5,.9,drawpen=red+dashed,fillpen=invisible);
drawfunc(f,low,3.14,drawpen=red+1,fillpen=palered);
drawfunc(f,3.14,6.28,drawpen=red+1,fillpen=paleblue);
drawfunc(f,6.28,high,drawpen=red+1,fillpen=palered);
xaxis("$x$",Arrow(HookHead,size=4),above=true);
yaxis("$y$",Arrow(HookHead,size=4));
real d=.03;
label("$a$", (low,-d),S);
label("$b$", (high,-d),S);
xequals(low,ymin=-.03,ymax=f(low),dashed);
xequals(high,ymin=-.03,ymax=f(high),dashed);
label("$\displaystyle\int_a^bf(x)\,dx=A_1-A_2+A_3$", ((low+high)/2+.7,.65),N);
label("$y=f(x)$", F(3.5),SW);
label("$A_1$", (1.6,.25),N);
label("$A_2$", (4.7,-.3),S);
label("$A_3$", (7.1,.25),N);
\end{asy}
\end{center}

The definite integral, representing a physical area, is therefore just a number.\footnote{Assuming there are no variables in the limits of integration or non-integration variables in the integrand.}

If the upper limit $b$ is less than the lower limit $a$ we can define, assuming $f$ is integrable on $[b,a]$, that
\[\int_a^b f(x)\,dx=-\int_b^a f(x)\,dx\,.\]
This definition is consistent with the Riemann sum in the original definition since if $b<a$ there, $\Delta x$ would be negative.  In practice, it is important to remember that if one exchanges limits one must introduce a minus sign.

The following theorem gives a sufficient condition for a function $f$ to be integrable on interval $[a,b]$.

\theorem{If $f$ is continuous on $[a,b]$ then $\int_a^b f(x)\,dx$ exists.}

In fact the weaker condition that $f$ be \textbf{piecewise continuous} on $[a,b]$ is sufficient.\footnote{Piecewise continuous means function $f$  is continuous everywhere except at a finite number of removable or jump discontinuities. Vertical asymptotes (infinite discontinuities) are not allowed.}

The next theorem lists several general properties of the definite integral.  While they may be rigorously proven by considering Riemann sums, consideration of their graphical meaning in terms of areas makes them intuitively reasonable.
\theorem{Let $f$ and $g$ be integrable functions on the given intervals of integration and $a$, $b$, $c$, $m$ and $M$ constants, then the following are true for definite integrals:
\begin{method}
\vspace{-1em}
\begin{enumerate}
\item $\displaystyle \int_a^a f(x)\,dx=0$
\item $\displaystyle \int_a^b c\,dx=c(b-a)$
\item $\displaystyle \int_a^b\left[f(x)\pm g(x)\right]\,dx=\int_a^bf(x)\,dx\pm\int_a^bg(x)\,dx$
\item $\displaystyle \int_a^bc f(x)\,dx=c\int_a^bf(x)\,dx$
\item $\displaystyle \int_a^b f(x)\,dx=\int_a^c f(x)\,dx+\int_c^b f(x)\,dx$
\item If $f(x)\ge0$ for all $x$ in $[a,b]$ then $\displaystyle \int_a^b f(x)\,dx\ge0$~.
\item If $f(x)\ge g(x)$ for all $x$ in $[a,b]$ then $\displaystyle \int_a^b f(x)\,dx\ge\int_a^bg(x)\,dx$~.
\item If $m\le f(x)\le M$ for all $x$ in $[a,b]$ then $\displaystyle m(b-a)\le\int_a^b f(x)\,dx\le M(b-a)$~.
\item $\displaystyle \left|\int_a^bf(x)\,dx\right|\le\int_a^b\left|f(x)\right|\,dx$
\end{enumerate}
\end{method}
}

\begin{example}
Evaluate or simplify the following:
\begin{enumerate}
\item $\displaystyle \int_{-1}^2 x\,dx$
\item $\displaystyle \int_9^4\sqrt{t}\,dt$\ \ if\ \ $\displaystyle \int_4^9\sqrt{x}\,dx=\frac{38}{3}$~.
\item $\displaystyle\int_3^4 f(x)\,dx+\int_1^3 f(x)\,dx+\int_4^1 f(x)\,dx$
\item $\displaystyle\int_1^3 f(x)\,dx+\int_3^6 f(x)\,dx+\int_6^{12} f(x)\,dx$
\end{enumerate}
\end{example}

If a function is integrable we are free to choose the points of evaluation, $x_i^*$, when evaluating the Riemann sum to be the right endpoints of the intervals.

\theorem{If $f$ is integrable on $[a,b]$ then
\[\int_a^b f(x)\,dx=\mylim{n}{\infty}\frac{b-a}{n}\sum_{i=1}^n f\left(a+i\frac{b-a}{n}\right)\]}

Note that similar theorems can be given for the left endpoint and midpoint choices of $x_i^*$ as previously discussed.

\begin{example}
Evaluate the following definite integrals using a Riemann sum with the function evaluated at the right endpoints of the intervals:
\begin{enumerate}
\item $\displaystyle\int_0^3\left(x^3-5x\right)\,dx$
\item $\displaystyle\int_1^5\left(2+3x-x^2\right)\,dx$
\end{enumerate}
\end{example}

\textbook{\clearpage}
\begin{exercise}
\input{INTEGRATION/the-definite-integral}
\end{exercise}

\section[Fundamental Theorem of Calculus]{The Fundamental Theorem of Calculus}

The \textbf{Fundamental Theorem of Calculus (FTC)} shows integration and differentiation are inverse processes of each other.  We will present two forms of the theorem, one involving derivatives and one antiderivatives.  The latter, as we will see, is particularly useful.

\theorem{\textbf{The Fundamental Theorem of Calculus (Derivative Form)}:

If $f$ is continuous on interval $[a,b]$, then the function $g(x)$ defined for all $x$ in $[a,b]$ by
\[g(x)=\int_a^xf(t)\,dt\ ,\]
is continuous on $[a,b]$ and differentiable on $(a,b)$ with\footnote{In fact, $g(x)$ is differentiable on $[a,b]$ (i.e. including the endpoints) if we admit right and left-handed derivatives at those points.  That is, we use the usual derivative formula with $\lim h\rightarrow 0^+$ and $\lim h\rightarrow 0^-$ at the endpoints.}
\[g'(x)=f(x)\ ,\]
or, equivalently,
\[\frac{d}{dx}\int_a^xf(t)\,dt=f(x)\ .\]
}

That the result of the theorem is plausible can be seen in the following diagram:
\begin{center}
\begin{asy}
// This imports our locally defined custom asymptote functions
import localcalculus;
size(300,150,IgnoreAspect);
real low=.2, high=.8;
real f(real x) {return sin(x+1.3)^2+.2;}
pair F(real x) {return (x,f(x));}
drawfunc(f,0.1,low,drawpen=red+dashed,fillpen=invisible);
drawfunc(f,high,.9,drawpen=red+dashed,fillpen=invisible);
drawfunc(f,low,high,drawpen=red+1,fillpen=lightgrey);
drawfunc(f,low,high-.1,drawpen=red+1,fillpen=grey);
xaxis("$x$",Arrow(HookHead,size=4));
yaxis("$y$",Arrow(HookHead,size=4));
real d=.03;
label("$a$", (low,-d),S);
label("$x$", (high-.1,-d),S);
label("$x+\Delta x$", (high,-.05*d),S);
xequals(low,ymin=-.03,ymax=f(low),dashed);
xequals(high-.1,ymin=-.03,ymax=f(high-.1),dashed);
xequals(high,ymin=-.03,ymax=f(high),dashed);
label(Label("$g(x)=$Area", white), ((low+high)/2-.1/2,.6),N);
draw((.555,.69)--(high-.1,.69),black,Arrow(size=6));
draw((.35,.69)--(low,.69),black,Arrow(size=6));
label(Label("$g(x+\Delta x)=$Area", white), ((low+high)/2,.3),N);
draw((.65,.39)--(high,.39),black,Arrow(size=6));
draw((.35,.39)--(low,.39),black,Arrow(size=6));
label("$y=f(x)$", F(.15),NE);
\end{asy}
\end{center}
The function $\displaystyle g(x)=\int_a^xf(t)\,dt$ associates with each value $x$ the area under the curve $y=f(x)$ from the fixed number $a$ up to $x$. To find the derivative of the function we must evaluate:
\[g'(x)=\mylim{\Delta x}{0}\frac{g(x+\Delta x)-g(x)}{\Delta x}\]
In the diagram $g(x)$ is the dark grey area, while $g(x+\Delta x)$ is all of that area plus the light grey shaded area.  Therefore the difference $g(x+\Delta x)-g(x)$ is simply the light grey shaded area itself.  Now for finite $\Delta x$ this light grey area is not a rectangle since the left side has height $f(x)$ while the right side has height $f(x+\Delta x)$ and the top side is the curve $y=f(x)$ over $[x,x+\Delta x]$.  However, due to the continuity of $f$, we have $\mylim{\Delta x}{0}f(x+\Delta x)=f(x)$, in other words the light grey area becomes increasingly like a rectangle of width $\Delta x$ and height $f(x)$ as $\Delta x\rightarrow 0$.  Thus
\[g(x+\Delta x)-g(x)\approx f(x)\Delta x~,\]
and hence
\[\frac{g(x+\Delta x)-g(x)}{\Delta x}\approx f(x)~.\] 
and in the limit we have
\[g'(x)=\mylim{\Delta x}{0}\frac{g(x+\Delta x)-g(x)}{\Delta x}=f(x)\]
exactly.  A rigorous proof of the theorem can be made using the Extreme Value Theorem, inequalities of the definite integral, and the Squeeze Theorem.

\begin{example}
Use the derivative form of the Fundamental Theorem of Calculus to find the derivatives of the following functions:
\begin{enumerate}
\item $\displaystyle g(x)=\int_{-1}^x\sqrt{t^3+1}\,dt$
\item $\displaystyle g(x)=\int_x^4\left(2+\sqrt{u}\right)^8\,du$
\item $\displaystyle h(x)=\int_{1}^{\sqrt{x}}\frac{s^2}{s^2+1}\,ds$
\item $\displaystyle g(x)=\int_{2}^{x^2+x}\sqrt{1+t^3}\,dt$
\item $\displaystyle g(x)=\int_0^{\sin x}\cos\theta\,d\theta$
\item $\displaystyle \mathrm{Si}(2x)$ where $\mathrm{Si}(x)$ is the \emph{sine integral} function $\displaystyle \mathrm{Si}(x)=\int_0^x\frac{\sin t}{t}\,dt$
\end{enumerate}
\end{example}

\begin{exercise}
\input{INTEGRATION/fundamental-theorem-of-calculus-derivative-form}
\end{exercise}

We next turn to the second form of the Fundamental Theorem of Calculus which gives a simple mechanism to evaluate many definite integrals.
% Since this is just Antiderivative Form of the theorem we decrement the result.
\addtocounter{mytheorem}{-1}
\theorem{\textbf{The Fundamental Theorem of Calculus (Antiderivative Form)}:

If $f$ is continuous on $[a,b]$ and $F$ is any antiderivative of $f$ (so $F'=f$) then
\[\boxed{\int_a^bf(x)\, dx=F(b)-F(a)}~.\]
}

Note we define the shorthand $\displaystyle \left. F(x)\right|_a^b$ to be the right hand side of the equality,  $\displaystyle \left. F(x)\right|_a^b=F(b)-F(a)$.  Unlike the integral sign, the bar is placed on the right.

Proof of the Antiderivative Form of the FTC follows from the fact that the deriative form of the FTC shows that $g(x)=\int_a^x f(t)dt$ is an antiderivative of $f(x)$, since $g'(x)=f(x)$.  By  Theorem~\ref{thm:antiderivatives}, any other antiderivative $F(x)$ of $f(x)$ differs by at most a constant from $g$, $F(x)=g(x)+C$.  Hence
\[F(b)-F(a)=[g(b)+C]-[g(a)+C]=g(b)-g(a)=\int_a^bf(t)\,dt-\underbrace{\int_a^af(t)\,dt}_{=0}=\int_a^bf(t)\,dt\ .\]

\begin{example}
Use the antiderivative form of the FTC to evaluate the following definite integrals:
\begin{enumerate}
\item $\displaystyle\int_1^2 x^{-2}\,dx$
\item $\displaystyle\int_0^1\left(y^9-2y^5+3y\right)\,dy$
\item $\displaystyle\int_0^{\frac{\pi}{2}}\left(\cos\theta+2\sin\theta\right)\,d\theta$
\item $\displaystyle\int_1^4\frac{\left(\sqrt{x}+2\right)^2}{\sqrt{x}}\,dx$
\item $\displaystyle\int_0^1\frac{1}{x^3}\,dx$
\end{enumerate}
\end{example}

\begin{exercise}
\input{INTEGRATION/fundamental-theorem-of-calculus-antiderivative-form}
\end{exercise}

\textbook{\clearpage}
\subsection*{Indefinite Integrals}
Because of the connection between the evaluation of definite integrals with integrand $f$ and the antiderivative of $f$ we define the \textbf{indefinite integral} as follows:
\definition{If $F(x)$ is an antiderivative of $f$, so $F'(x)=f(x)$, then the \textbf{indefinite integral} of $f(x)$ is
\[\int f(x)\,dx=F(x)+C\]
}
The advantage of this notation for the antiderivative (rather than, say $F(x)$) is that $\int f(x)\,dx$ clearly indicates the function $f$ being antidifferentiated, just as $\frac{df}{dx}$ indicates the function differentiated.  Note, however, the difference between the definite and indefinite integrals.  The definite integral $\int_a^b f(x)\,dx$ is a number while the indefinite integral $\int f(x)\,dx$ is a function.\footnote{Indeed, due to the presence of the constant $C$, a family of functions.}

For indefinite integrals we say, for example, that $\frac{1}{n+1}x^{n+1}+C$ is the \textbf{(indefinite) integral} of $x^n$ where $x^n$ is the \textbf{integrand}.  The \textbf{process} of finding the integral is called \textbf{integration}.

Using our notation for indefinite integrals and our knowledge of derivatives gives the following.
\begin{method}
\vspace{-.5em}
\begin{center}
\textbf{\Large Table of Indefinite Integrals}
\end{center}
\begin{enumerate}
\item $\displaystyle\int x^n\,dx=\frac{1}{n+1}x^{n+1}+C\ \ \ \ (n\neq-1)$
\item $\displaystyle\int \cos x\,dx=\sin x+C$
\item $\displaystyle\int \sin x\,dx=-\cos x+C$
\item $\displaystyle\int \sec^2x\,dx=\tan x+C$
\item $\displaystyle\int \sec x\tan x\,dx=\sec x+C$
\item $\displaystyle\int \csc^2x \,dx=-\cot x+C$
\item $\displaystyle\int \csc x\cot x\,dx=-\csc x+C$
\item $\displaystyle\int c f(x)\,dx=c\int f(x)\,dx$
\item $\displaystyle\int \left[f(x)\pm g(x)\right]\,dx=\int f(x)\,dx\pm \int g(x)\,dx$
\end{enumerate}
\end{method}
In the last two integration formulae $f(x)$ and $g(x)$ are functions while $c$ is a constant.  

\begin{example}
Evaluate the following integrals:
\begin{multicols}{2}
\begin{enumerate}
\item $\displaystyle\int\sqrt{x}\left(x^2-\frac{1}{x}\right)\,dx$
\item $\displaystyle\int\left(\sqrt{x}+3x\right)^2\,dx$
\item $\displaystyle\int\frac{\left(2x^3+3\right)^2}{x^2}\,dx$
\item $\displaystyle\int\left(3\cos t-2\sin t+\sec t\tan t\right)\,dt$
\item $\displaystyle\int\left(\sqrt[3]{y}+\frac{1}{\sqrt[3]{y}}\right)\,dy$
\item $\displaystyle\int\frac{(x+1)^3}{x^5}\,dx$
\item $\displaystyle\int_1^4\left(\sqrt{3x}+5x+1\right)\,dx$
\item $\displaystyle\int_0^{\frac{\pi}{4}}\left(2\cos x-3\sin x+\sec^2x\right)\,dx$
\end{enumerate}
\end{multicols}
\end{example}
The last two integrals in the example, definite integrals, illustrate that these just require the further step, after finding the antiderivative, of finding the difference of its evaluation at the endpoints.

\begin{exercise}
\input{INTEGRATION/indefinite-integrals}
\end{exercise}

\section{Integration by Substitution}

Consider the indefinite integral
\[\int x^2\sqrt{1+x^3}\, dx~.\]
Finding an antiderivative is possible if we recall the Chain Rule for differentiating compositions of functions:
\[\frac{d}{dx} f(g(x))=f'(g(x))\cdot g'(x)~.\]
In this example consider $\left(1+x^3\right)^{\frac{3}{2}}$ which can be thought of as $f(g(x))$ where $f(u)=u^{\frac{3}{2}}$ and \mbox{$u=g(x)=1+x^3$}.  The Chain Rule gives:
\[\frac{d}{dx} \left(1+x^3\right)^{\frac{3}{2}}=\frac{3}{2}\left(1+x^3\right)^{\frac{1}{2}}\cdot\frac{d}{dx}\left(1+x^3\right)=\frac{3}{2}\sqrt{1+x^3}\cdot\left(0+3x^2\right)=\frac{9}{2}x^2\sqrt{1+x^3}~.\]
This is almost the integrand.  Recalling that $(cf(x))'=cf'(x)$ we can get rid of the $9/2$ by multiplying the original function by $2/9$:
\[\frac{d}{dx}\left[ \frac{2}{9}\left(1+x^3\right)^{\frac{3}{2}}\right]=\frac{2}{9}\cdot\frac{9}{2}x^2\sqrt{1+x^3}=x^2\sqrt{1+x^3}~,\]
and therefore,
\[\int x^2\sqrt{1+x^3}\, dx = \frac{2}{9}\left(1+x^3\right)^{\frac{3}{2}}+C~.\]

This example is not very practical because the initial step of considering the derivative of $\left(1+x^3\right)^{\frac{3}{2}}$ came out of nowhere.  However it does suggest that the Chain Rule should underlie some useful integration method.  It does.  In practice we focus on transforming the original integral in $x$ into an integral in terms of a new variable $u$ where $u=g(x)$ is the inner function of a composite function found in the integrand.  We have the following:

\theorem{\textbf{Substitution Rule (Indefinite Integrals):} Suppose $u=g(x)$ is a differentiable function whose range of values is an interval $I$ upon which a further function $f$ is continuous, then
\[\int f(g(x))g'(x)\,dx=\int f(u)\,du\ .\]
where the right hand integral is to be evaluated at $u=g(x)$ after integration.
}

Note that the $du$ appearing on the right side is the differential:
\[du=g'(x)dx\]
which, recall, can be remembered by thinking $\frac{du}{dx}=g'(x)$ and multiplying both sides by $dx$.

\begin{method}
To integrate using the Substitution Rule for an indefinite integral follow these steps:
\begin{enumerate}
\item Selection a substitution $u$ that appears to simplify the integrand.  Try to select $u$ so that its derivative is a factor in the integrand.
\item Express the integrand entirely in terms of $u$ and $du$ eliminating the original variable and its differential.
\item Evaluate the new $u$ integral if possible.
\item Express the antiderivative found in the last step (a function of u) in terms of the the original variable.
\end{enumerate}
\end{method}

Consider the original integral again:
\[\int x^2\sqrt{1+x^3}\, dx\]
Let us apply the Substitution Rule steps to solve this integral:
\begin{enumerate}
\item Looking at the integrand a useful substitution looks like
\[u=1+x^3\]
since this turns $\sqrt{1+x^3}$ into $\sqrt{u}$.  Differentiating $u$ we get:
\[\frac{du}{dx}=0+3x^2=3x^2\ .\]
Up to the constant $3$ this is a factor in the integrand.  Our $du$ is:
\[du=3x^2\,dx\]
\item The original integral becomes, in terms of $u$ and $du$:
\[\int x^2\sqrt{1+x^3}\, dx=\int \sqrt{1+x^3}(x^2\, dx)=\int \sqrt{u}\,\frac{du}{3}\]
Here we used, from our differential formula that $x^2\,dx=\frac{du}{3}$.
\item Integrating we get:
\[\int \sqrt{u}\,\frac{du}{3}=\frac{1}{3}\int u^{\frac{1}{2}}\,du=\frac{1}{3}\frac{1}{\frac{3}{2}}u^{\frac{3}{2}}+C=\frac{1}{3}\cdot\frac{2}{3}u^{\frac{3}{2}}+C=\frac{2}{9}u^{\frac{3}{2}}+C\]
\item Replacing $u$ with $1+x^3$ gives the final result:
\[\int x^2\sqrt{1+x^3}\, dx=\frac{2}{9}\left(1+x^3\right)^{\frac{3}{2}}+C\]
Note this last step is required as the antiderivative of a function of $x$ must itself be a function of~$x$.
\end{enumerate}

\begin{example}
Find the indefinite integrals:
\begin{multicols}{2}
\begin{enumerate}
\item $\displaystyle\int \frac{5x^4+3}{\left(x^5+3x+2\right)^3}\,dx$
\item $\displaystyle\int \frac{x^2-1}{\left(x^3-3x+7\right)^2}\,dx$
\item $\displaystyle\int \tan^2x\, \sec^2x\,dx$
\item $\displaystyle\int x\cos\left(x^2+3\right)\,dx$
\item $\displaystyle\int \frac{\cos x}{\left(1+\sin x\right)^{\frac{5}{2}}}\,dx$
\item $\displaystyle\int \frac{\left(x^3+3x\right)^2}{x^2}\,dx$
\item $\displaystyle\int x^3\sqrt{1+x^2}\,dx$
\item $\displaystyle\int \frac{\sec^2\sqrt{x}}{\sqrt{x}}\,dx$
\item $\displaystyle\int x^5\left(2+3x^2\right)^{\frac{3}{2}}\,dx$
\item $\displaystyle\int \sin^2x\,dx$
\end{enumerate}
\end{multicols}
\end{example}

\subsection*{Substitution Rule with Definite Integrals}
When the substitution method is required for definite integrals the obvious method is to use the substitution to find the antiderivative and then evaluate at the endpoints and subtract as usual.
\begin{example}
Evaluate the definite integral $\displaystyle\int_0^2 x^2\sqrt{1+x^3}\, dx$.

Here we recognize the indefinite integral from before.  We solved this using the substitution $u=1+x^3$ to find the required antiderivative $\frac{2}{9}\left(1+x^3\right)^{\frac{3}{2}}+C$ so the definite integral is just:
\[\int_0^2 x^2\sqrt{1+x^3}\, dx=\ldots=\left.\frac{2}{9}\left(1+x^3\right)^{\frac{3}{2}}\right|_0^2=\frac{2}{9}\left[(1+2^3)^{\frac{3}{2}}-(1+0^3)^{\frac{3}{2}}\right]=\frac{2}{9}\left[27-1\right]=\frac{52}{9}\]
Notice here the constant $\frac{2}{9}$ which was a factor of both the upper and lower limit was pulled out to simplify evaluation.
\end{example}

A quicker way to solve the definite integral when doing a substitution is to skip the last step of converting the antiderivative in terms of $u$ back to the original variable.  Instead you can convert the limits of the original variable into new limits of the variable $u$.

\begin{example}
Evaluate the definite integral $\displaystyle\int_0^2 x^2\sqrt{1+x^3}\, dx$ by changing the limits of the integral upon substitution.

As before we have the substitution $u=1+x^3$ so $du=3x^2\, dx$.  Now $x$ ranges from lower limit 0 to upper limit 2.  The new limits of $u$ are:
\begin{description}
\item[upper limit:] $x=2$ $\Rightarrow$ $u=1+2^3=9$
\item[lower limit:] $x=0$ $\Rightarrow$ $u=1+0^3=1$
\end{description}

The integral becomes:
\[\int_0^2 x^2\sqrt{1+x^3}\, dx=\frac{1}{3}\int_1^9u^{\frac{1}{2}}\,du=\frac{1}{3}\left[\frac{1}{\frac{3}{2}}u^{\frac{3}{2}}\right|_1^9=\frac{2}{9}\left(9^{\frac{3}{2}}-1^{\frac{3}{2}}\right)=\frac{2}{9}\left[27-1\right]=\frac{52}{9}\]
\end{example}

Not only is changing the limits to limits in $u$ usually faster it is also cleaner.  For instance it would be wrong to write $\int_0^2 x^2\sqrt{1+x^3}\, dx=\frac{1}{3}\int_0^2u^{\frac{1}{2}}\,du$, even if you ultimately plan on converting $u$ back to $x$ to find the antiderivative.  The $u$ is just a dummy variable so $\frac{1}{3}\int_0^2u^{\frac{1}{2}}\,du$ can be evaluated to equal $2^{\frac{5}{2}}/9$ which is not the answer to the definite integral in question.

Also note that when you change the limits to limits in $u$ it can occur that the upper limit in $u$ may now be lower in value than the lower limit.  There is nothing wrong with this.  The upper limit in $u$ must correspond to the upper limit of original variable, and similarly for the lower limit.

\textbook{\clearpage}
The whole discussion may be summarized in the following theorem.
\theorem{\textbf{Substitution Rule (Definite Integrals):} Suppose
  $u=g(x)$ is a differentiable function whose derivative $g'$ is
  continuous on $[a,b]$ and a further function $f$ is continuous on
  the range of $u=g(x)$ (evaluated on $[a,b]$), then
\[\int_a^b f(g(x))g'(x)\,dx=\int_{g(a)}^{g(b)} f(u)\,du\ .\]
}
\begin{example}
Find the definite integrals:
\begin{enumerate}
\begin{multicols}{2}
\item $\displaystyle\int_0^1 \left(1+x\right)^5\,dx$
\item $\displaystyle\int_1^4 \frac{\left(\sqrt{x}+1\right)^4}{\sqrt{x}}\,dx$
\item $\displaystyle\int_0^{\frac{\pi}{3}}\sin 3\theta\,d\theta$
\item $\displaystyle\int_2^{10}\frac{3}{\sqrt{5x-1}}\,dx$
\item $\displaystyle\int_1^4\sqrt{5-x}\,dx$
\end{multicols}
\end{enumerate}
\end{example}

\textbook{\addtoanswerkey{\clearpage}}
\begin{exercise}
\input{INTEGRATION/the-substitution-rule}
\end{exercise}

\section{Symmetry and Definite Integrals}
\theorem{The following is true for symmetric functions integrable on $[-a,a]$\,:
\begin{itemize}
\item If $f(x)$ is \textbf{even} then $\displaystyle\int_{-a}^af(x)\,dx=2\int_0^af(x)\,dx$.
\item If $f(x)$ is \textbf{odd} then $\displaystyle\int_{-a}^af(x)\,dx=0$.
\end{itemize}
}
The last theorem is obvious from consideration of the definite integral as a sum of areas for in the even case the areas on each side of the $y$-axis will be equal.  In the odd case the areas are also equal in magnitude but will contribute oppositely in sign to the overall integral (since $f(-x)=-f(x)$).  Alternatively one may prove the theorem directly by writing
\[\int_{-a}^af(x)\,dx=\int_{-a}^0f(x)\,dx+\int_0^af(x)\,dx~,\]
and doing a change of variables of $u=-x$ on the $\int_{-a}^0$ integral.

\begin{example}
Integrate the following:
\begin{enumerate}
\item $\displaystyle \int_{-2}^{2} (x^2+3)\,dx$
\item $\displaystyle \int_{-\pi/2}^{\pi/2} \left(\sin x +\sin 2x\right)\,dx$
\end{enumerate}
\end{example}

\begin{exercise}
\input{INTEGRATION/integration-all-methods}
\end{exercise}

\section{Areas Between Curves}

We have already calculated an area between curves.  Namely, when $y=f(x)\ge0$ on $[a,b]$ then
\[A=\int_a^b f(x)\,dx\]
is the area below the curve $y=f(x)$ and above the $x$-axis.  But since the $y$-axis is just the curve $y=0$, the above integral is also the area between the curve $y=f(x)$ and the curve $y=0$.  If the lower curve is $y=g(x)$ instead of $y=0$ we get the following result:

\theorem{If $y=f(x)$ and $y=g(x)$ are integrable on the $x$-interval $[a,b]$ with $f(x)\ge g(x)$ on the interval then the \textbf{area between the curves} $y=f(x)$ and $y=g(x)$ and the lines $x=a$ and $x=b$ is 
\[A=\int_a^b \left[f(x)-g(x)\right]\,dx~.\]
}

The situation is illustrated in the following diagram:
\begin{center}
\begin{asy}
// This imports our locally defined custom asymptote functions
import localcalculus;
size(300,150,IgnoreAspect);
real low=.2, high=.8;
real f(real x) {return (x-.5)^2+.2;}
pair F(real x) {return (x,f(x));}
real g(real x) {return -(x-.7)^3+.05;}
pair G(real x) {return (x,g(x));}
drawfunc(f,0.1,low,drawpen=red+dashed,fillpen=invisible);
drawfunc(f,high,.9,drawpen=red+dashed,fillpen=invisible);
drawfunc(f,low,high,drawpen=red+1,fillpen=lightgrey);
drawfunc(g,0.1,low,drawpen=blue+dashed,fillpen=invisible);
drawfunc(g,high,.9,drawpen=blue+dashed,fillpen=invisible);
drawfunc(g,low,high,drawpen=blue+1,fillpen=white);
xaxis("$x$",Arrow(HookHead,size=4),above=true);
yaxis("$y$",Arrow(HookHead,size=4));
real d=.03;
label("$x=a$", (low,-d),S);
label("$x=b$", (high,-d),S);
xequals(low,ymin=-.03,ymax=g(low),dashed);
xequals(high,ymin=-.03,ymax=g(high),dashed);
xequals(low,ymin=g(low),ymax=f(low));
xequals(high,ymin=g(high),ymax=f(high));
label("$A$", (.4,.13),N);
label(Label("$y=f(x)$",red), F(.15), NE);
label(Label("$y=g(x)$",blue), G(.17),SW);
drawcontinuousbar(i=20,a=.2,dx=.025, shift=0.5, f, drawpen=black, fillpen=grey,g);
label(Label("$dx$", fontsize(9)),G(.7-.0125),S);
label(Label("$f(x)-g(x)$", fontsize(9)),(.7-.025,(f(.7-.0125)+g(.7-.0125))/2),W);
draw((.595,(f(.7-.0125)+g(.7-.0125))/2+.025)--(.595,f(.7-.0125)),black,Arrow(size=5));
yequals(f(.7-.0125),xmin=.518,xmax=.67,dashed);
draw((.595,(f(.7-.0125)+g(.7-.0125))/2-.025)--(.595,g(.7-.0125)),black,Arrow(size=5));
yequals(g(.7-.0125),xmin=.518,xmax=.67,dashed);
draw((.85,(f(.7-.0125)+g(.7-.0125))/2+.05)..(.7-.0125,(f(.7-.0125)+g(.7-.0125))/2+.025),black,Arrow(size=5));
label(Label("$dA$", fontsize(9)),(.85,(f(.7-.0125)+g(.7-.0125))/2+.055),E);
\end{asy}
\end{center}

A simple way to remember the theorem is the differential notation.  We are finding the sum $A=\int dA$ of the infinitesimal rectangle areas each of area $dA$ where
\[dA=\underbrace{\left[f(x)-g(x)\right]}_{\mbox{\tiny height}}\cdot\underbrace{\rule[-.25em]{0em}{1em}dx}_{\mbox{\tiny width}}~.\]
Since $f(x)\ge g(x)$ the height of the infinitesimal rectangular area,
$f(x)-g(x)$, is positive, even if one (or both) of the curves lies below the $x$-axis.  Since $a<b$ for an interval $[a,b]$ the width $dx$ is also positive, thereby ensuring a positive area element $dA$.

Another useful way to remember the result is that the area between the curves $y=f(x)$ and $y=g(x)$ is just the area under the curve $y=f(x)$ minus the area under the curve $y=g(x)$.  This is verified by using the properties of the definite integral to get:
\[A=\int_a^b \left[f(x)-g(x)\right]\,dx=\int_a^b f(x)\,dx-\int_a^b g(x)\,dx\]
This interpretation gives the proper area even when one or both of the curves lie below the $y$-axis.  (Think about it!)

\begin{example}
Find the area of the region bounded by $y=2x+4$ and $y=x^2+2x+3$ between $x=0$ and $x=\frac{1}{2}$.
\end{example}


Sometimes one is asked to find the area between two curves $y=h_1(x)$
and $y=h_2(x)$ with no endpoints $a$, $b$ given.  In that case the
curves in question must intersect at least twice to form one (or more)
regions bounded by the two curves.  The problem is illustrated below.
\begin{center}
\begin{asy}
// This imports our locally defined custom asymptote functions
import localcalculus;
size(300,150,IgnoreAspect);
real low=-1.2, high=1.2;
real x0=-0.918684, x1=-0.335629, x2=1.051201;
real f(real x) {return 3*x*(x-1)*(x+1);}
pair F(real x) {return (x,f(x));}
real g(real x) {return exp(-x^2);}
pair G(real x) {return (x,g(x));}
drawfunc(f,low,x0,drawpen=red+dashed,fillpen=invisible);
drawfunc(g,low,x0,drawpen=blue+dashed,fillpen=invisible);
drawfunc(f,x0,x1,drawpen=red+1,fillpen=lightgrey);
drawfunc(g,x0,x1,drawpen=blue+1,fillpen=white);
drawfunc(g,x1,x2,drawpen=blue+1,fillpen=grey);
drawfunc(f,x1,0,drawpen=red+1,fillpen=white);
drawfunc(f,0,1,drawpen=red+1,fillpen=grey);
drawfunc(f,1,x2,drawpen=red+1,fillpen=white);
drawfunc(f,x2,high,drawpen=red+dashed,fillpen=invisible);
drawfunc(g,x2,high,drawpen=blue+dashed,fillpen=invisible);
xaxis("$x$",Arrow(HookHead,size=4),above=true);
yaxis("$y$",Arrow(HookHead,size=4),above=true);
real d=.03;
label("$x_0$", (x0,-d),S);
label("$x_1$", (x1,-d),S);
label("$x_2$", (x2,-d),S);
xequals(x0,ymin=-.03,ymax=f(x0),dashed);
xequals(x1,ymin=-.03,ymax=f(x1),dashed);
xequals(x2,ymin=-.03,ymax=f(x2),dashed);
label("$A_1$", (-.65,.68),N);
label("$A_2$", (.4,.13),N);
label(Label("$y=h_1(x)$",red), F(-.6), NW);
label(Label("$y=h_2(x)$",blue), G(-.8),SE);
label(Label("$y=h_1(x)$",red), F(.5),SW);
label(Label("$y=h_2(x)$",blue), G(.5),NE);
\end{asy}
\end{center}
Here the two curves intersect at three points with $x$-coordinates $x_0$, $x_1$, and $x_2$.  The total area between the curves $A=A_1+A_2$ where the light grey area $A_1$ is over $[x_0,x_1]$ and has $h_1(x)\ge h_2(x)$, while the dark grey area $A_2$ is over $[x_1,x_2]$ and has $h_2(x)\ge h_1(x)$. In general proceed as follows.

\begin{method}
\vspace{-1em}
\begin{enumerate}
\item Find the $x$-coordinates of the intersection points of the two
  curves.  These will determine where each bounded subregion begins and
  ends.  Since an intersection point must lie on both curves this
  requires that $h_1(x)=y=h_2(x)$.  In other words we must solve:
\[h_1(x)=h_2(x)\]
for $x$ to get the solutions $x_i$.

\item For each interval corresponding to a bounded subregion one must
  determine which curve is higher than the other, i.e. which is $f(x)$
  and which $g(x)$ in the area formula.  This can be achieved by a
  sketch of the curve or consideration of the values of $h_1(x)$ and
  $h_2(x)$ of a test point $x$ in the interval.  If two or more
  regions are bounded by the curves then $h_1(x)$ and $h_2(x)$ will
  typically alternate being the higher curve.
\item Calculate the area of each subregion using the area formula and add
  them together.  (If any subregion area results in a negative
  value you have misidentified the higher curve.)
\end{enumerate}
\end{method}

\begin{example}
Find the area of the region bounded by the following curves:
\begin{enumerate}
\item $y=2x+4$ and $y=x^2+2x+3$ 
\item $y=x^2$ and $y=18-x^2$
\item $y=x^2$ and $y=(x-2)^2$ from $x=0$ to $x=3$
\end{enumerate}
\end{example}

Sometimes the region for which one wants an area is better described by functions $x=f(y)$ and $x=g(y)$ denoting the right and left boundaries of the region respectively.  One then has the result:

\theorem{If $x=f(y)$ and $x=g(y)$ are integrable on the $y$-interval $[c,d]$ with $f(y)\ge g(y)$ on the interval then the \textbf{area between the curves} $x=f(y)$ and $x=g(y)$ and the lines $y=c$ and $y=d$ is 
\[A=\int_c^d \left[f(y)-g(y)\right]\,dy~.\]
}
The situation is depicted below:
\begin{center}
\asycode{%
import localcalculus;
size(200,150,IgnoreAspect);
real low=.2, high=.8;
real f(real y) {return -(y-.5)^2+.4;}
pair F(real y) {return (f(y),y);}
real g(real y) {return -(y-.57)^3+.1;}
pair G(real y) {return (g(y),y);}
ydrawfunc(f,0.1,low,drawpen=red+dashed,fillpen=invisible);
ydrawfunc(f,high,.9,drawpen=red+dashed,fillpen=invisible);
ydrawfunc(f,low,high,drawpen=red+1,fillpen=lightgrey);
ydrawfunc(g,0.1,low,drawpen=blue+dashed,fillpen=invisible);
ydrawfunc(g,high,.9,drawpen=blue+dashed,fillpen=invisible);
ydrawfunc(g,low,high,drawpen=blue+1,fillpen=white);
xaxis("$x$",Arrow(HookHead,size=4),above=true);
yaxis("$y$",Arrow(HookHead,size=4),above=true);
real d=.01;
label("$y=c$", (-d,low-.01),W);
label("$y=d$", (-d,high),W);
yequals(low,xmin=-.01,xmax=g(low),dashed);
yequals(high,xmin=-.01,xmax=g(high),dashed);
yequals(low,xmin=g(low),xmax=f(low));
yequals(high,xmin=g(high),xmax=f(high));
label("$A$", (.9*(f(.6)+g(.6))/2,.6),N);
label(Label("$x=f(y)$",red), F(high+.05), NE);
label(Label("$x=g(y)$",blue), G(high+.05),NE);
path g=box((f(.4),.4-.025),(g(.4),.4+.025));
draw(g,black);
filldraw(g,grey);
label(Label("$dy$", fontsize(9)),G(.4),W);
label(Label("$f(y)-g(y)$", fontsize(9)),((f(.4)+g(.4))/2,.4+.025),N);
draw(((f(.4)+g(.4))/2+.064,.47)--(f(.4),.47),black,Arrow(size=5));
xequals(f(.4),ymin=.4,ymax=.53,dashed);
draw(((f(.4)+g(.4))/2-.064,.47)--(g(.4),.47),black,Arrow(size=5));
xequals(g(.4),ymin=.4,ymax=.53,dashed);
draw((f(.4)+.005,.3)..((f(.4)+g(.4))/2+.085,.4),black,Arrow(size=5));
label(Label("$dA$", fontsize(9)),(f(.4),.29),E);
}
\end{center}

In this case the integral represents the addition of horizontal area elements $dA$ of area 
\[dA=\underbrace{\left[f(y)-g(y)\right]}_{\mbox{\tiny width}}\cdot\underbrace{\rule[-.25em]{0em}{1em}dy}_{\mbox{\tiny height}}~.\]
When only the region bounded by $x=h_1(y)$ and $x=h_2(y)$ is requested with no interval $[c,d]$ given one must solve $h_1(y)=h_2(y)$ to find the $y$-values $y_i$ which enclose the bounded regions and identify the greater curve ($x=f(y)$) and the lesser curve ($x=g(y)$) for each interval.
\begin{example}
Find the area of the region bounded by the following curves:
\begin{multicols}{2}
\begin{enumerate}
\item $y^2=2x+10$ and $y=x+1$
\item $2y^2=x+4$ and $x=y^2$
\end{enumerate}
\end{multicols}
\end{example}
If given a choice of doing a vertical or horizontal area analysis of a bounded region one should consider:
\begin{itemize}
\item Whether the enclosing curves can be written as \textbf{functions} of $x$ or $y$.
\item Whether the area is comprised of any horizontal or vertical lines.
\item Whether the area would require piecewise defined functions along either direction.
\end{itemize}

\begin{example}
Find the area of the region bounded by the following curves:
\begin{enumerate}
\item $x^2+y=1$ and $x-y=1$
\item $y^2=4+x$ and $y^2+x=2$
\item $y=x+6$, $y=x^3$, and $2y+x=0$
\end{enumerate}
\end{example}

\begin{exercise}
\input{INTEGRATION/area-between-curves}
\end{exercise}

\section{Net Change}
If a variable $y$ is a function $f$ of $x$, then as $x$ changes from $x_1$ to $x_2$, and so undergoes a change $\Delta x=x_2-x_1$, there is a corresponding change in $y$ of $\Delta y=y_2-y_1=f(x_2)-f(x_1)$.  Assuming $f$ has continuous first derivative $f'$ on $[x_1,x_2]$ it follows by the Fundamental Theorem of Calculus that the net change in $y$ is
\[\Delta y=\int_{x_1}^{x_2}f'(x)\,dx\ .\]
In other words, if we know the derivative $\frac{dy}{dx}=f'(x)$, we can calculate the change in $y$ from its initial value $y_1$ at $x_1$ as $x$ changes to $x_2$.  In our formula, one notes that since the differential $dy$ is $dy=f'(x)\,dx$ the total change in $y$, $\Delta y$, is just the sum of infinitesimal changes in $y$, i.e. $\Delta y=\int_{y_1}^{y_2} dy$\, as one expects.

Often the independent variable $x$ is time $t$.  For instance, an object undergoing motion in one spatial dimension with velocity $v=\frac{ds}{dt}$ will have a total change in displacement $s(t)$ given by
\[\Delta s=\int_{t_1}^{t_2}\frac{ds}{dt}\,dt=\int_{t_1}^{t_2}v\,dt\]
between times $t_1$ and $t_2$.

\begin{example}
A ball thrown vertically upward has velocity given by $v(t)=-10t+18$ in m/s.  What is the total change in displacement of the ball between $t=1$ and $t=2$ seconds?
\end{example}

\begin{example}
Over the first 20~years of its existence a factory had a production rate of units given by
\[\frac{dU}{dt}=1000+150t\ [\mbox{units}/\mbox{year}]\,.\]
How many units did the factory produce in its first $20$~years?
\end{example}

\begin{example}
In Question~\ref{itm:greatpyramid} of Example~\ref{example:relatedrates} (page~\pageref*{itm:greatpyramid}), the rate of change of height of the pyramid frustum with time was
\[\frac{dh}{dt}=\frac{1}{B^2\left(1-\frac{h}{H}\right)^2}R~,\]
where $B=230$~m was the length of the base of the pyramid, $H=150$~m was its final height, and $R=360$~m$^3$/day was the constant rate of change of volume with time.  The rate of change of time with respect to height is the reciprocal:
\[\frac{dt}{dh}=\frac{B^2}{R}\left(1-\frac{h}{H}\right)^2~.\]
How long did it take to build the top third of the pyramid?  (i.e. from 2/3 of its final height to its final height.)\footnotemark
\end{example}
\footnotetext{Note you can check your answer directly by working out the volume of the top third of the pyramid and dividing by $R$\,.}

\textbook{\clearpage}%Required to get answer ref on correct page.
\begin{exercise}
\input{INTEGRATION/distances-and-net-change}
\end{exercise}

\section{Differential Equations}
We are accustomed to solving equations like $x^3-4x=0$ to find those values of $x$ that make the equation true (i.e. the solutions, here $x=-2$, $x=0$, and $x=2$.).  We now consider equations where the unknown is not a value $x$, but rather a function $y=f(x)$.

\definition{An equation which contains an unknown function and at least one of its derivatives is called at \textbf{differential equation}.}
\begin{example}
$\displaystyle y''+\sin(xy)+2=\frac{1}{x}$ is a differential equation involving unknown function $y=f(x)$.
\end{example}

\definition{The highest order derivative that occurs in a differential equation is called the \textbf{order} of the differential equation.}
\begin{example}The order of the following differential equations is as follows:
\begin{enumerate}
\item $y'+3xy=\sin x$\ \ ($1^{\mbox{\tiny st}}$ order)
\item $\displaystyle\frac{d^2y}{dx^2}+3\frac{dy}{dx}+5y=\cos x$\ \ ($2^{\mbox{\tiny nd}}$ order)
\item $xy'+3y\sin x=x^2+5$\ \ ($1^{\mbox{\tiny st}}$ order)
\end{enumerate}
\end{example}

\definition{If a function $y=f(x)$ and its derivatives  when substituted into a differential equation satisfies that equation then $f(x)$ is called a \textbf{solution} of the differential equation.}

\begin{example}\label{ex:desolution} Show that the given function is a solution of the given differential equation:
\begin{enumerate}
\item $\displaystyle y=2x^2+cx$\, in\, $\displaystyle xy'-y=2x^2$
\item $\displaystyle y=x\sin x$\, in\, $\displaystyle y''+y-2\cos x=0$
\end{enumerate}
\end{example}

The first solution in Example~\ref*{ex:desolution}, containing a constant, is called a \textbf{general solution} to the differential equation.\footnote{Other solutions called \textbf{singular solutions} may also arise for certain differential equations.} It can be shown that $n$ different constants are required for a general solution to a differential equation of order $n$.  Choosing different values for the constant(s) in a general solution generates a family of solutions to the differential equation.  Assigning specific values to the constants in a general solution yields a \textbf{particular solution} to the differential equation.  The second solution in Example~\ref*{ex:desolution} is a particular solution to that differential equation.  The next graph shows particular solutions generated by using the constants $c=1/10$, $c=1$, and $c=3$ respectively in the general solution of the first problem in Example~\ref*{ex:desolution}.  
\begin{center}
\resizebox{5cm}{!}{\asycode{%
import graph;
size(200,0);
real a=3;
real b=1;
real f(real x) {return 2x^2+a*x;}
pair F(real x) {return (x,f(x));}
real g(real x) {return sqrt((b-x^2)/3);}
pair G(real x) {return (x,g(x));}
xaxis("$x$",Arrow(HookHead,size=4));
yaxis("$y$",Arrow(HookHead,size=4));
draw(graph(f,0,1.13,operator --),red+2);
label("$y=2x^2+3x$~~($c=3$)",F(1.13),NE);
dot(F(1),black+4);
label("$(1,5)$",F(1),NE);
a=1;
draw(graph(f,0,1.13,operator --),red+2);
label("$y=2x^2+x$~~($c=1$)",F(1.13),NE);
dot(F(1),black+4);
label("$(1,3)$",F(1),NE);
a=0.1;
draw(graph(f,0,1.13,operator --),red+2);
label("$y=2x^2+\frac{x}{10}$~~($c=1/10$)",F(1.13),NE);
dot(F(1),black+4);
label("$(1,21/10)$",F(1),NE);
labelx("$1$",1);
xequals(1,ymin=-.05,ymax=.05);
}}
\end{center}

Physical problems often require finding a function that is not only a solution to a differential equation but also satisfies \textbf{initial conditions} at some value of the independent variable.  For example one may require the function satisfy the constraint $y(t_0)=y_0$ for given constants $t_0$ and $y_0$.  Here the terminology \emph{initial} arises from problems for which the independent variable is time.  An \textbf{initial value problem} is one for which one seeks a solution to a differential equation that satisfies a given set of initial conditions.  The initial conditions of the problem determine the constants of the general solution to the differential equation.  The resulting particular solution is the physical solution to the problem.  Higher order differential equations require more initial conditions, which may involve either the function or its derivatives having specified values at time $t_0$.

\begin{example}
\begin{enumerate}
\item Find the value of $c$ that makes $y=2x^2+cx$ a solution to the initial value problem $xy'-y=2x^2$, $y(1)=5$~.
\item For the initial value problem $y'+y\tan t=\sec t$, $y(0)=2$, show that $y=\sin t+C\cos t$ is a general solution to the differential equation and find the value $C$ that makes it satisfy the initial condition.
\end{enumerate}
\end{example}

As the previous example shows, solving an initial value problem given a general solution to the differential equation amounts to solving one (or more) equations for the unknown constant(s).  An equation is generated using each of the initial conditions substituted into the general solution, or potentially its derivatives.  So the central problem becomes how to find the general solution to a given differential equation.  Books and courses are devoted to that problem.  However there is a class of such differential equations we can solve at this point, namely those of the form
\[y^{(n)}=g(x)\ ,\]
where $y^{(n)}$ is the $n^{\scriptstyle th}$ derivative of $y$ with respect to $x$ and $g(x)$ is a function of $x$.  When $n=1$ we have
\[y'=g(x)\ .\]
In Section~\ref{sec:antiderivatives} we have already seen that the solution to such a problem is just the \emph{antiderivative} of $g(x)$.  Since the indefinite integral is just the antiderivative, it follows that the solution of
\[y'=g(x)\]
is just
\[y=\int\! g(x)\,dx+C\,.\]
Here the constant of integration has been written explicitly.  It is this constant that make the indefinite integral the general solution to the differential equation.  The constant $C$ will be determined by the given initial condition in an initial value problem.

For the higher order differential equation
\[y^{(n)}=g(x)\]
one can, in principle, integrate $n$ times with respect to $x$.  Each such integration will introduce a new constant of integration so that our general solution $y(x)$ will contain $n$ constants as expected for this order $n$ differential equation.  These, in turn, must be determined by $n$ initial conditions to find the physical solution to the initial value problem. 

\begin{example}
Solve the following differential equations and initial value problems.
\begin{enumerate}
\item $\displaystyle \frac{dy}{dx}=\sin^2\!x\cos x$
\item $\displaystyle y''=x^2+\cos x$
\item $\displaystyle \sqrt{1-x^2}+\frac{x}{y'}=0$, $y(0)=3$
\item $\displaystyle \frac{d^2 y}{dt^2}=-9.8~\mbox{m/s}^2$, $y(0)=3$~m, $\displaystyle\left.\frac{dy}{dt}\right|_{t=0}=2$~m/s
\end{enumerate}
\end{example}

\begin{exercise}
\input{INTEGRATION/differential-equations}
\end{exercise}

\clearpage
\textbook{\addtoanswerkey{\clearpage}}
\begin{reviewexercise}
\input{INTEGRATION/integration-review}
\end{reviewexercise}
%
% TODO
%
% Give more insight into summation formulas for powers of i?  Make this
% an exercise or appendix.
%
% Add computer problem to Exercise 5-3 asking to calculate the area of
% an arbitrary (convex) polygon with vertices (x_i,y_i) by subdividing it
% into triangles, working out the side lengths using the distance formula and
% finally using Heron's formula to work out the triangle area.
%
% Add Graphs to Theorem 5-5 illustrating their meaning.
%
% Should I introduce notation for converting limits from one variable to
% another?  i.e. like x|_a^b \rightarrow u_c^d ?
%
% 
