\documentclass[notes=show,10pt]{beamer}
\usepackage{mathpazo}			%% Beamer stuff
\usepackage{amsmath}			%% AMS math packages
\usepackage{amsfonts}			%%	-	special fonts
\usepackage{amssymb}			%%	-	special symbols
\usepackage{graphicx}			%% graphics
\usepackage{tcolorbox}			%% color boxes

\usepackage{hyperref}			%% for web links
\hypersetup{
%    bookmarks=true,         		% show bookmarks bar?
    unicode=false,          		% non-Latin characters in Acrobat’s bookmarks
    pdftoolbar=true,        		% show Acrobat’s toolbar?
    pdfmenubar=true,        	% show Acrobat’s menu?
    pdffitwindow=false,     		% window fit to page when opened
    pdfstartview={FitH},    		% fits the width of the page to the window
    pdfnewwindow=true,      	% links in new PDF window
    colorlinks=true,       			% false: boxed links; true: colored links
    linkcolor=blue,          		% color of internal links (change box color with linkbordercolor)
    citecolor=PineGreen,    		% color of links to bibliography
    filecolor=magenta,      		% color of file links
    urlcolor=cyan           		% color of external links
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%		TiKZ Ploting Stuff
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{tikz}				%% TikZ -graphics

\usetikzlibrary{arrows, positioning, calc, intersections}
\usetikzlibrary{decorations.pathreplacing, decorations.markings}

\usepackage{pgfplots}			%% fancy plotting

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%	For 3d plotting, using the tikz-3dplot package so
%	that (x,y,z) coordinates are specified in normal order
%	and one can change the perspective for 3-d plots
%
%	To invoke, use
%
%	\begin{tikzpicture}[tdplot_main_coords,{other options}]
%		...
%	\end{tikzpicture}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{tikz-3dplot}		%% Enhanced 3d plotting

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%		Package forest to draw tree diagrams for chain rule
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{forest}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%	adjustbox package to force minipage alignment
%
%	Two-column structure is
%
%	\adjustbox{valign=t}
%		{
%			\begin{minipage}{0.45\textwidth}
%			...
%			\end{minipage}
%		}
%	\adjustbox{valign=t}
%		{
%		
%			\begin{minipage}{0.45\textwidth}
%			...
%			\end{minipage}
%		}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{adjustbox}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%		Set Beamer theme
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usetheme{Dresden}
\usecolortheme{dolphin}

%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%		Hack to remove subsection bar from our
%		friends at Tex.StackExchange.Com
%
%%%%%%%%%%%%%%%%%%%%%%%%%%
\makeatletter
\beamer@theme@subsectionfalse

\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%%
%		
%		Hack to make the nice little circles appear
%		from Tex.stackexchange.com
%
%		Reference: 
%
%		https://tex.stackexchange.com/questions/2072/beamer-navigation-circles-without-subsections
%
%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{remreset}
\makeatletter
\@removefromreset{subsection}{section}
\makeatother
\setcounter{subsection}{1}

%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%		Get rid of triangles, put in circles for 
%		itemize items
%
%%%%%%%%%%%%%%%%%%%%%%%%%%
\setbeamertemplate{items}[circle]

%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%		Clean up fonts
%
%%%%%%%%%%%%%%%%%%%%%%%%%%

\usefonttheme{professionalfonts}
\usefonttheme{serif}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%		tikz plotting options
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\pgfplotsset{my style/.append style={axis x line=middle, axis y line=
           middle, xlabel={}, ylabel={}, axis equal }}
           
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%		Math Operators
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\DeclareMathOperator{\comp}{comp}
\DeclareMathOperator{\proj}{proj}
\DeclareMathOperator{\Hess}{Hess}

\DeclareMathOperator{\curl}{curl}
\DeclareMathOperator{\diver}{div}
\DeclareMathOperator{\grad}{grad}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%	Document begins here...
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
           
\begin{document}

\input{213-Lecture-Macros}		%% 	macros, settings, et.c


\title{Math 213 - Semester Review - II}			%%	title page
\author{Peter A. Perry}
\institute{University of Kentucky}
\date{December 11, 2019}
\maketitle

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%	
%	Due Date Reminders
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Reminders}

\begin{itemize}


