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

\newpage
\section{Integral Theorems}

\subsection{The Divergence Theorem}

(Also known as Gauss' theorem).

\begin{theorem*}[Gauss' Theorem]
    Given a smooth vector field $\bf{F}(\bf{x})$
    over $\RR^3$
    \[ \int_V \nabla \cdot \bf{F} \dd V = \int_S
    \bf{F} \cdot \bf{\dd S} \]
    with $S = \partial V$ and $\bf{\dd S} = \dd S
    \bf{n}$ is pointing outwards.
    \begin{center}
        \includegraphics[width=0.6\linewidth]
        {images/d302ad72927511ec.png}
    \end{center}
\end{theorem*}

\begin{note*}
    The divergence theorem gives intuition for the
    meaning of $\nabla \cdot \bf{F}$.
\end{note*}

\noindent
In a suitably small volume, over which $\nabla
\cdot \bf{F} \approx \text{constant}$,
\[ \int_V \nabla \cdot \bf{F} \dd V = V \nabla
\cdot \bf{F} (\bf{x}) \]
\[ \implies \nabla \cdot \bf{F} = \lim_{V \to 0}
\frac{1}{V} \int_{\partial V} \bf{F} \cdot \bf{\dd
S} \]
\[ \implies \text{divergence } = \text{ net flow
into/out of region $V$} \]
\[ \nabla \cdot \bf{F} > 0 \implies \text{ net
flow out} \]
\[ \nabla \cdot \bf{F} < 0 \implies \text{ net
flow int} \]
For example, MAxwell's equations tell us
\[ \nabla \cdot \bf{B} = 0 \implies \text{magnetic
field lines are continuous} \]
\[ \nabla \cdot \bf{E} = \frac{\rho}{\eps_0}
\implies \text{electric field lines are continuous
when electric charge density $\rho(\bf{x}) = 0$} \]
But when $\rho(\bf{x}) \neq 0$, the electric field
can begin and end.
\begin{center}
    \includegraphics[width=0.6\linewidth]
    {images/6a2cc07a927611ec.png}
\end{center}
\begin{example*}
    Let $V = \text{ solid hemisphere}$.
    \[ x^2 + y^2 + z^2 \le R^2 \]
    and $z \ge 0$.
    \[ \partial V = S_1 + S_2 \]
    \begin{center}
        \includegraphics[width=0.6\linewidth]
        {images/e5780442927611ec.png}
    \end{center}
    We'll integrate $\bf{F} = (0, 0, z + R)$
    \[ \implies \nabla \cdot \bf{F} = 1 \]
    \[ \implies \int_V \nabla \cdot \bf{F} \dd V =
    \int_V \dd V = \frac{2}{3} \pi R^3 \]
    On $S^1$:
    \[ \bf{n} = \frac{1}{R} (x, y, z) \]
    \[ \implies \bf{F} \cdot \bf{n} = \frac{z(z +
    R)}{R} = R\cos\theta (\cos\theta + 1) \]
    (where $z = R\cos\theta$)
    \[ \implies \int_{S_1} \bf{F} \cdot \bf{\dd S}
    = \int_0^{2\pi} \dd \phi \int_0^{\pi/2} \dd
    \theta (R^2 \sin\theta) \times R\cos\theta
    (\cos\theta + 1) = \frac{5}{3} \pi R^3 \]
    On $S_2$,
    \[ \bf{n} = (0, 0, -1) \]
    \[ \implies \bf{F} \cdot \bf{n} = -R \]
    on $S_2$
    \[ \implies \int_{S_2} \bf{F} \cdot \bf{\dd S}
    = (-R) \times \pi R^2 = -\pi R^3 \]
    \[ \implies \int_{S_1 + S_2} \bf{F} \cdot
    \bf{\dd S} = \frac{2}{3} \pi R^3 \]
\end{example*}

\begin{proof}[ of Divergence Theorem]
    First, a simple proof. Divide $V$ into cubes
    \begin{center}
        \includegraphics[width=0.6\linewidth]
        {images/9ebf7a16927711ec.png}
    \end{center}
    Flow of $\bf{F}$ through the $(y, z)$ plane is
    roughly
    \[ [F_x(x + \delta x, y, z) - F_x(x, y, z)]
    \delta y \delta z \approx \pfrac{F_x}{x}
    \delta x \delta y \delta z \]
    Do the same for the other sides
    \[ \implies \int_S \bf{F} \cdot \bf{\dd S} =
    \int_V \nabla \cdot \bf{F} \bf{\dd V} \]
\end{proof}

\myskip
A concern: can we approximate the boundary with
cubes? For example in 2d:
\begin{center}
    \includegraphics[width=0.6\linewidth]
    {images/e9404f52927711ec.png}
\end{center}

\begin{proof}[ (better proof)]
    First note that
    \[ \int_V \nabla \cdot \bf{F} \dd V =
    \int_\partial V \bf{F} \cdot \bf{\dd S} \]
    holds in and $\RR^n$. We start by proving the
    following:
    \begin{lemma*}
        2d divergence theorem:
        \[ \int_D \nabla \cdot \bf{F} \dd A =
        \int_C \bf{F} \cdot \bf{n} \bf{\dd S} \]
        with $C = \partial D$.
        \begin{center}
            \includegraphics[width=0.6\linewidth]
            {images/59c2158a927811ec.png}
        \end{center}
    \end{lemma*}
    \begin{proof}[ of lemma]
        \[ \int_D \nabla \cdot \bf{F} \dd A =
        \int_X \dd x \int_{y_-(x)}^{y_+(x)} \dd
        y \pfrac{F}{y} \]
        \begin{center}
            \includegraphics[width=0.6\linewidth]
            {images/a32eac88927811ec.png}
        \end{center}
        For now assume $D$ is convex so that the
        $\int \dd y$ is over a single interval,
        rather than
        \begin{center}
            \includegraphics[width=0.6\linewidth]
            {images/c756fb32998611ec.png}
        \end{center}
        Then
        \[ \int_D \nabla \cdot \bf{F} \dd A =
        \int_X \dd x (F(x, y_+(x)) - F(x, y_-(x))) \]
        Next we change $\int \dd x$ to $\int\ dd
        s$, where $s = \text{ arc length}$. Zoom
        in to the top curve $C_+$
        \begin{center}
            \includegraphics[width=0.6\linewidth]
            {images/08a5c974998711ec.png}
        \end{center}
        The normal makes an angle
        \[ \cos\theta = \hat{\bf{y}} \cdot \bf{n} \]
        and
        \[ \delta x = \cos\theta \delta s =
        \hat{\bf{y}} \cdot \bf{n} \delta s \]
        along $C_+$. Similarly, along $C_-$,
        \[ \delta x = \hat{\bf{y}} \cdot \bf{n}
        \delta s \]
        \begin{align*}
            \int_D \nabla \cdot \bf{F} \dd A
            &= \int_X \dd s \left( \bf{n} \cdot
            \bf{F} (x, y_+(x)) + \bf{n} \cdot
            \bf{F}(x, y_-(x))) \right) \\
            &= \int_{C_+} \bf{F} \cdot \bf{n} \dd
            s + \int_{C_-} \bf{F} \cdot \bf{n} \dd
            s \\
            &= \int_C \bf{F} \cdot \bf{n} \dd s
        \end{align*}
        with $C = C_+ + C_-$.
        Finally if $D$ is not convex, then just
        decompose $C$ into more pieces.
    \end{proof}
    Back to 3D theorem. \\
    We use the same strategy. Take $\bf{F} =
    F(\bf{x}) \hat{\bf{z}}$. Then
    \[ \int_V \nabla \cdot \bf{F} \dd V = \int_D
    \dd A \int_{z_-(x, y)}^{z_+(x, y)} \dd z
    \pfrac{F}{z} \]
    \begin{center}
        \includegraphics[width=0.6\linewidth]
        {images/b7cc85c8998711ec.png}
    \end{center}
    \[ \int_V \nabla \cdot \bf{F} \dd V = \int_D
    \dd A [F(x, y, z_+(c, y)) - F(x, y, z_-(x, y))] \]
    with limits $z_\pm$ the upper / lower surface
    of $V$. \\
    Now convert $\int \dd A$ into the surface
    integral over $S = \partial V$. This again
    includes an angle $\cos \theta = \pm \bf{n}
    \cdot \hat{\bf{z}}$ with $\bf{n}$ normal to
    $S$. This gives the result.
\end{proof}
