%! TEX root = TA.tex
% vim: tw=50
% 18/01/2024 12AM

% No lecture on Saturday 10th February.

\section{Metric spaces}

\subsection{Revision}

\begin{definition*}[Metric space]
  A \emph{metric space} is a pair $(X, d)$, where
  $X$ is a set, and $d : X^2 \to \RR$ is a
  function satisfying:
  \begin{itemize}
    \item $d(x, y) \ge 0$
    \item $d(x, y) = 0 \iff x = y$
    \item $d(x, y) = d(y, x)$
    \item $d(x, y) + d(y, z) \ge d(x, z)$
  \end{itemize}
\end{definition*}

\begin{example*}
  \phantom{}
  \begin{enumerate}[(i)]
    \item $\RR^n$ with the metric
      \[ d(x, y) = \|\bf{x} - \bf{y}\| =
      \left( \sum_{j = 1}^n (x_j - y_j)^2
      \right)^{\half} \]
    \item $\CC$ with the metric
      \[ d(z, w) = |z - w| \]
  \end{enumerate}
\end{example*}

\begin{notation*}
  We write $x_n \dto x$ if and only if $d(x_n, x)
  \to 0$ as $n \to \infty$.
\end{notation*}

\begin{notation*}
  Open ball $B(x, y) = \{y : d(x, y) < r\}$ (an
  open set).
\end{notation*}

\begin{definition*}[Closed and Open]
  A set $E \subseteq X$ is closed if for all
  convergent sequences $x_n \dto x$, with $x_n \in
  E$, we have $x \in E$. $U \subseteq X$ is open
  if whenever $x \in U$ there exists $\delta > 0$
  such that $B(x, \delta) \subseteq U$.
\end{definition*}

\begin{proposition*}
  If $U$ is open then $U^c$ is closed.
\end{proposition*}

\begin{proof}
  Suppose $x \in U$, then there exists $\delta >
  0$ such that $B(x, \delta) \subseteq U$, so
  $d(x_n, x) \ge \delta$ whenever $x_n \in U^c$ so
  $x_n \not\dto x$.
\end{proof}

\begin{proposition*}
  If $E$ is closed then $E^c$ is open.
\end{proposition*}

\begin{proof}
  Suppose $y \in E^c$. Then there does not exist
  $y_n \in E$ such that $y_n \dto y$, so there
  exists $\delta$ such that $B(y, \delta)
  \subseteq E^c$.
\end{proof}

\begin{definition*}[Cauchy sequence]
  Working in $(X, d)$, we say $(x_n)$ is
  \emph{Cauchy} if
  \[ \forall \eps > 0 ~\exists N ~\forall m, n \ge N
  ~~d(x_n, x_m) \]
  (sometimes just say $d(x_n, x_m) \to 0$ as $n, m
  \to \infty$).
\end{definition*}

\begin{proposition*}
  Any convergent sequence is Cauchy.
\end{proposition*}

\begin{proof}
  If $x_n \dto x$ then
  \[ \forall \eps > 0 ~\exists N ~\forall n \ge N
  ~~d(x_n, x) < \frac{\eps}{2} \]
  and so
  \[ \forall \eps > 0 ~\exists N ~\forall m, n \ge N
  ~~d(x_n, x_m) < \eps \qedhere \]
\end{proof}

If every Cauchy sequence converges we say $(X, d)$
is complete.

The following remearks are useful.

\begin{proposition*}
  If a subsequence of a Cauchy sequence converges,
  then the sequence converges.
\end{proposition*}

\begin{proof}
  Suppose $(x_n)$ is Cauchy, $x_{n(j)} \to x$,
  with $n(j) \to \infty$. Let $\eps > 0$ and
  choose $N$ such that $d(x_n, x_m) <
  \frac{\eps}{2}$ for all $n, m \ge N$. Choose
  $n(J) \ge N$ such that $d(x_{n(J)}, x) <
  \frac{\eps}{2}$.
  then if $yn \ge N$
  \[ d(x_n, x) \le d(x_n, x_{n(J)}) + d(x_{n(J)},
  x) < \frac{\eps}{2} + \frac{\eps}{2} \qedhere \]
\end{proof}

\begin{proposition*}
  To show $(X, d)$ complete, we need only show
  that for some $\eps(n) \to 0$, $d(y_n, y_{n +
  1}) < \eps(n) \implies \text{$y_n$ converges}$.
\end{proposition*}

\begin{proof}
  If $(x_n)$ is Cauchy, we can find $n(j)$ such
  that $d(x_{n(j)}, x_{n(j + 1)}) < \eps_j$.
\end{proof}

