% vim: tw=50
% 17/11/2022 11AM

\begin{remark*}
    This is what tells us connected components
    exist.
\end{remark*}

\noindent
Another concept of connectedness:

\begin{flashcard}[PathConnectedTop]
\begin{definition*}
    A \emph{path} from $x$ to $y$ in a topological
    space $X$ is \cloze{a continuous function $\varphi :
    [0, 1] \to X$ with $\varphi(0) = x$,
    $\varphi(1) = y$.} \\
    $X$ is \emph{path-connected}
    if \cloze{for all $x, y \in X$ there is a path from
    $x$ to $y$.}
\end{definition*}
\end{flashcard}

\begin{proposition}
    A path-connected space $X$ is connected.
\end{proposition}

\begin{proof}
    Suppose $U, V$ disconnect $X$. Pick $a \in U$,
    $b \in V$. Let $\varphi$ be a path in $X$ from
    $a$ to $b$. Then $U, V$ disconnect
    $\varphi([0, 1])$.
\end{proof}

\myskip
However, the converse is not true in general.

\begin{example*}
    Consider
    \begin{center}
        \includegraphics[width=0.6\linewidth]
        {images/d103e7a269d411ed.png}
    \end{center}
    Let $A = \{(0, y) \mid -1 \le y \le 1\}$ and
    $B = \{(x, \sin \frac{1}{x} \mid 0 < x \le
    1\}$. Let $X = a \cup B \subset \RR^2$. \\
    $X$ connected: Clearly $A$, $B$ path-connected
    hence connected. Suppose $U, V$ disconnect $X$
    in $\RR^2$. Then WLOG $A \subset U$, $B
    \subset V$. So $(0, 0) \in A \subset U$. $U$
    open so have some $\delta > 0$ such that
    $B_\delta((0,0)) \subset U$. Pick $n$ such
    that $\frac{1}{2n\pi} < \delta$. Then $\left(
    \frac{1}{2n\pi}, 0\right) \in U \cap B$,
    contradiction. \\
    $X$ not path-connected: Suppose $\varphi$ is a
    path from $(0,0)$ to $(1, \sin 1)$ in $X$. Let
    $\sigma = \sup \{t \in [0, 1] \mid \varphi_1(t)
    = 0\}$. Let $y = \varphi_2(\sigma)$. Then, as
    $\varphi$ continuous,
    \[ \varphi(\sigma) = (0, y) \]
    Choose $\delta > 0$ such that $|\sigma - t| <
    \delta$ implies $\|\varphi(\sigma) -
    \varphi(t)\| < 1$. WLOG $\delta < 1 -
    \sigma$. By definition of $\sigma$, $\varphi_1
    \left( \sigma + \frac{\delta}{2} \right) = x >
    0$. Choose $w \in (0, x)$ such that $\left|
    \sin \frac{1}{w} - y \right| \ge 1$. Then by
    IVT, there is some $t \in \left( \sigma,
    \sigma + \frac{\delta}{2} \right)$ such that
    $\varphi_1(t) = w$. Then $|\sigma - t| <
    \delta$, but
    \[ \|\varphi(\sigma) - \varphi(t)\| \ge
    |\varphi_2(\sigma) - \varphi_2(t)| = \left|
    \sin \frac{1}{w} - y \right| \ge 1 \]
    contradiction.
\end{example*}

\noindent
BUT:
\begin{proposition}
    An open, connected subset of Euclidean space
    is path-connected.
\end{proposition}

\begin{proof}
    Let $X \subset \RR^n$ be open and connected.
    If $X = \emptyset$ then done. So assume $X
    \neq \emptyset$. Fix $a \in X$. Let
    \[ U = \{x \in X \mid \exists \text{ path in
    $X$ from $a$ to $x$}\} \]
    \begin{itemize}
        \item $U \neq \emptyset$ since $a \in U$
            (constant path from $a$ to $a$)
        \item $U$ open in $X$. Suppose $b \in U$.
            $X$ open so can pick $\delta > 0$ such
            that $B_\delta(b) \subset X$. Let
            $\varphi$ be a path from $a$ to $b$ in
            $X$ and let $x \in B_\delta(b)$. Then
            $\theta$ is a path in $X$ from $a$ to
            $x$ where
            \[ \theta(t) = \begin{cases}
                \varphi(2t) & 0 \le t \le \half \\
                b + 2\left( t - \half \right) (x -
                b) & \half \le t \le 1
            \end{cases} \]
        \item $U$ closed in $X$, i.e. $X
            \setminus U$ open in $X$. Let $b \in
            X \setminus U$. Choose $\delta > 0$
            such that $B_\delta(b) \subset X$.
            Suppose $x \in B_\delta(b) \cap U$.
            Let $\varphi$ be a path in $X$ from
            $a$ to $x$. Then
            \[ t \mapsto \begin{cases}
                \varphi(2t) & 0 \le t \le \half \\
                x + 2\left( t - \half \right) (b -
                x) & \half \le t \le 1
            \end{cases} \]
            is a path from $a$ to $b$ in $X$. So
            $B_\delta(b) \subset X \setminus U$.
    \end{itemize}
    Hence, as $X$ is connected, $U = X$. But the
    point $a$ was arbitrary. So $X$ is
    path-connected.
\end{proof}

\begin{remark*}
    Recall that don't always specify the topology
    when defining a topological space - should
    always assume it's standard one. In
    particular:
    \begin{itemize}
        \item $\RR$ comes with the usual topology.
        \item $\RR^n$ comes with the Euclidean
            topology.
    \end{itemize}
    $X \subset \RR, \RR^n$ comes with the subspace
    topology from the above. Products, quotients
    come with the product / quotient topology
    respectively.
\end{remark*}

\newpage
\mychapter{Differentiation}

\renewcommand*{\theHsection}{ch2.\the\value{section}}
\setcounter{section}{1}

\setcounter{customtheorem}{0}
\setcounter{customlemma}{0}
\setcounter{customproposition}{0}

Recall: $f : \RR \to \RR$ is \emph{differentiable}
at $a \in \RR$ with \emph{derivative} $A$ if
\[ \frac{f(a + h) - f(a)}{h} \to A \]
as $h \to 0$. We write $f'(a) = A$. \\
Want to generalise to $f : \RR^n \to \RR^m$. \\
Easy:
$n = 1$. Exactly same definition works. \\
Problem: if $n \ge 2$, dividing by $b \in \RR^n$
makes no sense.

\begin{definition*}
    If $f : \RR^n \to \RR^m$, the \emph{$i$-th
    partial derivative} of $f$ at $a \in \RR^n$ is
    \[ D_i f(a) = \lim_{h \to 0} \frac{f(a + he_i)
    - f(a)}{h} \]
    where this limit exists, where $e_1, \dots,
    e_n$ is standard basis of $\RR^n$.
\end{definition*}

\begin{example*}
    $f : \RR^2 \to \RR$.
    \begin{center}
        \includegraphics[width=0.6\linewidth]
        {images/558923e669d711ed.png}
    \end{center}
    \[ f(x, y) = \begin{cases}
        0 & x = 0 \text{ or } y = 0 \\
        1 & x \neq 0 \text{ and } y \neq 0
    \end{cases} \]
    Both partial derivatives exist at $(0, 0)$:
    \[ D_1 f(0,0) = 0 \qquad D_2 f(0,0) = 0 \]
    But $f$ not continuous at $(0,0)$.
\end{example*}

\noindent
Better definition? Return to $f : \RR \to \RR$:
\begin{align*}
    f'(a) = A
    &\iff \frac{f(a + h) - f(a)}{h} \to A \text{
    as $h \to 0$} \\
    &\iff \frac{f(a + h) - f(a)}{h} = A + \eps(h)
    \text{ where $\eps(h) \to 0$ as $h \to 0$} \\
    &\iff f(a + h) = f(a) + A h + \eps(h) h \text{
    where $\eps(h) \to 0$ as $h \to 0$}
\end{align*}
\begin{center}
    \includegraphics[width=0.6\linewidth]
    {images/b81819f469d711ed.png}
\end{center}
`small changes in $a$ produce approximately linear
changes in $f(a)$'

\begin{flashcard}[RnDifferentiation]
\begin{definition*}
    Let $f : \RR^n \to \RR^m$, and $a \in \RR^n$.
    We say $f$ is \emph{differentiable} at $a$
    \cloze{if
    there is a linear map $\alpha \in
    \mathcal{L}(\RR^n, \RR^m)$ with
    \[ f(at + h) = f(a) + \alpha(h) + \eps(h)
    \|h\| \tag{$*$} \]
    where $\eps(h) \to 0$ as $h \to 0$.}
\end{definition*}
\end{flashcard}

\begin{proposition}
    Suppose $f : \RR^n \to \RR^m$, $a \in
    \RR^n$, $\alpha, \beta \in \mathcal{L}(\RR^n,
    \RR^m)$ and
    \[ f(a + h) = f(a) + \alpha(h) + \eps(h) \|h\| \]
    \[ f(a + h) = f(a) + \beta(h) + \eta(h) \|h\| \]
    with $\eps(h), \eta(h) \to 0$ as $h \to 0$.
    Then $\alpha = \beta$.
\end{proposition}

\begin{definition*}
    Once we've proved Proposition 1, we know the
    $\alpha$ in ($*$) is unique. We say $\alpha$ is
    the \emph{derivative} of $f$ at $a$, and write
    $D f |_a = \alpha$. So if $f$ differentiable
    at $a$,
    \[ f(a + h) = f(a) + D f|_a(h) + \eps(h)\|h\| \]
    where $\eps(h) \to 0$ as $h \to 0$.
\end{definition*}

\begin{remark*}
    If $f : \RR \to \RR^m$,
    \[ D f|_a (h) = f'(a)h \]
\end{remark*}
