\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 - Curl and Divergence}			%%	title page
\author{Peter A. Perry}
\institute{University of Kentucky}
\date{November 20, 2019}
\maketitle

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

\begin{frame}
\frametitle{Reminders}

\begin{itemize}

\item	Quiz \#9 on 16.1-16.2 (vector fields, line integrals) takes place tomorrow
\item	Homework D1 is due on Friday of this week
\item Thanksgiving is coming!

\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
\begingroup
\color{red}
\item[{}]			Curl and Divergence
\endgroup
\item[{}]			Parametric Surfaces and their Areas
\item[{}]			Surface Integrals
\item[{}]			Stokes' Theorem, I
\item[{}]			Stokes' Theorem, II 
\item[{}]			The Divergence Theorem
\item[{}]			
\item[{}]			Review
\item[{}]			Review
\item[{}]			Review
\end{itemize}
\end{center}
\end{frame}


\section{Learning Goals}

\begin{frame}
\frametitle{Goals of the Day}
This lecture is about two very important `derivatives' of a vector field. You'll learn:

\bigskip

\begin{itemize}
\item	How to compute the \emph{curl} of a vector field and what it measures
\item How to compute the \emph{divergence} of a vector field and what it measures
\item	(Sneak preview) The theorems that give the meaning of divergence and curl
\end{itemize}
\end{frame}

\section{Curl}

\begin{frame}
\frametitle{Curl}
\footnotesize
If $F = P \ii + Q \jj + R \kk$ is a vector field on $\R^3$, and the partial derivatives of $P$, $Q$, and $R$ all exist, then the \emph{curl} of $\bfF$ is a new vector field:

\medskip

\begin{center}
\fcolorbox{cyan}{white}
{
	\begin{minipage}{0.8\textwidth}
	$$ \curl \bfF = 
		\left( \frac{\dee R}{\dee y} - \frac{\dee Q}{\dee z} \right) \ii +
		\left( \frac{\dee P}{\dee z} - \frac{\dee R}{\dee x} \right) \jj +
		\left( \frac{\dee Q}{\dee x} - \frac{\dee P}{\dee y} \right) \kk
	$$
	\end{minipage}
}
\end{center}

\bigskip

This new vector field measures the ``rotation'' of the vector field $\bfF$ at a given point $(x,y,z)$:

\begin{itemize}
\item		Its \emph{direction} is the axis of rotation, dictated by the right-hand rule
\item		Its \emph{magnitude} is the angular speed of rotation
\end{itemize}

\end{frame}

\begin{frame}
\frametitle{Curl}
\footnotesize
$$ \curl \bfF = 
		\left( \frac{\dee R}{\dee y} - \frac{\dee Q}{\dee z} \right) \ii +
		\left( \frac{\dee P}{\dee z} - \frac{\dee R}{\dee x} \right) \jj +
		\left( \frac{\dee Q}{\dee x} - \frac{\dee P}{\dee y} \right) \kk
	$$

\bigskip

The new vector field $\curl \bfF$ is sometimes written $\nabla \times \bfF$ because of an easier-to-remember formula:
$$
\curl \bfF = \nabla \times \bfF =
\begin{vmatrix}
\ii							&	\jj							&	\kk	\\[5pt]
\dfrac{\dee}{\dee x}	&	\dfrac{\dee}{\dee y}	&	\dfrac{\dee}{\dee z}	\\[10pt]
P							&	Q							&	R
\end{vmatrix}
$$
\end{frame}

\begin{frame}
\frametitle{Curl}
\begin{minipage}{0.4\textwidth}
\begin{tikzpicture}[scale=0.5]
\begin{axis}
[
	domain=-1:1,
	xmin=-1,
	xmax=1,
	ymin=-1,
	ymax=1,
	zmin=-1,
	zmax=1,
	title={$\bfF(x,y,z) = x \ii + y \jj + z \kk$}
]
\foreach \z in {-1,-0.5,0,0.5,1}
{
	\addplot3[
		blue,
		quiver=
		{
			u={x},
			v={y},
			w={z},
			scale arrows=0.25,
		},
		-stealth, samples=5]
	(x,y,{\z});
}
\end{axis}
\end{tikzpicture}

\bigskip

\begin{tikzpicture}[scale=0.5]
\begin{axis}
[
	domain=-1:1,
	xmin=-1,
	xmax=1,
	ymin=-1,
	ymax=1,
	zmin=-1,
	zmax=1,
	title={$\bfF(x,y,z) = y \ii - x \jj + 0 \kk$}
]
\foreach \z in {-1,-0.5,0,0.5,1}
{
	\addplot3[
		blue,
		quiver=
		{
			u={y},
			v={-x},
			w={0},
			scale arrows=0.25,
		},
		-stealth, samples=5]
	(x,y,{\z});
}
\end{axis}
\end{tikzpicture}

\end{minipage}
\quad
\begin{minipage}{0.5\textwidth}
\footnotesize
If $\bfF = x \ii + y \jj + z \kk$ then
$$ \nabla \times \bfF = 
	\begin{vmatrix}
	\ii							&	\jj							&	\kk	\\[5pt]
	\dfrac{\dee}{\dee x}	&	\dfrac{\dee}{\dee y}	&	\dfrac{\dee}{\dee z}	\\[10pt]
	x							&	y							&	z
	\end{vmatrix}
= \mathbf{0}
$$

\bigskip

If $\bfF = y \ii - x \jj + 0 \kk$ then
$$ \nabla \times \bfF = 
	\begin{vmatrix}
	\ii							&	\jj							&	\kk	\\[5pt]
	\dfrac{\dee}{\dee x}	&	\dfrac{\dee}{\dee y}	&	\dfrac{\dee}{\dee z}	\\[10pt]
	y							&	-x							&	0
	\end{vmatrix}
= -2 \kk 
$$
\end{minipage}
\end{frame}

\begin{frame}
\frametitle{Curl}
\footnotesize
A gradient vector field has \emph{zero curl}:
\begin{align*}
\nabla \times (\nabla f)	&=	
	\begin{vmatrix}
		\ii									&	\jj								&	\kk						\\[5pt]
		\dfrac{\dee}{\dee x}			&	\dfrac{\dee}{\dee y}		&	\dfrac{\dee}{\dee z}	\\[10pt]
		\dfrac{\dee f}{\dee x}		&	\dfrac{\dee f}{\dee y}	&	\dfrac{\dee f }{\dee z}
	\end{vmatrix}	\\[5pt]
	&= 			
		\left( \frac{\dee^2 f}{\dee x \dee y} - \frac{\dee^2 f}{\dee y \dee x} \right) \ii
	 + 	\left( \frac{\dee^2 f}{\dee y \dee z} - \frac{\dee^2 f}{\dee z \dee y} \right) \jj
	 +	\left( \frac{\dee^2 f}{\dee z \dee x} - \frac{\dee^2 f}{\dee x \dee z} \right) \kk \\[5pt]
	&= \mathbf{0}
\end{align*}
so the curl ``detects'' conservative vector fields.
\end{frame}

\section{Divergence}

\begin{frame}
\frametitle{Divergence}
\footnotesize
The \emph{divergence} of a vector field $\bfF = P \ii + Q \jj + R \kk$ is a \emph{scalar} function:

\begin{center}
\fcolorbox{cyan}{white}
{
	\begin{minipage}{0.8\textwidth}
	$$ \diver \bfF = 
		\frac{\dee P}{\dee x} + \frac{\dee Q}{\dee y} + \frac{\dee R}{\dee z}
	$$
	\end{minipage}
}
\end{center}

\medskip
Sometimes $\diver \bfF$ is written $\nabla \cdot \bfF$:
$$ \nabla \cdot \bfF = \left\langle \frac{\dee}{\dee x}, \frac{\dee}{\dee y}, \frac{\dee}{\dee z} \right\rangle
	\cdot 	\left\langle P, Q, R \right\rangle =
	\frac{\dee P}{\dee x} + \frac{\dee Q}{\dee y} + \frac{\dee R}{\dee z}
$$

\bigskip

The divergence computes the outflow per unit volume of the vector field (thought of as a velocity field)


\end{frame}

\begin{frame}
\frametitle{Divergence}
\begin{minipage}{0.4\textwidth}
\begin{tikzpicture}[scale=0.5]
\begin{axis}
[
	domain=-1:1,
	xmin=-1,
	xmax=1,
	ymin=-1,
	ymax=1,
	zmin=-1,
	zmax=1,
	title={$\bfF(x,y,z) = x \ii + y \jj + z \kk$}
]
\foreach \z in {-1,-0.5,0,0.5,1}
{
	\addplot3[
		blue,
		quiver=
		{
			u={x},
			v={y},
			w={z},
			scale arrows=0.25,
		},
		-stealth, samples=5]
	(x,y,{\z});
}
\end{axis}
\end{tikzpicture}

\bigskip

\begin{tikzpicture}[scale=0.5]
\begin{axis}
[
	domain=-1:1,
	xmin=-1,
	xmax=1,
	ymin=-1,
	ymax=1,
	zmin=-1,
	zmax=1,
	title={$\bfF(x,y,z) = y \ii - x \jj + 0 \kk$}
]
\foreach \z in {-1,-0.5,0,0.5,1}
{
	\addplot3[
		blue,
		quiver=
		{
			u={y},
			v={-x},
			w={0},
			scale arrows=0.25,
		},
		-stealth, samples=5]
	(x,y,{\z});
}
\end{axis}
\end{tikzpicture}
\end{minipage}
\quad
\begin{minipage}{0.5\textwidth}
\footnotesize
If $\bfF = x \ii + y \jj + z \kk$ then
$$ \nabla \cdot \bfF = \frac{\dee x}{\dee x}+ \frac{\dee y}{\dee y} + \frac{\dee z}{\dee z} = 3
$$
(same outflow at each point of space)

\bigskip

\bigskip


If $\bfF = y \ii - x \jj + 0 \kk$ then
$$ \nabla \cdot \bfF = 
	\frac{\dee y}{\dee x} - \frac{\dee x}{\dee y} + 0 = 0
$$
(no outflow anywhere in space)
\end{minipage}
\end{frame}

\begin{frame}
\frametitle{Divergence}
\footnotesize
Remember that $\nabla \times (\nabla f) = 0$? There is an analogous result for the divergence:
$$ \diver \curl \bfF = 0 $$

\bigskip

You can see this using the definitions of divergence and curl:

\begin{align*}
\diver \curl \bfF	&=	
							\frac{\dee}{\dee x} 
								\left( {\color{blue} \frac{\dee R}{\dee y}} - {\color{violet} \frac{\dee Q}{\dee z}} \right) +
							\frac{\dee}{\dee y} 
								\left( {\color{red} \frac{\dee P}{\dee z}} - {\color{blue} \frac{\dee R}{\dee x}} \right) +
							\frac{\dee}{\dee z} 
								\left( {\color{violet} \frac{\dee Q}{\dee x}} - {\color{red} \frac{\dee P}{\dee y}} \right)\\
\end{align*}
The second partial derivatives cancel in pairs by Clairaut's theorem.

\bigskip
It turns out that \emph{any vector field} $\bfF$ can be written as
$$ \bfF = \nabla f + \nabla \times \bfA $$
for a \emph{scalar potential} $f$ and a \emph{vector potential} $\bfA$.

\end{frame}

\begin{frame}
\frametitle{Divergence and Curl}
\footnotesize
If $f$ is a scalar function and $\bfF$ is a vector function, 
which of these expressions make sense?  Do they define a scalar or a vector? Remember that
\begin{itemize}
\item	$\curl \bfF$ is a vector
\item	$\diver \bfF$ is a scalar
\end{itemize}

\bigskip

{\renewcommand{\arraystretch}{1.5}
\begin{tabular}{lllll}
(a)	&	$\curl f$					&&	(b)	&	 $\grad f$	\\
(c)		&	$\diver \bfF$			&&	(d)	&	$\curl (\grad f)$	\\
(e)	&	$\grad \bfF$			&&	(f)		&	$\grad (\diver \bfF)$ 	\\
(g)	&	$\diver (\grad f)$		&&	(h)	&	$\grad( \diver f)$		\\
(i)		&	$\curl (\curl \bfF)$	&&	(j)		&	$\diver (\diver f)$
\end{tabular}
}
\end{frame}

\begin{frame}
\frametitle{Conservative Vector Fields Again}
\footnotesize
Determine whether the vector field 
$$ \bfF(x,y,z) = y^2 z^3 \ii + 2xyz^3 \jj + 3xy^2 z^2 \kk $$
is conservative and, if so, find a function $f$ so that $\nabla f = \bfF$. 
\end{frame}

\begin{frame}
\frametitle{Vector Identities}
\footnotesize
Show that $\diver(f\bfF) = \nabla f \cdot \bfF + f \diver \bfF$ where $\bfF = \langle P,Q, R \rangle$
\uncover<2->
{
{\color{cyan}
\begin{align*}
\diver(f \bfF) 	&=	 \frac{\dee}{\dee x} (f P) + \frac{\dee}{\dee y} (f Q) + \frac{\dee}{\dee z}(f R)\\
					&=	\frac{\dee f}{\dee x} P + \frac{\dee f}{\dee y} Q + \frac{\dee f}{\dee z} R 	
						+ f \left(  \frac{\dee P}{\dee x} + \frac{\dee Q}{\dee y} + \frac{\dee R}{\dee z}\right)\\
					&=	\grad f \cdot \bfF + f \diver \bfF
\end{align*}
}
}
What is the right `product rule' for $\curl (f \bfF)$?
\uncover<3->
{
{
	\color{cyan}
	$$ \curl (f \bfF) = \grad f \times \bfF + f \curl (\bfF) $$
}
}