\item	Homework D5 (16.9, the Divergence Theorem) is due tonight

\medskip

\item	There will be a drop-in review session for the final exam on Wednesday, December 18, 3:30-5:30 PM, CB 106. 

\medskip

\item	Your final exam is Thursday, December 19 at 6:00 PM. Room assignments are the same as for Exams I - III

\item	On your final exam:

		\begin{itemize}
		\item	The multiple choice questions will be 50\% from Units I - III and 50\% from unit IV. 
		
		\smallskip
		
		\item All free response questions will be from unit IV. Since these questions typically involve
				integrals, they will also test material from unit III
		\end{itemize}

\end{itemize}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%	Unit Outline
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}
\frametitle{Unit IV: Vector Calculus}
\begin{center}
\begin{itemize}
\item[{}]			Fundamental Theorem for Line Integrals
\item[{}]			Green's Theorem
\item[{}]			Curl and Divergence
\item[{}]			Parametric Surfaces and their Areas
\item[{}]			Surface Integrals
\item[{}]			Stokes' Theorem, I
\item[{}]			Stokes' Theorem, II 

\item[{}]			The Divergence Theorem
\item[{}]		
\item[{}]			Review, I
\begingroup
\color{red}	
\item[{}]			Review, II
\endgroup
\item[{}]			Review, III
\end{itemize}
\end{center}
\end{frame}

\section{Learning Goals}

\begin{frame}
\frametitle{Goals of the Day}
Last time we talked about integrals -- this time we'll talk about derivatives. We'll recall the gradient, the Hessian, the second derivative test, and the Jacobian.

\medskip

We won't discuss, but you should be sure to review:

\medskip
\begin{itemize}
\item	Vector algebra, including dot products, cross product, and scalar triple product
\item	Equations of lines and planes
\item	Space curves and their tangents
\item	Chain rule and implicit differentiation
\end{itemize}
\end{frame}

\section{Leftovers}

