% vim: tw=50
% 11/02/2022 10AM

\begin{theorem*}[Gauss-Bonnet v2]
    Draw a geodesic triangle on a surface $S$.
    \begin{center}
        \includegraphics[width=0.6\linewidth]
        {images/7fbb27c28b7f11ec.png}
    \end{center}
    The sides are \emph{geodesics}, meaning curves
    with shortest arc length between two points.
    \[ \theta_1 + \theta_2 + \theta_3 = \phi +
    \int_\triangle \kappa \dd S .\]
\end{theorem*}

\newpage
\section{Grad, Div and Curl}

We will consider different ways to differentiate.

\subsection{The Gradient}

Consider a scalar field $\phi : \RR^n \to \RR$.
Then we define the \emph{gradient} by
\[ \phi(\bf{x} + \bf{h}) = \phi(\bf{x}) + \bf{h}
\cdot \nabla \phi + \theta(|\bf{h}|^2) \]
In cartesian coordinates $\bf{x} = (x^1, \dots,
x^n)$ with $\{\bf{e}_i\}$ the associated
orthonormal basis of $\RR^n$, we take
\[ \bf{h} = \eps \bf{e}_i \]
with $\eps \ll 1$ and this reduces to our earlier
definition
\[ \nabla \phi = \pfrac{\phi}{x^i} \bf{e}_i \]
This is what we use practice.

\begin{example*}
    Let $\phi : \RR^3 \to \RR$ with
    \[ \phi(\bf{x}) = -\frac{1}{r} \]
    with $r = \sqrt{x^2 + y^2 + z^2}$. Then
    \[ \pfrac{\phi}{x} = \frac{x}{(x^2 + y^2 +
    z^2)^{3/2}} = \frac{x}{r^3} \]
    and similarly for $\pfrac{\phi}{y}$ and
    $\pfrac{\phi}{z}$
    \[ \implies \nabla \phi = \frac{x \hat{\bf{x}}
    + y \hat{\bf{y}} + z \hat{\bf{z}}}{r^3} =
    \frac{\hat{\bf{r}}}{r^2} \]
    where $\hat{\bf{r}}$ is the unit vector
    pointing radially (also called $\bf{e}_r$).
\end{example*}

\subsubsection*{Application}

Let $\bf{x}(t) : \RR \to \RR^n$ define a curve in
$\RR^n$ and $\phi : \RR^n \to \RR$ be a scalar
field. Then
\[ \phi(\bf{x}(t)) : \RR \to \RR \]
is the value of $\phi$ along the curve. We can
differentiate $\phi$ along the curve using the
chain rule
\[ \dfrac{\phi}{t} = \pfrac{\phi}{x^i}
\dfrac{x^i}{t} = \nabla \phi \cdot
\dfrac{\bf{x}}{t} \]

\subsection{Div and Curl}

We define the \emph{gradient operator}
\[ \nabla = \bf{e}_i \pfrac{}{x^i} \]
This is both a vector and a differential operator.
These operators are waiting for some function to
come along to be differentiated. $\nabla$ is also
called \emph{nabla} or \emph{del}. \myskip
Originally we introduced $\nabla$ as acting on a
scalar $\phi : \RR \to \RR$. But we can also ask
how it might act on other fields. \myskip
Consider a vector field $\bf{F} : \RR^n \to
\RR^n$. The \emph{divergence} of $\bf{F}$ is a
scalar field, defined by
\begin{align*}
    \nabla \cdot \bf{F} = \left( \bf{e}_i
    \pfrac{}{x^i} \right) \cdot (\bf{e}_j F_j) \\
    &= (\bf{e}_i \cdot \bf{e}_j) \pfrac{F_j}{x^i}
    \\
    &= \pfrac{F_i}{x^i}
\end{align*}
but $\bf{e}_i \cdot \bf{e}_j = \delta_{ij}$. For
example in $\RR^3$
\[ \nabla \cdot \bf{F} = \pfrac{F_1}{x} +
\pfrac{F_2}{y} + \pfrac{F_3}{z} \]
with $\bf{F} = (F_1, F_2, F_3)$. \myskip
We'll later see that $\nabla \cdot \bf{F}$
measures the net flow of $\bf{F}$ into / out of a
point $\bf{x}$. \myskip
For vector fields $\bf{F} : \RR^3 \to \RR^3$, we
can also define the \emph{curl}
\begin{align*}
    \nabla \times \bf{F}
    &= \left( \bf{e}_i \pfrac{}{x^i} \right)
    \times (\bf{e}_j F_j) \\
    &= \eps_{ijk} \pfrac{F_j}{x^i} \bf{e}_k
\end{align*}
Equivalently
\[ \nabla \times \bf{F} =
\begin{pmatrix}
    \partial_2 F_3 - \partial_3 F_2 \\
    \partial_3 F_1 - \partial_1 F_3 \\
    \partial_1 F_2 - \partial_2 F_1
\end{pmatrix}
\]
where $\partial_i \equiv \pfrac{}{x^i}$.
Alternatively
\[ \nabla \times \bf{F} = \left|
\begin{matrix}
    \bf{e}_1 & \bf{e}_2 & \bf{e}_3 \\
    \partial_1 & \partial_2 & \partial_3 \\
    F_1 & F_2 & F_3
\end{matrix}
\right| \]
We'll later see that $\nabla \times \bf{F}$
measures the rotation of $\bf{F}$.

\subsubsection*{Examples in $\RR^3$}

\begin{enumerate}[(1)]
    \item Consider $\bf{F} = (x^2, 0, 0)$
        \begin{center}
            \includegraphics[width=0.6\linewidth]
            {images/eb5fd2648b8111ec.png}
        \end{center}
        \[ \implies \nabla \cdot \bf{F} = 2x
        \implies \text{more out than in at any
        point} \]
        \[ \nabla \times \bf{F} = \bf{0} \implies
        \text{no rotation} \]
    \item Consider $\bf{F} = (y, -x, 0)$
        \begin{center}
            \includegraphics[width=0.6\linewidth]
            {images/07eb9ef48b8211ec.png}
        \end{center}
        \[ \nabla \cdot \bf{F} = 0 \implies
        \text{no build up at any point} \]
        \[ \nabla \times \bf{F} = (0, 0, -z)
        \implies \text{rotation in $x-y$ plane} \]
    \item $\bf{F} = \frac{\hat{\bf{r}}}{r^2}$. You
        can check that $\nabla \cdot \bf{F} = 0$
        and $\nabla \times \bf{F} = \bf{0}$.
        Except there's a subtlety at $r = 0$ where
        $\bf{F}$ is singular. It turns out that
        \[ \nabla \times \bf{F} = \bf{0} \]
        \[ \nabla \cdot \bf{F} = 4\pi
        \delta^3(\bf{x}) \]
        Where
        \[ \delta^3(\bf{x}) =
        \delta(x)\delta(y)\delta(z) \]
        ($\delta$ is the Dirac delta function).
\end{enumerate}