What is $\diver \grad f$?
\uncover<4->
{
	{
	\color{cyan}
	\begin{align*}
	\diver \grad f 	&= 	\diver 
										\left\langle 
											\frac{\dee f}{\dee x}, \frac{\dee f}{\dee y},  \frac{\dee f }{\dee z} 
										\right\rangle\\
						&=	\frac{\dee}{\dee x} \frac{\dee f}{\dee x} +
								\frac{\dee}{\dee y} \frac{\dee f}{\dee y} +
								\frac{\dee}{\dee z} \frac{\dee f}{\dee z} \\
						&=	\frac{\dee^2 f}{\dee x^2} + \frac{\dee^2 f}{\dee y^2} + \frac{\dee^2 f}{\dee z^2}
	\end{align*}
	}
	
}


\end{frame}

\section{The Big Three}

\begin{frame}
\frametitle{Divergence Theorem, Stokes' Theorem}
\footnotesize
\fcolorbox{cyan}{white}
{
\begin{minipage}{0.85\textwidth}
{\color{cyan} \textbf{Divergence Theorem}} \hspace{5pt} Suppose $E$ is a simple solid region and $S$ is its boundary. Let $\bfN$ be the outward normal to $S$. Then
$$ \iint_S \bfF \cdot \bfN \, dS = \iiint_E \diver \bfF \, dV $$
\end{minipage}
}

\bigskip

\fcolorbox{cyan}{white}
{
\begin{minipage}{0.85\textwidth}
{\color{cyan} \textbf{Stokes' Theorem}} \hspace{5pt} Suppose $S$ is an oriented piecewise-smooth surface with outward normal $\bfN$, bounded by a simple closed curve $C$ with piecewise smooth boundary. Then
$$ \int_C \bfF \cdot d\bfr = \iint_S \curl \bfF \cdot \bfN \, dS $$
\end{minipage}
}
\end{frame}

\begin{frame}
\frametitle{The `Big Three' Theorems of Vector Calculus}
\footnotesize
\begin{align*}
{\color{gray} F(b) - F(a)}
&
{\color{gray}=  \int_a^b F'(x) \, dx		 } & {\color{gray} \text{(Fundamental)}}\\
\\
\int_C P \, dx + Q \, dy 
	&=	\iint_D \left(\frac{\dee Q}{\dee x} - \frac{\dee P}{\dee y} \right) \, dA	&	\text{(Green)}\\
	\\
\int_C \bfF \cdot \, d\bfr	&=	\iint_S \curl \bfF \cdot \bfN \, dS	&	\text{(Stokes)}	\\
\\
\iint_S \bfF \cdot \bfN \, dS	&=	\iiint_E \diver \bfF \, dV	&
\text{(Divergence)}
\end{align*}
\end{frame}




\end{document}