\begin{frame}
\frametitle{Green's Theorem}
\footnotesize

If $\bfF(x,y) = P(x,y) \ii + Q(x,y) \jj$ and $C$ bounds $R$ with counterclockwise orientation,  then
	$$ \oint_C \bfF \cdot \, d\bfr = \iint_R \left(\frac{\dee Q}{\dee x} - \frac{\dee P}{\dee y} \right) \, dA$$

\vfill
Remember that $\bfF \cdot \, d\bfr = P(x,y) \, dx + Q(x,y) \, dy$
	
\vfill
Use Green's Theorem to evaluate 
$$ \oint_C x^2 y \, dx - xy^2 \, dy $$
if $C$ is the circle $x^2+y^2=4$ with counterclockwise orientation.
	
	
\end{frame}

\begin{frame}
\frametitle{Stokes' Theorem}
\footnotesize
If $C$ bounds $S$ (watch orientation!), then
$$\oint_C \bfF \cdot \, d\bfr = \iint_S \, {\mathrm{curl}} \, \bfF \cdot d\bfS$$

\vfill

Use Stokes' Theorem to evaluate $\iint_S \, {\mathrm{curl} \,} \bfF \cdot \, d \bfS$
if
$$ \bfF(x,y,z) = x^2 yz \ii + yz^2 \jj + z^3 e^{xy} \kk $$
and 
$S$ is the part of the sphere $x^2 + y^2 + z^2 = 5$ above the plane $z=1$, oriented upwards
\end{frame}

\begin{frame}
\frametitle{The Divergence Theorem}
\footnotesize
If $S$ bounds $E$, a simple solid, oriented with outward normal, and $\bfF$ is a vector field with continuous partial derivatives in a neighborhood of $E$,
$$ \iint_S \bfF \cdot \, d \bfS = \iiint_E {\mathrm{div}} \, \bfF \, dV $$

\vfill

\adjustbox{valign=t}
{
	\begin{minipage}{0.45\textwidth}
		Use the divergence theorem to find the flux of
		$$ \bfF(x,y,z) = z \ii + y \jj + zx \kk $$
		across the surface of the tetrahedron bounded by the coordinate planes and 
		the plane
		$$ \frac{x}{a} + \frac{y}{b} + \frac{z}{c} = 1 $$
		where $a$, $b$, and $c$ are positive numbers.
	\end{minipage}
}
\quad
\adjustbox{valign=t}
{
	\begin{minipage}{0.45\textwidth}
		\tdplotsetmaincoords{60}{130}
		\begin{tikzpicture}[scale=0.7,tdplot_main_coords]
			%%
			%%	Coordinate axes
			%%
			\draw[thick,->,>=stealth]	(0,0,0)	--	(4,0,0) 	
					node[anchor=north east] 	{\footnotesize{$x$}};
			\draw[thick,->,>=stealth]	(0,0,0)	--	(0,4,0) 	
					node[anchor=north west]		{\footnotesize{$y$}};
			\draw[thick,->,>=stealth]	(0,0,0)	--	(0,0,4)	
					node[anchor=south]			{\footnotesize{$z$}};
			%%
			%%	Intersection of solid with $xz$ plane
			%%
			\draw[thick,red,fill=red!60,opacity=0.5]
				(2,0,0)	--	(0,0,0)	--	(0,0,2)	--	cycle;
			%%
			%%	Intersection of solide with $yz$ plane
			%%
			\draw[thick,red=fill=red!80,opacity=0.5]
				(0,0,0)	--	(0,3,0)	--	(0,0,2)	--	cycle;
			%%
			%%	Intersection of solid with $xy$ plane
			%%
			\draw[thick,red,fill=red!50]
				(0,0,0)	--	(2,0,0)	--	(0,3,0)	--	cycle;
			%%
			%%	Surface of the tetrahedron
			%%
			\draw[thick,red,fill=red!50,opacity=0.5]
					(2,0,0)	--	(0,3,0)	--	(0,0,2)	--	cycle;
			%%
			%%	Label intersections with x, y, and z-axes
			%%
			\node at (2,-0.75,0)				{\tiny{$(a,0,0)$}};
			\node at (-0.75,3,0)				{\tiny{$(0,b,0)$}};
			\node at (-0.5,0.5,2.25)		{\tiny{$(0,0,c)$}};
		\end{tikzpicture}
	\end{minipage}
}

\end{frame}


\section{Derivatives}

\begin{frame}
\frametitle{Derivatives}
\begin{minipage}{0.4\textwidth}
\begin{tikzpicture}[scale=0.6]
\begin{axis}[
	title={$f(x)=x^2+y^2$},
	xlabel=$x$,
	ylabel=$y$,
	small,
	colormap/cool
]
\addplot3[
	surf,
	domain=-2:2,
	domain y = -2:2,
]
	{x^2+y^2};
\end{axis}
\end{tikzpicture}

\medskip

\only<3>
{
\begin{tikzpicture}[scale=0.5]
{
\drawxy{3}
\foreach	\r	in	{0.25,0.49,0.81,1.21,1.69}
{
	\draw[red]	plot[domain=0:360,smooth]		({\r*cos(\x)},{\r*sin(\x)});
}
}
\end{tikzpicture}
}
\only<4>
{
\begin{tikzpicture}[scale=0.4]
\begin{axis}
	[
		title={$\nabla f$},
		domain=-2:2,
		view={0}{90},
		axis background/.style={fill=white}
	]	
        \addplot3[blue,
            quiver={
             u={2*x},
             v={2*y},
             scale arrows=0.1,
            },
            -stealth,samples=15]
                {0};
\end{axis}
\end{tikzpicture}
}
\end{minipage}
\quad
\begin{minipage}{0.5\textwidth}
\scriptsize
Calculus III is about functions of \emph{two} (or more) variables

\begin{itemize}
\uncover<2->
{
\item	The \emph{graph} of a function $$z=f(x,y)$$ is a \emph{surface} in $xyz$ space
		with points $(x,y,f(x,y))$
}
\uncover<3->
{
\item	You can also visualize a function of two variables through its \emph{contour plot}
}
\uncover<4->
{
\item	The \emph{derivative} of a function of two variables is the \emph{gradient vector}
		$$ (\nabla f)(x,y) = 
				\left\langle 
						\frac{\dee f}{\dee x}(x,y), 
						\frac{\dee f}{\dee y}(x,y) 
				\right\rangle 
		$$
}
\end{itemize}


\bigskip
\end{minipage}

\end{frame}

\begin{frame}
\frametitle{The Derivative is the Gradient}

\footnotesize
The gradient vector $(\nabla f)(a,b)$:

\medskip

\begin{itemize}
\item	Has magnitude equal to the maximum rate of change of $f$ at $(a,b)$
\item	Points in the direction of greatest change of $f$ at $(a,b)$
\item	Is the zero vector at critical points of $f$
\end{itemize}

\vfill

\begin{center}
\only<1>
{
\begin{tikzpicture}[scale=0.6]
\begin{axis}
	[
		title={$f(x) = x e^{-x^2-y^2}$},
		domain=-2:2,
		axis background/.style={fill=white},
		colormap/cool
	]	
		\addplot3[surf,
			domain=-2:2,samples=30,z buffer=sort]
			{x*exp(-x^2-y^2)};
\end{axis}
\end{tikzpicture}
\qquad
\begin{tikzpicture}[scale=0.6]
\begin{axis}
	[
		title={$\nabla f$},
		domain=-2:2,
		view={0}{90},
		axis background/.style={fill=white}
	]	
        \addplot3[blue,
            quiver={
             u={exp(0-x^2-y^2)*(1-2*x^2)},
             v={exp(0-x^2-y^2)*(-2*x*y)},
             scale arrows=0.3,
            },
            -stealth,samples=15]
                {0};
\end{axis}
\end{tikzpicture}
}
\only<2>
{
\begin{tikzpicture}[scale=0.6]
\begin{axis}
	[
		title={$f(x) = x^2 e^{-x^2-y^2}$},
		domain=-2:2,
		axis background/.style={fill=white},
		colormap/cool
	]	
		\addplot3[surf,
			domain=-2:2,samples=30,z buffer=sort]
			{x*x*exp(-x^2-y^2)};
\end{axis}
\end{tikzpicture}
\qquad
\begin{tikzpicture}[scale=0.6]
\begin{axis}
	[
		title={$\nabla f$},
		domain=-2:2,
		view={0}{90},
		axis background/.style={fill=white}
	]	
        \addplot3[blue,
            quiver={
             u={exp(0-x^2-y^2)*(-2*x)*(x+1)*(x-1)},
             v={exp(0-x^2-y^2)*(-2*x*x*y)},
             scale arrows=0.5,
            },
            -stealth,samples=15]
                {0};
\end{axis}
\end{tikzpicture}
}
\end{center}
\end{frame}

\begin{frame}
\frametitle{The Derivative is the Gradient}
\begin{minipage}{0.4\textwidth}
\begin{center}
\begin{tikzpicture}[scale=0.7]
\drawxyz{3}
\draw[blue,shading=ball,opacity=0.5]
	plot[domain=2:0]	
		({0},{sqrt(4-\x*\x)},{\x})
	--	plot[domain=0:2,variable=\y]
		({\y},{sqrt(4-\y*\y)},{0})
	--	plot[domain=90:0,variable=\theta]
		({2*sin(\theta)},{0},{2*cos(\theta)});
\uncover<2->
{
	\draw[red,fill=red]	(1,1.414,1)		circle(0.05cm);
	\draw[red,thick,fill=red!50,opacity=0.5]
		(0.5,1.414,1.5)	--
		(1.5,0.707,1.5)	--
		(1.5,1.414,0.5)	--
		(0.5,2.121,0.5);
}
\end{tikzpicture}
\scriptsize
$$
f(x,y) 	= \sqrt{4-x^2-y^2} 
$$
\uncover<2->
{
\begin{multline*}
L(x,y)	=	\sqrt{2}\\
	-\frac{1}{\sqrt{2}}(x-1)
	- \frac{1}{\sqrt{2}}(y-1) 
\end{multline*}
}
\end{center}
\end{minipage}
\quad
\begin{minipage}{0.5\textwidth}
\scriptsize
The gradient vector also gives us a \emph{linear approximation} to the function $f$ near $(x,y)=(a,b)$:

\uncover<2->
{
\begin{multline*}
L(x,y) = f(a,b) + \\
\frac{\dee f}{\dee x}(a,b) (x-a) + \frac{\dee f}{\dee y}(a,b) (y-b) 
\end{multline*}
}

\medskip

\uncover<3->
{
It may help to think of this formula as 
$$ L(x,y) = f(a,b) + \left( \nabla f \right)(a,b) \cdot \langle x-a, y-b \rangle $$
to compare with
$$ L(x) = f(a) + f'(a) (x-a) $$
}
\end{minipage}

\end{frame}

\begin{frame}
\frametitle{The Second Derivative is a Matrix}
\begin{minipage}{0.4\textwidth}
\only<1>
{
\begin{tikzpicture}[scale=0.45]
\begin{axis}
	[
		title={$f(x) = x e^{-x^2-y^2}$},
		domain=-2:2,
		axis background/.style={fill=white},
		colormap/cool
	]	
		\addplot3[surf,
			domain=-2:2,samples=30,z buffer=sort]
			{x*exp(-x^2-y^2)};
\end{axis}
\end{tikzpicture}
}
\only<2>
{
\begin{tikzpicture}[scale=0.45]
\begin{axis}
	[
		title={$f(x) = x^2 e^{-x^2-y^2}$},
		domain=-2:2,
		axis background/.style={fill=white},
		colormap/cool
	]	
		\addplot3[surf,
			domain=-2:2,samples=30,z buffer=sort]
			{x*x*exp(-x^2-y^2)};
\end{axis}
\end{tikzpicture}
}
\end{minipage}
\begin{minipage}{0.5\textwidth}
\scriptsize
If the first derivative is a vector, the second derivative is a \emph{matrix}!
$$
(\Hess f) (a,b)=
\begin{pmatrix}
\dfrac{\dee^2 f}{\dee x^2}(a,b)			&		\dfrac{\dee^2 f}{\dee x \dee y}(a,b)	\\[15pt]
\dfrac{\dee^2 f}{\dee y \dee x}(a,b)	&		\dfrac{\dee^2 f}{\dee y^2}(a,b)
\end{pmatrix}
$$

\vfill

The determinant of the Hessian at a critical point is:
			\begin{itemize}
			\item	Positive at  a local extremum
			\item	Negative at  a saddle
			\end{itemize}
	
\vfill
			
The second derivative $\dfrac{\dee^2 f}{\dee x^2}(a,b)$ is 
			\begin{itemize}
			\item	Positive at  a \emph{local minimum} of $f$
			\item	Negative at a \emph{local maximum} of $f$
			\end{itemize}

\end{minipage}

\end{frame}


\begin{frame}
\frametitle{Maxima and Minima in Calculus I and III}
\scriptsize
Second Derivative Test - Functions of One Variable

\begin{center}

\begin{minipage}{0.3\textwidth}
\begin{tikzpicture}[scale=0.4]
\draw[thick,->,>=stealth]	(-2.5,0)	--	(2.5,0);
\draw[thick,->,>=stealth]	(0,-0.5)	--	(0,2.5);
\draw[thick,red]	plot[domain=-2:2]	({\x},{0.5*\x*\x});
\end{tikzpicture}

\medskip

\begin{center}
\tiny
$f(x)=x^2$, $f''(0)>0$
\end{center}
\end{minipage}
\quad
\begin{minipage}{0.3\textwidth}
\begin{tikzpicture}[scale=0.4]
\draw[thick,->,>=stealth]	(-2.5,0)	--	(2.5,0);
\draw[thick,->,>=stealth]	(0,-2.5)	--	(0,0.5);
\draw[thick,red]	plot[domain=-2:2]	({\x},{-0.5*\x*\x});
\end{tikzpicture}

\medskip

\begin{center}
\tiny
$f(x)=-x^3$, $f''(0)<0$
\end{center}
\end{minipage}
\quad
\begin{minipage}{0.25\textwidth}
\begin{tikzpicture}[scale=0.4]
\draw[thick,->,>=stealth]	(-2.5,0)	--	(2.5,0);
\draw[thick,->,>=stealth]	(0,-1.5)	--	(0,1.5);
\draw[thick,red]	plot[domain=-2:2]	({\x},{(3/16)*\x*\x*\x});
\end{tikzpicture}

\medskip

\begin{center}
\tiny
$f(x)=x^3$, $f''(0)=0$
\end{center}
\end{minipage}


\end{center}



\vfill

Second Derivative Test - Functions of Two Variables

\begin{center}

\begin{minipage}{0.3\textwidth}
\begin{tikzpicture}[scale=0.4]
\begin{axis}[
	title={$x^2+y^2$ },
	xlabel=$x$,
	ylabel=$y$,
	small,
	colormap/cool
]
\addplot3[
	surf,
	domain=-2:2,
	domain y = -2:2,
]
	{x^2+y^2};
\end{axis}
\end{tikzpicture}

\medskip

\begin{center}
\tiny
$f(x,y)=x^2+y^2$, $D=4$, $f_{xx}(0)=2$
\end{center}
\end{minipage}
\quad
\begin{minipage}{0.3\textwidth}
\begin{tikzpicture}[scale=0.4]
\begin{axis}[
	title={$-(x^2+y^2)$ },
	xlabel=$x$,
	ylabel=$y$,
	small,
	colormap/cool
]
\addplot3[
	surf,
	domain=-2:2,
	domain y = -2:2,
]
	{-(x^2+y^2)};
\end{axis}
\end{tikzpicture}

\medskip

\begin{center}
\tiny
$f(x,y)=-(x^2+y^2)$, $D=4$, $f_{xx}(0)=-2$
\end{center}
\end{minipage}
\quad
\begin{minipage}{0.3\textwidth}
\begin{tikzpicture}[scale=0.4]
\begin{axis}[
	title={$x^2-y^2$ },
	xlabel=$x$,
	ylabel=$y$,
	small,
	colormap/cool
]
\addplot3[
	surf,
	domain=-2:2,
	domain y = -2:2,
]
	{x^2-y^2};
\end{axis}
\end{tikzpicture}
\medskip

\begin{center}
\tiny
$f(x,y)=x^2-y^2$, $D=-4$
\end{center}
\end{minipage}


\end{center}


\end{frame}

\begin{frame}
\frametitle{Optimization - Critical Points and Boundary Points}

\scriptsize
To find the absolute maximum and minimum of a function $f(x,y)$ on a domain $D$:

\smallskip

\begin{itemize}
\uncover<2->
{
\item	Find the \emph{interior critical points} of $f$
}
\uncover<3->
{
\item	Test $f$ at the interior critical points
}
\uncover<4->
{
\item	Use one-variable optimization to find the maximum and minimum
		of $f$ on each component of the boundary
}
\uncover<5->
{
\item	The largest value of $f$ in this list is its absolute maximum, and
		the smallest value of $f$ in this list is its absolute minimum
}
\end{itemize}

\smallskip
\hrulefill
\medskip

\tiny
\textbf{Example}: Optimize the function $ f(x,y)= x^2-y^2 $ on the domain 
$$ D= \{ (x,y): x^2+y^2 \leq 1 \}$$

\begin{center}
\begin{minipage}{0.3\textwidth}
\begin{tikzpicture}[scale=0.5]
\draw[thick,->,>=stealth]	(-2,0)		--	(2,0);
\draw[thick,->,>=stealth]	(0,-2)		--	(0,2);
\node[right]	at	(2,0)	{\tiny{$x$}};
\node[above]	at	(0,2)	{\tiny{$y$}};
\only<1-3>
{
\draw[red,fill=red!40,opacity=0.5]
	(0,0)	circle(1);
}
\node at		(0.3,0.3)	{\tiny{$D$}};
%%
\uncover<2->
{
\draw[green,fill=green!50]	(0,0)	circle(0.05cm);
}
\uncover<4->
{
\draw[thick,red]	(0,0)	circle(1);			%% highlight the boundary
\draw[blue,fill=blue!50]		(0,1)	circle(0.075cm);
\draw[blue,fill=blue!50]		(0,-1)	circle(0.075cm);
\draw[red,fill=red!50]			(1,0)	circle(0.075cm);
\draw[red,fill=red!50]			(-1,0)	circle(0.075cm);
}
\draw[white] (0,-3) -- (0,-2.5);	%% crude hack to align figures!!!
\end{tikzpicture}
\end{minipage}
\quad
\begin{minipage}{0.3\textwidth}
\begin{tikzpicture}[scale=0.4]
\begin{axis}
[
	xlabel={$x$},
	ylabel={$y$}, 
	title={ }, 
	view={45}{60},
	domain=-2:2,
	colormap/cool
]
\addplot3[surf]{x^2-y^2};
\addplot3+[no markers,
				samples=50,
				samples y=0,
				variable=\t,
				very thick,
				dashed,
				domain=0:6.28318] 
	({cos(\t r)},{sin(\t r)},{(cos(\t r))^2-(sin(\t r))^2});
\only<2-5>
{
	\addplot3+[only marks,
					mark=*,
					mark options={scale=2, fill=green},
					text mark as node=true
					] 
	coordinates{ ((0,0,0) };
}
\only<4-5>
%% mark maxima and minima
{
	\addplot3+[only marks,
					mark=*,
					mark options={scale=2, fill=red},
					text mark as node=true
					] 
		coordinates{ (1,0,1) (-1,0,1) };
	\addplot3+[only marks,
					mark=*,
					mark options={scale=2, fill=blue},
					text mark as node=true] 
		coordinates{ (0,1,-1) (0,-1,-1) };
}
\end{axis}
\end{tikzpicture}
\end{minipage}
\quad
\begin{minipage}{0.3\textwidth}
\tiny
\only<2-5>
{
	$\nabla f(x,y) = \langle 2x,-2y \rangle $
}

\medskip

\only<3-5>
{
$f(0,0)=0$
}

\medskip

\only<4-5>
{

	Parameterize circle:
	
	\smallskip
	
	$x(t)=\cos(t), \, y(t)=\sin(t)$
	
	$g(t) = \cos^2 t - \sin^2 t$
	
	$g'(t) = -4\cos(t) \sin(t) $
}

\medskip

\only<5>
{
$g(0)=g(\pi) = 1$

$g(\pi/2) = g(3\pi/2) = -1$
}


\end{minipage}

\end{center}

\end{frame}

\begin{frame}
\frametitle{Gradients, Level Lines, Level Surfaces}
\footnotesize
The gradient of $f(x,y)$ is perpendicular to \emph{level lines}

\medskip
The gradient of $f(x,y,z)$ is perpendicular to \emph{level surfaces}

\bigskip
Find the equation of the tangent plane to the surface
$$ x^2 + 4y^2 + z^2 = 17 $$
at the point $(2,1,3)$. 

\medskip
Idea: This surface is a level surface of the function
$$ f(x,y,z) =x^2 + 4y^2 +z^2 $$


\end{frame}

\begin{frame}
\frametitle{Transformations and Their Jacobians}
\footnotesize
The map $T(u,v) = (x(u,v),y(u,v)$ defines a \emph{transformation} from the $uv$ plane to the $xy$ plane

\medskip
Its ``derivative'' is the Jacobian
$$ 
	\frac{\dee (x,y)}{\dee (u,v)} = \begin{vmatrix}
					\frac{\dee x}{\dee u}	&	\frac{\dee x}{\dee v}	\\[7pt]
					\frac{\dee y}{\dee u}	&	\frac{\dee y}{\dee v}
				\end{vmatrix}
$$
The Jacobian enters in the \emph{change of variables formula}
$$
\iint_R f(x,y) \, dx \, dy = \iint_S f(x(u,v),y(u,v)) \left| \frac{\dee(x,y)}{\dee(u,v)} \right| \, du \, dv 
$$
if the transformation $T$ maps $S$ to $R$.

\bigskip
Find the Jacobian of the transformation
$$ x(u,v) = u^2-v^2, \quad y(u,v) = 2uv $$

\end{frame} 

\section{Potentials}

\begin{frame}
\frametitle{Potentials}
\footnotesize
Remember the Fundamental Theorem for Line Integrals:  If $\bfF = \nabla f$, and
$C$ is parameterized by $\bfr(t)$, $a \leq t \leq b$, then
$$ \int_C \bfF \cdot \, d\bfr = f(\bfr(b)) - f(\bfr(a)). $$

When is $\bfF$ a gradient vector field?  In general, if $\curl \bfF = 0$, then $\bfF = \nabla f$ 
for some potential $f$

\bigskip

FInd the potential for the vector field
$$ \bfF (x,y,z) = \sin y \ii + (x \cos y + \cos z) \jj - y \sin z \kk $$


\end{frame}





\end{document}