\begin{remark*}
  If $(X, d)$ is a metric space and $Y \subseteq
  X$ then writing
  \[ d_Y(y_1, y_2) = d(y_1, y_2)
  ~\forall y_1, y_2 \in Y \]
  we have $(Y, d_y)$ a
  metric space.
\end{remark*}

\begin{lemma*}
  If $E$ is closed in $(X, d)$ and $(X, d)$ is
  complete then $(Y, d_Y)$ is complete.
\end{lemma*}

\begin{proof}
  If $(y_n)$ is Cauchy in $(Y, d_Y)$ then $(y_n)$
  is Cauchy in $X$, so $y_n \dto x$. But $E$ is
  closed, so $x \in E$, so $x \in Y$, so $y_n
  \stackrel{d_Y}{\to} x$.
\end{proof}

\begin{proposition*}
  If $(Y, d_Y)$ is complete then $Y$ is closed in
  $X$.
\end{proposition*}

\begin{proof}
  If $y_n \dto x$, $y_n \in Y$ then $(y_n)$ is
  Cauchy for $d$ and so for $d_Y$, so $y_n
  \stackrel{d_Y}{\to} y$, $y \in Y$, so $y_n \dto
  y \in Y$ so by uniqueness of limits, $x = y \in
  Y$.
\end{proof}

From \courseref[IA Numbers and Sets]{NS}, we know
that $\RR$ is complete.

\begin{theorem*}
  $\RR^n$ (with usual Euclidean meteric) is
  complete.
\end{theorem*}

\begin{proof}
  $\|\bf{x}(m) - \bf{x}(n)\| \ge |x_j(m) -
  x_j(n)|$, so $(\bf{x}(n))$ Cauchy implies
  $x_j(n)$ Cauchy, so $x_j(n) \to x_j$ for some
  $x_j$, so
  \[ \sum_{j = 1}^n (x_{j(n)} - x_j)^2 \to 0 ,\]
  so $\bf{x}_j \to \bf{x}$.
\end{proof}

\begin{theorem*}[Bolzano Weierstrass (in $\RR$)]
  Let $[a, b]$ be a closed interval. If $x_n \in
  [a, b]$, then there exists a sequence $n(j) \to
  \infty$ and $x \in [a, b]$ such that $x_{n(j)}
  \to x$.
\end{theorem*}

\vspace{-1em}
This theorem has an easy extension to $\RR^m$.

\begin{theorem*}[Bolzano Weierstrass (in $\RR^m$)]
  \label{BW}
  If $\bf{x}(k) \in \prod_{j = 1}^m [a_j, b_j]$, then
  $\bf{x}(k)$ has a convergent subsequence.
\end{theorem*}

\begin{proof}
  Proof by induction. True for $m = 1$ (see
  \courseref[IA Numbers and Sets]{NS}). Suppose
  true for $m$. Then if $\bf{x}(k) \in \prod_{j =
  1}^{m + 1} [a_j, b_j]$, we write
  \[ \bf{x}(k) = (\bf{y}(k), z_k) \]
  with $\bf{y}(k) \in \prod_{i = 1}^m [a_j, b_j]$,
  $z_k \in [a_{m + 1}, b_{m + 1}]$. By inductive
  hypothesis, there exists $k(r) \to \infty$ such
  that $\bf{y}(k(r)) \to \bf{y} \in \prod_{j =
  1}^m [a_j, b_j]$. By Bolzano Weierstrass in
  $\RR$, there exists $r(s) \to \infty$ such that
  $z_{k(r(s))} \to z$. Then
  \[ \bf{x}(k(r(s))) \to (\bf{y}, z) . \qedhere \]
\end{proof}

\begin{theorem*}[Bolzano Weierstrass (for closed
  and bounded sets)]
  If $E \subseteq \RR^n$ is closed and bounded,
  then if $\bf{e}_n \in E$ is a sequence in $E$,
  then there exists a sequence $n(k) \to \infty$
  such that $\bf{e}_{n(k)} \to \bf{e} \in E$. Only
  true if $E$ is closed and bounded.
\end{theorem*}

\begin{proof}
  Choose $R$ such that $[-R, R]^n \supseteq E$
  (possible since $E$ is bounded). Then if
  $\bf{e}_r \in E$, $\bf{e}_r \in [-R, R]^n$ so
  there exists $r(j) \to \infty$ and $\bf{e}$ such
  that $\bf{e}_{r(j)} \to \bf{e}$. But $E$ is
  closed so $\bf{e} \in E$.
\end{proof}

This is false if $E$ is not closed. Pick $x, x_n$,
$x_n \in E$ with $x_n \to x$, $x \notin E$. Then
any subsequence of $x_n$ also converges to $x$. If
$E$ is not bounded pick $|x_n| \ge n$ with $x_n
\in E$. This sequence has no convergent
subsequence.
