\documentclass[12pt,oneside]{amsart}
\usepackage{amssymb, amsmath, amsthm}

\usepackage{epsfig}
\usepackage{epstopdf}
\usepackage{graphicx}
\usepackage{color}
%\usepackage[shortalphabetic]{amsrefs}
\usepackage{mathptmx}
%\usepackage{hyperref}
%\usepackage{url}

%\usepackage{pinlabel}

%Define theorem styles
     \theoremstyle{definition}
      \newtheorem{theorem}{Theorem}[section]
      \newtheorem*{theorem*}{Theorem}
      \newtheorem{definition}[theorem]{Definition}
      \newtheorem{exercise}[theorem]{Exercise}
      \newtheorem{example}[theorem]{Example}
      \newtheorem{conj}{Conjecture}
      \newtheorem{proposition}[theorem]{Proposition}
      \newtheorem{corollary}[theorem]{Corollary}
      \newtheorem{claim}{Claim}
      \newtheorem{lemma}[theorem]{Lemma}
    
   % Define new commands

      \newcommand{\R}{{\mathbb R}}
      \newcommand{\C}{\mathbb C}
      \newcommand{\Z}{\mathbb Z}
	\newcommand{\N}{\mathbb N}
	\newcommand{\Q}{\mathbb Q}
      \newcommand{\nil}{\varnothing}
	\newcommand{\til}{\tilde}
	\newcommand{\boundary}{\partial}
	\newcommand{\m}{\backslash}
	\newcommand{\mc}[1]{\mathcal{#1}}
	\newcommand{\vect}[1]{\mathbf{#1}}
	\newcommand{\prob}[1]{\textbf{Problem {#1}: }}
	\newcommand{\defn}[1]{\textbf{#1}}
	\newcommand{\ob}[1]{\overline{#1}}
	\newcommand{\kernel}{\operatorname{ker}}
	\newcommand{\im}{\operatorname{im}}
	\newcommand{\tr}{\operatorname{tr}}
	\newcommand{\rank}{\operatorname{rank}}
	\newcommand{\rref}{\operatorname{rref}}
	
	\newcommand{\diver}{\operatorname{div}}
	\newcommand{\curl}{\operatorname{curl}}
	\newcommand{\scurl}{\operatorname{scalar \text{ } curl}}
	\newcommand{\grad}{\operatorname{grad}}
	\newcommand{\vl}{\cdot d\vect{s}}
	\newcommand{\wihat}[1]{\widehat{#1}}

	\newcommand{\lpartial}[1]{\frac{\partial}{\partial #1}}
	\newcommand{\llpartial}[2]{\frac{\partial #1}{\partial #2}}
	\newcommand{\co}{\mskip0.5mu\colon\thinspace} 
	\newcommand{\spacing}{\parskip 6.6pt \parindent 0pt}

	\newcommand{\custthm}[2]{
			\framebox[0.95\linewidth]{
			\begin{minipage}{0.9\linewidth}

			\begin{theorem}\label{#1}
			#2	
			\end{theorem}
			\end{minipage}
			}
	}
	
	
	
	\newenvironment{enumer}
		{\begin{enumerate}
		\parskip 6.6pt
		\parindent 0pt
		\renewcommand{\labelenumi}{(\alph{enumi})}
		
		}
		{\end{enumerate}}


	  
\parskip 6.6pt
\parindent 0pt

%\renewcommand{\labelenumi}{(\alph{enumi})}


	
   % The following mysterious maneuver gets rid of AMS junk at the top
   % and bottom of the first page.
   
      \makeatletter
      \def\@setcopyright{}
      \def\serieslogo@{}
      \makeatother
   
% This ends the preamble.  We now proceed to the document itself.

\begin{document}


   % title

   \title[short title]{long title}
   \author{}
   % Note that the short title for running heads goes in square
   % brackets.  This is optional.  The long title goes in curly
   % braces.  In the long title, line breaks are indicated by \\.


%Here are two sets of commands for including images.
  
%\begin{center}
%\begin{figure}[h]
%\includegraphics[scale=0.4]{FinalExam-prob10.pdf}
%\end{figure}
%\end{center}

%\begin{figure}[ht] 
%\scalebox{0.5}{\input{Pen.eps_t}}
%\caption{A pox on both your houses!}
%\end{figure}

   

   % today's date, or fill in whatever date you prefer
   \date{\today}

\framebox{
\raisebox{0in}[.5in][.2in]{
\textbf{MA 302: Selected Course notes} 
}
}

\tableofcontents

\newpage

\section{Revisiting Calculus 1 and 2 with a view toward Vector Calculus}

This section takes a look at some functions you may have encountered and interprets them in various ways. Each of these ways will be studied and generalized in this course.

\framebox{
\raisebox{0in}[.5in][.2in]{
\textit{Five Views of $f(x) = x^3$ and its derivative $f'(x) = 3x^2$} 
}}

\textbf{Viewpoint 1:} The Graph

The graph of $f(x)$ is the set of points $(x,y) \in \R^2$ such that $y = f(x)$. The derivative $f'(a)$ is the slope of the line tangent to the graph at the point $(a,f(a))$
\begin{center}
\scalebox{.5}{\includegraphics{Figures/GraphXcubed}}
\end{center}


\textbf{Viewpoint 2:} $t$ is time and $f(t)$ is position

In the figure, the labels below the line correspond to position $f(t)$. Blue dots corresponding to times $t = -1, 0, 1, 2$ have been placed on the line. The derivative $f'(t)$ is the velocity (speed and direction) of the object at time $t$.

\begin{center}
\scalebox{.5}{\includegraphics{Figures/1DPath}}
\end{center}

\textbf{Viewpoint 3:} $x$ represents position and $f(x)$ represents temperature (or amount)

In the image, the labels below the line correspond to $x$ and the colors correspond to $f(x)$ with warmer colors representing a greater temperature (or amount) and cooler colors representing smaller temperatures (or amounts.) This is called a \defn{scalar field}. The derivative $f'(x)$ represents the direction and amount of greatest increase in temperature.

\begin{center}
\scalebox{.37}{\includegraphics{Figures/1DScalarField}}
\end{center}

\textbf{Viewpoint 4:} $x$ is position and $f(x)$ is a direction.

In the image, the labels below the line correspond to $x$ and the arrows correspond to $f(x)$. If $f(x) < 0$, the arrow points left; if $f(x) > 0$, the arrow points right. The length of the arrow corresponds to $|f(x)|$.
The derivative $f'(x)$ seems to measure how much stuff is flowing into or out of $x$.

\begin{center}
\scalebox{.37}{\includegraphics{Figures/1DVectorField}}
\end{center}

\textbf{Viewpoint 5:} $x$ is position and $f(x)$ is position.

In this case $f$ is a change-of-coordinates function. Each point on the line has two labels, we get between them by using $f$ (or its inverse $f^{-1}(x) = \sqrt[3]{x}$.

\begin{center}
\scalebox{.8}{\includegraphics{Figures/1DCC}}
\end{center}

To figure out what $f'(2)$ (say) represents, consider the difference quotient $\frac{f(2 + \epsilon) - f(2)}{\epsilon}$. The denominator is the length of the interval $I = [2, 2 + \epsilon]$. The numerator is the length of the interval obtained by applying $f$ to the interval $I$. Thus, $|\frac{f(2 + \epsilon) - f(2)}{\epsilon}|$ is the scale factor of the map $f$ near $2$. Thus, $|f'(2)|$ is the infinitesimal scale factor of $f$ at $2$.

\newpage

\framebox{
\raisebox{0in}[.5in][.2in]{
\textit{Two views of $f(x,y) = x^2 + y^2$}\newline
}}

\textbf{Viewpoint 1:} The Graph 

The graph is the set of points $(x,y,z) \in \R^3$ such that $z = f(x,y)$. 
\begin{center}
\scalebox{.5}{\includegraphics{Figures/3DGraph}}
\end{center}

The gradient 
\[\nabla f(x,y) = \begin{pmatrix}\lpartial{x}f(x,y) \\ \lpartial{y} f(x,y) \end{pmatrix}\]
is the vector pointing in the direction of greatest increase in $z$ at $(x,y) \in \R^2$. The tangent plane to the graph of $f$ at the point $\vect{a}$ has equation:
\[
L(\vect{x}) = \nabla f(\vect{a}) \cdot (\vect{x} - \vect{a}) + f(\vect{a}).
\]
This is also the equation of the best linear (or affine) approximation to $f$ near $\vect{a}$.

\textbf{Viewpoint 2:} Is not relevant, since the input to the function is two-dimensional and so we shouldn't think of it as being time.

\textbf{Viewpoint 3:} $\vect{x}$ is position and $f(\vect{x})$ is temperature (or amount).

As with functions from $\R$ to $\R$, this viewpoint makes sense for functions from $\R^2$ to $\R$. Below is a temperature plot of this scalar field:

\begin{center}
\scalebox{.3}{\includegraphics{Figures/2DScalarField}}
\end{center}

The gradient $\nabla f(x,y)$ points in the direction of greatest temperature increase.

\textbf{Viewpoint 4:} Does not make sense since the 1-dimensional output cannot express a direction in 2-dimensions.

\textbf{Viewpoint 5:} Does not make sense since the input and output to $f$ have different dimensions.

\newpage

\framebox{
\raisebox{0in}[.5in][.2in]{\textit{Two views of $f(t) = (t,t^2)$}
}}

\textbf{Viewpoint 1:} The Graph

Technically this makes sense. We could plot the points $(x,y,z) \in \R^3$ such that $(y,z) = f(x)$. But we usually don't do this.

\textbf{Viewpoint 2:} $t$ represents time, and $f(t)$ represents position.

This makes sense. For each time $t$, we can plot the point $(t,t^2)$. We obtain a curve in $\R^2$. We can label this curve with the direction we are travelling on it and label particular points with what time we are at that point.

\begin{center}
\scalebox{.5}{\includegraphics{Figures/2DPath}}
\end{center}

The derivative $f'(t) = (1,2t)$ tells us what direction we are travelling in at each $t$ value and $||f'(t)|| = \sqrt{1 + 4t^2}$ tells us our speed.

\textbf{Viewpoints 3 - 5:} These do not make sense for this function. Why is that?

\newpage

\framebox{
\raisebox{0in}[.5in][.2in]{\textit{3 Views of $f(x,y) = (2x - y, x + y)$}
}}

\textbf{Viewpoint 1:} The Graph

Technically, this makes sense. We could plot points $(x,y,z,w) \in \R^4$ such that $(z,w) = f(x,y)$. But we usually don't do this.

\textbf{Viewpoints 2 - 3:} These don't make sense in this context. Why is that?

\textbf{Viewpoint 4:} $\vect{x}$ is position and $f(\vect{x})$ is position.

This is called a vector field. At each point $(x,y) \in \R^2$ we draw an arrow of length $||f(\vect{x})||$ and pointing in the direction of $f(\vect{x})$. In the computer image below, the color of the arrow indicates how long it is.

\begin{center}
\scalebox{.5}{\includegraphics{Figures/2DVectorField}}
\end{center}

\textbf{Viewpoint 5:} $\vect{x}$ and $f(\vect{x})$ both represent position. 

We say that $f$ is a change of coordinates function. Under this viewpoint, each point of the plane is labelled with both $\vect{x}$ and with $f(\vect{x})$. We think of $f$ as a transformation taking one coordinate system to the other.

\begin{center}
\scalebox{.5}{\includegraphics{Figures/2DCC}}
\end{center}

Notice that the unit vectors $\vect{i} = (1,0)$ and $\vect{j} = (0,1)$ define a square $R$ of area 1. After applying $f$, this square is transformed into a parallelogram defined by the vectors $(2,1)$ and $(-1,1)$. The area of the parallelogram $f(R)$ is equal to $\Bigg|\det\begin{pmatrix}2 & -1 \\ 1 & 1 \end{pmatrix}\Bigg| = 3$. So the transformation $f$ scales the area of $R$ by $3$. It turns out that this is related to the derivative of $f$.

\newpage

\section{Some Linear Algebra}

\subsection{Linear and Affine Functions}
Here is the definition of linear function:

\framebox[0.95\linewidth]{
 	\begin{minipage}{0.9\linewidth}
 	\textbf{Definition:}
A function $L \co \R^n \to \R^m$ is \defn{linear} if for all $\vect{a},\vect{b} \in \R^n$ and $k,m \in \R$ the following equation is true:
\[
L(k\vect{a} + m\vect{b}) = kL(\vect{a}) + m L(\vect{b}.
\]
\end{minipage}
}

\begin{example}
The function $f(x) = 2x$ is linear, since:
\[
f(ka + mb) = 2(ka + mb) = k(2a) + m(2b) = kf(a) + mf(b).
\]
\end{example}
\hrulefill
\begin{example}
The function $f(x) = 2x + 1$ is not linear since:
\[
f(1 + 1) = f(2) = 5
\]
but
\[
f(1) + f(1) = 3 + 3 = 6.
\]
\end{example}
Notice that functions you may have considered to be linear in a calculus course will not count as linear in this course.

\hrulefill

\begin{example}
The function $h\begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} 2x - y \\ x + y \end{pmatrix}$ is linear. To see this notice that:
\[
h\left(k\begin{pmatrix}a_1 \\ a_2 \end{pmatrix} + m \begin{pmatrix}b_1 \\ b_2 \end{pmatrix}\right) = h\begin{pmatrix} ka_1 + mb_1 \\ k a_2 + mb_2 \end{pmatrix} = 
\begin{pmatrix}2ka_1 + 2mb_1 - ka_2 - mb_2 \\ ka_1 + mb_1 + ka_2 + mb_2 \end{pmatrix}.
\]
Notice that this equals:

\[
kh\begin{pmatrix}a_1\\ a_2 \end{pmatrix} + m h\begin{pmatrix}b_1 \\ b_2 \end{pmatrix} = k\begin{pmatrix}2 a_1 - a_2 \\ a_1 + a_2 \end{pmatrix} + m\begin{pmatrix}2b_1 - b_2 \\ b_1 + b_2 \end{pmatrix}.
\]
\end{example}
\hrulefill

If you know about matrix multiplication, you should notice that, in the previous example, $h\begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} 2 & -1 \\ 1 & 1 \end{pmatrix}\begin{pmatrix} x \\ y \end{pmatrix}$. 

The following is an important theorem from linear algebra:

\custthm{thm-linearmaps}{
A function $L \co \R^n \to \R^m$ is linear if and only if there exists an $m \times n$ matrix $A$ such that $L(\vect{x}) = A\vect{x}$ for all $\vect{x} \in \R^n$.
}

\framebox[0.95\linewidth]{
 	\begin{minipage}{0.9\linewidth}
 	\textbf{Definition:}
A function $f \co \R^n \to \R^m$ is \defn{affine} if there exists a linear function $L \co \R^n \to \R^m$ and a vector $\vect{b} \in \R^m$ such that for all $\vect{x} \in \R^n$:
\[
f(\vect{x}) = L(\vect{x}) + \vect{b}.
\]
\end{minipage}
}

That is, ``affine'' means ``linear plus a constant''.

Equivalently, there exists an $m \times n$ matrix $A$ and a vector $\vect{b} \in \R^m$ such that $f(\vect{x}) = A\vect{x} + \vect{b}$.

\begin{example}
$f(x) = 2x + 1$ is an affine function.
\end{example}
\hrulefill

\begin{example}
\[
f(x,y) = \begin{pmatrix} 2 x - y + 3 \\ x + y + 1 \end{pmatrix}
\]
is an affine function since
\[
f(\vect{x}) = \begin{pmatrix}2 & -1 \\ 1 & 1 \end{pmatrix} \vect{x} + \begin{pmatrix}3 \\ 1 \end{pmatrix}.
\]
\end{example}
\hrulefill

\subsection{Matrix Multiplication}
As you know we can write a vector $\vect{a} \in \R^n$ in either horizontal
\[(a_1, a_2, \hdots, a_n)\]
or vertical
\[
\begin{pmatrix}a_1 \\ a_2 \\ \vdots \\ a_n \end{pmatrix}
\]
format.

A row vector is different. It is written horizontally without commas:
\[
\begin{pmatrix} a_1 & a_2 & \hdots & a_n \end{pmatrix}.
\]
If we have a row vector $\vect{a} = \begin{pmatrix}a_1 & \hdots & a_n \end{pmatrix}$ and a column vector $\vect{b} = \begin{pmatrix} b_1 \\ \vdots \\ b_n \end{pmatrix}$, we define their product:
\[
\vect{a}\vect{b} = a_1b_1 + a_2b_2 + \hdots + a_nb_n.
\]
This should remind you of the dot product. In fact if we let $\vect{a}^T$ denote the column vector obtained by writing $\vect{a}$ as a column instead of as a row,
\[
\vect{a}\vect{b} = \vect{a}^T \cdot \vect{b}.
\]
Suppose that $A$ is an $m \times n$ matrix:
\[
A = \begin{pmatrix}
a_{11} & a_{12} & a_{13} & \hdots & a_{1n} \\
a_{21} & a_{22} & a_{23} & \hdots & a_{2n} \\
\vdots &&&&\\
a_{m1} & a_{m2}& a_{m3} & \hdots & a_{mn}\\
\end{pmatrix}
\]
Let $\vect{a}_1$ denote the first row, $\vect{a}_2$ the second row, etc. Write:
\[
A = \begin{pmatrix} \vect{a}_1 \\ \vect{a}_2 \\ \vdots \\ \vect{a}_m \end{pmatrix}
\]
Suppose that $B$ is an $n \times p$ matrix:
\[
B = \begin{pmatrix}
b_{11} & b_{12} & b_{13} & \hdots & b_{1p} \\
b_{21} & b_{22} & b_{23} & \hdots & b_{2p} \\
\vdots &&&&\\
b_{n1} & b_{n2}& b_{n3} & \hdots & b_{np}\\
\end{pmatrix}
\]
Let $\vect{b}_1$ denote the first column, $\vect{b}_2$ the second column, etc. Write
\[
B = \begin{pmatrix} \vect{b}_1 & \vect{b}_2 & \vect{b}_3 & \hdots & \vect{b}_p \end{pmatrix}.
\]
Define the product of $A$ and $B$ to be
\[
AB = \begin{pmatrix}
\vect{a}_1\vect{b}_1 & \vect{a}_1 \vect{b}_2 & \hdots & \vect{a}_1 \vect{b}_p \\
\vect{a}_2 \vect{b}_1 & \vect{a}_2 \vect{b}_2 & \hdots & \vect{a}_2 \vect{b}_p \\
\vdots &&& \\
\vect{a}_m \vect{b}_1 & \vect{a}_m \vect{b}_2 & \hdots & \vect{a}_m \vect{b}_p \\
\end{pmatrix}
\]

Notice this is the $m \times p$ matrix whose entry in the $i$th row and $j$th column is the product of the $i$th row of $A$ with the $j$th column of $B$.

\begin{example}
Let $A = \begin{pmatrix}2 & -1 \\ 1 & 1 \end{pmatrix}$. Then
\[
A \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix}2x - y \\ x + y \end{pmatrix}.
\]
\end{example}

\hrulefill

\begin{example}
Let $A = \begin{pmatrix} 2 & 3 \\ 1 & -1 \end{pmatrix}$. Let $B = \begin{pmatrix}5 & 7 \\ 0 & 6 \end{pmatrix}$. Then
\[
AB = \begin{pmatrix}2(5) + 3(0) & 2(7) + 3(6) \\ 1(5) + (-1)(0) & 1(7) + (-1)(6) \end{pmatrix} = \begin{pmatrix}10 & 32 \\ 5 & 1 \end{pmatrix}.
\]
\end{example}
\hrulefill

\section{Differentiation}

\subsection{The derivative}
We are now ready to define the derivative of a function $f \co \R^n \to \R^m$ and to define what it means to be differentiable. The concept is modelled on the definition from MA 122, so you should review those definitions.

\framebox[0.95\linewidth]{
 	\begin{minipage}{0.9\linewidth}
 	\textbf{Definition:}
A function $f \co \R^n \to \R^m$ is \defn{differentiable} at $\vect{a} \in \R^n$ if there exists an affine function $L \co \R^n \to \R^m$ such that
\begin{itemize}
\item $f(\vect{a}) = L(\vect{a})$
\item \[\lim\limits_{\vect{x} \to \vect{a}} \frac{||L(\vect{x}) - f(\vect{x})||}{||\vect{x} - \vect{a}||} = 0 \]
\end{itemize}
 	\end{minipage}
 	}
 	
A few remarks:
\begin{enumerate}
\item The affine function $L$ is called the ``affine approximation'' to $f$ at $\vect{a}$. The criteria ensure that the relative error between $L$ and $f$ goes to zero and that they are actually equal at $\vect{a}$.
\item In past math classes, $L$ was probably called the ``linear approximation'' to $f$, but it is, in fact, an affine function that is not necessarily linear.
\item Since $L$ is an affine function, there exists an $m \times n$ matrix $A$ such that $L(\vect{x}) = A(\vect{x}- \vect{a}) + f(\vect{a})$. This matrix is called the \defn{derivative} of $f$ at $\vect{a}$ and is denoted $Df(\vect{a})$. 
\item If $f$ is differentiable and if $Df(\vect{x})$ is continuous, then we say that $f$ is $C^1$. 
\end{enumerate}

\custthm{thm-derivativematrix}{
Suppose that $f\co \R^n \to \R^m$ is differentiable at $\vect{a}$ and that $f(x_1,x_2, \hdots, x_n) = \begin{pmatrix}f_1(x_1, \hdots, x_n) \\ f_2(x_1, \hdots, x_n) \\ \vdots \\ f_m(x_1, \hdots, x_n) \end{pmatrix}$. 

Then $Df(\vect{a})$ is the matrix
\[
Df(\vect{a}) = \begin{pmatrix}
\llpartial{f_1}{x_1}(\vect{a}) & \llpartial{f_1}{x_2}(\vect{a}) & \llpartial{f_1}{x_3}(\vect{a}) &\hdots & \llpartial{f_1}{x_n}(\vect{a})\\
\llpartial{f_2}{x_1}(\vect{a}) & \llpartial{f_2}{x_2}(\vect{a}) & \llpartial{f_2}{x_3}(\vect{a}) &\hdots & \llpartial{f_2}{x_n}(\vect{a})\\
\llpartial{f_3}{x_1}(\vect{a}) & \llpartial{f_3}{x_2}(\vect{a}) & \llpartial{f_3}{x_3}(\vect{a}) &\hdots & \llpartial{f_3}{x_n}(\vect{a})\\
\vdots & &&\vdots \\
\llpartial{f_m}{x_1}(\vect{a}) & \llpartial{f_m}{x_2}(\vect{a}) & \llpartial{f_m}{x_3}(\vect{a}) &\hdots & \llpartial{f_m}{x_n}(\vect{a})\\
\end{pmatrix}
\]
The entry in the $i$th row and $j$th column is the partial derivative at $\vect{a}$ of $f_i$ with respect to $x_j$. Equivalently, the $i$th row consists of $Df_i(\vect{a})$.
}

\begin{example}
If $f(x,y) = x^2 + 3yx$ then $Df(x,y) = \begin{pmatrix} 2x + 3y & 3x \end{pmatrix}$.
\end{example}
\hrulefill

\begin{example}
If $f(x,y) = \begin{pmatrix}2x - 3y \\ x + y \end{pmatrix}$ then $Df(x,y) = \begin{pmatrix}2 & - 3 \\ 1 & 1 \end{pmatrix}$. Notice that this is the transpose of the gradient fo $f$.
\end{example}
\hrulefill

It is a fact that if $f\co \R^n \to \R^n$ is a $C^1$ change of coordinates function then the amount that $f$ scales $n$-dimensional volume near $\vect{a}$ is approximately the absolute value of the determinant of $Df(\vect{a})$. Here is an example:

\begin{example}
Define $f(r,\theta) = \begin{pmatrix} r \cos \theta \\ r \sin \theta \end{pmatrix}$. The derivative of $f$ is
\[
Df(r,\theta) = \begin{pmatrix} \cos \theta & -r\sin \theta \\ \sin \theta & r \cos \theta \end{pmatrix}.
\]
This has determinant equal to $r\cos^2\theta + r\sin^2\theta = r$.  In the $r-\theta$ plane, the square $[r, r + \Delta r] \times [\theta, \theta + \Delta \theta]$ has area $\Delta \theta \Delta r$. Applying $f$ to this square converts it into the set of $(x,y)$ values between the circle of radius $r$ and the circle of radius $r + \Delta r$ and with angle between $\theta$ and $\theta + \Delta \theta$. Elementary geometry guarantees that the area of this region is \[\big( \frac{\Delta \theta}{2\pi}\big) \pi (r + \Delta r)^2 - \big(\frac{\Delta \theta}{2\pi}\big)\pi r^2 = (\Delta \theta/2)(2 r \Delta r + (\Delta r)^2).\] The actual scaling factor is, therefore,
\[
\frac{1}{2}(2r + \Delta r)
\]
which goes to $r$ as $\Delta r \to 0^+$.
\end{example}
\hrulefill
\begin{example}
Define $f\co \R^2 \to \R^4$ by
\[f(x,y) = (xy, x^2y, xy^3, x^4e^y)\]
Then
\[
Df(x,y) = \begin{pmatrix}
y & x\\
2xy & x^2\\
y^3 & 3xy^2\\
4x^3e^y & x^4e^y\\
\end{pmatrix}\]
and 
\[
Df(1,2)= \begin{pmatrix}
2 & 1\\
4 & 1\\
8 & 12\\
4e^2 & e^2\\
\end{pmatrix}.\]
\end{example}

Here is another example, demonstrating an important point (to be made later).
\begin{example}
Define $f\co \R^2 \to \R^2$ and $g\co \R^2 \to \R^2$ by
\[\begin{array}{rcl}
f(x,y) &=& (x^2 + 2x, e^y)\\
g(x,y) &=& (\sin(x), 5y + x)\\
\end{array}\]

Notice that we can compose $f$ and $g$ to obtain $f\circ g \co \R^2 \to \R$. A formula for $f \circ g$ is:
\[ f\circ g(x,y) = (\sin^2 x + 2\sin x, e^{5y + x}).\] Notice that $g(0,0) = (0,0)$.

Compare $Df(g(\vect{0}))$, $Dg(\vect{0})$ and $D(f\circ g)(\vect{0})$.

\textbf{Solution:}
\[\begin{array}{rcl}
Df(\vect{0}) &=& \begin{pmatrix}2&0\\0&1\end{pmatrix}\\
Dg(\vect{0}) &=& \begin{pmatrix}1&0\\1&5\end{pmatrix}\\
D(f\circ g)(\vect{0}) &=& \begin{pmatrix}2 &0\\1&5 \end{pmatrix}
\end{array}\]
Notice that:
\[
D(f\circ g)(\vect{0}) = Df(g(\vect{0})) Dg(\vect{0}).
\]
This is an example of the chain rule at work.
\end{example}

\subsection{Differentiability}
\subsubsection{Differentiability}
Throughout this section, let $f\co \R^n \to \R^m$ be a differentiable function and let $f_i$ be the $i$th coordinate function.  That is $f(\vect{x}) = (f_1(\vect{x}), \hdots, f_m(\vect{x}))$.

\custthm{thm-differentiability}{
Suppose that $f \co \R^n \to \R^m$ has the property that each component function $f_i$ is differentiable at $\vect{a}$. Then $f$ is differentiable at $\vect{a}$. Furthermore, $f_i\co \R^n \to \R$ is differentiable at $\vect{a}$, if there is an open ball $X$ containing $\vect{a}$ such that $f_i$ is defined on $X$ and all partial derivatives of $f_i$ exist and are continuous on $X$.
}

\begin{example}
Let $f\co \R^3 \to \R^2$ be defined by
\[
f(x,y,z) = (\ln(|xyz|), x + y + z^2)
\]
Then
\[
Df(x,y,z) = \begin{pmatrix}
1/x & 1/y & 1/z \\
1 & 1 & 2z\\
\end{pmatrix}.
\]

Let $A$ be the coordinate axes in $\R^3$. That is, $A = \{(x,y,z) : xyz = 0\}$. Each entry in the matrix $Df(x,y,z)$ is continuous on $\R^3 - A$. The function $f$ is defined on $\R^3 - A$. Consequently, $f$ is differentiable at each point $\vect{a} \in \R^3 - A$.
\end{example}
\hrulefill

\subsection{The chain rule}
Here is the justly famous chain rule:

\custthm{thm-chainrule}{
Suppose that $g\co \R^n \to \R^m$ and $f\co \R^m \to \R^p$ are functions which are defined on open sets $Y \subset \R^n$ and $X \subset \R^m$ such that $g(Y)\subset X$. Assume that $g$ is differentiable at $\vect{y} \in Y$ and that $f$ is differentiable at $g(\vect{y}) \in X$. Then, $f\circ g \co \R^n \to \R^p$ is differentiable at $\vect{y}$ and 
$D(f\circ g)(\vect{y}) = Df\big(g(\vect{y})\big) Dg(\vect{y}).$
}

\begin{example}
Define $f(x,y) = (x^2, x^2 + y^2)$. Let $\hat{f} \co \R^2 \to \R^2$ be the function $f$ with domain in polar coordinates. What is $D\hat{f}(r,\theta)$?

\textbf{Solution:}
Let $T\co \R^2 \to \R^2$ be the change from polar coordinates to rectangular coordinates. That is,
\[T(r,\theta) = (r\cos \theta, r \sin \theta).\]
Then, by definition, $\hat{f} = f \circ T$. Since the coordinates of $f$ and $T$ are polynomials and trig functions, $f$ and $T$ are everywhere differentiable. A calculation shows that:
\[
Df(x,y) = \begin{pmatrix} 2x & 0 \\2x & 2y\end{pmatrix}.
\]
Thus, 
\[Df(T(r,\theta)) = \begin{pmatrix} 2r\cos \theta &0 \\ 2r\cos\theta & 2r \sin\theta \end{pmatrix}.\]
Another calculation shows that
\[DT(r,\theta) = \begin{pmatrix}\cos \theta & -r\sin\theta \\ \sin\theta & r\cos\theta \end{pmatrix}.\]

Thus, by the chain rule:
\[
D\hat{f}(r,\theta) = \begin{pmatrix} 2r\cos \theta &0 \\ 2r\cos\theta & 2r \sin\theta \end{pmatrix}\begin{pmatrix}\cos \theta & -r\sin\theta \\ \sin\theta & r\cos\theta \end{pmatrix} = \begin{pmatrix}2r\cos^2\theta & -2r^2\cos\theta\sin\theta \\2r & 0\end{pmatrix}
\]
\end{example}
\hrulefill

The point is that ``the derivative of a composition is the product of derivatives''.

\begin{proof}[Sketch of proof of Chain Rule]
Let $g\co \R^n \to \R^m$ and $f\co \R^m \to \R^k$ be such that $g$ and $f$ are both differentiable at $\vect{0}$ and $g(\vect{0}) = \vect{0}$ and $f(\vect{0}) = \vect{0}$. 

\textbf{Special case:} $f$ and $g$ are both linear.

Then there exist matrices $A_{mk}$ and $B_{nm}$ so that
\[\begin{array}{rcll}
f(\vect{x}) &=& A\vect{x}&\hspace{.2in} \text{for all } \vect{x} \in \R^m\\
g(\vect{x}) &=& B\vect{x}&\hspace{.2in} \text{for all } \vect{x} \in \R^n
\end{array}\]
This implies that, for all $\vect{x} \in \R^n$
\[
f\circ g(\vect{x}) = A(B\vect{x}) = (AB)\vect{x}.
\]

Notice that:
\[\begin{array}{rcl}
Df(g(\vect{0})) &=& A\\
Dg(\vect{0}) &=& B\\
D(f\circ g)(\vect{0}) &=& AB
\end{array}\]

Thus, 
\[D(f\circ g)(\vect{0}) = Df(g\vect{0})Dg(\vect{0})\]
as desired.

\textbf{General Case:} $f$ and $g$ are not necessarily linear.

Since $g\co \R^n \to \R^m$ is differentiable at $\vect{0}$, for $\vect{x}$ near $\vect{0}$,
\[
g(\vect{x}) \approx Dg(\vect{0})\vect{x}.
\]
Similarly, since $f \co \R^m \to \R^k$ is differentiable at $g(\vect{0}) = \vect{0}$, for $\vect{x}$ near $\vect{0}$,
\[
f(\vect{x}) \approx Df(g(\vect{0}))\vect{x}.
\]

To prove the theorem we just need to show that
\[
f\circ g(\vect{x})  \approx Df(g(\vect{0}))Dg(\vect{0}).
\]
Remember that $\approx$ in this context means that the relative error goes to 0 as $\vect{x} \to \vect{0}$.  We didn't go over this in class, but here is a proof:

For convenience, define the following:
\[\begin{array}{rcl}
B &=& Dg(\vect{0})\\
A &=& Df(\vect{0})\\
\end{array}\]


We need to show that for each $\epsilon > 0$, there exists $\delta > 0$ so that if $0 < ||\vect{x}|| = ||\vect{x} - \vect{0}|| < \delta$ then
\[
\frac{||f\circ g(\vect{x}) - AB\vect{x}||}{||\vect{x} - \vect{0}||} < \epsilon.
\]

Notice that:
\[
||f\circ g(\vect{x}) - AB\vect{x}|| = ||f\circ g(\vect{x}) - Ag(\vect{x}) + Ag(\vect{x})  - AB\vect{x}||.
\]
By the triangle inequality,
\[
||f \circ g(\vect{x}) - AB\vect{x}|| \leq ||f \circ g(\vect{x}) - Ag(\vect{x})|| + ||A(g\vect{x}) - B\vect{x})||.
\]

Now there exists a constant $\alpha$, such that for all $\vect{y} \in \R^m$, $||A\vect{y}|| \leq \alpha ||\vect{y}||$. Thus,
\[\begin{array}{rc}
||f \circ g(\vect{x}) - AB\vect{x}|| &\leq \\
||f (g(\vect{x}) )- Ag(\vect{x})|| + ||A(g\vect{x}) - B\vect{x})|| & \leq \\
||f( g(\vect{x})) - Ag(\vect{x})|| + \alpha ||g(\vect{x} - B\vect{x}||&
\end{array}\]

We now consider the relative errors. 

\textbf{Piece 1:} Since $g$ is differentiable at $\vect{0}$, there exists $\delta_1 > 0$, so that if $0 < ||\vect{x}|| < \delta_1$ then
\[
\frac{||g(\vect{x}) - B\vect{x}||}{||\vect{x}||} < \epsilon/2\alpha.
\]

\textbf{Piece 2:} There is a theorem, which guarantees that (since $g$ is differentiable at $\vect{0}$) there exists $\delta_2 > 0$ so that if $||\vect{x}|| < \delta_2$, then there is a constant $\beta$ such that
\[||g(\vect{x})|| \leq \beta||\vect{x}||.\]

\textbf{Piece 3:} Since $f$ is differentiable at $\vect{0} = g(\vect{0})$, there exists $\delta_3 > 0$ so that if $0 < ||\vect{y}|| < \delta _3$, then
\[
\frac{||f(\vect{y}) - A\vect{y}}{||\vect{y}||} < \epsilon/2\beta.
\]
This implies that
\[
||f(\vect{y}) - A\vect{y}|| < (\epsilon/2\beta)||\vect{y}||
\]


Pieces 2 and 3 imply: if $0 < \vect{x} < \min(\delta_2, \delta_3)$, setting $\vect{y} = g(\vect{x})$ we have
\[
||f(g(\vect{x}) - Ag(\vect{x})|| < (\epsilon/2\beta)||g(\vect{x})|| < (\epsilon/2\beta)\beta||\vect{x}||.
\]

Consequently, if $0 < \vect{x} < \min(\delta_2, \delta_3)$, we have
\[
\frac{||f(g(\vect{x})) - Ag(\vect{x})}{||\vect{x}||} < \epsilon/2.
\]
 
 Piece 1 implies: if $0 < \vect{x} < \delta_1$, then
 \[
 \frac{\alpha||g(\vect{x}) - B\vect{x}||}{||\vect{x}||} < \epsilon/2.
 \]

We conclude that if $0 < ||\vect{x}|| < \delta = \min(\delta_1, \delta_2, \delta_3)$ then
\[
\begin{array}{rc}
||f\circ g(\vect{x}) - AB\vect{x}||/||\vect{x}|| &\leq \\
||f(g(\vect{x})) - Ag(\vect{x})||/||\vect{x}|| + \alpha||g(\vect{x}) - B\vect{x}||/||\vect{x}|| & <\\
\epsilon/2 + \epsilon/2 & = \epsilon
\end{array}
\]
as desired.
\end{proof}

\newpage

\section{Parameterized Curves}
A function $\vect{x}\co \R \to \R^n$ traces out a path in $\R^n$. The set of points \[\{\vect{a} \in \R^n : \vect{x}(t)  = \vect{a} \text{ for some } t \in \R \} \] is called the \defn{image} of the path $\vect{x}$. If $\vect{x}$ is one-to-one (so that no place on the image occurs at more than one time) we say that $\vect{x}$ is a \defn{parameterization} of its image. We also allow the domain to be a subset of $\R$ rather than all of $\R$.

\subsection{Some important examples}

\begin{example}
The path $\vect{x_1}(t) = \begin{pmatrix} \cos t \\ \sin t \end{pmatrix}$ for $t \in [0,2\pi]$ is a parameterization of the unit circle in$\R^2$.  The path $\vect{x_2}(t) = \begin{pmatrix} \cos 2t \\ \sin 2t \end{pmatrix}$ for $t \in [0,2\pi]$ also has image the unit circle but is not a parameterization of it since it travels through each point on the unit circle twice. The path $\vect{x_3}(t) = \begin{pmatrix} \cos 2t \\ \sin 2t \end{pmatrix}$ for $t \in [0,\pi]$ is parameterization of the unit circle. The path $\vect{x_3}$ is different from the path $\vect{x_1}$ since it travels around the circle twice as fast.
\end{example}
\hrulefill

\begin{example}
The path $\vect{x}(t) = \begin{pmatrix} \cos t \\ \sin t \\ t \end{pmatrix}$ is a parameterization of a helix in $\R^3$ that winds around the $z$-axis.

\begin{center}
\scalebox{.3}{\includegraphics{Figures/Helix}}
\end{center}
\end{example}
\hrulefill

\begin{example}
Suppose that $f \co \R \to \R$ is a continuous function. Then $\vect{x}(t) = (t, f(t))$ is a parameterization of the graph of $f$ in $\R^2$. The path $\vect{y}(t) = (-t,f(-t))$ is a parameterization of the graph that travels in the opposite direction.
\end{example}
\hrulefill


\begin{example}
Suppose that $\vect{v}$ and $\vect{w}$ are distinct vectors in $\R^n$. Then $\vect{x}(t) = t\vect{v} + (1-t)\vect{w}$ is a parameterization of the line through $\vect{v}$ and $\vect{w}$. Restricting $\vect{x}$ to $t \in [0,1]$ is a parametrization of the line segment joining $\vect{v}$ and $\vect{w}$.
\end{example}
\hrulefill

\begin{example}
Suppose that $\vect{v}$ and $\vect{w}$ are distinct vectors in $\R^n$. Then $\vect{x}(t) = \vect{v} + t \vect{w}$ is a parameterization of the line through $\vect{v}$ that is parallel to the vector $\vect{w}$.
\end{example}
\hrulefill

\subsection{Velocity and Acceleration}

If $\vect{x} \co \R \to \R^n$ is a differentiable parameterized curve, its \defn{velocity} is $\vect{x}'(t) = D\vect{x}(t)$ and its acceleration is $\vect{v'}(t) = D\vect{v}(t)$. The \defn{speed} of $\vect{x}$ is $||\vect{x'}(t)||$.

\begin{example}
Find $\vect{v}(t)$ and $\vect{a}(t)$ for the curve $\vect{x}(t) = (t, t\sin(t), t\cos(t))$. Also find the speed of $\vect{x}(t)$ at time $t$.

\textbf{Solution:}
\[\begin{array}{rcl}
\vect{v}(t) & = & (1, \sin(t) + t\cos(t), \cos(t) - t\sin(t))\\
||\vect{v}(t)|| &=& \sqrt{1 + \sin(t)\cos(t) - t^2\sin(t)\cos(t) - t\sin^2(t) + t\cos^2(t)} \\
\vect{a}(t) &=& (0, 2\cos(t) - t\sin(t), -2\sin(t) - t\cos(t))
\end{array}\]
\end{example}

The next theorem should not be surprising.
\begin{theorem}
Suppose that $\vect{x} \co \R \to \R^n$ is differentiable. Then $\vect{x}'(t_0)$ is parallel to the line tangent to the curve $\vect{x}(t)$ at $t_0$. 
\end{theorem}
\begin{proof}
We consider only $n = 2$; for $n > 2$, the proof is nearly identical. A vector parallel to the tangent line to $\vect{x}(t)$ at $t = t_0$ can be obtained as in 1-variable calculus:
\[\begin{array}{rcl}
\text{tangent vector } &=& \lim_{\Delta t \to 0} \big(\vect{x}(t_0 + \Delta t) - \vect{x}(t_0)\big)/\Delta t\\
&=& \lim_{\Delta t \to 0} \Big(\big(x(t_0 + \Delta t), y(t_0 + \Delta t)\big) - \big(x(t_0), y(t_0)\big)\Big)/\Delta t\\
&=& \lim_{\Delta t \to 0} \Big(\frac{x(t_0 + \Delta t) - x(t_0)}{\Delta t}, \frac{y(t_0 + \Delta t) - y(t_0)}{\Delta t}\Big)\\
&=& \Big(\lim_{\Delta t \to 0}\frac{x(t_0 + \Delta t) - x(t_0)}{\Delta t}          , \lim_{\Delta t \to 0} \frac{y(t_0 + \Delta t) - y(t_0)}{\Delta t}         \Big)\\
&=& (x'(t), y'(t))\\
&=&\vect{x}'(t)
\end{array}
\]
\end{proof}

\begin{example}
Let $\vect{x}(t) = (3\cos(2t), \sin(6t))$. The image of $\vect{x}$ for $t \in [-6\pi,6\pi]$ is drawn below. Find the equations of the tangent lines at the point $(-1.5,0)$.

\begin{center}
\includegraphics[scale=0.4]{Figures/Notes-planecurve1}
\end{center}

\textbf{Solution:} The point $(-1.5,0)$ is crossed by $\vect{x}$ at $t_1 = \pi/3$ and at $t_2 = 2\pi/3$. The derivative of $\vect{x}$ is
\[\vect{x}'(t) = (-6\sin(2t), 6\cos(6t)).\]
At $t_1$, we have:
\[\vect{x}'(t_1) = (-6\sin(2\pi/3),6\cos(2\pi)) = (-3\sqrt{3}, 6).\]
Thus, one of the tangent lines has parameterization:
\[
L_1(t) = t(-3\sqrt{3},6) + (-1.5,0).
\]
At $t_2$, we have:
\[\vect{x}'(t_2) = (3\sqrt{3},6).\]
Thus, the other tangent line has a parameterization:
\[
L_2(t) = t(3\sqrt{3},6) + (-1.5,0).
\]
\end{example}

\subsection{Tangent space coordinates}
In the previous section we saw that if $\vect{x}$ was a parameterized curve, then $\vect{x'}(t)$ is a vector \textit{parallel} to the tangent line to the image of $\vect{x}$ at $t$. It would be much better to base our derivative vector at the point $\vect{x}(t)$. We can do this if we change coordinate systems.

Here is the idea:

\begin{example}
Let $\vect{x}(t) = (\cos t, \sin t)$ and let $t_0 = (\pi/4,\pi/4)$. Notice that $\vect{x}'(t_0) = (1/\sqrt{2}, 1/\sqrt{2})$. If an object's position at time $t$ seconds is given by $\vect{x}(t)$ and if at time $t_0$ all forces stop acting on the object then 1 second later, the object will be at the position given by $\vect{x}(t_0) + \vect{x}'(t_0)$. That is, $\vect{x}'(t_0)$ denotes the direction the object will travel starting at $\vect{x}(t_0)$. It would be convenient to represent $\vect{x}(t_0)$ by a vector with tail at $\vect{x}(t_0)$ and head at $\vect{x}(t_0) + \vect{x}'(t_0)$.

\begin{center}
\begin{figure}[ht]
\includegraphics[scale=0.4]{Figures/Notes-directionvector1}
\caption{}
\label{Fig-directionvector1}
\end{figure}
\end{center}
\end{example}

To do this to each point $\vect{p} \in \R^n$ we associate a ``tangent space'' $T_\vect{p}$. This is simply a copy of $\R^n$ such that $\vect{p}$ corresponds to the origin of $T_\vect{p}$. In $\R^2$, the standard basis vectors are denoted $\vect{i}$ and $\vect{j}$. In $\R^3$ the standard basis vectors are denoted $\vect{i}$, $\vect{j}$, and $\vect{k}$. We usually think of $T_\vect{p}$ as an alternative coordinate system for $\R^n$ which is positioned so that $\vect{p} \in \R^n$ is at the origin.

\begin{example}
If $\vect{p} = (1,3)$ and if $(2,5) \in T_\vect{p}$ then $(2,5)$ corresponds to the point $(1,3) + (2,5) = (3,8)$ in $\R^2$.
\end{example}

We think of $T_\vect{p}$ as the set of directions at $\vect{p}$.

\begin{example}
Let $\vect{x}(t) = (\cos t, \sin t)$ and let $t_0 = \pi/6$. Suppose that an object is following the path $\vect{x}(t)$ and that at time $t_0$ all forces stop acting on the object. Then the direction in which the object will head is 
\[
\vect{x}'(t_0) = (-\sin \pi/6, \cos \pi/6) = (-1/2, \sqrt{3}/2).
\]
That is, the object will travel $1/2$ units to the left of $\vect{x}(t_0)$ and $\sqrt{3}/2$ units up from $\vect{x}(t_0)$ in 1 second.
\end{example}

Put another way, the point $\vect{x}(t_0) + \vect{x}'(t_0)$ is the same as the point $\vect{x}'(t_0) \in T_{\vect{x}(t_0)}$.

Suppose that $f \co \R^n \to \R^m$ is differentiable at $\vect{p} \in \R^n$. Then $L\co T_p \to T_{f(\vect{p})}$ defined by
\[
L(\vect{x}) = Df(\vect{p})\vect{x}
\]
is a linear map between tangent spaces.

\begin{example}
Let $\vect{p} = (1,2) \in\R^2$ and let $f(\vect{x}) = (1/4)(x^2 + y^2, x^2 - y^2)$ for all $\vect{x} = (x,y)$. Let $\vect{v} = (-2,3) \in T_\vect{p}$. Sketch the point $Df(\vect{p})\vect{v} \in T_{f(\vect{p})}$.

\textbf{Solution:}
Compute:
\[Df(x,y) = \begin{pmatrix}x/2 & y/2\\ x/2& -y/2\end{pmatrix}.\]
So that
\[Df(\vect{p}) = \begin{pmatrix}1/2 & 1 \\ 1/2 & -1 \end{pmatrix}.\]
Thus,
\[Df(\vect{p}) \vect{v}= \begin{pmatrix} 1/2 & 1 \\ 1/2 & -1 \end{pmatrix} \begin{pmatrix}-2 \\ 3 \end{pmatrix} = \begin{pmatrix}2 \\ -4 \end{pmatrix}.\]
In $\R^2$, we plot $Df(\vect{p})\vect{v}$ by starting at $f(\vect{p}) = (5/4, -3/4)$ and then travel over 2 and down 4. See Figure \ref{Fig-directionvector2}.

\begin{center}
\begin{figure}[ht]
\includegraphics[scale=0.4]{Figures/Notes-directionvector2} \hspace{.2in}
\includegraphics[scale=0.4]{Figures/Notes-directionvector3}
\caption{On the left is an arrow representing $\vect{v} \in T_\vect{p}$. On the right is an arrow representing $Df(\vect{p})\vect{v}$ in $T_{f(\vect{p})}$.}
\label{Fig-directionvector2}
\end{figure}
\end{center}

\end{example}

\newpage

%\subsection{Parameterizing interesting curves}
%
\begin{example}
Suppose that a circle of radius $\rho$ cm rolls along level ground so that the center of the circle is moving at 1 cm/sec. At time $t = 0$, the center of the circle is at $(0,0)$ and the top of the circle is a point $P = (0,\rho)$. As the circle rolls, the point $P$ traces out a curve $\vect{x}(t)$ (with $P = \vect{x}(0)$). Find an equation for $\vect{x}(t)$. 

\textbf{Solution:} Let $\vect{c}(t)$ denote the center of the circle at time $t$. The circumference of the circle is $2\pi\rho$ and so the circle makes one complete rotation in $2\pi\rho$ sec. At time $t$, the line segment joining $\vect{c}(t)$ to $\vect{x}(t)$ makes an angle of $-t/\rho + \pi/2$ with the horizontal. That is, in $T_{\vect{c}(t)}$, $\vect{x}(t)$ is represented by the point $(\rho\cos(-t/\rho + \pi/2), \rho\sin(-t/\rho + \pi/2))$. Thus, with respect to the standard coordinates on $\R^2$:
\[
\vect{x}(t) = \vect{c}(t) + \begin{pmatrix}\rho \cos(-t/\rho + \pi/2) \\ \rho \sin(-t/\rho + \pi/2) \end{pmatrix}.\]

Since
\[ \vect{c}(t) = t\begin{pmatrix}1 \\ 0 \end{pmatrix},\]
we have
\[
\vect{x}(t) =  \begin{pmatrix}t + \rho\cos(-t/\rho + \pi/2) \\ \rho\sin(-t/\rho + \pi/2) \end{pmatrix}.
\]

\begin{center}
\includegraphics[scale=0.5]{Figures/cycloid} 
\end{center}
\end{example}



\textbf{Question:} Is the cycloid a differentiable curve?
\hrulefill

\begin{example}
Suppose that a circle $C$ of radius $r$ is moving so that the center of $C$, $\vect{c}$ traces out the path $(R\cos(t), R\sin(t))$. As $C$ moves, it rotates counterclockwise so that it completes $k$ revolutions per second. Suppose that $E$ is the East pole of $C$ at time 0. What path does $P$ trace out?

\textbf{Solution:}
In $T_{\vect{c}(t)}$, $E$ has coordinates $(r\cos 2\pi k t , r \sin 2\pi k t)$. Thus in $\R^2$ coordinates, $E$ has position
\[\vect{x}(t) = \vect{c}(t) + (r\cos t, r\sin t) = (R\cos t + r \cos 2\pi k t, R \sin t + r\sin 2 \pi k t).\]
\end{example}

\begin{center}
\includegraphics[scale=0.3]{Figures/epicycle} 
\end{center}

\hrulefill

\subsection{Intrinsic vs. Extrinsic}

\begin{example}
Consider the parameterizations
\[
\vect{x}(t) = \begin{pmatrix}\cos t \\ \sin t \end{pmatrix} \hspace{.2in} \text{ for } 0 \leq t \leq 2\pi
\]
and
\[
\vect{y}(t) = \begin{pmatrix} \cos 2t \\ \sin 2t \end{pmatrix} \hspace{.2in} \text{ for } 0 \leq t \leq \pi.
\]
Both are parameterizations of the unit circle. To use either of them to study the unit circle we need to develop properties of parameterizations that depend only on the underlying curve and not on the parameterization chosen. Such properties are called ``intrinsic'' properties of the curve.
\end{example}
\hrulefill

\begin{definition}
A function $h\co [c,d] \to [a,b]$ is a \defn{change of coordinates function} if it is a C$^1$ bijection. Often we will also require $h$ to have the property that for all $t$, $h'(t) \neq 0$.
\end{definition}

(Recall: C$^1$ means that its derivative always exists and is continuous. A ``bijection'' is a function that is both one-to-one and onto.)

\begin{example}
Define $h(t)\co [0,\pi] \to [0,2\pi]$ by $h(t) = 2t$. The function $h$ is a change of coordinates function.
\end{example}
\hrulefill

\begin{example}
Define $h\co [0,1] \to [0,1]$ by $h(t) = t^3$. Then $h$ is a change of coordinates function, but its inverse $h^{-1}(t) = \sqrt[3]{t}$ is not a change of coordinates function because it is not differentiable at $t = 0$.
\end{example}
\hrulefill

\begin{example}
Find a change of coordinates function $h \co [0,1]\to [0,1]$ such that $h(0) = 1$ and $h(1) = 0$. (This is an example of an ``orientation-reversing'' change of coordinates function.

\textbf{Solution:} Sketch the $x$ and $y$ axes. Any function that is monotonically decreasing from the point $(0,1)$ to the point $(1,0)$ will work. The function $h(t) = -t + 1$ is one such function.
\end{example}
\hrulefill

Notice that if $h$ is a change of coordinates function with $h'(t) \neq 0$ for any $t$, then either $h'(t) > 0$ for all $t$ or $h'(t) < 0$ for all $t$ (by the intermediate value theorem).

\begin{definition}
A change of coordinates function $h\co [c,d] \to [a,b]$ is \defn{orientation-preserving} if $h'(t) > 0$ for all $t$ and is \defn{orientation-reversing} if $h'(t) < 0$ for all $t$. Notice that if $h$ is orientation-preserving then $h(c) = a$ and $h(d) = b$ while if $h$ is orientation-reversing then $h(c) = b$ and $h(d) = a$.
\end{definition}

\begin{definition}
If $\vect{x}\co [a,b] \to \R^n$ and $\vect{y}\co[c,d] \to \R^n$ are paths, we say that $\vect{y}$ is a \defn{reparameterization} of $\vect{x}$ if there exists a change of coordinates function $h\co [c,d] \to [a,b]$ such that $\vect{y} = \vect{x} \circ h$. If $h$ is orientation preserving, we say that $\vect{y}$ is an \defn{orientation-preserving reparameterization} of $\vect{x}$. If $h$ is orientation reversing, we say that $\vect{y}$ is an \defn{orientation-reversing} reparameterization of $\vect{x}$.
\end{definition}

The key point is that: \textit{reparameterizing a curve is changing the speed and possibly the direction that we walk along the curve}. Intuitively, the change-of-coordinates function $h$ tells us how to speed up or slow down as we traverse that path laid down by $\vect{x}$. If $\vect{y}$ is an orientation-preserving reparameterization of $\vect{x}$, it traces out the path in the same direction that $\vect{x}$ did, otherwise it traces the path out in the opposite direction.

\begin{example}
Let $\vect{x}(t) = \begin{pmatrix} t^2 \\ 2t \end{pmatrix}$ for $t \in [0,5]$. Let $\vect{y}(t) = \begin{pmatrix} 9t^2 \\ 6t \end{pmatrix}$ for $t \in [0,5/3]$. 

The path $\vect{y}$ is an orientation reparameterization of $\vect{x}$ by the change of coordinates function $h(t) = 3t$.
\end{example}
\hrulefill

\begin{example}
Let $\vect{x}(t) = (\cos t, \sin t)$ for $t\in [0,2\pi]$ and let $\vect{y}(t) = (\cos 3t, \sin 3t)$ for $t \in [0,2\pi]$. Then $\vect{y}$ is not a reparameterization of $\vect{x}$ since $\vect{x}$ traverses the unit circle once, but $\vect{y}$ traverses it three times.
\end{example}
\hrulefill

\begin{example}
Let $\vect{x}(t) = \begin{pmatrix} t \\ \cos t \\ \sin t \end{pmatrix}$ for $t \in [\pi,2\pi]$. Let $\vect{y}(t) = \begin{pmatrix}t^3 \\ \cos t^3 \\ \sin t^3 \end{pmatrix}$ for $t \in [\sqrt[3]{\pi},\sqrt[3]{2\pi}]$. 

The path $\vect{y}$ is an orientation-preserving reparameterization of $\vect{x}$ using the change of coordinates function $h(t) = t^3$ for $t \in [\sqrt[3]{\pi},\sqrt[3]{2\pi}]$.
\end{example}
\hrulefill

\begin{example}
Let $G$ be the graph of a function $y = f(x)$ for $x\in[a,b]$. Find two parameterizations, with opposite orientations, of $G$.

One parameterization is $\vect{x}(t) = \begin{pmatrix}t \\ f(t) \end{pmatrix}$ for $t \in [a,b]$. A second one is $\vect{y}(t) = \begin{pmatrix} - t \\ f(-t)\end{pmatrix}$ for $t \in [-b,-a]$. Since they are related by the change of coordinates function $h(t) = -t$ which has $h'(t) = -1$, the curves have the opposite orientations.
\end{example}

\hrulefill

\begin{definition}
A quantity is \defn{intrinsic} if it does not change under orientation preserving reparameterization. A quantity is \defn{intrinsic to oriented curves} if it does not change under orientation preserving reparameterization.
\end{definition}

\begin{example}
If $\vect{x}\co [a,b] \to \R^n$ is a path, its derivative and speed are not intrinsic, since we can walk the same path at a different speed.
\end{example}
\hrulefill

\begin{example}
Let $\vect{x}\co[a,b] \to \R^n$ be a C$^1$ path such that $||\vect{x'}(t)||\neq 0$ for any $t$. Then the unit tangent vector \[\vect{T}_\vect{x}(t) = \frac{\vect{x'}}{||\vect{x'}||}\] is intrinsic to the oriented curve.

To see this, suppose that $\vect{y}\co[c,d] \to \R^n$ is another C$^1$ path such that $||\vect{y'}(t)|| \neq 0$ for any $t$ and suppose that $h\co [c,d] \to [a,b]$ is an orientation preserving change of coordinate function so that $\vect{y} = \vect{x} \circ h$. We need to show that $\vect{T}_\vect{y}(t) = \vect{T}_\vect{x}(h(t))$ for all $t$.

By the chain rule,
\[
\vect{y'}(t) = \vect{x'}(h(t))h'(t).
\]
Notice that since $h$ is orientation preserving, $h'(t) = |h'(t)|$ for all $t$. Thus,
\[\begin{array}{rcl}
\vect{T}_\vect{y}(t) &=& \frac{\vect{y'}(t)}{||\vect{y'}(t)||} \\
&&\\
&=&\frac{\vect{x'}(h(t))h'(t)}{||\vect{x'}(h(t)) h'(t)||} \\
&&\\
&=& \frac{\vect{x'}(h(t))h'(t)}{||\vect{x'}(h(t))||\thinspace |h'(t)|} \\
&&\\
&=&\frac{\vect{x'}(h(t))h'(t)}{||\vect{x'}(h(t))|| \thinspace h'(t)} \\
&&\\
&=& \frac{\vect{x'}(h(t))}{||\vect{x'}(h(t))} \\
&&\\
&=& \vect{T}_\vect{x}(t)
\end{array}
\]
\end{example}
\hrulefill

\begin{example}
Here is an informal example that we will develop in the next section.

If $\vect{x}\co [a,b] \to \R^n$ is a curve that, as a function, is one-to-one, we can define its length to be the limit of the lengths of piecewise linear approximations to the image of $\vect{x}$. Since this does not depend on the parameterization this length that we calculate is intrinsic to $\vect{x}$.
\end{example}
\hrulefill

\newpage

\subsection{Arc length}

Suppose that $\vect{x}\co [a,b] \to \R$ is a $C^1$ curve. We wish to find the length of $\vect{x}$. The formula is

\framebox[0.95\linewidth]{
 	\begin{minipage}{0.9\linewidth}
 	\begin{theorem}
   The arc length of $\vect{x}$ is 
		\[
   \int_a^b ||\vect{x}'(t)||\thinspace dt.
		\]
		\end{theorem}
	Arc length is often denote by
	\[
	\int_\vect{x} \thinspace ds
	\]
	where 
	\[
	ds = ||\vect{x}'||dt
	\]
	\end{minipage}
}

\begin{example}
Let $\vect{x}(t) = (t^2,2t^2)$ for $t \in [0,1]$. Then 
\[||\vect{x}'(t)|| = ||(2t,4t)|| = \sqrt{4t^2 + 16t^2} = 2t\sqrt{5}.\]
The arclength of $\vect{x}$ is
\[
\int_\vect{x} \thinspace ds = \int_0^1 2t\sqrt{5}\thinspace dt = t^2\sqrt{5}\big|_0^1 = \sqrt{5}.
\]
\end{example}

\begin{example}
Let $\vect{x}(t) = (t,t^2)$ for $t \in [0,1]$. Then
\[
\int_\vect{x} \thinspace ds = \int_0^1 \sqrt{1 + 4t^2}\thinspace dt \approx 1.47894 
\]
\end{example}

Here is why the formula for arclength is what it is. For convenience, we assume that $n = 2$.

Partition $[a,b]$ into $n$ subintervals $[t_{i-1},t_i]$ for $1 \leq i \leq n$, each of length $\Delta t = (b-a)/n$. Joining the points $\vect{x}(t_{i-1})$ and $\vect{x}(t_i)$ by straight lines creates a polygonal approximation $P_n$ to the image of $\vect{x}$. The length of the polygonal path is:
\[
\operatorname{length}(P_n) = \sum_{i = 1}^n ||\vect{x}(t_{i}) - \vect{x}(t_{i-1})||.
\]
We \textit{define} the \defn{arc length} of $\vect{x}$ to be
\[
L = \int_\vect{x} \thinspace ds = \lim_{n \to \infty} \sum_{i=1}^n ||\vect{x}(t_i) - \vect{x}(t_{i-1})||.
\]

Now suppose that $\vect{x}(t) = (x(t),y(t))$. Both $x$ and $y$ are $C^1$ functions. Notice that if we replace our current polygonal approximation with a polygonal approximation have vertices $(x(t_i^*),y(t_i^{**}))$, with $t_i^*,t_i^{**} \in [t_{i-1},t_i]$, we will still have:
\[
L = \int_\vect{x} \thinspace ds = \lim_{n \to \infty} \sum_{i=1}^n ||(x(t_i^*),y(t_i^{**})) - (x(t_{i-1}^*),y(t_{i-1}^{**}))||.
\]

Here's how to choose the values $t_i^*$ and $t_i^{**}$. By the mean value theorem (remember that?) There exists $t^*_i,t^{**}_i \in [t_{i-1},t_i]$ so that
\[
\begin{array}{rclcl}
x(t^*_i) &=& x'(t^*_i)(t_i - t_{i-1}) &=& x'(t^*_i)\Delta t\\
y(t^{**}_i) &=& y'(t^{**}_i)(t_i - t_{i-1}) &=& y'(t^{**}_i)\Delta t\\
\end{array}
\]

Thus,
\[
L = \lim_{n \to \infty} \sum_{i=1}^n \sqrt{\big(x'(t^*_i)^2 + y'(t^{**}_i)^2}\Delta t = \int_a^b \sqrt{x'(t)^2 + y'(t)^2}\thinspace dt = \int_a^b ||\vect{x}'(t)||\thinspace dt.
\]

We can also compute the arc length of paths which are piecewise $C^1$. These paths must be composed of a finite number of pieces.

\begin{example}
Compute the length of the curve $\vect{x}\co [0,2] \to \R$ defined by:
\[
\vect{x}(t) = \left\{ \begin{array}{rcl}
(t,t^2) &\hspace{.3in} & \text{ if } 0 \leq t \leq 1 \\
(t,(2-t)^2) & & \text{ if } 1 \leq t \leq 2
\end{array}\right\}
\]

\textbf{Solution:} Let $\vect{x_1}(t) = \vect{x}(t)$ for $0 \leq t \leq 1$ and let $\vect{x}_2(t) = \vect{x}(t)$ for $1 \leq t \leq 2$. Then 
\[\begin{array}{rcl}
\int_{\vect{x}} \thinspace ds &=& \int_{\vect{x_1}} \thinspace ds + \int_{\vect{x_2}} \thinspace ds\\
&=& \int_0^1 \sqrt{1 + 4t^2} \thinspace dt + \int_1^2 \sqrt{1 + 4(2-t)^2}\\
&\approx& 2.95789
\end{array}
\]
\end{example}

The following example shows that it is possible for a ``finite'' curve to have infinite length.

\begin{example}
We will specify the graph of the curve $f(x)$. On the interval $[\frac{1}{n+2},\frac{1}{n}]$ erect a tent consisting of two straight lines with the bottoms of the lines on the $x$ axis and the top of the tent at the point $(\frac{1}{n+1},\frac{1}{n})$. See the figure below:

\begin{center}
\scalebox{0.5}{\input{jagged1.eps_t}}
\end{center}

Do this for each odd value of $n$, achieving the following graph:

\begin{center}
\includegraphics[scale=1]{Figures/jagged2} 
\end{center}

If you want an equation for $f(x)$ do the following:

Begin by defining
\[
g_n(x) = \left\{\begin{array}{rcl}
0 & \hspace{.2in} & \text{ if } x < \frac{1}{n+2}\\
\frac{1}{n\left(\frac{1}{n+1} - \frac{1}{n}\right)}(x - \frac{1}{n+2}) & & \text{ if } \frac{1}{n+2} \leq x \leq \frac{1}{n+1}\\
&&\\
\frac{-1}{n\left(\frac{1}{n} - \frac{1}{n+1}\right)}(x - \frac{1}{n}) & & \text{ if } \frac{1}{n+1} \leq x \leq \frac{1}{n}\\
0 & & \text{ if } x > \frac{1}{n}
\end{array}\right\}
\]
Then define
\[
f(x) = \sum_{n=0}^\infty g_{2n+1}(x).
\]
Notice that $g_{2n + 1}(x) \neq 0$ only if $x \in [\frac{1}{2n+3}, \frac{1}{2n+1}]$. Thus, the sum defining $f(x)$ has only one term which is not zero.

Let's show that the length of the graph of $f$ is infinite. To do this, consider the line segment in the interval $[\frac{1}{n+1},\frac{1}{n}]$ for an odd value of $n$. This line segment has length
\[
L = \sqrt{(\frac{1}{n})^2 + (\frac{1}{n} - \frac{1}{n+1})^2} = \sqrt{\frac{2}{n^2} + \frac{1}{(n+1)^2} - \frac{2}{n(n+1)}}.
\]
Some algebra shows that $L \geq \frac{1}{n}$
Similarly, the line segment in the interval $[\frac{1}{n+2},\frac{1}{n+1}]$ has length at least $1/(n+1)$. Consequently, the length of the graph of $f$ is at least
\[
\sum_{n = 1}^\infty \frac{1}{n}.
\]
It is well known that this is the harmonic series which diverges to infinity.
\end{example}

The text gives an example of a function $f\co[0,1] \to [-1,1]$ which is differentiable on $(0,1]$ but whose graph has infinite arclength. An example similar to that one could be constructed from our example by rounding the points of the graph above.
\hrulefill

\begin{theorem}[Arc length is intrinsic]
Suppose that $\vect{x}\co [a,b] \to \R^n$ and $\vect{y}\co [c,d] \to \R^n$ are C$^1$ curves and that $\vect{y}$ is a reparameterization of $\vect{x}$. Then the length of $\vect{y}$ is equal to the length of $\vect{x}$.
\end{theorem}
\begin{proof}
Since $\vect{y}$ is a reparameterization of $\vect{x}$, there exists a change-of-coordinates function $h\co[c,d] \to [a,b]$ such that $\vect{y} = \vect{x} \circ h$. By the chain rule we have:
\[
\vect{y'}(t) = \vect{x'}(h(t)) h'(t).
\]
Taking magnitudes gives:
\[
||\vect{y'}(t)|| = ||\vect{x'}(h(t))|| \thinspace |h'(t)|.
\]
\textbf{Case 1:} $h$ is orientation-preserving.
In this case, $|h'(t)| = h'(t)$. Then, by definition, the length of $\vect{y}$ is:
\[\begin{array}{rcl}
L(\vect{y}) &=& \int_c^d ||\vect{y'}(t)|| \thinspace dt\\
&=& \int_c^d ||\vect{x'}(t)|| h'(t) \thinspace dt.
\end{array}
\]
Let $u = h(t)$. Then $du = h'(t)\thinspace dt$ and $u(c) = a$ and $u(d)= b$ since $h$ is orientation preserving. Thus, substitution shows that:
\[
\int_c^d ||\vect{x'}(t)|| h'(t) \thinspace dt = \int_a^b ||\vect{x}(u)|| \thinspace du.
\]
This latter integral is exactly the length of $\vect{x}$.

\textbf{Case 2:} $h$ is orientation-reversing.

This case is left to the reader. It follows from the observations that $|h'(t)| = -h'(t)$ and $h(c) = b$ and $h(d) = a$.
\end{proof}

Being able to calculate arclength is not just an end-in-itself. It also gives us a useful way of reparameterizing so that we always travel at unit speed (eg. 1 meter/sec.) This reparameterization is called \defn{reparameterization by arclength}. If a curve $\vect{x}\co[a,b] \to \R^n$ has the property that for all $t$, $||\vect{x'}(t)|| = 1$, we say that $\vect{x}$ is \defn{parameterized by arclength}. Here's how to do it:

Suppose that $\vect{x} \co [a,b] \to \R$ is $C^1$ and that $||\vect{x}'(t)|| > 0$ for all $t \in [a,b]$. Define $s\co [a,b] \to [0,L]$ by
\[
s(t) = \int_a^t ||\vect{x}'(\tau)|| \thinspace d\tau.
\]
Notice that $s$ is a strictly increasing $C^1$ function and so is an orientation preserving bijection $[a,b] \to [0,L]$. By the fundamental theorem of Calculus, $s'(t) = ||\vect{x'}(t)||$ so we often write $ds = ||\vect{x'}(t)||dt$.

Furthermore, its inverse function $s^{-1} \co [a,b] \to [a,L]$ is also strictly increasing bijection. Define $\vect{y}(t) = \vect{x} \circ s^{-1}$. The function $s$ measures the distance travelled from time $a$ to time $t$ using the path $\vect{x}$. Composing $\vect{x}$ with $s^{-1}$ makes it so that $\vect{x}$ travels at one unit of distance per unit of time. (Like how driving at 60 mph means that you travel at 1 mile per minute.)

For the record: \textbf{How to reparameterize by arclength}, given $\vect{x}\co [a,b] \to \R^n$ such that $||\vect{x'}(t)|| \neq 0$.

\begin{enumerate}
\item Find $s\co [a,b] \to [0,L]$ defined by
\[ s(t) = \int_a^t ||\vect{x'}(\tau)|| \thinspace d\tau.\]

\item Find the inverse function $s^{-1}\co [0,L] \to [a,b]$. Do this by setting $\sigma = s(t)$ and solving for $t$.

\item Define $\vect{y}(\sigma) = \vect{x}(s^{-1}(\sigma))$. That is, $\vect{y} = \vect{x} \circ s^{-1}$.
The curve $\vect{y}$ is the reparameterization of $\vect{x}$ by arclength, as we show after some examples.
\end{enumerate}

\begin{example}
Reparameterizing $\vect{x}(t) = \begin{pmatrix} t \\ 3t \end{pmatrix}$ for $t \in [0,2]$ by arclength.

\textbf{Solution:} Notice that $||\vect{x'}(t)|| = \sqrt{10}$. Thus,
\[
s(t) = \int_0^t \sqrt{10} \thinspace d\tau = \sqrt{10} t.
\]
Let $\sigma = \sqrt{10} t$ and solve for $t$ to find that:
\[
s^{-1}(\sigma) = t = \sigma/\sqrt{10}.
\]

Thus, 
\[\vect{y}(\sigma) = \vect{x}(s^{-1}(\sigma)) = \begin{pmatrix} \sigma/\sqrt{10} \\ 3\sigma/\sqrt{10}\end{pmatrix}\] 
is a reparameterization of $\vect{x}$ by arclength.
\end{example}
\hrulefill

\begin{example}
Let $\vect{x}(t) = \begin{pmatrix}t \\ t \\ (2/3)t^{3/2} \end{pmatrix}$ for $t \in [1,10]$. Reparameterize $\vect{x}$ by arclength.

\textbf{Solution:} Notice that $\vect{x'}(t) = (1,1,t^{1/2})$ and that $||\vect{x'}(t)|| = \sqrt{2 + t}$. Thus,
\[
\sigma = s(t) = \int_1^t \sqrt{2 + \tau} \thinspace d\tau = (2/3)(2 + t)^{3/2}.
\]

Solving for $t$ we get:
\[
s^{-1}(\sigma) = t = (3\sigma/2)^{2/3} - 2.
\]

We plug into $\vect{x}$ to get:
\[
\vect{y}(\sigma) = \vect{x}(s^{-1}(\sigma)= \begin{pmatrix} (3\sigma/2)^{2/3} - 2 \\ (3\sigma/32)^{2/3} - 2 \\ (2/3)((3\sigma/2)^{3/2} -  2)^{(3/2)} \end{pmatrix}.
\]
\end{example}
\hrulefill

Next we prove that the steps to reparameterization work, and then we do some other examples.



\begin{lemma}
Assume that $\vect{x}$ is a C$^1$ curve defined on $[a,b]$ such that for all $t$, $||\vect{x'}(t)|| \neq 0$. Let $\vect{y}$ be the reparameterization of $\vect{x}$ by arc length. Then for all $t$, $||\vect{y'}(t)|| = 1$ and the length of $\vect{y}$ on the interval $[0,t]$ is $t$.
\end{lemma}
\begin{proof}
Notice that:
\[
s'(t) = ||\vect{x}'(t)||
\]
by the fundamental theorem of Calculus. Also, $\vect{y} = \vect{x} \circ s^{-1}$ means that $\vect{x} = \vect{y} \circ s$. Consequently, by the chain rule,
\[
||\vect{x}'(t)|| = ||\vect{y'}(s(t))||\thinspace|s'(t)|
\]
Letting $\sigma = s(t)$ and recalling that $s'(t) = ||\vect{x'}(t)||$ we get:
\[
||\vect{x'}(t)|| = ||\vect{y'}(\sigma)|| \thinspace ||\vect{x}'(t)||.
\]
Thus, since $||\vect{x'}(t)|| \neq 0$,
\[
||\vect{y'}(\sigma)|| = 1.
\]
The length of $\vect{y}$ on the interval $[0,t]$ is, by definition,
\[
\int_0^t ||\vect{y}'(\sigma)|| \thinspace d\sigma.
\]
We see immediately that this equals $t$.
\end{proof}


\begin{example}
Let $\vect{x}(t) = (t^2,3t^2)$ for $t \in [1,2]$. Reparameterize $\vect{x}$ by arc length.

\textbf{Answer:} By definition, 
\[\begin{array}{rcl}
s(t) &=& \int_{1}^t \sqrt{4\tau^2 + 36\tau^2} \thinspace d\tau\\
&=& \int_{1}^t \sqrt{40}\tau \thinspace d\tau\\
&=& \sqrt{40}(t^2 - 1)
\end{array}\]
We need, $s^{-1}$. Solving the previous equation for $t$ we find:
\[
t = \sqrt{1 + s/\sqrt{40}}
\]
Thus,
\[
s^{-1}(t) = \sqrt{1 + t/\sqrt{40}}
\]
To get $\vect{y}(t)$ which is the reparameterization of $\vect{x}$ by arclength, we plug this in for $t$ in the equation for $\vect{x}$, getting:
\[\begin{array}{rcl}
\vect{y}(t) &= & \vect{x}\circ s^{-1}(t) \\
&=& \big(\left(\sqrt{1 + t/\sqrt{40}}\right)^2, 3\left(\sqrt{1 + t/\sqrt{40}}\right)^2\big)\\
&=& \big(1 + t/\sqrt{40}, 3(1 + t/\sqrt{40})\big)
\end{array}
\]
\end{example}

To avoid much of this algebra, we will often simply write $\vect{x}(s)$ instead of $\vect{x}\circ s^{-1}$. This notation has the potential to be confusing. Thus, in the previous example, the reparameterization of $\vect{x}(t) = (t^2,3t^2)$ by arc length is
\[
\vect{x}(s) = \big(1 + s/\sqrt{40}, 3(1 + s/\sqrt{40})\big).
\]

\begin{example}
Let $\vect{x}(t) = (\cos t, \sin t, (2/3)t^{3/2})$ for $t \geq 3$. Find $\vect{x}(s)$.

\textbf{Answer:} Compute:
\[
||\vect{x}'(t)|| = ||(-\sin t, \cos t, t^{1/2})|| = \sqrt{1 + t}.
\]
Thus,
\[
s = \int_{3}^t \sqrt{1 + \tau}\thinspace d\tau = (2/3)(1 + t)^{3/2} - (2/3)(1 + 3)^{3/2} = (2/3)(1 + t)^{3/2} - 16/3.
\]
Consequently,
\[
t = \left(\frac{3(s + 16/3)}{2}\right)^{2/3}
\]
Thus,
\[
\vect{x}(s) = \Bigg(\cos \left(\frac{3(s + 16/3)}{2}\right)^{2/3}, \sin \left(\frac{3(s + 16/3)}{2}\right)^{2/3}, (2/3)\left(\frac{3(s + 16/3)}{2}\right)^{4/3}\Bigg)
\]
\end{example}

\subsection{Curvature and the Moving Frame}

In this section we assign an intrinsic tangent space coordinate system to each point $\vect{x}$ on the image of a path $\vect{x}\co[a,b] \to \R^3$ called \defn{the moving frame}. 

We begin with an important lemma. It can be interpreted as saying that if a path lies on a sphere then its position vector is perpendicular to its tangent vector. This should not be a surprise if we believe that the radius of a circle is perpendicular to the tangent line intersecting it.

\begin{lemma}
Suppose that $\phi\co[a,b] \to \R^n$ is a C$^1$ path such that $||\phi(t)||$ is constant. Then, for all $t$, $\phi(t)$ is perpendicular to $\phi'(t)$.
\end{lemma}
\begin{proof}
Since $||\phi(t)||$ is constant,
\[
\phi(t) \cdot \phi(t) = ||\phi(t)||
\]
is constant. Thus,
\[
\frac{d}{dt} \phi(t) \cdot \phi(t) = 0.
\]
By the product rule we have:
\[
\phi'(t) \cdot \phi(t) + \phi(t) \cdot \phi'(t) = 0.
\]
Since dot product is commutative, this implies that
\[
2\phi(t) \cdot \phi'(t) = 0.
\]
Consequently,
\[
\phi(t) \cdot \phi'(t) = 0
\]
as desired.
\end{proof}

We already know that the unit tangent vector $\vect{T}$ is intrinsice to an oriented curve, so we take it as one of our coordinate directions in our moving frame. By the previous lemma, its derivative $\vect{T'}$ is perpendicular to it. So we define the \defn{unit normal vector} to be
\[
\vect{N}(t) = \frac{\vect{T'}(t)}{||\vect{T'}(t)||}.
\]

Our third coordinate direction needs to be of unit length and perpendicular to both $\vect{T}$ and $\vect{B}$. We call it the \defn{unit binormal vector:}
\[
\vect{B}(t) = \vect{T}(t) \times \vect{N}(t).
\]

Using the unit tangent vector we can also define the \defn{curvature} of a curve $\vect{x}$ to be:
\[
\kappa(t) = \frac{||\vect{T'}(t)||}{||\vect{x'}(t)||}.
\]

\begin{example}
Find the curvature of a line $\vect{x}(t) = t\vect{v} + \vect{b}$.

\textbf{Answer:} We have
\[
\vect{T} = \vect{x}'/||\vect{x}|| = \vect{v}/||\vect{v}||.
\]

Thus, $d\vect{T}/dt = \vect{0}$ and so $\kappa(t) = 0$.
\end{example}
\hrulefill

\begin{example}
The curvature of a circle of radius $r > 0$ is $1/r$ at each point on the circle.
\end{example}
\hrulefill

\begin{example}
Let $\phi(t) = (t,at^2)$ be a parameterized curve. Find the curvature of $\phi$ at $t = 0$.

\textbf{Answer:} We have: $\phi'(t) = (1,2at)$ and $\vect{T} = (1,2at)/\sqrt{1 + 4a^2t^2}$. Thus,
\[
\frac{d}{dt} \vect{T} = (0,2a)/\sqrt{1 + 4a^2t^2} + (1,2at)(-1/2)(1 + 4a^2t^2)^{-3/2}(8a^2t).
\]
Thus,
\[
||\phi'(0)|| = 1
\]
and
\[
||\frac{d}{dt}\vect{T}(0)|| = ||(0,2a)|| = 2a
\]
Consequently,
\[
\kappa(t) = 2a/1 = 2a
\]
\end{example}
\hrulefill

\begin{example}
Compute the moving frame and curvature for the path $\vect{x}(t) = (\sin t - t\cos t, \cos t + t\sin t, 2)$ with $t \geq 0$.

\textbf{Answer:}
We compute:
\[\begin{array}{rclcl}
\vect{x'}(t) &=& (\cos t - \cos t+ t\sin t, -\sin t + \sin t + t\cos t, 0) &=& (t\sin t, t \cos t, 0)\\
\hline\\
||\vect{x'}(t)|| &=& \sqrt{t^2\sin^2 t + t^2\cos^2 t} &=& t\\
\hline\\
\vect{T} &=& \vect{x}'(t)/||\vect{x}'(t)|| &=& (\sin t, \cos t, 0)\\
\hline\\
\vect{T}' &=& (-\cos t, \sin t, 0) &&\\
\hline\\
||\vect{T}'|| &=& 1 &&\\
\hline\\
\vect{N} &=& \vect{T'}/||\vect{T'}|| &= & (-\cos t, \sin t, 0)\\
\hline\\
\kappa &=& ||\vect{T}'||/||\vect{x}'|| &=& 1/t\\
\end{array}
\]

Finally, to compute $\vect{B}$ we need the cross product:
\[
\vect{B} = (\sin t, \cos t, 0) \times (-\cos t, \sin t, 0) = (0,0,1).
\]
\end{example}
\hrulefill

It turns out that
\[
\frac{\vect{B'}(t)}{||\vect{x'}(t)||} = -\tau \vect{N}
\]
for some scalar function $\tau$, called the \defn{torsion}. If $\tau(t) = 0$ for all $t$, the Binormal vector is constant and so is the plane perpendicular to it. That plane contains $\vect{x}$ and so the torsion measures how much the curve twists out of a plane. If $\tau(t) = 0$ for all $t$, then the curve lies in a plane.

\begin{example}
Let $\vect{x}(t) = \begin{pmatrix} \sin t - t\cos t \\ \cos t + t\sin t\\t^2\end{pmatrix}$ for $t > 0$. Calculate $\vect{T}$, $\vect{N}$, $\vect{B}$, $\kappa$, and $\tau$ for $\vect{x}$.

Easy computations show that:
\[\begin{array}{rcl}
\vect{x'}(t) &=& \begin{pmatrix} t\sin t \\ t\cos t \\ 2t \end{pmatrix}\\
&&\\
||\vect{x'}(t)|| &=& t\sqrt{5}.
\end{array}
\]

More computations show:
\[\begin{array}{rcl}
\vect{T}(t) &=& \frac{1}{\sqrt{5}}\begin{pmatrix} \sin t \\ \cos t \\ 2 \end{pmatrix} \\
&&\\
\vect{T'}(t) &=& \frac{1}{\sqrt{5}} \begin{pmatrix} \cos t \\ -\sin t \\ 0 \end{pmatrix} \\
&&\\
\vect{N}(t) &=& \begin{pmatrix}\cos t \\ -\sin t \\ 0 \end{pmatrix} \\
&&\\
\kappa(t) &=& \frac{1}{5t} \\
&&\\
\vect{B}(t) &=& \frac{1}{\sqrt{5}} \begin{pmatrix} 2 \sin t \\ 2\cos t \\ -1 \end{pmatrix} \\
&&\\
\vect{B'}(t) &=& \frac{1}{\sqrt{5}} \begin{pmatrix} 2 \cos t \\ -2\sin t \\ 0 \end{pmatrix}\\
&&\\ 
\vect{B'}(t)/||\vect{x'}(t)|| &=& \frac{2}{5t}\vect{N}(t) \\
&&\\
\tau(t) &=& -\frac{2}{5t}.
\end{array}\].
\end{example}
\hrulefill

\newpage

\section{Integrating Vector Fields and Scalar Fields over Curves}

\textbf{Warm-up Question 1:} Suppose that a constant force of $f$ Newtons pushes a box $d$ meters. How much work was done?

\textbf{Answer:} $df$ Newton-meters of work was done, since if a force is constant and in the direction of motion, then the work done is equal to the magnitude of the force times the distance moved.

\textbf{Warm-up Question 2:}Suppose that a constant force of $f$ Newtons is applied to a box and moves the box $d$ meters. This time, however, the force is at an angle of $\theta$ degress with the direction of motion. How much work is done by the force?

\textbf{Solution:} Let $\vect{F}$ be the force and let $\vect{d}$ be the direction. The projection of $\vect{F}$ onto $\vect{d}$ tells us how much of the force is in the direction of motion. Some trigonometry tells us that it is $||\vect{F}||\cos \theta$. Taking this times the distance travelled gives:
\[
\text{Work done } = ||\vect{F}||||\vect{d}||\cos \theta = \vect{F} \cdot \vect{d}.
\]

\textbf{Warm-up Question 3:} Suppose that at each point on a path $\vect{x}\co [a,b] \to \R^n$ there is a different force $\vect{F}$. Assume that the path and the  function $\vect{F}$ are C$^1$. How much work is done by the force to an object moving along the path?

\textbf{Solution:} Break the path into segments of equal length $\Delta s$ and pretend that $\vect{F}$ is constant on each segment and that the image of $\vect{x}$ is a polygonal path with endpoints corresponding to the segment breaks. We would then add up $\vect{F}\cdot \vect{d}$ on each segment. This gives an approximation to the work done. If we want the exact value we take a limit. This suggests \textit{defining} the work done to be:
\[
\int_a^b \vect{F}(\vect{x}(t))\cdot \vect{x'}(t) \thinspace dt.
\]

This last integral is an example of a path integral of a vector field. Before discussing them more, we discuss path integrals of scalar fields.

\subsection{Path Integrals of Scalar Fields}
A \defn{scalar field} on $\R^n$ is simply a function $f\co \R^n \to \R$. We think of $f$ as assigning a number $f(\vect{x})$ to each point $\vect{x}$ in $\R^n$. Below is a depiction of the scalar field $f(x,y) = x^2 + y^2$ on $\R^2$. To a point $(x,y) \in \R^2$, we assign the number $x^2 + y^2$.  Points which are assigned small numbers are colored blue and points which are assigned large numbers are colored red.

\begin{center}
\includegraphics[scale=.2]{Figures/ScalarField}
\end{center}

The following  example demonstrates the important idea of integrating a scalar field over a curve.
\begin{example}
Let $L$ be a straight piece of wire in $\R^2$ with endpoints at $(0,0)$ and at $(1,2)$. Suppose that the temperature of the wire at point $(x,y)$ is $f(x,y) = x^2 + y$. Find the average temperature of the wire.

\textbf{Solution:}
Break the wire $L$ into little tiny segments, $L_1, \hdots, L_n$ each of length $\Delta s$. Since $L$ has a length of $\sqrt{5}$, $\Delta s = \sqrt{5}/n$.

Then the average temperature of $L$ is approximately
\[
T_n = \frac{1}{n} \sum_{i = 1}^n f(\vect{x^*_i})
\]
In fact, the average temperature of $L$ is exactly
\[
T = \lim_{n \to \infty} \frac{1}{n}\sum_{i = 1}^n f(\vect{x^*_i}).
\]
Recall that $1/n = (\Delta s)/\sqrt{5}$. Thus,
\[
T = \lim_{n \to \infty} \frac{1}{\sqrt{5}}\sum_{i=1}^n f(\vect{x^*_i})\Delta s
\]
This looks a lot like a limit of Riemann sums, so perhaps we can convert this to a definite integral and use the Fundamental Theorem of Calculus. Before we do that, however, notice that (up to proving that the limit exists) we have a perfectly fine definition of the quantity
\[
\text{Ave. value of } f \text{ on } L = \frac{1}{\text{length of } L}\int_L f \thinspace ds.
\]
We were able to define this integral without relying on a parameterization of $L$!

To calculate this, however, we need a parameterization. Suppose that there exists a parameterization $\phi\co [0,\sqrt{5}] \to \R^2$ of $L$ such that at time $t$, the distance from $(0,0)$ to $\phi(t)$ along $L$ is exactly $t$. That is, ``$L$ is parameterized by arc length''. Then, $\Delta s = \Delta t = \sqrt{5}/n$ so
\[
T = \frac{1}{\sqrt{5}}\lim_{n \to \infty} \sum_{i = 1}^n f(\phi(t^*_i))\Delta t = \frac{1}{\sqrt{5}}\int_0^{\sqrt{5}}f(\phi(t))\thinspace dt.
\]

\textbf{Exercise:} Find a parameterization of $L$ by arclength.

\textbf{Solution:} Define $\hat{\phi}(t)= (t,2t)$ and define $\phi(t) = \hat{\phi}(t/\sqrt{5})$. 
\end{example}
\hrulefill

we make the following definition:

Suppose that $f\co \R^n \to \R$ is continuous and that $\vect{x}\co [a,b] \to \R^n$ is a (piecewise) C$^1$ path. Define 
\[\int_\vect{x} f \thinspace ds = \int_a^b f(\vect{x}(t))||\vect{x}'(t)||\thinspace dt.\]

\begin{example}
Let $f(x,y) = x^2 + y$ and $\vect{x}(t) = t\begin{pmatrix}1\\2 \end{pmatrix}$ for $0 \leq t \leq 1$. Then,
\[\begin{array}{rcl}
\int_\vect{x} f \thinspace ds &=& \int_0^1 f(\vect{x}(t))|\thinspace ||\vec{x'}(t)||\thinspace dt\\
&=& \int_0^1 (t^2 + 2t)\sqrt{5} \thinspace dt.
\end{array}
\]
\end{example}
%
\begin{example}
Let $f(x,y,z) = 1/(xyz)$ and $\vect{x}(t) = \begin{pmatrix}\sin t \\ t\cos t \\ t \end{pmatrix}$ for $\pi/4 \leq t \leq 2\pi$. 

Then
$||\vect{x'}(t)|| = \sqrt{\cos^2 t + (\cos t - t\sin t)^2 + 1}$.

Thus,
\[
\int_\vect{x} f \thinspace ds = \int_{\pi/4}^{2\pi} \frac{\sqrt{\cos^2 t + (\cos t - t\sin t)^2 + 1}}{t^2\sin t \cos t} \thinspace dt.
\]
\end{example}

\subsection{Path Integrals of Vector Fields}
A \defn{vector field} on $\R^n$ is a function $F$ such that for every $\vect{x}\in \R^n$, $F(\vect{x})$ is a vector in $T_\vect{x}$. Since $T_\vect{x}$ is simply a copy of $\R^n$ with origin at $\vect{x}$, we can think of $F$ as the assignment of a vector $F(\vect{x})$ in $\R^n$ to each point in $\R^n$. Since we think of this vector as living in $T_\vect{x}$, we draw it as a vector in $\R^n$ with tail at $\vect{x}$. 
\begin{example}
Here is a picture of the vector field $\vect{F}(x,y) = (-y,x)$. The arrows are not drawn with the correct lengths.

\begin{center}
\includegraphics[scale=.4]{Figures/CircularFlow1}
\end{center}
\end{example}

If $\vect{F}\co \R^n\to \R^n$ is a C$^1$ vector field, and if $\vect{x}\co [a,b] \to \R^n$ is a C$^1$ path, the \defn{integral} of $\vect{F}$ along $\vect{x}$ is defined to be:
\[
\int_\vect{x} \vect{F} \cdot d\vect{s} = \int_a^b \vect{F}(\vect{x}(t))\cdot \vect{x'}(t) \thinspace dt.
\]

\begin{example}
Let $\vect{F}(x,y) = \begin{pmatrix} -y \\ x \end{pmatrix}$. Let $\vect{x}(t) = \begin{pmatrix} \cos t \\ \sin t \end{pmatrix}$. Find $\int_\vect{x} \vect{F}\cdot d\vect{s}$.

\textbf{Solution:}
Notice that $\vect{F}(\vect{x}(t)) = \begin{pmatrix} -\sin t \\ \cos t \end{pmatrix}$ and that $\vect{x'}(t) = \begin{pmatrix} -\sin t \\ \cos t \end{pmatrix}$. Thus,
\[
\int_\vect{x} \vect{F} \cdot d\vect{s} = \int_a^b \begin{pmatrix} - \sin t \\ \cos t \end{pmatrix} \cdot \begin{pmatrix} -\sin t \\ \cos t \end{pmatrix} = 2\pi.
\]

Notice that here we have an example where the work done transporting an object in a closed loop is not necessarily zero.
\end{example}
\hrulefill

Before discussing integration more, we look at additional examples of vector fields and some important associated concepts.

\section{Vector Fields}
\begin{example}

Here is the vector field $F(x,y) = (y,x)$. The arrows are not drawn with the right lengths.

\begin{center}
\includegraphics[scale=.4]{Figures/VectorField1}
\end{center}
\end{example}
\hrulefill

A good way of thinking about a vector field is that it tells you the direction and speed of flow of water in a huge water system. To see this, suppose that we have an object in the stream at point (1,0) at time 0. Its position at time $t$ is given by $\phi(t) = (x(t),y(t))$. If the vector field $F(x,y) = (F_1(x,y), F_2(x,y))$ describes the direction and speed of the object, then
\[
\begin{array}{rcl}
x'(t) &=& F_1(\phi(t))\\
y'(t) &=& F_2(\phi(t))\\
\end{array}
\]
This a system of differential equations which we may or may not be able to solve. If $\phi$ exists, it is called a flow line for $F$.  

\begin{example}
Find a flow line $\phi(t)$ for $\vect{F}(x,y) = (-y,x)$ passing through the point $(2,0)$.

\textbf{Solution:} Suppose that $\phi(t) = \begin{pmatrix}x(t) \\ y(t) \end{pmatrix}$. Then the equation $\phi'(t) = \vect{F}(\phi(t))$ becomes:
\[
\begin{pmatrix} x'(t) \\ y'(t) \end{pmatrix} = \begin{pmatrix} -y(t) \\ x(t) \end{pmatrix}.
\]

Thus we are looking for function $x$ and $y$ so that
\[\begin{array}{rcl}
x'(t) &=& -y(t) \\
y'(t) &= & x(t) \\
x(0) &=& 2\\
y(0) &=& 0\\
\end{array}
\]

The differential equations make us remember that $\sin$ and $\cos$ have derivatives related to each other  in the way that we need.

Thus,
\[
\phi(t) = \begin{pmatrix} 2\cos t \\ 2\sin t \end{pmatrix}
\]
is the flow line we are looking for.
\end{example}
\hrulefill

\begin{example}
Let $\vect{F}(x,y) = (y,x)$. Find flow lines through $(1,1)$ and through $(1,0)$.

\textbf{Answer:} Let $\phi(t) = \begin{pmatrix} x(t) \\ y(t) \end{pmatrix}$ be a flow line. Then,
\[
\begin{array}{rcl}
x'(t) &=& y(t) \\
y'(t) &=& x(t) \\
\end{array}
\]

As a first guess, we try $x(t) = e^t$ and $y(t) = e^t$. Sure enough, $\phi(t)= \begin{pmatrix} e^t \\ e^t \end{pmatrix}$ is a flow line for $\vect{F}$ passing through $(1,1)$.

To find a flow line passing through $(1,0)$ more ingenuity is required. Eventually, we might come up with:

\[\phi(t) = \begin{pmatrix} \cosh t \\ \sinh t \end{pmatrix} = \begin{pmatrix}
(e^t + e^{-t})/2\\
(e^t - e^{-t})/2
\end{pmatrix}\]

The image of this second flow line in the vector field $\vect{F}$ is pictured below.

\begin{center}
\includegraphics[scale=.4]{Figures/VectorField1wflow}
\end{center}
\end{example}
\hrulefill

\newpage

\subsection{Gradient}

Define the gradient by $\nabla \co C^1(\R^n) \to \R^n$ by 
\[
\grad f = \nabla f= (\lpartial{x_1}, \lpartial{x_2}, \hdots, \lpartial{x_n}).
\]

If we think of $f \in C^1(\R^n)$ as a scalar field, then $\nabla$ (the gradient) converts the scalar field into a vector field. The vectors point in the direction of greatest increase of $f$.



\begin{example}
Consider $f\co \R^2 \to \R$ defined by $f(x,y)= \sin x \cos y$. Then $\nabla f = (\cos x \cos y, -\sin x \sin y)$. Below is the vector field $\nabla f$ on top of the scalar field $f$. Contour lines have been drawn on the scalar field so that you can see how the vectors $\nabla f$ are perpendicular to the contour lines.

\begin{center}
\includegraphics[scale=.4]{Figures/GradField1}
\end{center}
\end{example}
\hrulefill

If $f\co \R^n \to \R$ is a scalar field and if $\vect{F} = \nabla f$, we say that $f$ is a \defn{potential function} for $\vect{F}$ and that $\vect{F}$ is a \defn{gradient field} or a \defn{conservative vector field}.

For a fixed constant $c$, the set of points $\{\vect{x} : f(\vect{x}) = c \}$ is called an \defn{equipotential set} for $f$ or $\vect{F}$. 

\begin{example}
Find a potential function for $\vect{F}(x,y) = \begin{pmatrix} -x \\ y \end{pmatrix}$.

\textbf{Answer:} The function $f(x,y) = -\frac{1}{2} x^2 + \frac{1}{2} y^2$ is a potential function for $\vect{F}$ since $\nabla f = \vect{F}$. The hyperbolae
\[
-\frac{1}{2}x^2 + \frac{1}{2} y^2 = c
\]
are the equipotential lines for $f$. Notice in the figure below, that the equipotential line is perpendicular to a flow line. The flow line is black and the equipotential line is red.

\begin{center}
\includegraphics[scale=.3]{Figures/VFflowEquipotential}
\end{center}
\end{example}
\hrulefill

\begin{theorem}
Suppose that $\vect{F}$ is a conservative vector field with potential function $f$. Suppose that $L$ is a smooth equipotential line for $f$ and that $\phi$ is a flow line for $\vect{F}$ intersecting $L$. Then $L$ and $\phi$ are perpendicular.
\end{theorem}
\begin{proof}
Suppose that $\phi$ and $L$ intersect at a point $\vect{x_0}$ and that $L$ has a unit tangent vector $\vect{v}$ at $\vect{x}_0$. Since $f$ is constant along $L$, the directional derivative $\lpartial{\vect{v}} f (\vect{x_0})$ is equal to zero. By a standard result from Calculus II, $\lpartial{\vect{v}} f(\vect{x_0}) = \nabla f(\vect{x_0}) \cdot \vect{v}$. Since this is zero, $\nabla f(\vect{x_0}) = \vect{F}(\vect{x}_0)$ is perpendicular to $L$ at $\vect{x_0}$.
\end{proof}

Another very useful fact is:

\begin{theorem}
Suppose that $\vect{F}$ is a gradient field and that $\phi$ is a flow line with $||\phi'(t)|| > 0$ for all $t$. Then $\phi$ does not close up on itself; in fact, for all $t_1$ and $t_2$ with $t_1 \neq t_2$, $\phi(t_1) \neq \phi(t_2)$.
\end{theorem}
\begin{proof}
Since $\vect{F}$ is a gradient field, there exists a potential function $f$ for $\vect{F}$. Consider $g(t) = f(\phi(t))$. Then
\[
g'(t) = Df(\phi(t))\phi'(t) = \nabla f(\phi(t)) \cdot \phi'(t)
\]
Since $\vect{F} = \nabla f$ and since $\phi'(t) = \vect{F}(\phi(t))$, we have
\[
g'(t) = \vect{F}(\phi(t)) \cdot \vect{F}(\phi(t)) = ||\vect{F}(\phi(t))||^2 = ||\phi'(t)||^2 > 0.
\]

Thus, $g'(t) > 0$ for all $t$. In particular, $g(t) = f(\phi(t))$ is a strictly increasing function.

Suppose that there exist $t_1 \neq t_2$ such that $\phi(t_1) = \phi(t_2)$. Then $g(t_1) = g(t_2)$, but this contradicts the fact that $g$ is strictly increasing. Hence, $\phi(t_1) \neq \phi(t_2)$ for all $t_1 \neq t_2$.
\end{proof}

\begin{example}
The vector field $\vect{F}(x,y) = (-y,x)$ has $\phi(t) = (\cos t, \sin t)$ as a flow line. Since $\phi(0) = \phi(2\pi)$, the vector field $\vect{F}$ is not a gradient field.
\end{example}
\hrulefill

The most important theorem of this subsection is a version of the Fundamental Theorem of Calculus for conservative vector fields:
\begin{theorem}\label{Thm: FTC Conservative}
Suppose that $\vect{F} = \nabla f$ is a C$^1$ conservative vector field on $\R^n$. Let $\vect{x}\co [a,b] \to \R^n$ be a path, then
\[
\int_{\vect{x}} \vect{F} \vl = f(\vect{x}(b)) - f(\vect{x}(a)).
\]
\end{theorem}
Notice that one implication of this theorem is that the path integral of a conservative vector fields depends only on the potential function and the endpoints of the path, but not on the path itself. This suggests the following definition (which applies to any vector field, not just conservative ones.)

\begin{definition}
A vector field $\vect{F}$ defined on a region $D \subset \R^n$ has \defn{path independent line integrals} if whenever $\vect{x}\co [a,b] \to D$ and $\vect{y}\co [c,d] \to D$ are paths such that $\vect{x}(a) = \vect{y}(c)$ and $\vect{x}(b) = \vect{y}(d)$ we have
\[
\int_\vect{x} \vect{F} \vl = \int_\vect{y} \vect{F} \vl.
\]
In other words, line integrals depend only on the endpoints and direction of the path.
\end{definition}

Theorem \ref{Thm: FTC Conservative} has the immediate consequence:
\begin{corollary}\label{Cor: Conservative Path Independence}
Conservative vector fields have path independent line integrals. 
\end{corollary}

We now prove Theorem \ref{Thm: FTC Conservative}.
\begin{proof}[proof of Theorem \ref{Thm: FTC Conservative}]
Recall that $\vect{F} = \nabla f$. By the chain rule:
\[
\frac{d}{dt} f(\vect{x}(t)) = \nabla f(\vect{x}(t)) \cdot \vect{x'}(t) = \vect{F}(\vect{x}(t))\cdot \vect{x'}(t).
\]
Hence,
\[
\int_a^b \frac{d}{dt} f(\vect{x}(t))  \thinspace dt = \int_a^b \vect{F}(\vect{x}(t))\cdot \vect{x'}(t) \thinspace dt.
\]
We can evaluate the left hand side using the Fundamental Theorem of Calculus (version 2) to conclude that
\[
f(\vect{x}(b)) - f(\vect{x}(a)) = \int_a^b \vect{F}(\vect{x}(t))\cdot \vect{x'}(t) \thinspace dt.
\]

The right hand side is just one piece of the definition of line integral and so we have:
\[
f(\vect{x}(b)) - f(\vect{x}(a)) = \int_\vect{x} \vect{F} \vl
\]
as desired.
\end{proof}

By using the Fundamental Theorem of Calculus (version 1) we can actually also prove the converse to Theorem \ref{Thm: FTC Conservative}.

\begin{theorem}\label{Thm: PI -> Conserv}
Suppose that $\vect{F}$ is a C$^1$ vector field defined on an open region $D$ in $\R^n$. If $\vect{F}$ has path independent line integrals then $\vect{F}$ is conservative.
\end{theorem}
\begin{proof}
The only way we have of showing a vector field is conservative is to construct a potential function, so that is what we do. For simplicity, we assume that $D$ has the property that for any two points $\vect{a}$ and $\vect{b}$ in $D$, there is a C$^1$ path joining them.

We need to define a C$^2$ potential function $f\co D \to \R^2$ for $\vect{F}$. To that end, let $\vect{a} \in D$, be considered as a basepoint. If $\vect{x} \in D$, choose a path $\phi$ joining $\vect{a}$ to $\vect{x}$ and define $f(\vect{x}) = \int_\phi \vect{F}\cdot d\vect{s}$. Notice that definition of $f$ requires that the path $\phi$ be chosen, but that the choice does not matter -- any two paths will give the same answer, by our hypothesis.

We need to show that $f$ is differentiable and that $\nabla f = \vect{F}$. We do this by examining the directional derivatives of $f$. 

Let $\vect{u}$ be a unit vector. Since $D$ is open, there exists an open disc centered at $\vect{x}$ and contained in $D$. Choose $h \in \R$ small enough so that the vector $\vect{x} + h\vect{u}$ is in this disc. Let $\phi$ be a path from $\vect{a}$ to $\vect{x}$ and let $\psi$ be a straight line path in $D$ from $\vect{x}$ to $\vect{x } + \vect{h}$. Then:
\[\begin{array}{rc}
\frac{1}{h}(f(\vect{x} + \vect{h}) - f(\vect{x}) &=\\
\frac{1}{h}\left(\int_{\phi} \vect{F} \cdot d\vect{s} + \int_\psi \vect{F} \vl - \int_\phi \vect{F} \vl \right) &=\\
\frac{1}{h} \int_\psi \vect{F} \vl &\\
\end{array}
\]
Since $\psi$ is a straight line path, we may assume that $\psi(t) =\vect{x} + t\vect{u}$ for $0 \leq t \leq h$. Then $\psi'(t) = \vect{u}$. The directional derivative of $f$ in the direction $\vect{u}$ is then:

\[\begin{array}{rc}
\lim_{h \to 0} \frac{1}{h}f(\vect{x} + h\vect{u}) - f(\vect{x}) &=\\
\lim_{h \to 0}\frac{1}{h} \int_\psi \vect{F} \vl &=\\
\lim_{h \to 0}\frac{1}{h} \int_0^h \vect{F}(\psi(t))\cdot \vect{u})\thinspace dt &=\\
\end{array}
\]

When $h$ is very small, $\vect{F}(\psi(t)) \approx \vect{F}(x)$ with the approximation improving as $\vect{h} \to \vect{0}$. Thus, if $\vect{u}$ is constant, we have the directional derivative of $f$ in the $u$ direction as:
\[\begin{array}{rc}
\lim_{h \to 0} \frac{1}{h}(f(\vect{x} + \vect{h}) - f(\vect{x})) &=\\
\lim_{h \to 0}\frac{1}{h} \int_0^h \vect{F}(\psi(t))\cdot \vect{u})\thinspace dt &= \\
\lim_{h \to 0} \frac{1}{h} \int_0^h \vect{F}(\vect{x}) \cdot \vect{u} \thinspace dt &=\\
\lim_{h \to 0} \frac{1}{h}(\vect{F}(\vect{x})\cdot \vect{u}) h &=\\
\vect{F}(\vect{x}) \cdot \vect{u}.
\end{array}\]

By making wise choices of $\vect{h}$, we see that $\frac{\partial f}{\partial x} = \vect{F} \cdot \vect{i}$ and $\frac{\partial f}{\partial y} = \vect{F} \cdot \vect{j}$. Consequently, $\nabla f = \vect{F}$. Furthermore, because $\vect{F}$ is C$^1$, $f$ is differentiable and is C$^2$.
\end{proof}

\newpage

\subsection{Curl}
If $C$ is a closed curve, the \defn{circulation} of a vector field $\vect{F}$ around $C$ is defined to be $\int_C \vect{F}\vl$. In the previous section, among other things, we say that the circulation around any closed curve of a conservative vector field is 0. In the homework, you will show that Theorem \ref{Thm: PI -> Conserv} is in fact equivalent to the statement that if a vector field has the property that for all closed curves $C$ the circulation around $C$ is 0 then $\vect{F}$ is conservative. Does this mean that a non-conservative vector field always has some kind of swirling or rotation? In this section we make the concept precise and will begin exploring the nuances of the answer. We begin with an example.


\begin{example}
Let $\vect{F}(x,y) = \begin{pmatrix} 0 \\ x \end{pmatrix}$. It is shown below:

\begin{center}
\includegraphics[scale=.3]{Figures/VerticalNonConserv}
\end{center}

Notice that the arrows get longer and longer as we move out the $x$ axis. Consider circles $C_r$ of radius $r$ centered at the origin. The \defn{circulation} of $\vect{F}$ around $C_r$ is simply the line integral $\int_{C_r} \vect{F}\cdot d\vect{s}$. We can easily calculate this by parameterizing $C_r$ as:
\[
C_r(t) = r\begin{pmatrix}\cos t \\ \sin t \end{pmatrix} \hspace{.3in} \text{ for } 0 \leq t \leq 2\pi.
\]
We have:
\[
C'_r(t) = r\begin{pmatrix} -\sin t \\ \cos t \end{pmatrix}.
\]
Thus,
\[\begin{array}{rcl}
\int\limits_{C_r} \vect{F} \vl &=& \int_0^{2\pi} \begin{pmatrix} 0 \\ r\cos t \end{pmatrix} \cdot \begin{pmatrix} -r\sin t \\ r\cos t \end{pmatrix} \thinspace dt \\
&=& \int_0^{2\pi}  r^2\cos^2 t \thinspace dt \\
&=& \int_0^{2\pi}r^2(\cos 2t +1)/2 \\
&=& \pi r^2
\end{array}
\]

Since this integral is non-zero (for $r > 0$), the field is not conservative. Furthermore, there is clearly some sort of rotation about the origin even though all flow lines are straight lines. Even on small scales this rotation persists as we can see by taking the limit of the circulation around $C_r$ divided by the area enclosed by $C_r$:
\[
\lim_{r \to 0^+} \frac{1}{\pi r^2} \int\limits_{C_r} \vect{F} \vl = \lim_{r \to 0^+} (\frac{1}{\pi r^2})(\pi r^2) = 1.
\]
This is an example of what is called the ``scalar curl'' of a 2-dimensional vector field.
\end{example}
\hrulefill

\begin{definition}
Suppose that $\vect{F}$ is a C$^1$ vector field defined on an open region $D \subset \R^2$. Let $\vect{a} \in D$. For each $r$, let $C_r$ be a circle of radius $r$ centered at $\vect{a}$ and oriented counter-clockwise. Choose $r$ small enough so that the disc $D_r$ bounded by $C_r$ is contained in $D$. Then, the \defn{scalar curl} of $\vect{F}$ at $\vect{a}$ is defined to be:
\[
\operatorname{scalar curl}\vect{F}(\vect{a}) = \lim_{r \to 0^+} \frac{1}{\operatorname{Area}(D_r)} \int_{C_r} \vect{F} \vl.
\]
\end{definition}

Since the integral of a conservative vector field around a closed curve is 0, we see immediately that the scalar curl of a conservative vector field at any point $\vect{a}$ is zero.

How important is it that the curves $C_r$ be circles? Not that important, as the next example suggests.

\begin{example}
Let $\vect{F}(x,y) = \begin{pmatrix} 0 \\ x \end{pmatrix}$. Let $C_r$ be the square with corners at $(-r,-r)$, $(r,-r)$, $(r,r)$, and $(-r,r)$ oriented counter-clockwise. Let $D_r$ be the solid square bounded by $C_r$. We will compute
\[
\lim_{r \to 0^+} \frac{1}{\operatorname{Area}(D_r)} \int_{C_r} \vect{F} \vl.
\]

To do that we need to parameterize $C_r$. $C_r$ consists of four line segments which we may paramterize as:
\[\begin{array}{rlcl}
L_1(t) = & (t,-r) & \hspace{.3in} & -r \leq t \leq r\\
L_2(t) =  &(r,t) & & -r \leq t \leq r \\
L_3(t) = & (-t,r) & & -r \leq t \leq r \\
L_4(t) = & (-r,-t) && -r \leq t \leq r.
\end{array}
\]
Notice that:
\[\begin{array}{rlcl}
L_1(t) = & (1,0) & \hspace{.3in} & -r \leq t \leq r\\
L_2(t) =  &(0,1) & & -r \leq t \leq r \\
L_3(t) = & (-1,0) & & -r \leq t \leq r \\
L_4(t) = & (0,-1) && -r \leq t \leq r.
\end{array}
\]
We have that
\[\begin{array}{rcl}
\int_{C_r} \vect{F} \vl &=& \int_{L_1} \vect{F} \vl + \int_{L_2} \vect{F} \vl + \int_{L_3} \vect{F} \vl +\int_{L_4} \vect{F} \vl \\
&=& \int_{-r}^r \begin{pmatrix} 0 \\ t \end{pmatrix} \cdot \begin{pmatrix} 1 \\ 0 \end{pmatrix} + 
\begin{pmatrix} 0 \\ r \end{pmatrix} \cdot \begin{pmatrix} 0 \\ 1 \end{pmatrix} + 
\begin{pmatrix} 0 \\ -t \end{pmatrix} \cdot \begin{pmatrix} -1 \\ 0 \end{pmatrix} + 
\begin{pmatrix} 0 \\ -r \end{pmatrix} \cdot \begin{pmatrix} 0 \\ -1 \end{pmatrix} \\
&=& 0 + r(2r) + 0 +r(2r) \\
&=& 4r^2.
\end{array}
\]
The area $D_r$ is $(2r)^2 = 4r^2$. So
\[
\lim_{r \to 0^+} \frac{1}{\operatorname{Area}(D_r)} \int_{C_r} \vect{F} \vl = \lim_{r \to 0^+} \frac{1}{4r^2}(4r^2) = 1.
\]
This is the same answer as in the previous example.
\end{example}
\hrulefill

\begin{example}
Compute the scalar curl of $\vect{F}(x,y) = (-y,x)$ at each $\vect{a}$ in $\R^2$. 

Let $C_r$ be the circle of radius $r$ centered at $\vect{a} = (a_1,a_2)$. The curve $C_r$ can be parameterized as:
\[
C_r(t) = \begin{pmatrix} a_1 + r \cos t \\ a_2 + r \sin t \end{pmatrix} \text{ for } 0 \leq t \leq 2\pi.
\]
We have
\[
C'_r(t) = \begin{pmatrix} -r\sin t \\ r \cos t \end{pmatrix}.
\]
Thus, the circulation of $\vect{F}$ around $C_r$ is:
\[
\begin{array}{rcl}
\int_{C_r} \vect{F} \vl &=& \int_0^{2\pi} \begin{pmatrix}-a_2 - r \sin t \\ a_1 + r \cos t \end{pmatrix} \cdot \begin{pmatrix}-r\sin t \\ r\cos t \end{pmatrix} \\
&=& \int_0^{2\pi} -(a_2 + r \sin t)(-r \sin t) + (a_1 + r \cos t)(r \cos t) \\
&=& \int_0^{2\pi} ra_2 \sin t + ra_1 \cos t + r^2 \\
&=& 2\pi r^2.
\end{array}
\]
Hence, the scalar curl of $\vect{F}$ at $\vect{a}$ is:
\[
\lim_{r \to 0^+} \frac{1}{\pi r^2} \int_{C_r} \vect{F} \vl = \lim_{r \to 0^+} \frac{1}{\pi r^2} (2\pi r^2) = 2.
\]
\end{example}
\hrulefill

Can we define some sort of ``curl'' for vector fields in $\R^3$? We sure can:

\begin{definition}
Suppose that $\vect{F}$ is a C$^1$ vector field defined on an open subset of $\R^3$. Let $\vect{a}$ be a point in the domain of $\vect{F}$. Let $C_r$ be a circle in the $xy$-plane centered at $\vect{a}$ of radius $r$ and with the right-hand orientation around the positive $z$-axis. Let $D_r$ be a circle in the $yz$-plane centered at $\vect{a}$ of radius $r$ and with the right-hand orientation around the positive $x$-axis. Let $E_r$ be a circle in the $xz$-plane centered at $\vect{a}$ of radius $r$ and with the right-hand orientation around the positive $y$-axis. Choose $r > 0$ small enough so that each of these circles is contained in the domain of $\vect{F}$. Then the \defn{curl} of $\vect{F}$ and $\vect{a}$ is defined to be:
\[
\curl \vect{F}(\vect{a}) = \lim_{r \to 0^+} \frac{1}{\pi r^2} \begin{pmatrix} \int_{D_r} \vect{F} \vl \\ \int_{E_r} \vect{F} \vl \\ \int_{C_r} \vect{F} \vl \end{pmatrix}.
\]
\end{definition}
The circles $C_r$, $D_r$ and $E_r$ are pictured below (with $\vect{a} = \vect{0}$.

\begin{center}
\includegraphics[scale=.3]{Figures/CurlCircles}
\end{center}

Notice that if $\vect{F} = \begin{pmatrix} F_1 \\ F_2 \\ 0 \end{pmatrix}$, is actually 2-dimensional, then the $\vect{k}$ component of $\curl \vect{F}(\vect{a})$ is the scalar curl of $\vect{F}$.

Notice that, based on this definition, it is fair to say that curl measures the ``infinitesimal rotation'' of a vector field $\vect{F}$ about a point $\vect{a}$. Informally, if $\curl \vect{F}(\vect{a}) \neq \vect{0}$, then a paddle-wheel dropped in the vector field at $\vect{F}$ will spin around an axis pointing in the direction of $curl \vect{F}(\vect{a})$. 

Although the definition of curl tells us what it is, it doesn't provide a good means of calculating it. After we learn Stokes' theorem, we'll be able to prove the following:
\begin{theorem}\label{Thm: Curl Formula}
Suppose that $\vect{F} = \begin{pmatrix} M \\ N \\ P \end{pmatrix}$. Then
\[
\begin{array}{rcl}
\curl \vect{F}(\vect{a}) &=& \nabla \times \vect{F} (\vect{a}) \\
&=& \det \begin{pmatrix} \vect{i} & \vect{j}  & \vect{k} \\ \lpartial{x} & \lpartial{y} & \lpartial{z} \\ M & N & P \end{pmatrix}\\
&=& \begin{pmatrix} \lpartial{y} P(\vect{a}) - \lpartial{z} N(\vect{a}) \\ \lpartial{z} M(\vect{a}) - \lpartial{x}P(\vect{a}) \\ \lpartial{x} N(\vect{a}) - \lpartial{y} M(\vect{a}) \end{pmatrix}.
\end{array}
\]
\end{theorem}

\begin{example}
Calculate the curl of $\vect{F}(x,y) = (-y,x)$.

\textbf{Solution:} 
\[\begin{array}{rcl}
\curl \vect{F}(x,y) &=& \det \begin{pmatrix} \vect{i} & \vect{j}  & \vect{k} \\ \lpartial{x} & \lpartial{y} & \lpartial{z} \\ -y & x & 0 \end{pmatrix}\\
&=& \begin{pmatrix} \lpartial{y} 0 - \lpartial{z} (x) \\ \lpartial{z} (-y) - \lpartial{x} (0) \\ \lpartial{x} (x) - \lpartial{y} (-y) \end{pmatrix} \\
&=& \begin{pmatrix} 0 \\ 0 \\ 2 \end{pmatrix}.
\end{array}
\]
\end{example}
\hrulefill

\newpage

\subsection{Divergence}

In the last section we saw two formulations of curl -- one in terms of integrals and one in terms of partial derivatives. The formula in terms of integrals told us what curl means but the formula with derivatives tells us how to calculate it. In this section we'll do something similar for the ``divergence'' of a vector field. At present, we can only do this in 2-dimensions. After we introduce the notion of surface integral, we'll also be able to define divergence in 3-dimensions.

Before defining divergence, we need to define the concept of ``outward pointing normal'' to a curve.

\begin{definition}
Suppose that $\vect{x}\co [a,b] \to \R^2$ is a simple closed curve (that is, it closes up and is one-to-one except at $a$ and $b$.) Assume that $\vect{x}$ is (piecewise) C$^1$ and that for all $t$, $||x'(t)|| \neq 0$. A theorem from topology guarantees that the image of $\vect{x}$ separates $\R^2$ into two regions, one of which $D$ is bounded. For $t \in [a,b]$, the \defn{outward unit normal} to $\vect{x}$ is the unit vector $\vect{n}(t)$ that is perpendicular to $\vect{x'}(t)$ and points out of $D$. See the figure below. This may or may not be the same as the standard unit normal $\vect{N}(t)$.
\end{definition}

\begin{center}
\includegraphics[scale=.3]{Figures/OutwardNormal}
\end{center}

\begin{example}
Let $\vect{x}(t) = \begin{pmatrix} r\cos t \\ r \sin t \end{pmatrix}$. The outward pointing unit normal is $\vect{n}(t) = \begin{pmatrix} \cos t \\ \sin t \end{pmatrix}.$ If we reparameterize  this circle, the outward unit normal $\vect{n}$ is the same at each point on the circle (although perhaps not at each moment in time).
\end{example}
\hrulefill

To measure how much of $\vect{F}$ flows through a simple closed curve $\vect{x}$ at a particular point, we could look the dot product of $\vect{F}$ with $\vect{n}$ at that point. This suggests that the following definition will be useful.
\begin{definition}
Let $C$ be a simple closed (piecewise) C$^1$ curve in $\R^2$ parameterized by $\vect{x}\co[a,b] \to \R^2$. Let $\vect{n}(t)$ be the outward unit normal of $\vect{x}(t)$. If $\vect{F}$ is a C$^1$ vector field defined on an open set containing $C$, the \defn{flux} of $\vect{F}$ through $C$ is defined to be
\[
\int_C \vect{F} \cdot \vect{n} \thinspace ds
\]
Notice that this is a line integral of a scalar field.
\end{definition}

\begin{example}
Let $\vect{F}(x,y) = \begin{pmatrix}x \\ y \end{pmatrix}$ and let $C_r$ be a circle of radius $r$ centered at the origin. Then the flux of $\vect{F}$ through $C_r$ is:
\[
\int_{C_r} \vect{F} \cdot \vect{n} \thinspace ds.
\]
To calculate this, parameterize $C_r$ as $\vect{x}(t) = r(\cos t, \sin t)$ for $0 \leq t \leq 2\pi$ so that $\vect{n}(t) = (\cos t, \sin t)$. Recall that $||\vect{x'}(t)|| = r$.Then:
\[
\int_{C_r} \vect{F} \cdot \vect{n} \thinspace ds = \int_0^{2\pi} \begin{pmatrix}r\cos t \\ r\sin t \end{pmatrix} \cdot \begin{pmatrix} \cos t \\ \sin t \end{pmatrix}\thinspace r dt = 2\pi r^2.
\]
\end{example}
\hrulefill

\begin{example}
Let $\vect{F}(x,y) = (-y,x)$ and let $C_r$ be the circle of radius $r$ centered at the origin. Then the flux of $\vect{F}$ through $C_r$ is 0.
\end{example}
\hrulefill

If we want to measure how much a vector field $\vect{F}$ is spreading out from a point $\vect{a}$ or sucked into a point $\vect{a}$, we take the limit as $r \to 0^+$ of the flux through a circle of radius $r$ centered at $\vect{a}$ divided by the area enclosed by the circle.

\begin{definition}
Suppose that $\vect{F}$ is a C$^1$ vector field defined on an open subset of $\R^2$. If $\vect{a}$ is a point in the domain of $\vect{F}$, then the \defn{divergence} of $\vect{F}$ at $\vect{a}$ is defined to be:
\[
\diver \vect{F}(vect{a}) = \lim_{r \to 0^+} \frac{1}{\pi r^2} \int_{C_r} \vect{F} \cdot \vect{n} \thinspace ds.
\]
where $C_r$ is a circle in the domain of $\vect{F}$ centered at $\vect{a}$ of radius $r$ and $\vect{n}$ is its outward pointing unit normal.
\end{definition}

\begin{example}
Based on our previous calculations we can deduce that the divergence of the vector field $(x,y)$ at $\vect{0}$ is 2 and the divergence of $(-y,x)$ at $\vect{0}$ is 0.
\end{example}

We will be able to prove the next theorem after we discuss the planar divergence theorem:
\begin{theorem}\label{Thm: Divergence Formula}
Suppose that $\vect{F}(x,y) = \begin{pmatrix}M(x,y) \\ N(x,y) \end{pmatrix}$ is a C$^1$ vector field defined on an open subset of $\R^2$. Then
\[
\diver \vect{F}(x,y) = \lpartial{x} M(x,y) + \lpartial{y} N(x,y).
\]
\end{theorem}

In fact, in all dimensions we could (and do) define the divergence of a vector field $\vect{F} = (F_1, \hdots, F_n)$ to be
\[
\diver \vect{F}(\vect{x}) = \sum_{i=1}^n \lpartial{x_i} F_i(\vect{x}).
\]

In the previous section we showed that the curl of a gradient field is $\vect{0}$. Now we show that the divergence of curl is 0.

\begin{theorem}
Suppose that $\vect{G}$ is a $C^2$ vector field defined on an open subset of $\R^2$ or $\R^3$. Then $\diver \curl \vect{G} = 0$.
\end{theorem}
\begin{theorem}
This is an exercise that uses Theorem \ref{Thm: Divergence Formula} and Theorem \ref{Thm: Curl Formula}.
\end{theorem}

\subsection{From Vector Calculus to Cohomology}

Gradient is an operator that converts a scalar field into a vector field. Curl converts a vector field into another vector field. Divergence converts a vector field into a scalar field. Furthermore, (assuming all scalar fields and vector fields in question are C$^2$) we have that $\curl \grad = \vect{0}$ and $\diver \curl = 0$. These observations are the basis for something called ``cohomology theory''. More will be said at the end of these notes.

\newpage

\section{Review: Double Integrals}

\subsection{Integrating over rectangles}
Suppose that $R = [a,b] \times [c,d]$ is a rectangle in the $xy$-plane with corners at the points $(a,c)$, $(a,d)$, $(b,c)$ and $(b,d)$. Let $f\co R \to \R$ is a scalar field. Here is a picture of the situation:

\begin{center}
\scalebox{.5}{\includegraphics{Figures/ScalarFieldonRectangle}}
\end{center}


we define the double integral $\iint\limits_R f \thinspace dA$ as follows.

Subdivide $R$ into $n$ rectangles $R_1, \hdots, R_n$ (each with sides parallel to the axes). Let $\Delta A_i$ denote the area of rectangle $i$. Choose a point $\vect{c_i}$ in rectangle $R_i$.  Define the $n$th Riemann sum to be
\[
S_n = \sum_{i = 1}^n f(\vect{c_i})\Delta A_i
\]
Notice that $S_n$ is an approximation to the (signed) volume between the graph of $f$ in $\R^3$ and the rectangle $R$ in the $xy$-plane. Here is another interpretation of $S_n$:  If all the rectangles are chosen to have the same area $\Delta A_i = \Delta A$, then $\Delta A = \operatorname{Area}(R)/n$. The average value of $f$ on the rectangle can be approximated by:
\[
\begin{array}{rc}
\frac{1}{n} \sum_{i=1}^n f(\vect{c_i}) &= \\
&\\
\frac{\Delta A}{\operatorname{Area}(R)} \sum_{i=1}^n f(\vect{c_i}) & = \\
&\\
\frac{1}{\operatorname{Area}(R)} \sum_{i=1}^n f(\vect{c_i}) \Delta A &=\\
&\\
\frac{1}{\operatorname{Area}(R)} S_n
\end{array}
\]

We then define
\[
\iint\limits_R f \thinspace dA = \lim_{\max \Delta A_i \to 0} S_n
\]
This integral represents the volume between the graph of $f$ in $\R^3$ and the rectangle $R \subset \R^2$.

The average value of $f$ could be defined to be
\[
\frac{1}{\operatorname{Area}(R)} \iint\limits_R f \thinspace dA.
\]

Fubini's theorem is what we usually use to calculate double integrals. In many situations, Fubini's theorem tells us that a double integral can be rewritten as an iterated integral, that is as \textit{two} Calc I integrals.

\begin{theorem}[Fubini's theorem]
Suppose that $R = [a,b] \times [c,d]$ is a rectangle in $\R^2$ and that $f \co R \to \R$ is a bounded function such that the discontinuities of $f$ have zero area and every line parallel ot the coordinate axes meets the set of discontinuities in finitely many points. Then
\[
\iint\limits_R f \thinspace dA = \int_a^b \int_c^d f(x,y) \thinspace dy dx = \int_c^d \int_a^b f(x,y) \thinspace dx dy.
\]
\end{theorem}

\begin{example}
Let $R = [0,2\pi] \times [0,\pi]$ and let $f(x,y) = \sin x \cos y$. Find $\iint \limits_R f \thinspace dA$.

\textbf{Solution:} By Fubini's theorem:
\[
\begin{array}{rcl}
\iint \limits_R f \thinspace dA. &=& \int_0^{2\pi} \thinspace \int_0^\pi \sin x \cos y \thinspace dy \thinspace dx\\
&=& \int_0^{2\pi} \thinspace \sin x \sin y \Big |_0^\pi \thinspace dx \\
&=& \int_0^{2\pi} 0 \thinspace dx \\
&=& 0.
\end{array}
\]
\end{example}
\hrulefill

\subsection{Integrating over non-rectangular regions}

There are two ways of defining an integral of a scalar field over a non-rectangular region. Both reduce the problem to integrating over rectangles. The first will suggest a good way of doing calculations but the second produces an integral that is defined in more situations. If both integrals exist, they give the same answer.

For our purposes, it will suffice to consider the situation when $D \subset \R^2$ is a closed and bounded region and when $f \co D \to \R$ is a \textbf{continuous} function. We seek to define $\iint \limits_D f \thinspace dA$.

Here is a picture of a region $D$ bounded by an ellipse and the scalar field $f(x,y) = \sin x \cos y$.

\begin{center}
\scalebox{.5}{\includegraphics{Figures/ScalarFieldonEllipse}}
\end{center}


\subsubsection{The method of extension}

For this method we need to assume that the boundary of $D$ (denoted by $\boundary D$) has zero area and meets each vertical or horizontal line in only finitely many points. Since $D$ is bounded, there is a rectangle $R$ (with sides parallel to the axes) containing $D$ in its interior.

We extend $f\co D \to \R$ to a function $\wihat{f} \co R \to \R$ defined by:
\[
\wihat{f}(x,y) = \Big\{ \begin{matrix} f(x,y) &\hspace{.3in} & \text{ if } (x,y) \in D \\ 0 & & \text{ if } (x,y) \not \in D \end{matrix}.
\]

Here is a picture of the scalar field $\wihat{f}$. The original ellipse is marked with a dashed line. Notice that outside of $D$, the scalar field is zero (i.e. green).

\begin{center}
\scalebox{.5}{\includegraphics{Figures/ScalarFieldonEllipse2}}
\end{center}

We now define:
\[
\iint\limits_D f \thinspace dA = \iint\limits_R \wihat{f} \thinspace dA.
\]

\subsubsection{The method of exhaustion}

For this method, we assume that $D$ is an open set in $\R^2$. Subdivide the region $D$ into $m$ rectangles $R_1, \hdots, R_m$ so that $D \subset \bigcup_{i = 1}^m C_i$. (That is the rectangles cover $D$.) Let $\Delta A$ be the maximum area of any rectangle. Choose the numbering so that rectangles $R_1, \hdots, R_n$ are completely contained inside $D$.  Define:
\[
\iint\limits_D f \thinspace dA = \lim_{\Delta A \to 0} \sum_{i=1}^n \iint\limits_{R_i} f \thinspace dA.
\]
This integral is called the \defn{improper integral} of $f$ on $D$. 

If $D$ is a closed, bounded region in $\R^2$, we now have two possible definitions of $\iint\limits_D f \thinspace dA$. We could try to define it using the method of extension or define it using the method of exhaustion on the interior of the region. The improper integral will always exist, although the usual integral (defined using the method of extension) may not exist. If both exist, however, they are equal. See Theorem 15.4 of Munkres' \textit{Analysis on Manifolds}.

\subsubsection{Calculating integrals over non-rectangular regions}

The advantage of the definition of the integral $\iint\limits_D f \thinspace dA$ using the method of extension is that we can apply Fubini's theorem to the integral $\iint\limits_R \wihat{f} \thinspace dA$. Doing so provides the following methods of converting a double integral $\iint\limits_D f \thinspace dA$ over a non-rectangular region $D$ into an iterated integral. To describe the method we first introduce some terminology.

Suppose that $D \subset \R^2$ is a closed, bounded region. We say that it is \defn{vertically convex} (or \defn{Type I}) if every vertical line segment having endpoints in $D$ itself lies entirely in $D$.

\begin{example}\label{Ex: VertConvex}
Here is an example of a vertically convex region:

\begin{center}
\scalebox{.5}{\includegraphics{Figures/VertConvex}}
\end{center}

\end{example}
\hrulefill

\begin{example}
The region bounded by the black curve is not vertically convex, since there exists a vertical line segment (in red) having both endpoints inside the region but not lying entirely in the region itself.

\begin{center}
\scalebox{.5}{\includegraphics{Figures/NotVertConvex}}
\end{center}

\end{example}
\hrulefill

We say a closed, bounded region $D \subset \R^2$ is \defn{horizontally convex} (or \defn{Type II}) if every horizontal line segment with both endpoints in the region itself lies completely in the region.

\begin{example}
Here is an example of a horizontally convex region.

\begin{center}
\scalebox{.5}{\includegraphics{Figures/HorizConvex}}
\end{center}

\end{example}
\hrulefill

Finally, we say that a region is \defn{Type III} if it is both of Type I and Type II. Regions bounded by circles and squares are examples of Type III regions.

Notice that if a region $D$ is vertically convex, then it can be described as:
\[
D = \Big\{ (x,y) \in \R^2 : \begin{matrix} a \leq x \leq b \\ \gamma(x) \leq y \leq \delta(x) \end{matrix} \Big\}
\]
where $\gamma$ and $\delta$ are functions of $x$.


\begin{example}
The region from Example \ref{Ex: VertConvex} can be described as:
\[
D = \Big\{ (x,y) \in \R^2 : \begin{matrix} -3 \leq x \leq 3 \\ -\sqrt{1 - x^2/9} \leq y \leq \sin(2(x+3)) + 2 \end{matrix} \Big\}
\]
\end{example}
\hrulefill

Notice that if a region $D$ is horizontally convex, then it can be described as:
\[
D = \Big\{ (x,y) \in \R^2 : \begin{matrix} c \leq y \leq d \\ \alpha(y) \leq x \leq \alpha(y) \end{matrix} \Big\}
\]
where $\alpha$ and $\beta$ are functions of $y$.


\begin{example}
The region from Example \ref{Ex: HorizConvex} can be described as:
\[
D = \Big\{ (x,y) \in \R^2 : \begin{matrix} -2 \leq y \leq 2 \\ \sqrt{1 - y^2/4} - 2 \leq x \leq \sin(4y) + 2 \end{matrix} \Big\}
\]
\end{example}
\hrulefill

Now here's how to integrate a scalar field $f$ over a non-rectangular region $D$ \defn{assuming that the integral defined by extension exists}.

\begin{itemize}
\item If $D$ is vertically convex, write:
\[
D = \Big\{ (x,y) \in \R^2 : \begin{matrix} a \leq x \leq b \\ \gamma(x) \leq y \leq \delta(x) \end{matrix} \Big\}
\]
Then
\[
\iint\limits_D f \thinspace dA = \int_a^b \int_{\gamma(x)}^{\delta(x)} \thinspace f(x,y) \thinspace dy \thinspace dx.
\]

\item If $D$ is horizontally convex, write:
\[
D = \Big\{ (x,y) \in \R^2 : \begin{matrix} c \leq y \leq d \\ \alpha(y) \leq x \leq \alpha(y) \end{matrix} \Big\}
\]
Then
\[
\iint\limits_D f \thinspace dA = \int_c^d \int_{\alpha(y)}^{\beta(y)} \thinspace f(x,y) \thinspace dx \thinspace dy.
\]
\end{itemize}

\begin{example}
Let $D$ be the region from Example \ref{Ex: VertConvex}. Let $f(x,y) = xy^2$. Then:
\[
\iint\limits_D f \thinspace dA = \int_{-3}^3 \int_{-\sqrt{1 - x^2/9}}^{\sin(2(x+3) + 2} xy^2 \thinspace dy dx.
\]
These integrals can easily be plugged into Mathematica or similar program.
\end{example}
\hrulefill

\begin{example}
Let $D$ be the region from Example \ref{Ex: HorizConvex}. Let $f(x,y) = \cos(xy)$. Then:
\[
\iint\limits_D f \thinspace dA = \int_{-2}^2 \int_{\sqrt{1 - y^2/4} - 2}^{\sin(4y) + 2} \cos(xy) \thinspace dA.
\]
\end{example} 
\hrulefill

\begin{example}
Let $D$ be the region between the graphs of $y = (x-1)^2$ and $y = -(x-1)^2 + 2$. Let $f(x,y) = xy$. Find $\iint\limits_D f \thinspace dA$.

\begin{center}
\includegraphics[scale=0.4]{Figures/IteratedIntegralRegion}
\end{center}


\textbf{Solution:} Some easy algebra shows that the two curves intersect at the points $(0,1)$ and $(2,1)$. We are given the region as a Type I (vertically convex) region. So:
\[
\iint\limits_D f \thinspace dA = \int_0^2 \int_{(x-1)^2}^{-(x-1)^2 + 2} xy \thinspace dy dx.
\]
\end{example}
\hrulefill

Sometimes there are other tricks we can use to find integrals.

\begin{example}
Let $D$ be the square region with vertices at $(-1,0)$, $(1,0)$, $(0,1)$ and $(0,-1)$. Let $f(x,y) = x^2 + y^2$. Find $\iint\limits_D f \thinspace dA$.

\textbf{Solution:} Notice that $f(x,y) = r^2$ where $r = ||(x,y)||$. Thus, if the plane is rotated about the origin by any angle $f(x,y)$ will remain unchanged. Rotate the plane so that $D$ is a square centered at the origin and with sides parallel to the $x$ and $y$ axes. Call this new square $D'$. Since the value of $f$ doesn't change after the rotation,
\[
\iint\limits_D f \thinspace dA = \iint\limits_{D'} f \thinspace dA.
\]
Both $D$ and $D'$ have sides of length $\sqrt{2}$ and so the corners of $D'$ are at $(\pm\sqrt{2}, \pm\sqrt{2})$ and $(\pm \sqrt{2}, \mp \sqrt{2})$. Thus,
\[
\iint\limits_D f \thinspace dA = \iint\limits_{D'} f \thinspace dA = \int_{-\sqrt{2}}^{\sqrt{2}}\int_{-\sqrt{2}}^{\sqrt{2}} x^2 + y^2 \thinspace dx dy.
\]
This last integral can be evaluated easily by hand:
\[
\begin{array}{rcl}
\int_{-\sqrt{2}}^{\sqrt{2}}\int_{-\sqrt{2}}^{\sqrt{2}} x^2 + y^2 \thinspace dx dy 
& =& \int_{-\sqrt{2}}^{\sqrt{2}} \frac{2}{3}(2^{3/2}) + 2\sqrt{2} y^2 \thinspace dy \\
&&\\
&=& \frac{4}{3}(2^{3/2})(2^{1/2}) + \frac{4\sqrt{2}}{3}(2^{3/2}) \\
&=& \frac{32}{3}
\end{array}
\]
\end{example}
\hrulefill

\newpage

\section{Interlude: The Fundamental Theorem of Calculus and generalizations}

\subsection{0 and 1 dimensional integrals}

Let $I = [a,b]$ be an interval (oriented from $a$ to $b$) If $F\co I \to \R$ is a differentiable function, then you learn in one variable calculus that
\[
\int_I \frac{d}{dt} F(t) \thinspace dt = F(b) - F(a).
\]
To generalize this theorem to higher dimensions we introduce some new terminology.

\textbf{Terminology 1:} If $p \in \R$ is a point, then say that $p$ has ``positive orientation'' if we place an arrow on it pointing to the right. The point $p$ has ``negative orientation'' if we put an arrow on it pointing to the left. If we have chosen an orientation for $p$, we say that $p$ is oriented. If $A$ is a finite subset of $\R$ and if each point in $A$ has been given an orientation (not necessarily the same), we say that $A$ is oriented.

\textbf{Terminology 2:} Suppose that $p \in \R$ is an oriented point and that $f \co \R \to \R$ is a function. If $p$ has positive orientation, define $\int_p f = f(p)$. If $p$ has negative orientation, define $\int_p f = -f(p)$. If $A = \{p_1, \hdots, p_n\}$ is a finite set of oriented points in $\R$, define $\int_A = \sum_{i = 1}^n \int_{p_i} f$. 

\textbf{Terminology 3:} Suppose that $a < b$ are real numbers. The interval $[a,b]$ is positively oriented and the interval $[b a]$ is negatively oriented. (Think of an arrow running from the small number $a$ to the big number $b$. If the arrow points right, the interval is positively oriented; if it points left it is negatively oriented.) If $I$ is an interval in $\R$ with endpoints $a < b$, then the ``boundary'' of $I$, denoted $\boundary I$, is the set $\{a,b\}$. If $I$ has positive orientation, we assign the points of $\boundary I$ the orientation with arrows pointing out of $I$. If $I$ has negative orientation, we assign the points of $\boundary I$, the orientations with arrows pointing into $I$. We say that $\boundary I$ has the orientation ``induced'' by the orientation from $I$.

Suppose that $I = [a,b]$ has positive orientation (i.e. $a < b$). Let $J = [b,a]$ be the same interval but with the opposite orientation. If $f \co \R \to \R$ is integrable, then by definition \[ \int_{I} f = \int_a^b f(x)\thinspace dx \hspace{.2in} \text{ and } \hspace{.2in} \int_{J} f = \int_b^a f(x) \thinspace dx = -\int_{I} f.\]

The fundamental theorem of calculus can then be stated as

\framebox[0.95\linewidth]{
 	\begin{minipage}{0.9\linewidth}
 	\begin{theorem}[Fundamental Theorem of Calculus]
 	Suppose that $F \co \R \to \R$ is a $C^1$ function. Let $DF \co \R \to \R$ be its derivative. Let $I \subset \R$ be an oriented interval and give $\boundary I$ the induced orientation. Then
 	\[
 	\int_I DF = \int_{\boundary I} F.
 	\]	
 	\end{theorem}
 	\end{minipage}
 	}

Notice that the FTC says that the 1-dimensional integal of a derivative is equal to a certain 0-dimensional integral (over the boundary) of the antiderivative. 

\subsection{Green's theorem}

\begin{theorem}[Green's Theorem]
Suppose that $D \subset \R^2$ is closed and bounded and that $\boundary D$ is (piecewise) C$^1$. Orient $\boundary D$ so that $D$ is always on the left. If $\vect{F} \co D \to \R^2$ is a C$^1$ scalar field then:
\[
\iint\limits_D \operatorname{scalar curl}(\vect{F}) \thinspace dA = \int\limits_{\boundary D} \vect{F}\vl
\]
\end{theorem}

Notice that this relates a 2-dimensional integral of a ``derivative'' to a 1-dimensional integral of an ``anti-derivative''.

\begin{example}
Let $D_r$ be the disc of radius $r$ in $\R^2$ centered at the origin. Let $C_r = \boundary D_r$ oriented counterclockwise. Let $\vect{F}(xy) = \begin{pmatrix}-y \\ x \end{pmatrix}$. We calculate both sides of the equality in Green's theorem to verify that Green's theorem is true in this case.

The scalar curl of $\vect{F}$ is:
\[
\operatorname{scalar curl}(\vect{F}(x,y)) = \lpartial{x}(x) - \lpartial{y}(-y) = 2.
\]
Thus,
\[
\iint\limits_D \operatorname{scalar curl}(\vect{F}(x,y) \thinspace dA = \iint\limits_D 2 \thinspace dA = 2\operatorname{Area}(D) = 2\pi r^2.
\]

The curve $C_r$ can be parameterized as $C_r(t) = \begin{pmatrix} r \cos t \\ r \sin t \end{pmatrix}$ for $t \in [0,2\pi]$. It is evident that $C'_r(t) = \begin{pmatrix} - r \sin t \\ r \cos t \end{pmatrix}$. Thus,
\[
\int\limits_{C_r} \vect{F} \vl = \int_0^{2\pi} \vect{F}(C_r(t)) \cdot C'_r(t) \thinspace dt = \int_0^{2\pi} r^2 \thinspace dt = 2\pi r^2
\]
Notice that indeed:
\[
\iint\limits_D \operatorname{scalar curl}(\vect{F})\thinspace dA = \int\limits{C_r} \vect{F} \vl
\]
\end{example}

Rather than using an orientation of $\boundary D$ that points in the direction of travel, we can also rephrase Green's theorem so as to use a normal orientation of $\boundary D$.

\begin{definition}
Suppose that $D \subset \R^2$ is a closed, bounded region with $\boundary D$ piecewise C$^1$. At each C$^1$ point of $\boundary D$, let $\vect{n}$ be the unit normal vector pointing out of $D$. If $\vect{x}(t) = (x(t),y(t))$ is a parameterization of $\boundary D$ with $D$ always on the left, then the outward unit normal is $\vect{n}(t) = \frac{1}{||\vect{x'}(t)||}(y'(t), -x'(t))$. 
\end{definition}

\begin{theorem}[Planar Divergence Theorem]
Suppose that $D \subset \R^2$ is a closed, bounded region with $\boundary D$ piecewise C$^1$. Let $\vect{n}$ be the outward pointing unit normal to $\boundary D$. Then, if $\vect{F}$ is C$^1$:
\[
\iint\limits_D \diver \vect{F} \thinspace dA = \int_{\boundary D} \vect{F} \cdot \vect{n} \thinspace ds.
\]
\end{theorem}

Notice that once again we have a 2-dimensional integral of a derivative equal to a 1-dimensional integral of an ``antiderivative''. (Obviously the terminology from Calc I doesn't match up exactly.) The right hand side of the equality above is called the ``flux'' of $\vect{F}$ across $\boundary D$.

\subsection{Stokes' Theorem}

We don't have all the terminology available to us yet, but here's the statement of Stokes' theorem so that you can compare it to the other cases.

\begin{theorem}[Stokes' Theorem]
Suppose that $S$ is a (piecewise) C$^1$ orientable surface in $\R^3$ and that $\boundary S$ is also piecewise C$^1$. Give $S$ an orientation and give $\boundary S$ the orientation induced from $S$. Let $\vect{F}$ be a C$^1$ vector field defined on an open set containing $S$. Then:
\[
\iint\limits{S} \curl \vect{F} \cdot d\vect{S} = \int\limits_{\boundary S} \vect{F}\vl
\]
\end{theorem}

Once again we have a 2--dimensional integral of a derivative equal to a 1--dimensional integral of the anti-derivative.
This theorem will eventually motivate us to define the notion of  ``surface integral''. We will have to talk about parameterizing surfaces and orientations of surfaces, as well.

\subsection{The Divergence Theorem}
Once again, we don't have all the terminology available to us, but here is the statement of the Divergence Theorem (also known as Gauss' theorem).

\begin{theorem}[The Divergence Theorem]
Suppose that $D \subset \R^3$ is a closed, bounded region with $\boundary D$ a piecewise C$^1$ surface. Give $\boundary D$ the normal orientation pointing out of $D$.  Then
\[
\iiint\limits_D \diver \vect{F} \thinspace dV = \iint\limits_{\boundary D} \vect{F}\cdot d\vect{S}.
\]
\end{theorem}

The integral on the left is the triple integral you encountered in Calc II. The integral on the right is a surface integral, which we have still to define. In any case, you can see that we have a 3-dimensional integral of a ``derivative'' equal to a 2--dimensional integral of the ``anti-derivative''.

\subsection{Generalized Stokes' Theorem}
The divergence theorem is as far as we'll be able to go in our class, but you may wonder about a version of FTC in dimensions greater than 3. There is such a thing, called ``Generalized Stokes' Theorem'' (or simply ``Stokes' Theorem''. Here, for the record is the statement. We won't define any of the unknown terms in this class.

\begin{theorem}[Generalized Stokes' Theorem]
Suppose that $M$ is an oriented, smooth $n$-dimensional manifold with smooth boundary $\boundary M$ having the induced orientation. (The boundary of $M$ is an $(n-1)$ manifold.) Suppose that $\omega$ is an $(n-1)$ form on $M$ having compact support then
\[
\int\limits_M d\omega = \int\limits_{\boundary M} \omega.
\]
\end{theorem}

At the very least you can see an $n$-dimensional integral on the left and an $(n-1)$-dimensional integral on the right. The integrand on the left is a derivative of the integrand on the right.  And that's all we'll say about that!

\newpage

\section{Basic Examples of Green's Theorem in Action}

\begin{theorem}[Green's Theorem]
Suppose that $D \subset \R^2$ is closed and bounded and that $\boundary D$ is (piecewise) C$^1$. Orient $\boundary D$ so that $D$ is always on the left. If $\vect{F} \co D \to \R^2$ is a C$^1$ scalar field then:
\[
\iint\limits_D \operatorname{scalar curl}(\vect{F}) \thinspace dA = \int\limits_{\boundary D} \vect{F}\vl
\]
\end{theorem}

If we write $\vect{F}(x,y) = M(x,y)\vect{i} + N(x,y)\vect{j}$, then the conclusion of Green's theorem can be written as:
\[
\int_{\boundary D} M\thinspace dx + N \thinspace dy = \iint\limits_D \left( \frac{\partial N}{\partial x} - \frac{\partial M}{\partial y} \right) \thinspace dA.
\]

Before proving (part of) Green's theorem, we'll look at some examples.

\begin{example} For this example, let $D \subset \R^2$be the solid square with corners $(1,-1)$, $(1,1)$, $(-1,1)$, and $(-1,-1)$. We will need a parameterization of $\boundary D$. Since $\boundary D$ is made up of 4 line segments, we can parameterize them as follows. For each of them $0 \leq t \leq 1$.
\[\begin{array}{rcl}
L_1(t) &=& (1,2t - 1)\\
L_2(t) &=& (1- 2t, 1)\\
L_3(t) &=& (-1, 1 - 2t)\\
L_4(t) &=& (2t - 1, -1)\\
\end{array}\]
We will also need the derivatives:
\[\begin{array}{rcl}
L'_1(t) &=& (0,2)\\
L'_2(t) &=& (-2,0)\\
L'_3(t) &=& (0,-2)\\
L'_4(t) &=& (2,0)\\
\end{array}\]

\textbf{Example 1a:} Let $\vect{F}(x,y) = (-x,y)$.

\textbf{Example 1a.i:} Compute $\int_{\boundary D} \vect{F} \cdot d\vect{s}$.

\textbf{Answer:}  We have:
\[
\begin{array}{rcl}
\int_{\boundary D}\vect{F}\cdot d\vect{s} &=& \int_0^1 \vect{F}(L_1(t))\cdot L'_1(t) \thinspace dt + \int_0^1 \vect{F}(L_2(t))\cdot L'_2(t) \thinspace dt + \\
&& \int_0^1 \vect{F}(L_3(t))\cdot L'_3(t) \thinspace dt + \int_0^1 \vect{F}(L_4(t))\cdot L'_4(t) \thinspace dt\\

&=& \int_0^1 \begin{pmatrix} - 1 \\ 2t - 1 \end{pmatrix} \cdot \begin{pmatrix} 0 \\ 2 \end{pmatrix} + 
 \begin{pmatrix} 2t - 1 \\ 1 \end{pmatrix} \cdot \begin{pmatrix} -2 \\ 0 \end{pmatrix}  +
 \begin{pmatrix} 1 \\ 1 - 2t \end{pmatrix} \cdot \begin{pmatrix} 0 \\ -2 \end{pmatrix} + 
  \begin{pmatrix} 1 - 2t \\ -1 \end{pmatrix} \cdot \begin{pmatrix} 2 \\ 0 \end{pmatrix} \thinspace dt \\
 & = & \int_0^1 2(2t - 1) + (-2)(2t -1) + (-2)(1- 2t) + 2(1- 2t) \thinspace dt\\
 &=& 0
\end{array}
\]


\textbf{Example 1a.ii:} Compute $\iint\limits_D (\curl \vect{F})\cdot \vect{k} \thinspace dA$.

\textbf{Answer:}  We have \[\curl \vect{F} \cdot \vect{k} = \frac{\partial (y)}{\partial x} - \frac{\partial (-x)}{\partial y} = 0.\]
Thus, $\iint\limits_D \curl\vect{F} \cdot \vect{k} \thinspace dA = \iint\limits_D 0 \thinspace dA = 0$. Notice that this matches the answer from Example 1a.i, as predicted by Green's theorem.

\textbf{Example 1b:} Let $\vect{F}(x,y) = (-y,x)$. 

\textbf{Example 1b.i}  Compute $\int_{\boundary D} \vect{F} \cdot d\vect{s}$.

\textbf{Answer:}  We have:
\[
\begin{array}{rcl}
\int_{\boundary D}\vect{F}\cdot d\vect{s} &=& \int_0^1 \vect{F}(L_1(t))\cdot L'_1(t) \thinspace dt + \int_0^1 \vect{F}(L_2(t))\cdot L'_2(t) \thinspace dt + \\
&&\int_0^1 \vect{F}(L_3(t))\cdot L'_3(t) \thinspace dt + \int_0^1 \vect{F}(L_4(t))\cdot L'_4(t) \thinspace dt\\
&=& \int_0^1 \begin{pmatrix} 1 - 2t \\ 1 \end{pmatrix} \cdot \begin{pmatrix} 0 \\ 2 \end{pmatrix} + 
 \begin{pmatrix} -1 \\ 1 -  2t\end{pmatrix} \cdot \begin{pmatrix} -2 \\ 0 \end{pmatrix}  +
 \begin{pmatrix} 2t - 1 \\ -1 \end{pmatrix} \cdot \begin{pmatrix} 0 \\ -2 \end{pmatrix} + 
  \begin{pmatrix} 1 \\ 2t - 1 \end{pmatrix} \cdot \begin{pmatrix} 2 \\ 0 \end{pmatrix} \thinspace dt \\
 & = & \int_0^1 2 + 2 + 2 + 2\thinspace dt\\
 &=& 8
\end{array}
\]

\textbf{Example 1b.ii} Compute $\iint\limits_D (\curl \vect{F})\cdot \vect{k} \thinspace dA$.

In this case, $\curl \vect{F} \cdot \vect{k} = 2$. Thus,
\[
\iint \limits_D \curl \vect{F} \cdot \vect{k} \thinspace dA = \int_{-1}^1 \int_{-1}^1 2 \thinspace dA = 8.
\]
Notice that this is the same as in Example 1b.i as predicted by Green's theorem.
\end{example}

\begin{example}
Let $\vect{F}(x,y) = (\sin x, \ln(1  + y^2))$. Let $C$ be a simple closed curve which is made up of 24 line segments in a star shape. Compute $\int_C \vect{F} \thinspace d\vect{s}$.

\textbf{Answer:}  Let $D$ be the region bounded by $C$. Notice that $\curl \vect{F} = \vect{0}$, so $\iint\limits_D \curl \vect{F} \cdot \vect{k} \thinspace dA = 0$. By Green's theorem, this is also the answer to the requested integral.
\end{example}
\hrulefill

\begin{example}
Let $\phi(t)= \begin{pmatrix}\cos t \sin (3t) \\ \sin t \cos (3t) \end{pmatrix}$ for $0 \leq t \leq \pi/2$. Find the area of the region $D$ enclosed by $\phi$.

\textbf{Answer:} Notice that $\phi$ travels clock-wise around $D$, we need it to go counter-clockwise to use Green's theorem. Changing the direction that $\phi$ travels, changes the sign of a path integral of a vector field. Thus, by Green's theorem, the area of $D$ is given by
\[
\iint_D 1 \thinspace dA = -\int_\phi \vect{F} \cdot d\vect{s},
\]
where $\vect{F}$ is a vector field having the property that $\curl \vect{F} = (0,0,1)$. The vector field: $\vect{F}(x,y) = \frac{1}{2}(-y,x)$ has that property. Thus,
\[
\begin{array}{rcl}
\iint_D 1 \thinspace dA &=& -\int_\phi \vect{F} \cdot d\vect{s}\\
&=& -(1/2) \int_0^{\pi/2} (-\sin t \cos 3 t, \cos t \sin 3t)\cdot \phi'(t) \thinspace dt \\
&=& -(1/2) \int_0^{\pi/2} \cos 3t \sin 3t - 3\sin t\cos t \thinspace dt\\
&=& -(1/2) \int_0^{\pi/2} \sin(6t)/2 - 3\sin(2t)/2 \thinspace dt\\
&=& -(1/2)(1/6 - 3/2)\\
&=& 2/3.
\end{array}
\]
\end{example}
\hrulefill

\newpage

\section{The proof of Green's Theorem}

The proof of Green's theorem relies heavily on the following fact:

\begin{lemma}
Suppose that $R_1$ and $R_2$ are two regions in $\R^2$ each with piecewise $C^1$ boundary and suppose that $R_1$ and $R_2$ intersect only along a path $\phi$ in their boundaries. Give $\boundary R_1$ the orientation with $R_1$ on the left and give $\boundary R_2$ the orientation with $R_2$ on the left.  Let $R = R_1 \cup R_2$ and give $\boundary R$ the orientation having $R$ on the left. Suppose that $\vect{F}$ is a C$^1$ vector field defined on $R$. Then:
\[
\int_{\boundary R} \vect{F} \vl = \int_{\boundary R_1} \vect{F} \vl + \int_{\boundary R_2} \vect{F} \vl.
\]
\end{lemma}
\begin{proof}
Since $\phi = R_1 \cap R_2$, the orientations on $\boundary R_1$ and $\boundary R_2$ induce opposite orientations on $\phi$. We have proved that if $\vect{x}$ and $\vect{y}$ are orientation reversing reparameterizations of each other then
\[
\int_\vect{y} \vect{F} \vl = - \int_\vect{x} \vect{F} \vl.
\]
Let $\vect{x}$ be the parameterization of $\phi$ coming from a parameterization of $\boundary R_1$ and let $\vect{y}$ be the parameterization of $\phi$ coming from a parameterization of $\boundary R_2$.

Let $\psi_1 = \boundary R_1 - \phi$ and let $\psi_2 = \boundary R_2 - \phi$. Then:
\[
\int_{\boundary R_1} \vect{F} \vl = \int_{\psi_1} \vect{F} \vl + \int_\vect{x} \vect{F} \vl
\]

and

\[
\int_{\boundary R_2} \vect{F} \vl = \int_{\psi_2} \vect{F} \vl + \int_\vect{y} \vect{F} \vl
\]

Thus,
\[
\int_{\boundary R_1} \vect{F} \vl + \int_{\boundary R_2} \vect{F} \vl = \int_{\psi_1} \vect{F} \vl + \int_\vect{x} \vect{F} \vl + \int_{\psi_2} \vect{F} \vl + \int_\vect{y} \vect{F} \vl
\]
Since $\vect{x}$ and $\vect{y}$ are orientation-reversing reparameterizations of each other, we have
\[
\int_{\boundary R_1} \vect{F} \vl + \int_{\boundary R_2} \vect{F} \vl = \int_{\psi_1} \vect{F} \vl + \int_{\psi_2} \vect{F} \vl
\]
But this is exactly $\int_{\boundary R} \vect{F} \vl$.
\end{proof}

\begin{proof}[Sketch of Proof of Green's Theorem]
Let $D$ be a region in $\R^2$ satisfying the hypotheses of Green's theorem. Recall that for a point $\vect{a} \in D$ we have:
\[
\operatorname{scalar curl}(\vect{F})(\vect{a}) = \lim_{\operatorname{Area}(E) \to 0^+} \frac{1}{\operatorname{Area}(E)} \int_{\boundary E} \vect{F} \vl.
\]
where $E$ is any region enclosing $\vect{a}$.

From topology, we know that for any $\epsilon > 0$, and for large enough $n$, the region $D$ can be subdivided into $n$ triangles having piecewise C$^1$ boundary and each having area less than $\epsilon$. Let $T_1, \hdots, T_n$ be those triangles. Orient the boundaries of each of those triangles so that the triangle is on the left. By repeatedly applying the previous lemma and using the additivity properties of the double integral we have:
\[
\int\limits_{\boundary D} \vect{F} \vl = \sum_{i = 1}^n \int_{\boundary T_i} \vect{F} \vl.
\]

Taking the limit we obtain:
\[
\int\limits_{\boundary D} \vect{F} \vl =  \lim_{\epsilon \to 0^+} \sum_{i = 1}^n \int_{\boundary T_i} \vect{F} \vl.
\]

In each triangle $T_i$, choose a point $\vect{c}_i$. By the definition of scalar curl, if $\epsilon$ is small enough, 
\[
\operatorname{Area}(T_i) \operatorname{scalar curl}\vect{F}(\vect{c_i}) \approx  \int_{\boundary T_i} \vect{F} \vl.
\]

Thus, for $\epsilon$ small enough,
\[
\sum_{i=1}^n \operatorname{Area}(T_i) \operatorname{scalar curl}\vect{F}(\vect{c_i}) \approx  \sum_{i=1}^n \int_{\boundary T_i} \vect{F} \vl.
\]

When we take the limit as $\epsilon \to 0^+$, we get equality:

\[
\lim_{\epsilon \to 0^+} \sum_{i=1}^n \operatorname{Area}(T_i) \operatorname{scalar curl}\vect{F}(\vect{c_i}) =  \lim_{\epsilon \to 0^+} \sum_{i=1}^n \int_{\boundary T_i} \vect{F} \vl.
\]

The left hand side is simply the limit of Riemann sums (using triangles instead of squares) and the right hand side we have already calculated. So:
\[
\iint\limits_D \operatorname{scalar curl}\vect{F} \thinspace dA = \int\limits_{\boundary D} \vect{F} \vl.
\]
\end{proof}

\section{Applications of Green's Theorem}

\subsection{Finding Areas}
Green's theorem says that (under certain hypotheses)
\[ \iint\limits_D \scurl \vect{F} \thinspace dA = \int\limits_{\boundary D} \vect{F} \vl \]
We recall that the area of a region $D$ is equal to $\iint\limits_D 1 \thinspace dA$. Thus, if we can find a vector field $\vect{F}$ with $\scurl \vect{F} = 1$ we can use Green's theorem to compute the areas of regions bounded by parameterized curves.  There are three vector fields having scalar curl 0 that are most commonly used for computing area. They are $\begin{pmatrix}0 \\ x \end{pmatrix}$, $\begin{pmatrix} -y \\ 0\end{pmatrix}$, and $\begin{pmatrix} -y/2 \\ x/2 \end{pmatrix}$. Which one we use depends on the situation.

\begin{example}
Compute the area enclosed by a circle of radius $R$ using Green's theorem.

\textbf{Solution:} Let $D$ be the disc of radius $R$ centered at the origin and parameterize $\boundary D$ as $\vect{x}(t) = \begin{pmatrix} R \cos t \\ R \sin t \end{pmatrix}$ for $t \in [0,2\pi]$. We have chosen our parameterization so that $D$ is on the left, as we needed to apply Green's theorem. Let $\vect{F}(x,y) = \begin{pmatrix} 0 \\ x \end{pmatrix}$. Then Green's Theorem says:
\[
\begin{array}{rcl}
\iint\limits_D 1 \thinspace dA &=& \iint\limits_D \scurl \vect{F} \thinspace dA\\
&=& \int\limits_\vect{x} \vect{F} \vl \\
&=& \int_0^{2\pi} \begin{pmatrix}0 \\ R\cos t \end{pmatrix} \cdot \begin{pmatrix} -R\sin t \\ R \cos t \end{pmatrix}  \thinspace dt \\
&=& \int_0^{2\pi} R^2 \cos^2 t \thinspace dt \\
&=& \int_0^{2\pi} R^2 (\cos 2t + 1)/2 \thinspace dt \\
&=& \pi R^2
\end{array}
\]

You might try this example using a different choice of $\vect{F}$ to see if it is easier.
\end{example}
\hrulefill

\begin{example}
Compute the area enclosed by the ellipse $\vect{x}(t) = \begin{pmatrix} 2\cos t \\ \sin t \end{pmatrix}$ with $t \in [0,2\pi]$.

\textbf{Solution:} Let $\vect{F}(x,y) = \begin{pmatrix}-y/2 \\ x/2 \end{pmatrix}$. As in the previous example, by Green's theorem, the area enclosed by the ellipse is equal to
\[
\begin{array}{rcl}
\int_{\vect{x}} \vect{F} \vl &=& \int_0^{2\pi} \begin{pmatrix}-(\sin t)/2 \\ \cos t \end{pmatrix} \cdot \begin{pmatrix}-2\sin t \\ \cos t \end{pmatrix} \thinspace dt \\
&=& \int_0^{2\pi} \sin^2 t + \cos^2 t  \thinspace dt \\
&=& 2\pi
\end{array}
\]
\end{example}
\hrulefill

\begin{example}
Let $\phi(t)= \begin{pmatrix}\cos t \sin (3t) \\ \sin t \cos (3t) \end{pmatrix}$ for $0 \leq t \leq \pi/2$. Find the area of the region $D$ enclosed by $\phi$.

\textbf{Answer:} Notice that $\phi$ travels clock-wise around $D$, we need it to go counter-clockwise to use Green's theorem. Changing the direction that $\phi$ travels, changes the sign of a path integral of a vector field. Thus, by Green's theorem, the area of $D$ is given by
\[
\iint_D 1 \thinspace dA = -\int_\phi \vect{F} \cdot d\vect{s},
\]
where $\vect{F}$ is a vector field having the property that $\scurl \vect{F} = 1$. Let $\vect{F}(x,y) = \frac{1}{2}(-y,x)$. Then,
\[
\begin{array}{rcl}
\iint_D 1 \thinspace dA &=& -\int_\phi \vect{F} \cdot d\vect{s}\\
&=& -(1/2) \int_0^{\pi/2} (-\sin t \cos 3 t, \cos t \sin 3t)\cdot \phi'(t) \thinspace dt \\
&=& -(1/2) \int_0^{\pi/2} \cos 3t \sin 3t - 3\sin t\cos t \thinspace dt\\
&=& -(1/2) \int_0^{\pi/2} \sin(6t)/2 - 3\sin(2t)/2 \thinspace dt\\
&=& -(1/2)(1/6 - 3/2)\\
&=& 2/3.
\end{array}
\]
\end{example}
\hrulefill

\newpage

\subsection{Conservative Vector Fields}
In previous sections we've studied conservative vector fields and have deduced the following:

\begin{itemize}
\item If any of the following hold, the vector field $\vect{F}$ is \textbf{not} conservative:
\begin{itemize}
\item $\vect{F}$ has a closed up flow line (assuming $||\vect{F}|| > 0$.)
\item $\curl \vect{F} = \vect{0}$.
\item There is a closed curve $C$ such that $\int_C \vect{F} \vl \neq 0$
\item There are two paths $\vect{x}$ and $\vect{y}$ both connecting point $\vect{a}$ to point $\vect{b}$ such that $\int_\vect{x} \vect{F} \vl \neq \int_\vect{y} \vect{F} \vl$.
\end{itemize}

\item If any of the following hold, the vector field $\vect{F}$ \textbf{is} a conservative field:
\begin{itemize}
\item There exists a scalar field $f$ (with the same domain as $\vect{F}$) such that $\vect{F} = \nabla f$.
\item $\vect{F}$ has path independent line integrals
\item For all closed curves $C$, the integral $\int_C \vect{F} \vl$ is zero.
\end{itemize}
\end{itemize}

Thus while we have practical ways of determining that a vector field $\vect{F}$ \textbf{is not} conservative, the only even semi-practical way we have of determining that $\vect{F}$ \textbf{is} conservative is to produce a potential function for $\vect{F}$. Usually, this involves solving a system of partial differential equations, and usually that is extremely difficult. Still, if we can find a potential function that's very useful. The next theorem applies Green's theorem to produce a simple criterion for a vector field to be conservative. Before stating the theorem, we make a definition:

\begin{definition}
An open subset $X$ of $\R^n$ is called \defn{connected} if for all points $\vect{a}$ and $\vect{b}$ in $X$, there is a path in $X$ joining $\vect{a}$ to $\vect{b}$. (That is, $X$ is ``one piece''\footnote{Technically, being ``one piece'' is called ``connected'' while having the property that any two points can be joined by a path is called ``path connected''. There are spaces where these concepts differ. In our context, however, they are the same.})We say that $X$ has \defn{all loops contractible} if for each closed curve $C$ in $X$, the curve $C$ can be shrunk to a point in $X$ all the while remaining in $X$. If $X$ is connected and has all loops contractible, we say that it is \defn{simply connected}. 
\end{definition}

\begin{example}
In $\R^2$, a connected open subset $X$ is simply connected if and only if it ``has no holes''. The set $\R^3 - \{\vect{0}\}$ is simply connected, but $\R^3 - \{(0,0,z) : z \in \R\}$ is not simply connected.
\end{example}


\begin{theorem}\label{curl -> PI}
Suppose that $X$ is a simply connected open subset of $\R^2$ or $\R^3$. If $\vect{F}$ is a C$^1$ vector field on $X$ such that $\curl \vect{F} = \vect{0}$ then $\vect{F}$ is a conservative vector field.
\end{theorem}
\begin{proof}[Proof Sketch]
We (partially) prove this for $X \subset \R^2$ using Green's theorem. To prove it for $X \subset \R^3$, you should use Stokes' theorem which we will discuss later. (You would also need a replacement for the Jordan Curve Theorem, so it's rather challenging to do this in 3D.)

The exact statement that we will prove is that: ``If $X \subset \R^2$ is open and simply connected, and if $\vect{F}$ is a C$^1$ vector field on $X$ with $\curl \vect{F} = \vect{0}$, then if $C$ is a simple closed curve $\int_C \vect{F} \vl = \vect{0}$.''

If we could prove this statement for any closed curve $C$ (not just simple closed curve) then by the observations before the theorem we would know that $\vect{F}$ was conservative, as desired. This gap between what we need to prove and what we will prove is one reason why I say this is just a proof sketch.

We assume by hypothesis that $\curl \vect{F} = \vect{0}$ and that $X \subset \R^2$ is simply connected. Let $C \subset X$  be a simple closed curve. A theorem from topology (the Jordan Curve Theorem) says that in $\R^2$, the curve $C$ is the boundary of a compact region $D$. Since $X$ is simply connected, the region $D$ must be a subset of $X$. Thus, $\vect{F}$ is defined on $D$. By Green's theorem, $\int_C \vect{F} \vl = \iint\limits_D \scurl \vect{F} \thinspace dA = 0$.
\end{proof}

We put our previous results together to obtain:

\begin{theorem}[Poincar\'e]
Let $X \subset \R^2$ (or $\R^3$) be a simply connected, open domain. Let $\vect{F}$ be a C$^1$ vector field defined on $X$. Then, the following are equivalent:
\begin{enumerate}
\item There exists a potential function $f$ with domain $X$ such that $\vect{F} = \nabla f$.
\item $\vect{F}$ has path independent line integrals on $X$
\item The integral of $\vect{F}$ around any closed curve in $X$ is zero.
\item $\curl \vect{F} = \vect{0}$.
\end{enumerate}
\end{theorem}

\newpage

\subsection{Planar Divergence Theorem}

Recall that if $C$ is a smooth simple closed curve in $\R^2$, the vector $\vect{n}$ at $(x,y) \in C$ is the outward pointing unit normal vector. If $\vect{F}$ is a C$^1$ vector field, $\int_C \vect{F} \cdot \vect{n} \vl$ is called the \defn{flux} of $\vect{F}$ through $C$. The planar divergence theorem relates the flux of $\vect{F}$ through $C$ to the total amount of divergence of $\vect{F}$ inside the region bounded by $C$. 

\begin{theorem}[Planar Divergence Theorem]
Suppose that $D \subset \R^2$ is a closed, bounded region with $\boundary D$ piecewise C$^1$. Let $\vect{n}$ be the outward pointing unit normal to $\boundary D$. Then, if $\vect{F}$ is C$^1$ on $D$:
\[
\iint\limits_D \diver \vect{F} \thinspace dA = \int_{\boundary D} \vect{F} \cdot \vect{n} \thinspace ds.
\]
\end{theorem}

\begin{proof}
Let $\vect{G}$ be the vector field obtained from $\vect{F}$ by rotating each vector 90$^\circ$ counter-clockwise. If $\vect{F} = (M,N)$ then $\vect{G} = (-N,M)$. Rotating $\vect{n}$ by 90$^\circ$ counterclockwise creates the unit tangent vector $\vect{T}$ to $C$ oriented so that $D$ is on the left as we traverse $C$ in the direction of $\vect{T}$. Since the magnitude of $\vect{G}$ at each point equals the magnitude of $\vect{F}$ at that point and since the angle between $\vect{G}$ and $\vect{T}$ is the same as the angle between $\vect{F}$ and $\vect{n}$, we have $\vect{G} \cdot \vect{T} = \vect{F} \cdot \vect{n}$. Thus, $\int_C \vect{G}\cdot \vect{T} \thinspace ds = \int_C \vect{F}\cdot \vect{n} \thinspace ds$. We know that $\int_C \vect{G} \cdot \vect{T} \thinspace ds = \int_C \vect{G} \cdot d\vect{s}$. By Green's theorem this is equal to $\iint\limits_D \scurl \vect{G} \thinspace dA$. An easy calculation shows that $\scurl \vect{G} = \diver \vect{F}$. The planar divergence theorem follows immediately
\end{proof}

\begin{example}
Let $\vect{F}(x,y,z) = \begin{pmatrix} x + y + z \\ y + z \\ z \end{pmatrix}$. Let $C$ be the ellipse parameterized by $\begin{pmatrix} 2\cos t \\ \sin t \end{pmatrix}$. Find the flux of $\vect{F}$ through $C$.

\textbf{Solution:} In a previous example we calculated that the area enclosed by $C$ is $2\pi$. The divergence of $\vect{F}$ is $\diver \vect{F} = 3$. Thus, the flux of $\vect{F}$ through $C$ is $6\pi$.
\end{example}
\hrulefill

\newpage

\section{Surfaces: Topology and Calculus}

We will study surfaces from both the topological and calculus point of view. These views don't necessarily give the same answer, but the intuition coming from topology will help us understand the calculus better. 

\subsection{Topological Surfaces}

Recall that a surface is a 2--dimensional manifold: that is, every point on a surface has a region around it (in the surface) that looks like the region around some point in $\R^2_+ = \{(x,y) \in \R^2 : y \geq 0\}$.

Examples of surfaces are spheres, tori, tori with holes in them, infinite cones, m\"obius bands, Klein bottles, and projective planes. It is a theorem from topology that every surface can be triangulated. (i.e. decomposed into the union of possibly bendy triangles that intersect along their sides.) We can use triangulations to help us understand the orientability of surfaces.

Let $T$ be a (solid) triangle. An \defn{orientation} on $T$ is an orientation of $\boundary T$. Each triangle has two possible orientations:

\begin{center}
\scalebox{.5}{\includegraphics{Figures/TriangleOrientations}}
\end{center}

If $S$ is a surface with triangulation $\mc{T}$ an \defn{orientation} of $S$ is a choice of orientation for each triangle in $\mc{T}$ such that adjacent triangles give their shared edges opposite orientations. For example:

\begin{center}
\scalebox{.5}{\includegraphics{Figures/SurfaceOrientation}}.
\end{center}

\begin{example}
Topologically, the torus can be obtained from a square by gluing opposite sides together without twisting. Here is a schematic representation of the torus with a triangulation:

\begin{center}
\scalebox{.5}{\includegraphics{Figures/TorusTriangulation1}}
\end{center}

Here is one possible orientation for the torus:

\begin{center}
\scalebox{.5}{\includegraphics{Figures/TorusTriangulation2}}
\end{center}


and here is another:

\begin{center}
\scalebox{.5}{\includegraphics{Figures/TorusTriangulation3}}
\end{center}
\end{example}
\hrulefill

Not all surfaces can be oriented. If a surface $S$ (with triangulation $\mc{T}$) is not orientable, we say it is \defn{non-orientable}.

\begin{exercise}
Here is a picture of the M\"obius band. Triangulate the M\"obius band and prove that it is non-orientable.

\begin{center}
\scalebox{.5}{\includegraphics{Figures/MobiusBand}}
\end{center}
\end{exercise}
\hrulefill

\begin{theorem}
A (topological) surface is non-orientable if and only if it contains a M\"obius band as a subset.
\end{theorem}

\begin{exercise}
Prove that the Klein bottle and Projective Plane are not orientable.
\end{exercise}
\hrulefill

If a surface $S$ has a triangulation $\mc{T}$ with each triangle oriented, then we can define a unit normal vector at each point of $S$ using the right hand rule.

For the oriented triangles below: the normal vector at each point in the triangle on the left points into the page and for each point in the triangle on the right points into the page.
\begin{center}
\scalebox{.5}{\includegraphics{Figures/TriangleOrientations}}
\end{center}

If as we move from a triangle to an adjacent triangle the unit normal vector varies continuously, then we say that the choice of normal vectors is a \defn{normal orientation}. Conversly, given a smooth surface and a unit normal vector at each point, such that the unit normal vector varies continuously across the surface we can give a triangulation of the surface an orientation. Thus, having a normal orientation is pretty much the same thing as having an orientation. 

If $S$ is a smooth surface and if we have a closed path $C$ on $S$ such that taking a unit normal vector to $S$ at a point on $C$ and pushing it around $C$ creates a unit normal vector pointing in the opposite direction we say that $S$ is \defn{1-sided}. If no such path exists, then $S$ is \defn{2-sided}. In $\R^3$, a surface is 1--sided if and only if it is non-orientable. In other 3-dimensional spaces, these concepts differ. (That is, in other 3-dimensional spaces it is possible to have a 2-sided non-orientable surface.)

\subsection{Parameterized Surfaces}

Suppose that $\vect{X}\co D \to \R^3$ is a function defined on a 2--dimensional region $D \subseteq \R^2$. We require that $D$ have piece-wise C$^1$ boundary  and that $\vect{X}$ be continuous and injective on the interior of $D$ (that is on $D - \boundary D$). We say that $\vect{X}$ is a \defn{parameterized surface} and that it is a \defn{parameterization} of the surface $\vect{X}(D) \subseteq \R^3$. It is possible that $\vect{X}(D)$ is not a surface in the topological sense.

\begin{example}
Let $\vect{X}(s,t) = (s,t,0)$ for $(s,t) \in D$ with $D$ some region in $\R^2$.
\end{example}
\hrulefill

\begin{example}
The graph of a function $z = f(x,y)$ can be parameterized as $\vect{X}(s,t) = (s,t,f(s,t))$.
\end{example}
\hrulefill

\begin{example}
Suppose that $\vect{x}\co [a,b] \to \R^3$ and $\vect{y}\co [a,b] \to \R^3$ are two simple curves. Define $\vect{X}(s,t) = (1-s)\vect{x}(t) + s\vect{y}(t)$ for $(s,t) \in [0,1] \times [a,b]$. This is the surface of lines that joint the path $\vect{x}$ to the path $\vect{y}$. 
\end{example}
\hrulefill

\begin{example}
Suppose that $\vect{u}$, $\vect{v}$, and $\vect{w}$ are three non-collinear points in $\R^3$. The plane containing the three points can be parameterized as $\vect{X}(s,t) = s\vect{u} + t\vect{v} + (1- s - t)\vect{w}$. 
\end{example}
\hrulefill

\begin{example}
If  $\vect{x}(t) = (x(t),y(t))$ is a curve in the $x-y$ plane, the surface obtained by rotating that curve around the $y$ axis can be parameterized as
\[
\vect{X}(s,t) = \begin{pmatrix}\cos(s)x(t)\\ y(t) \\ \sin(s)x(t)\end{pmatrix}
\]
with $s \in [0,2\pi]$.
\end{example}
\hrulefill

If $\vect{X}\co D \to \R^3$ is a surface and if we fix some $t_0$ then the curve $\vect{x}(s) = \vect{X}(s,t_0)$ is called a \defn{$s$--coordinate curve}. Similarly, if $s_0$ is fixed, then $\vect{x}(t) = \vect{X}(s_0,t)$ is a $t$--coordinate curve. We let $\vect{T}_s$ and $\vect{T}_t$ be the tangent vectors of these curves. That is: $\vect{T}_s(s,t) = \lpartial{s}\vect{X}(s,t)$ and $\vect{T}_t(s,t) = \lpartial{t}\vect{X}(s,t)$. Notice that the vectors $\vect{T}_s(s,t)$ and $\vect{T}_t(s,t)$ are tangent to the surface $\vect{X}(D)$. Indeed, if $\vect{X}(D)$ has a tangent plane at the point $(s,t)$ then $\vect{T}_s(s,t)$ and $\vect{T}_t(s,t)$ lie in that plane. The following definition, therefore, is likely to be useful:

If $\vect{X}$ is $C^1$ at the point $(s,t)$, then the vector $\vect{N}(s,t) = \vect{T}_s \times \vect{T}_t$ is called the \defn{normal vector} at $(s,t)$. If $\vect{N}(s,t) \neq \vect{0}$, then we say that $\vect{X}$ is \defn{smooth} at $(s,t)$. Being smooth at $(s,t)$ is equivalant to the statment that the vectors $\vect{T}_s$ and $\vect{T}_t$ form a basis for the tangent plane to $\vect{X}(D)$ at $\vect{X}(s,t)$.

If $D$ is connected and if $\vect{X}$ is smooth, then if $\vect{N}$ varies continuously with $(s,t)$, then $\vect{X}$ is \defn{oriented} with orientation $\vect{N}/||\vect{N}||$. Notice that since $\vect{X}$ is smooth and since $\vect{N}$ is continuous, a connected smooth surface has exactly two orientations. 

\begin{example}
Let $\vect{X}(s,t) = \begin{pmatrix}t\cos s \\ t \\ t\sin s\end{pmatrix}$ for $(s,t) \in [0,2\pi] \times [1,2]$. Determine if $\vect{X}$ is smooth and orientable.

\begin{center}
\scalebox{.4}{\includegraphics{Figures/NapkinRing}}
\end{center}

\textbf{Solution:} We compute the coordinate curve derivatives as:
\[
\vect{T}_s = \begin{pmatrix}-t\sin s \\ 0 \\ t\cos s \end{pmatrix}
\]
and
\[
\vect{T}_t = \begin{pmatrix}\cos s \\ 1 \\ \sin s \end{pmatrix}
\]
A computation shows that
\[
\vect{N} = \vect{T}_s \times \vect{T}_t = \begin{pmatrix}-t\cos s \\ t \\-t\sin s \end{pmatrix}.
\]
and
\[
||\vect{N}(s,t)|| = t\sqrt{2}
\]

Since $\vect{N}$ is everywhere defined and is non zero for $t \in [1,2]$, $\vect{X}$ is smooth. Since $\vect{N}$ is continuous $\vect{X}$ is orientable.
\end{example}
\hrulefill



\begin{example}
Let \[\vect{X}(s,t) = \begin{pmatrix} \cos s \cos t \\ \sin t \\sin s \cos t \end{pmatrix}\] for $(s,t) \in [0,2\pi]\times[-\pi,\pi]$. This is a parameterization of the unit sphere. Calculations show that \[\vect{N}(s,t) = \begin{pmatrix} -\sin s \sin^2 t - \cos s \cos^2 t \\ -\cos^2 s \cos t \sin t - \sin^2 s \cos t \sin t \\ -\cos^2 t \sin s + \sin^2 t \cos s \end{pmatrix}.\] It is possible to check that $\vect{N}$ is everywhere non-zero and continuous. Thus $\vect{X}$ is smooth and orientable.
\end{example}
\hrulefill

\newpage

\subsection{Surface Integrals}

Suppose that $\vect{X}\co D \to \R^3$ is a smooth surface. Suppose that $f \co \vect{X}(D) \to \R$ and $f \co \vect{X}(D) \to \R^3$ are C$^1$.  Then define:
\[
\begin{array}{rcl}
\iint_{\vect{X}} \vect{F} \cdot \thinspace d\vect{S} &=& \iint\limits_D (\vect{F} \circ \vect{X})\cdot \vect{N} \thinspace dA \\
\iint_{\vect{X}} f \thinspace dS &=& \iint\limits_D (f \circ \vect{X}) \thinspace ||\vect{N}|| \thinspace dA.
\end{array}
\]

\begin{example}
Let $\vect{X}(s,t) = \begin{pmatrix}t\cos s \\ t \\ t\sin s\end{pmatrix}$ for $(s,t) \in [0,2\pi] \times [1,2]$. Let $f(x,y,z) = x + y + z$. Compute $\iint\limits_{\vect{X}} f \thinspace dS$.

\textbf{Solution:} We have already calculated that 
\[
\vect{N} = \begin{pmatrix}-t\cos s \\ t \\-t\sin s \end{pmatrix}.
\]
By the formula:
\[
\begin{array}{rcl}
\iint\limits_\vect{X} f \thinspace dS &=& \iint\limits_{[0,2\pi] \times[1,2]} f(\vect{X}(s,t)) ||\vect{N}(s,t)||\thinspace dA \\
&=&\int_1^2  \int_0^{2\pi} (t \cos t + t + t\sin t)t\sqrt{2} \thinspace ds dt\\
&=& \int_1^2 t^2\sqrt{2} \thinspace dt \\
&=& \frac{7\sqrt{2}}{3}
\end{array}
\]
\end{example}
\hrulefill

\begin{example}
Let $\vect{X}(s,t) = \begin{pmatrix}t\cos s \\ t \\ t\sin s\end{pmatrix}$ for $(s,t) \in [0,2\pi] \times [1,2]$. Let $\vect{F}(x,y,z) = \begin{pmatrix} y \\ x \\ z \end{pmatrix}$. Compute $\iint\limits_{\vect{X}} \vect{F}\cdot d\vect{S}$.

\textbf{Solution:} We have already calculated that 
\[
\vect{N} = \begin{pmatrix}-t\cos s \\ t \\-t\sin s \end{pmatrix}.
\]
By the formula:
\[
\begin{array}{rcl}
\iint\limits_{\vect{X}} \vect{F}\cdot d\vect{S} &=& \iint\limits_{[0,2\pi] \times[1,2]} \vect{F}(\vect{X}(s,t)) \cdot \vect{N}(s,t)\thinspace dA \\
&=&\int_1^2  \int_0^{2\pi} \begin{pmatrix}t \\ t\cos s \\ t \sin s \end{pmatrix} \cdot \begin{pmatrix}-t\cos s \\ t \\ -t \sin s \end{pmatrix}\thinspace ds dt\\
&=& \int_1^2 \int_0^{2\pi} (-t^2 \cos s + t^2 \cos s - t^2 \sin s\thinspace ds dt \\
&=& 0
\end{array}
\]
\end{example}
\hrulefill


\begin{example}
Let $\vect{Y}(u,v) = \begin{pmatrix} v\cos u \\ v \sin u \\ v^2 \end{pmatrix}$ for $(u,v) \in E$ where $E = [0,2\pi] \times [0,4]$. Let $\vect{F}(x,y,z) = \begin{pmatrix} -y \\ x \\ 0 \end{pmatrix}$. Calculate $\iint_\vect{Y} \vect{F}\cdot d\vect{S}$.

Recall that $\vect{N}_\vect{Y} = \begin{pmatrix} 2v^2 \cos u \\ 2v^2 \sin u \\ - v \end{pmatrix}$. Thus,
\[
\begin{array}{rcl}
\iint_\vect{Y} \vect{F} \thinspace d\vect{S}&=& \iint_{E} \vect{F}(\vect{Y}(u,v))\cdot \vect{N}_\vect{Y} \thinspace dA \\
&&\\
&=& \int_0^4 \int_0^{2\pi} \begin{pmatrix} -v\sin u \\ v\cos u \\ 0 \end{pmatrix} \cdot \begin{pmatrix} 2v^2 \cos u \\ 2v^2 \sin u \\ - v \end{pmatrix} \thinspace du\thinspace dv \\
&&\\
&=& \int_0^4 \int_0^{2\pi} 0 \thinspace du \thinspace dv\\
&=& 0.
\end{array}
\]
\end{example}
\hrulefill

If $\vect{F}\co \R^3 \to \R^3$ is a vector field and if $S \subset \R^3$ is an oriented surface, with normal orientation $\vect{n}$, then the \defn{flux} of $\vect{F}$ across $\vect{S}$ is, by definition, $\iint_\vect{X} \vect{F} \cdot d\vect{S}$, where $\vect{X}$ is any parameterization of $S$, with normal vector $\vect{N}$ pointing in the same direction as $\vect{n}$.

Informally, the flux of $\vect{F}$ across $S$, measures the fluid flow across $S$.

\begin{example}
Let $S$ be the paraboloid which is the graph of $f(x,y) = x^2 + y^2$ for $x^2 + y^2 \leq 4$. Orient $S$. If $\vect{F}(x,y,z) = (-y,x, 0)$, then the flux of $\vect{F}$ across $S$ is 0 since the vector field is tangent to $S$. (Notice that the flow lines for $\vect{F}$ which contain points of $S$, actually lie on $S$.
\end{example}

\begin{example}
Let $S$ be the unit sphere in $\R^3$ with outward pointing normal. Let $\vect{F}(x,y,z) = (x,y,z)$. Then the flux of $\vect{F}$ across $S$ is simply the surface area of $S$ (which is $4\pi$) since, at $(x,y,z) \in S$.

To see this, let $\vect{X}\co D \to \R^3$ be a smooth parameterization of $S$ with outward pointing normal vector. Noticing that $||\vect{F}(\vect{X})|| = 1$, we have:
\[\begin{array}{rcl}
\iint_\vect{X} \vect{F} \cdot d\vect{S} &=& \iint_D \vect{F}(\vect{X}) \cdot \vect{N} \thinspace ds \thinspace dt\\
&=& \iint_D \left(\vect{F}(\vect{X})\cdot \frac{\vect{N}}{||\vect{N}||}\right) \thinspace ||\vect{N}|| \thinspace ds \thinspace dt\\
&=& \iint_D ||\vect{F}(\vect{X})|| ||\vect{N}|| \thinspace ds \thinspace dt\\
&=& \iint_D ||\vect{N}|| \thinspace ds \thinspace dt\\
&=& \iint_\vect{X} dS \\
\end{array}
\]
and this last expression is the surface area of $S$.
\end{example}

This last example can be generalized to:
\begin{theorem}
Suppose that $S$ is a compact surface in $\R^3$ and that $\vect{F}$ is a non-zero $C^1$ vector field defined in a neighborhood of $S$ such that for each $(x,y,z)\in S$, $\vect{F}(x,y,z)$ is perpindicular to $S$. If $||\vect{F}(x,y,z)|| > 0$ for all $(x,y,z) \in S$, then the flux of $\vect{F}$ across $S$ is simply $\pm \iint_S ||\vect{F}|| \thinspace dS$. 
\end{theorem}


\begin{example}
Suppose that a thin sphere of radius 1 centered at the origin is given a constant $+1$ charge. Then the sphere generates an electric field given by:
\[
\vect{E}(a,b,c) = \nabla_{(a,b,c)} \cdot \iint_S f \thinspace dS,
\]
where $f(x,y,z) = \frac{-1}{(a-x)^2 + (b-y)^2 + (c-z)^2}$.

We will prove that this does not depend on a parameterization for $S$.
\end{example}


\newpage

\subsection{Reparameterizations}
\begin{definition}
Suppose that $D$ and $E$ are 2-dimensional regions in $\R^2$ with $C^1$ boundary. Let $h\co E \to D$ be a C$^1$ function such that:
\begin{enumerate}
\spacing
\item $h$ is a surjection.
\item $h$ is one-to-one on the interior of $E$.
\item Any point $\vect{x}\in E$ such that $\det Dh(\vect{x}) = 0$ lies on $\boundary E$
\end{enumerate}

Then we say that $h$ is a \defn{change of coordinates} function.
\end{definition}

\begin{example}
Let $D$ be the disc $0 \leq s^2 + t^2 \leq 4$ in the $s-t$ plane. Let $E$ be the rectangle $[0,2\pi] \times [0,2]$ in the $u-v$ plane. Define:
\[
\begin{pmatrix} s \\ t \end{pmatrix} = h(u,v) = \begin{pmatrix} v \cos u \\ v\sin u \end{pmatrix}.
\]
\textbf{Claim:} $h$ is a change of coordinates function.

Clearly, $h$ is a surjection and $h$ is C$^1$. Notice that:
\[
Dh(u,v) = \begin{pmatrix} -v\sin u & \cos u \\ v\cos u & \sin u \end{pmatrix}.
\]
Thus, $\det Dh(u,v) = -v$. As long as $v > 0$, $\det Dh(u,v) \neq 0$. The set $\mc{P} = \{(0,v)\}$ lies in $\boundary E$. Thus, $h$ is a change of coordinates function.
\end{example}

\begin{lemma}
Suppose that $E$ is connected and that $h\co E \to D$ is a change of coordinates function. If $\vect{x}_1$ and $\vect{x}_2$ are points in $E$ at which $h$ is C$^1$ and with $\det Dh(\vect{x}_1) \neq 0$ and $\det Dh(\vect{x}_2) \neq 0$, then either both $\det Dh(\vect{x}_1)$ and $\det Dh(\vect{x}_2)$ are positive, or both are negative. 
\end{lemma}

\begin{proof}
There is a continuous path in $E$ joining $\vect{x}_1$ to $\vect{x}_2$. Since $h$ is C$^1$ on $E $, $\det Dh$ varies continuously along the path. Since the path misses the places where the determinant of the derivative of $h$ is zero, $\det Dh(\vect{x}_1)$ and $\det Dh(\vect{x}_2)$ are both positive or both negative.
\end{proof}

\begin{definition}
If $h\co E \to D$ is a change of coordinates function, and if $E$ is connected then $h$ is \defn{orientation preserving} if $\det Dh > 0$ on all points where $\det Dh$ is defined and non-zero. Otherwise, $h$ is \defn{orientation reversing}.
\end{definition}

\begin{definition}
Suppose that $\vect{X}\co D \to\R^3$ is a surface and that $\vect{Y} \co E \to \R^3$ is a surface such that there exists a change of coordinates function $h \co E \to D$ with $\vect{Y} = \vect{X} \circ h$. Then $\vect{Y}$ is a reparameterization of $\vect{X}$. 
\end{definition}

\begin{example}
Let $\vect{X}(s,t) = \begin{pmatrix}s \\ t \\ s^2 + t^2 \end{pmatrix}$ for $0 \leq s^2 + t^2 \leq 4$. Let $\vect{Y}(u,v) = \begin{pmatrix} v\cos u \\ v \sin u \\ v^2 \end{pmatrix}$. Notice that $\vect{X}$ and $\vect{Y}$ are parameterizations of the same paraboloid. Define $h(u,v) = \begin{pmatrix} v\cos u \\ v \sin u \end{pmatrix}$. Then $\vect{Y}$ is a reparameterization of $\vect{X}$ by an orientation reversing change of coordinates.
\end{example}

\begin{lemma}
Suppose that $\vect{X} \co D \to\R^3$ and that $h\co E \to D$ is a change of coordinates function. Let $\vect{Y} = \vect{X} \circ h$. Let $\vect{N}_\vect{X}$ and $\vect{N}_\vect{Y}$ be the normal vectors of $\vect{X}$ and $\vect{Y}$ respectively. Then,
\[
\vect{N}_{\vect{Y}}(u,v) = (\det Dh(u,v))\vect{N}_\vect{X}(h(u,v)).
\]
\end{lemma}

\begin{proof}
We simply provide a sketch for those who have taken Linear Algebra. The book provides a different method.

Let $S = \vect{X}(D) = \vect{Y}(E)$. Assume that both $\vect{X}$ and $\vect{Y}$ are smooth, so that there exists a tangent plane $TS_\vect{p}$ to $S$ at $\vect{p} = \vect{X}(s,t) = \vect{Y}(u,v)$. Assume that coordinates on $\R^3$ have been chosen so that $TS_\vect{p}$ is the $xy$-plane in $\R^3$.

We think of $TS(u,v)$ as lying in the tangent space $T_\vect{p}$ in $\R^3$ at $\vect{p}$. Since both $\vect{X}$ and $\vect{Y}$ are smooth, the sets of vectors $\{\vect{T}_s, \vect{T}_t\}$ and $\{\vect{T}_u, \vect{T}_v\}$ are each a basis for $TS_\vect{p}$. Identifying $TS_\vect{p}$ with both the $s-t$ plane and with the $u-v$ plane.

By the chain rule,
\[
D\vect{Y}(u,v) = D\vect{X}(h(u,v))Dh(u,v).
\]

We have
\[\begin{array}{rcl}
D\vect{Y}(u,v) &=& \begin{pmatrix} \vect{T}_u (u,v)& \vect{T}_v (u,v)\end{pmatrix}\\
D\vect{X}(h(u,v)) &=& \begin{pmatrix} \vect{T}_s (h(u,v))& \vect{T}_t (h(u,v))\end{pmatrix}\\
\end{array}
\]
Recall that the absolute value of the determinant of a $2 \times 2$ matrix is the area of the parallelogram formed by its column vectors. Recall also that determinant is multiplicative. Thus, by taking determinants and absolute values we get:
\[\begin{array}{l}
\text{( Area of parallelogram formed by } \vect{T}_u (u,v) \text{ and } \vect{T}_v(u,v) \text{ )} = \\
\text{( Area of parallelogram formed by } \vect{T}_s (h(u,v)) \text{ and } \vect{T}_t(h(u,v)) \text{ )} |\det Dh(u,v)|\\
\end{array}
\]

Thus,
\[
||\vect{N}_\vect{Y}(u,,v)|| = ||\vect{N}_\vect{X}(h(u,v))|| \thinspace |\det Dh(u,v)|.
\]

Since we have arranged that $TS_\vect{p}$ is the $xy$-plane, both $\vect{N}_\vect{Y}(u,v)$ and $\vect{N}_\vect{X}$ point in the $\pm \vect{k}$ direction. That is:
\[\begin{array}{rcl}
\vect{N}_\vect{Y}(u,,v) &=& \begin{pmatrix} 0 \\ 0 \\ \det D\vect{Y}(u,v) \end{pmatrix} \\
&&\\
\vect{N}_\vect{X}(h(u,v)) &=& \begin{pmatrix} 0 \\ 0 \\ \det D\vect{X}(h(u,v))\end{pmatrix}
\end{array}\]

Since, $\det D\vect{Y}(u,v)= \det D\vect{X}(h(u,v)) \det Dh(u,v)$,
the result follows.
\end{proof}

Thus, if $\vect{X}$ and $\vect{Y}$ are both smooth and connected surfaces and if $\vect{Y}$ is a reparameterization of $\vect{X}$ by a change of coordinates function $h$, then $\vect{Y}$ has the same normal orientation as $\vect{X}$ if and only if there exists a point $(u,v)$ with $\det Dh(u,v) >0$.

\begin{example}
Let $\vect{X}(s,t) = \begin{pmatrix}s \\ t \\ s^2 + t^2 \end{pmatrix}$ for $0 \leq s^2 + t^2 \leq 4$. Let $\vect{Y}(u,v) = \begin{pmatrix} v\cos u \\ v \sin u \\ v^2 \end{pmatrix}$. Notice that $\vect{X}$ and $\vect{Y}$ are parameterizations of the same paraboloid. Define $h(u,v) = \begin{pmatrix} v\cos u \\ v \sin u \end{pmatrix}$. Notice that $\vect{Y} = \vect{X} \circ h$ where $h(u,v) = (v\cos u, v\sin u)$.

Calculations show that:
\[ \begin{array}{rcl}
\vect{N}_\vect{X} &= & \begin{pmatrix} -2s \\ -2 t\\ 1 \end{pmatrix} \\
&&\\
\vect{N}_\vect{Y} & = & \begin{pmatrix} 2v^2 \cos u \\ 2v^2 \sin u \\ - v \end{pmatrix}
\end{array}\]

Recalling that $\det Dh(u,v) = -v$, we see that the lemma gives us the same relationship between $\vect{N}_\vect{X}$ and $\vect{N}_\vect{Y}$.
\end{example}

You may wonder how surface integrals change under reparameterization.  The following theorem provides the answer:
\begin{theorem}
Suppose that $\vect{X}$ and $\vect{Y}$ are parameterized connected surfaces and that $\vect{Y}$ is a reparameterization of $\vect{X}$. If the change of coordinate function $h$ is orientation-preserving, let $\epsilon = +1$. If $h$ is orientation reversing, let $\epsilon = -1$. Let $f$ be a C$^1$ scalar field and let $\vect{F}$ be a C$^1$ vector field, both defined in a neighborhood of the image of $\vect{X}$ and $\vect{Y}$. Then:
\[\begin{array}{rcl}
\iint_\vect{Y} f \thinspace dS &= & \iint_\vect{X} f \thinspace dS \\
&&\\
\iint_\vect{Y} \vect{F}\cdot \thinspace d\vect{S} &= & \iint_\vect{X} \vect{F} \cdot \thinspace d\vect{S} \\
\end{array}\]
\end{theorem}

\begin{proof}
We will need the change of variables theorem:

\begin{theorem*}
Suppose that $D$ and $E$ are regions in the $st$ plane and the $uv$ plane respectively and that $h\co E \to D$ is a change of coordinates function. Let $g\co D \to \R$ be C$^1$. Then
\[
\iint_E g \circ h \thinspace |\det Dh(u,v)| du \thinspace dv = \iint_D g \thinspace ds \thinspace dt
\]
\end{theorem*}

Both equations are a rather immediate application of this. We prove only the second, in the case when $h$ is orientation reversing.

\[\begin{array}{rcl}
\iint_\vect{Y} \vect{F} \thinspace d\vect{S} &=& \iint_E (\vect{F} \circ \vect{Y}) \cdot \vect{N}_\vect{Y} \thinspace du \thinspace dv\\
&=& \iint_E ((\vect{F} \circ \vect{X}) \circ h) \cdot (\vect{N}_\vect{X} \cdot h) \thinspace (\det Dh(u,v)) \thinspace du \thinspace dv \\
&=& \iint_D (\vect{F} \circ \vect{X}) \cdot \vect{N}_\vect{X} \thinspace ds \thinspace dt\\
&=& \iint_\vect{X} \vect{F} \cdot d \vect{S}.
\end{array}
\]
The second to last equality comes from an application of the change of variables theorem.
\end{proof}

\newpage

\section{Stokes' and Gauss' Theorems}

\begin{definition}
Suppose that $S$ is a piecewise smooth surface which has normal orientation $\vect{n}$ (a unit vector). Let $\gamma$ be a component of $\boundary S$. Orient $\gamma$. We say that $\gamma$ has been oriented consistently with $\vect{n}$ if  it is possible to put a little triangle on $\gamma$, give the edges of the triangle arrows circulating in the direction of the orientation of $\gamma$, use the right hand rule and obtain a normal vector pointing in the direction of $\vect{n}$. We also say that $\boundary S$ has been given the orientation induced from the orientation of $\vect{S}$.
\end{definition}

\begin{example}
Suppose that $A \subset \R^3$ is an oriented annulus (i.e. cylinder) with two boundary components. Those boundary components must have opposite orientations.
\end{example}
\hrulefill

\subsection{Stokes' Theorem}

\begin{theorem}[Stokes' Theorem]
Let $S$ be a compact, oriented, piecewise smooth surface in $\R^3$. Give $\boundary S$ the orientation induced by the orientation of $S$. Let $\vect{F}$ be a C$^1$ vector field defined on an open set containing $S$. Then,
\[
\iint_S (\curl \vect{F}) \cdot d\vect{S} = \int_{\boundary S} \vect{F} \cdot d\vect{s}.
\]
\end{theorem}

\begin{example}
Let $S \subset \R^3$ be the disc of radius 1 in the plane $z = 1$ with center at $(0,0,1)$ and normal orientation pointing in the direction of the positive $z$-axis. Let $\vect{F}(x,y,z) = \begin{pmatrix}x \\ y \\ z \end{pmatrix}$. Compute both sides of the equality in the statement of Stokes' theorem.

\textbf{Solution:} We begin with the surface integral. Let $D$ be the unit disc in the $st$-plane. We can parameterize $S$ as $\vect{X}(s,t) = \begin{pmatrix} s \\ t \\ 1 \end{pmatrix}$ for $(s,t) \in D$. It is easy to check that the normal vector for $\vect{X}$ is $\vect{N}(s,t) = \begin{pmatrix} 0 \\ 0 \\ 1 \end{pmatrix}$. Thus,
\[\begin{array}{rcl}
\iint\limits_S \curl \vect{F}\cdot d\vect{S} &=& \iint\limits_D 0 \thinspace ds dt \\
&=& 0
\end{array}
\]

Now we calculate the line integral. The induced orientation on $\boundary S$ gives it the counterclockwise orientation when viewed from above. So we can parameterize $\boundary S$ as $\vect{x}(t) = \begin{pmatrix}\cos t \\ \sin t \\ 1 \end{pmatrix}$ with $0 \leq t \leq 2\pi$. Hence,
\[
\begin{array}{rcl}
\int\limits_{\boundary S} \vect{F} \vl &=& \int_0^{2\pi} \begin{pmatrix} \cos t \\ \sin t \\ 1 \end{pmatrix} \cdot \begin{pmatrix}-\sin t \\ \cos t \\ 0 \end{pmatrix} \\
&=& \int_0^{2\pi} 0 \thinspace dt \\
&=& 0.
\end{array}
\]
\end{example}
\hrulefill

\begin{example}
Let $S \subset \R^3$ be the disc of radius 1 in the plane $z = 1$ with center at $(0,0,1)$ and normal orientation pointing in the direction of the positive $z$-axis. Let $\vect{F}(x,y,z) = \begin{pmatrix}-y \\ x \\ 0 \end{pmatrix}$. Compute both sides of the equality in the statement of Stokes' theorem.

\textbf{Solution:} We begin with the surface integral. Let $D$ be the unit disc in the $st$-plane. We can parameterize $S$ as $\vect{X}(s,t) = \begin{pmatrix} s \\ t \\ 1 \end{pmatrix}$ for $(s,t) \in D$. It is easy to check that the normal vector for $\vect{X}$ is $\vect{N}(s,t) = \begin{pmatrix} 0 \\ 0 \\ 1 \end{pmatrix}$. Thus,
\[\begin{array}{rcl}
\iint\limits_S \curl \vect{F}\cdot d\vect{S} &=& \iint\limits_D \begin{pmatrix} 0 \\ 0 \\ 2 \end{pmatrix} \cdot \begin{pmatrix} 0 \\ 0 \\ 1 \end{pmatrix} \thinspace ds dt \\
&=& \iint\limits_D 2 \thinspace ds dt \\
&=& 2\pi
\end{array}
\]

Now we calculate the line integral. The induced orientation on $\boundary S$ gives it the counterclockwise orientation when viewed from above. So we can parameterize $\boundary S$ as $\vect{x}(t) = \begin{pmatrix}\cos t \\ \sin t \\ 1 \end{pmatrix}$ with $0 \leq t \leq 2\pi$. Hence,
\[
\begin{array}{rcl}
\int\limits_{\boundary S} \vect{F} \vl &=& \int_0^{2\pi} \begin{pmatrix} -\sin t \\ \cos t \\ 0 \end{pmatrix} \cdot \begin{pmatrix}-\sin t \\ \cos t \\ 0 \end{pmatrix} \\
&=& \int_0^{2\pi} 1 \thinspace dt \\
&=& 2\pi.
\end{array}
\]
\end{example}
\hrulefill

\begin{example}
Let $P$ be the paraboloid given by the equation $z = x^2 + y^2$ for $x^2 + y^2 \leq 1$. Give $P$ the orientation so that the normal vector to $P$ at $\vect{0}$ points upward. Let $F(x,y,z)$ be the vector field $\vect{F}(x,y,z) = \begin{pmatrix}-y \\ x \\ 0\end{pmatrix}$. Find the circulation of $\vect{F}$ around $P$.

\textbf{Solution:} The circulation of $\vect{F}$ around $P$ is simply $\iint_P \curl \vect{F} \cdot d\vect{S}$. By Stokes' theorem this is equal to $\int\limits_{\boundary P} \vect{F}\cdot d\vect{s}$. By the previous problem this is equal to $2\pi$. (Notice that the orientation induced by $P$ on $\boundary P = \boundary S$ is the same as the orientation induced by the disc $S$ from the previous problem.
\end{example}

That example generalizes to:

\begin{theorem}
Suppose that $S_1$ and $S_2$ are two oriented surfaces such that $\boundary S_1 = \boundary S_2$ and such that the induced orientations on the boundary are equal. If $\vect{F} = \curl \vect{G}$ for some $\vect{G}$ then $\iint\limits_{S_1} \vect{F} \cdot d\vect{S} = \iint\limits_{S_2} \vect{F}\cdot d\vect{S}$.
\end{theorem}
\begin{proof}
By Stokes' theorem applied twice:
\[
\iint\limits_{S_1} \vect{F} \cdot d\vect{S} = \int_{\boundary S_1} \vect{G} \cdot d\vect{s} = \int_{\boundary S_2} \vect{G} \cdot d\vect{s}= \iint\limits_{S_2} \vect{F}\cdot d\vect{S}.
\]
\end{proof}
\hrulefill

\newpage

\subsection{Divergence Theorem}
\begin{theorem}[Divergence Theorem/Gauss' Theorem]
Let $V$ be a compact solid region in $\R^3$ such that $\boundary V$ consists of piecewise smooth, closed, orientable surfaces. Orient $\boundary V$ with unit normals pointing out of $V$. Suppose that $\vect{F}$ is a C$^1$ vectorfield defined on an open set containing $V$. Then:
\[
\iiint\limits_{V} \diver \vect{F} dV =\iint\limits_{\boundary V} \vect{F}\cdot d\vect{S}
\]
\end{theorem}

\begin{example}
Suppose that $\vect{F}$ is a C$^1$ vector field defined on $\R^3 - \{\vect{0}\}$ such that $\diver \vect{F}$ is a constant 7. Let $S_1$ be the unit sphere centered at the origin and let $S_8$ be the sphere of radius 8 centered at the origin. Orient both $S_1$ and $S_8$ outward. If the flux of $\vect{F}$ through $S_1$ is 9, find the flux of $\vect{F}$ through $S_8$.

\textbf{Solution:} Let $V$ be the region between $S_1$ and $S_8$ and note that $\vect{F}$ is $C^1$ on $V$. Giving $\boundary V = S_1 \cup S_2$ the outward orientation gives $S_8$ the same orientation as the one given, but gives $S_1$ the opposite orientation. Thus
\[
\iint\limits_{\boundary V} \vect{F} \cdot d\vect{S} = \iint \limits_{S_8} \vect{F} \cdot d\vect{S} - \iint\limits_{S_1} \vect{F} \cdot d\vect{S}.
\]
By the divergence theorem this equals:
\[
\iiint\limits_V \diver \vect{F} \thinspace dV = 7\operatorname{volume}(V).
\]
The volume of $V$ is simply $\frac{4\pi}{3}(8^3) - \frac{4\pi}{3} = \frac{2044\pi}{3}$.
Thus,
\[
\iint \limits_{S_8} \vect{F} \cdot d\vect{S} = \frac{2044\pi}{3} + \iint\limits_{S_1} \vect{F} \cdot d\vect{S} = \frac{2044\pi}{3} + 9.
\]
\end{example}
\hrulefill

\newpage

\section{Gravity}

Suppose that $\rho\co \R^3 \to \R$ is a density function. That is, $\rho(\vect{x})$ is the density at a point $\vect{x} \in \R^3$. If $V \subset \R^3$ is a 3-dimensional region, then the mass of $V$ is $\iiint\limits_V \rho \thinspace dV$. 

The gravitational attraction exerted by a point at $\vect{x}$ on another point at $\vect{r} \neq \vect{x}$ is given by:
\[
\vect{F}(\vect{r}) = G\rho(\vect{x}) \frac{\vect{x} - \vect{r}}{||\vect{x} - \vect{r}||^3}
\]
where $G$ is the universal gravitational constant.

It is easy to check that the divergence of $\vect{F}$ with respect to $\vect{r}$ is zero.

Fundamental to the study of gravitation is:
\begin{theorem}[Gauss' Law]
Let $V$ be a 3--dimensional region. The flux of the gravitational field $\vect{F}$ exerted by $V$ across $\boundary V$ is:
\[
\iint_{\boundary V} \vect{F}\cdot d\vect{S} = -4\pi G \iiint_{V} \rho \thinspace dV
\]
\end{theorem}

\begin{proof}
\textbf{Simple Case:} There exists a point $\vect{x} \in V$ with $\rho(\vect{x}) \neq 0$ and all other points in $V$ have zero density. Let $S$ be a small sphere of radius $a$ enclosing $\vect{x}$ contained inside $V$. Let $\vect{n}$ be the unit outward normal to $S_a$. Notice that at a point $\vect{r}$ on $S_a$, $\vect{n}(\vect{r}) = (\vect{r} - \vect{x})/a = -(\vect{x} - \vect{r})/a$.

Then 
\[\begin{array}{rcl}
\iint_{S_a} \vect{F}\cdot d\vect{S} &=& \iint_{S_a} \vect{F}\cdot \vect{n} dS\\
&=& G\rho(\vect{x})\iint_{S} \frac{1}{a^3}(\vect{x} - \vect{r})\cdot \frac{-1}{a}(\vect{x} - \vect{r}) \thinspace dS\\
&=&-G\rho(\vect{x})\iint_{S} \frac{a^2}{a^4} \thinspace dS \\
&=&-G\rho(\vect{x})\iint_{S} \frac{1}{a^2} \thinspace dS \\
&=& -G\rho(\vect{x}) \frac{1}{a^2} \iint_S \thinspace dS\\
&=& -G\rho(\vect{x})(4\pi)
\end{array}
\]

Now notice that since $\nabla_{\vect{r}}\cdot \vect{F} = 0$, by the divergence theorem, we have:
\[
\iint_{\boundary V} \vect{F} \cdot d\vect{S} = \iint_{S} \vect{F}\cdot d\vect{S} = -4\pi G \rho(\vect{x}).
\]

\textbf{The general case:} For an arbitrary (integrable) density function, by superposition we have
\[
\iint_{\boundary V}\vect{F}\cdot d\vect{S} = -4\pi G \iiint_{V} \rho \thinspace dV.
\]
\end{proof}

We can now prove an important theorem:
\begin{theorem}[Shell Theorem]
Suppose that $W$ is a 3--dimensional region of constant density which is the region between a sphere of radius $a\geq 0$ and a sphere of radius $b > a$, both centered at the origin.

Then the following hold:
\begin{enumerate}
\item For a point $\vect{r}$, with $||\vect{r}|| > b$, the force of gravity is the same as if $W$ were a point mass.
\item In either case, for a point $\vect{r}$ with $a < ||\vect{r}|| < b$, the force of gravity varies linearly with distance from the origin.
\item For a point $\vect{r}$ with $||\vect{r}|| < a$, the force of gravity is zero.
\end{enumerate}
\end{theorem}

\begin{proof}
Let $\vect{r}$ be a point in $\R^3$ and let $r = ||\vect{r}||$. By the symmetry of $W$, the gravitational field at $\vect{r}$ is a vector that points toward the origin. That is, if $\vect{r} \neq \vect{0}$,
\[
\vect{F}(\vect{r}) = -f(r) \frac{\vect{r}}{r}
\]
where $f(r)$ is a non-negative scalar function depending only on the magnitude $r$ of $\vect{r}$.

Let $S$ be a sphere of radius $r$ bounding a ball $V$ centered at $\vect{0}$. We have:
\[\begin{array}{rcl}
\iint_S \vect{F} \cdot d\vect{S} &=& f(r) \iint_{S} \frac{-\vect{r}}{r} \thinspace d\vect{S}\\
&=& -4\pi r^2 f(r).\\
\end{array}\]

By Gauss' Law  we also have:
\[
\begin{array}{rcl}
\iint_S \vect{F} \cdot d\vect{S} &=& -4\pi G \iiint\limits_V \rho \thinspace dV\\
&=& -4\pi G \operatorname{mass}(V).
\end{array}
\]

Thus,
\[
-4\pi r^2 f(r) = -4\pi G \operatorname{mass}(V).
\]

If $r > b$, then $\operatorname{mass}(V) = \operatorname{mass}(W)$ and so
\[
f(r) = \frac{G \operatorname{mass}(W)}{r^2}
\]
as desired.

If $a < r < b$, then the mass of $V$ is equal to the mass of $W \cap V$ which varies with the cube of $r$. Hence $f(r)$ varies linearly with $r$.

If $0 < r < b$, then $\operatorname{mass}(V) = 0$ and so $f(r) = 0$.
\end{proof}

%\newpage
%
%\section{(Co)homology}
%In this section we describe how a number of the facts and properties about gradient, divergence, and curl that we have discovered over the course of a semester fit into a larger theory. Throughout we assume some linear algebra that wasn't covered in class. For the purposes of exposition, some technical details have been glossed over and not everything is stated in its most general form. We occasionally let ``0'' denote the vector space with a single element.
%
%\subsection{Cochain complexes}
%
%A \defn{cochain complex} is a collection of vector spaces $C_i$ and linear maps $d_{i+1}\co C_i \to C_{i+1}$ called the \defn{coboundary maps} as pictured:
%\[
%0 \stackrel{d_{i-1}{\to} C_0 \stackrel{d_1}{\to} C_1 \stackrel{d_2}{\to} C_2 \hdots \stackrel{d_n}{\to} C_n \to 0
%\]
%Furthermore, we require that for any $i$
%\[
%d_{i+1}\circ d_i = 0.
%\]
%
%\begin{example}
%Consider the cochain complex
%\[
%0 \to \R^2 \stackrel{A}{\to} \R^2 \stackrel{B}{\to} \R^2 \to 0
%\]
%where
%\[
%\begin{array}{rcl}
%A(x,y) &=& \begin{pmatrix}1&0\\0&0 \end{pmatrix}\begin{pmatrix x \\ y \end{pmatrix} \\
%B(x,y) &=& \begin{pmatrix} 0 & 0 \\ 2 & 3 \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix}\\
%\end{array}
%\]
%Notice that
%\[
%\begin{pmatrix} 0 & 0 \\ 2 & 3 \end{pmatrix}\begin{pmatrix}1&0\\0&0 \end{pmatrix} = \begin{pmatrix} 0 & 0 \\ 0 & 0 \end{pmatrix}
%\]
%so this is in fact a cochain complex with $C_0 = C_1 = \R^2$. 
%\end{example}
%\hrulefill
%
%The most important examples for us are the following:
%
%\begin{example}
%Let $X \subset \R^2$ be an open set. Let $C_0$ and $C_2$ denote the vector space of all infinitely differentiable scalar fields on $X$. Let $C_1$ denote the vector space of all infinitely differentiable vector fields on $X$. Let $d_1 = \grad$ and let $d_2 = \scurl$. Then
%\[
%0 \to C_0 \stackrel{d_1}{\to} C_1 \stackrel{d_2}{\to} C_2 \to 0
%\]
%is a cochain complex.
%\end{example}
%\hrulefill
%
%\begin{example}
%Let $X \subset \R^3$ be an open set. Let $C_0$ and $C_3$ denote the vector space of all infinitely differentiable scalar fields on $X$. Let $C_1$ and $C_2$ denote the vector space of all infinitely differentiable vector fields on $X$. Let $d_1 = \grad$ and let $d_2 = \curl$ and let $d_3 = \diver$. Then
%\[
%0 \to C_0 \stackrel{d_1}{\to} C_1 \stackrel{d_2}{\to} C_2 \stackrel{d_3}{\to} C_3 \to 0
%\]
%is a cochain complex.
%\end{example}
%
%\subsection{Quotient Vector Spaces}
%
%If $V$ is a vector space and if $W \subset V$ is a subspace, then we can define a vector $\vect{a} \in V$ to be \defn{equivalent} to a vector $\vect{b} \in V$ if there exists a $\vect{w} \in W$ so that
%\[
%\vect{a} = \vect{b} + \vect{w}.
%\]
%We write
%\[
%\vect{a} \sim \vect{b}.
%\]
%
%Since $W$ is a subspace, for all $\vect{a}, \vect{b}, \vect{c} \in V$ we have
%\[\begin{array}{crcl}
%(i) & \vect{a} \sim \vect{b} &\Rightarrow& \vect{b} \sim \vect{a}\\
%(ii) & \vect{a} \sim \vect{a} &&\\
%(iii) & \vect{a} \sim \vect{b} \text{ and } \vect{b} \sim \vect{c} &\Rightarrow & \vect{a} \sim \vect{c} \\
%\end{array}
%\]
%
%Notice also that if $\vect{w} \in W$ then $\vect{w} \sim \vect{0}$. That is, all vectors in $W$ are equivalent to the zero vector.
%
%If $\vect{a} \in V$, we define the \defn{equivalence class} of $\vect{a}$ to be
%\[
%[a] = \{ \vect{b} \in V : \vect{a} \sim \vect{b}
%\]
%
%and let the \defn{quotient vector space} $V/W$ be the set of all equivalence classes. It turns out that $V/W$ is, in fact, a vector space with
%\[
%[\vect{a}] + [\vect{b}] = [\vect{a} + \vect{b}]
%\]
%and, for a real number $k$,
%\[
%k[\vect{a}] = [k\vect{a}].
%\]
%
%.... To be continued ...
%
%\subsection{Cohomology}
%Suppose that
%\[
%0 \to C_0 \stackrel{d_1}{\to} C_1 \stackrel{d_2}{\to} C_2 \to 0
%\]
%is a cochain complex. We define the $i$th cohomology group to be the quotient vector space $\frac{\ker d_{i+1}}{\im d_i}$.
%
%If the cochain complex comes from an open set $X \subset \R^2$ or $X \subset \R^3$ then we write $H^i(X)$ for the $i$th cohomology group. It is a vector space associated to the set $X$. It turns out that the topology of $X$ tells us something about the dimension of $H^i(X)$ (for each $i$) and the dimension of $H^i(X)$ tells us something about the topology of $X$.
%
%... To be continued ...




\end{document}
