\chapter{Metric Spaces: Getting Some Distance}
\label{metricspaces}

%
%
% use this section as a bridge to manifolds!
%
%

As we mentioned early in this book, topology views the world flexibly---as if made of rubber---and asks: what features are preserved?  We developed the ideas of open sets and topologies to capture in a flexible way the idea of points in a space being ``close''.  And we did not need to refer to a notion of  ``distance'' to specify this closeness!  Using open sets, we have seen that we can formalize the ideas of convergence, connectedness, and continuity in a flexible way.

However, many of the spaces that we care about in this world do have a precise notion of distance attached to them.  Scientists measure how close two points are.  Astronomers talk about distance between stars.  Genealogists ask how many generations separate two individuals.  Biologists can say that two species are genetically close.  While distances like these arise naturally from context, a distance is sometimes chosen for convenience: a mathematician can use many different measures of closeness for two objects.   Topology can help us understand the relationships among various distance notions.

We will make precise this idea of a distance between points, and call it a \emph{metric}, and then ask how our topological developments relate to a metric, when it exists.  Spaces that have a metric are called \emph{metric spaces}.

\section{Metric Spaces}
Metric spaces arise by generalizing the notion of the distance between two points in the familiar Euclidean spaces $\R^n$.  The strategy is to look at that familiar idea of distance and cull from it central features, which then become the definition of a metric. 

\begin{dfn}
\index{metric}
A \textbf{metric} on a set $M$ is a function $d:M\times M \to \R_+$, where $\R_+$ is the non-negative real numbers, such that for all $a,b,c \in M$, each of these properties hold:
\begin{enumerate}
 \item $d(a,b) \geq 0$, with $d(a,b)=0$ if and only if $a=b$; 
 \item $d(a,b) = d(b,a)$;
 \item $d(a,c) \leq d(a,b) + d(b,c)$.
\end{enumerate}
The three properties are often summarized by saying that a metric is \textbf{positive definite}, \textbf{symmetric}, and 
satisfies the \textbf{triangle inequality}.
\index{positive definite}
\index{triangle inequality}

A \textbf{metric space} $(M,d)$ is a set $M$ with a metric $d$.
\end{dfn}


\begin{example}
The function $d(x,y)=|x-y|$ is a metric on $\R$.  This is the \textbf{standard metric} on $\R$.
\end{example}

This metric can be generalized to $\R^n$ in many different ways, as the following examples show.

\begin{exercise}
Verify that the following are metrics.
\begin{enumerate}
\item The \textbf{Euclidean metric} on $\R^n$ is defined by 
   $d({\bf x},{\bf y}) = \sqrt{ \sum_{i=1}^n (x_i-y_i)^2 }$.
\item The \textbf{box metric} on $\R^n$ is defined by 
  $d({\bf x},{\bf y}) = \max_i \{ |x_i-y_i| \}$.
\item The \textbf{taxi-cab metric} on $\R^n$ is defined by 
  $d({\bf x},{\bf y}) = \sum_i \{ |x_i-y_i| \}$.
\end{enumerate}
Show that when $n\geq 2$, these metrics are different.
\end{exercise}

\begin{example}
On any set M, we can define the \textbf{discrete metric}: $d(a,b)=1$ if $a \neq b$ and $d(a,a)=0$ for any $a,b \in M$.
This metric basically tells us whether two points are the same or different.
\end{example}

\begin{example}
Here's a strange metric on $\Q$: for reduced fractions, 
let $d(\frac{a}{b}, \frac{m}{n}) = \max(|a-m|, |b-n|)$.  Which rationals are ``close'' under this metric?
\end{example}

The idea of a metric space is powerful, because it applies to more than just subsets of $\R^{n}$.  
For instance, function spaces are sets in which every point is a function.  

\begin{exercise}
Let $X$ be a compact topological space.  Let $\mathcal{C}(X)$ denote the set of continuous functions $f:X\rightarrow \R$.  
We can endow $\mathcal{C}(X)$ with a metric:
$$d(f,g) = \sup_{x \in X}  | f(x)-g(x) |$$
and this distance is also sometimes denoted $\|f-g\|$.  Check that $d$ is a well-defined metric on $\mathcal{C}(X)$.
\end{exercise}

%\begin{exercise}
%Show that $\
%\end{exercise}

A space with a given metric has a natural topology induced by the metric.  The standard metric on $\R$ and the Euclidean metric on $\R^n$ give rise to the standard topologies on these spaces in the following way.

\begin{thm}    
Let $d$ be a metric on the set $X$. Then 
the collection of all open balls 
$$\mathcal{B} = \{ B(p,\epsilon)=\{ y\in X | d(p,y)<\epsilon \} \text{ for every $p\in X$ and every $\epsilon>0$} \}$$
forms a basis for a topology on X.  
\end{thm}

The topology generated by a metric $d$ on $X$ is called the \emph{$d$-metric topology\/} for $X$.

\begin{dfn}\index{metric space}
A topological space $(X, \cal T)$ is a \textbf{metric space} or is \textbf{metrizable} if and only if there is a metric $d$ on $X$ such that $\cal T$ is the $d$-metric topology. We sometimes write a metric space as $(X,d)$ to stand for $X$ with the $d$-metric topology.
\end{dfn}

We want to comment that previously we defined a metric space as a set with a metric, but any such space has a topology induced by the metric, so these two definitions are the same.  The former emphasizes a given metric, and the latter emphasizes the topology (for which the related metric may or may not be stated explicitly).  This book concerns topology, so in what follows, when you read '$X$ is a metric space', you should think of $X$ as a topological space induced by a metric.

Different metrics can generate the same topology.

\begin{exercise}
On $\R^n$, show that the Euclidean metric, box metric, and taxi-cab metric generate the same topology.  %Then show that this is the same as the product topology (induced by the absolute value metric on $\R$).
\end{exercise}

\begin{exercise}
Now find a metric on $\R^n$ that does {\em not} induce the same topology as the ones in the previous exercise do.  
\end{exercise}

Subspaces of a metric space are also metric spaces.

\begin{thm}
If $X$ is a metric space and $Y \subset X$, then $Y$ is a metric space.
\end{thm}

%\begin{dfn}
%A set $A$ in $(X,d)$ is {\em bounded} if there exists a real number $B$ such
%that $d(x,y)<B$ for every pair $x,y\in A$. 
%\end{dfn}

\begin{thm}
For any metric space $(X,d)$, there exists a metric $\bar d$ such that $d$ and $\bar d$ generate the same topology, and such that $d$ is a \textbf{bounded metric}: for each $x, y \in X$, $\bar d(x,y) < 1$.
\end{thm}
%$\bar d (x,y)=\min\{1,d(x,y)\}$ or $\bar d(x,y)= d(x,y)/(1+d(x.y))$

Thus every set is bounded under $\bar d$ even if not all sets are bounded under $d$.  So boundedness is not a topological property.

%\begin{example}
%The following aren't metric spaces:\\
%a) $\R$ with metric $d(x,y) = | xy | $\\
%b) $\N$ with metric 
%\[ d(a,b) = 
%\left\{
%\begin{array}{ll}
%\frac{|a-b|}{2}, & \mbox{if $a,b$ both odd}\\
%|a-b|, & \mbox{otherwise}
%\end{array} \right. . \] 
%\end{example}

Metric spaces have nice properties:

\begin{thm}
A metric space is Hausdorff, regular, and normal.
\end{thm}

%To prove normality of a metric space, it may help to consider the graphs of $y=1/x$ and $y=0$ in the plane, which are closed sets.

\begin{thm}
A metric space is a $1^{\textrm{st}}$ countable space.
\end{thm}

%\begin{thm}
%A separable metric space is 2nd countable.
%\end{thm}

The next theorem shows that in a metric space, many of the countability and covering properties we learned earlier are equivalent.  
%The Axiom of Choice will be needed for one of the implications.

\begin{thm}
\label{count.prop.metric}     
In a metric space $X$, the following are
equivalent:
\begin{enumerate}
\item $X$ is separable,
\item $X$ is $2^{\textrm{nd}}$ countable,
\item $X$ is Lindel\"of,
\item every uncountable set in $X$ has a limit point,
%\item $X$ has the Souslin property.
\end{enumerate}
\begin{hint}
How many points can be at least unit distance apart from each other?
\end{hint}
\end{thm}
One route to proving this theorem is to show (1) implies (2) implies (3) implies (4) implies (1).  The last implication will be the hardest.  After you prove the theorem, ask yourself which of the implications relies on $X$ being a metric space.

Theorem \ref{count.prop.metric} can be used to infer some spaces are not metrizable.  For example, there is no metric on the upper half plane that will generate the sticky bubble topology $\Hbub$, because $\Hbub$ is separable but not $2^{\textrm{nd}}$ countable (Exercise \ref{examples-2nd-countable-separable}).

\begin{exercise}
If you've read about the Souslin property in Section \ref{sec:souslin}, then a fifth property can be added to the above theorem: a metric space $X$ has the Souslin property if and only if it has one of the other properties mentioned in Theorem \ref{count.prop.metric}.
\end{exercise}
% proof:  Lindelof implies Souslin: If there is an uncountable collection of disjoint open sets then there's a cover with no countable subcover. Souslin implies 4, b/c if there is an uncountable set with no limit point, then there is an uncountable collection of disjoint open sets. 

In metric spaces, countable compactness and compactness are the same.

\begin{thm}
A metric space is compact if and only if it is countably compact.
\end{thm}

The next theorem basically says that open covers of compact sets in a metric space can't just barely overlap. There must be some size larger than zero such that every point in the compact set is cushioned by at least that metric distance inside at least one of the elements of the open cover. 

\begin{LebegueNumThm}    
Let $\{ U_\alpha\}_{\alpha\in\lambda}$ be an open
cover of a compact set $A$ in a metric space $X$. Then there exists a
$\delta >0$ such that for every point $p$ in $A$, $B(p,\delta) \subset 
U_\alpha$ for some $\alpha$.
This number $\delta$ is called a \textbf{Lebesgue number} of the cover.
\end{LebegueNumThm}

%A number $\delta$ satisfying the theorem above is called a \textbf{Lebesgue number\/} of the cover.

One natural way to prove the Lebesgue Number Theorem is by contradiction. Among the proofs you discover, that approach should be one. However, we cannot resist suggesting two alternative methods as well. One method is to define a continuous function from $A$ to the positive reals that basically measures the maximum size of an open ball around each point that lies in a single open set of the cover. Then remember that a continuous function of a compact set into the reals attains its minimum. Another approach is to realize that proving the theorem for open covers consisting of finitely many open balls is sufficient. Now consider replacing each open ball by an expanding union of slightly smaller open balls, thus replacing a finite cover by a related infinite cover. By compactness that new cover has a finite subcover that basically shrinks each ball in the original cover. Use that fact to get your Lebesgue number. 

The Lebesgue Number Theorem has many applications, as we shall see in later chapters when we discuss paths in topological spaces and the fundamental group.  The following exercise might help you imagine how it could be useful even when discussing covers of spaces that are not necessarily metric spaces.

%%%%%

\begin{thm}
\label{thm:lebesgue-interval}
Let $\gamma:[0,1] \rightarrow X$ be a \textbf{path}: a continuous map from $[0,1]$ into the space $X$.  Given an open cover $\{ U_{\alpha}\}$ of $X$, show that $[0,1]$ can be divided into $N$ intervals of the form  $I_{i}=[\frac{i-1}{N}, \frac{i}{N}]$  such that each $\gamma(I_{i})$ lies completely in one set of the cover.
\end{thm}


\starsection{Metrizability}

We saw above that a metric on a set gives rise to a topology. Then we saw some consequences of knowing that the topology on a space is generated by a metric. Now we ask a sort of reverse question:  if $(X,\cal T)$ is a topological
space, when is it possible to find a metric on the set $X$, such that
the metric space topology is the same as the topology $X$ already has?

Put more succinctly, when is a topological space metrizable? To show a space is not metrizable, we might show that one of the properties that every metric space enjoys does not hold for that space. At this point in our discussion, the only way to show that a space is metrizable is
 to produce a metric that generates the topology.

%Some strategies:
%You can show a space is metrizable by producing a metric that yields the space's topology.
%You can show a space is not metrizable by showing, for instance, that the properties in Theorem \ref{count.prop.metric} are not equivalent.

\begin{exercise}
Is the space $\R$ with the discrete topology metrizable?
Is the space $\R_\textrm{LL}$ metrizable?
\end{exercise}

Since being a metric space is both a category of spaces and being metrizable is a property that a topological space may or not possess, you can now add a new row and a new column to your chart of properties and examples.  

\begin{exercise}
Take your chart of examples and properties and add metric space as an example and add metrizable as a property and fill in the chart. 
\end{exercise}

%\section{Urysohn's Lemma*}
%
%A {\em diadic} rational a number expressible as a fraction with denominator 
%a power of two.
%
%\begin{thm}
%Let $A$ and $B$ be disjoint closed sets in a normal space $X$.  Then
%there exist open sets $U_r$ for each diadic rational $0\leq r \leq 1$
%such that $A \subset U_0$, $B\subset \bar U_1^c$, and for $r < s$,
%$\bar U_r \subset U_s$.
%\end{thm}
%
%Thus the sets are all ``nested'' in an ordered way.
%
%\begin{thm}[Urysohn's Lemma]
%A space $X$ is normal if and only if for each pair of disjoint closed sets
%$A$ and $B$ in $X$, there exists a continuous function $f:X \rightarrow
%[0,1]$ such that $A \subset f^{-1}(0)$ and $B \subset f^{-1}(1)$.
%\end{thm}
%
%So Urysohn's Lemma says that in a normal space disjoint closed sets
%can be ``separated by a continuous function''.
%
%
%\begin{exercise}
%Use Urysohn's Lemma to give a quick proof that countable, regular, $T_1$ space with more than one
%point is not connected.
%\end{exercise}

%Urysohn's Lemma has many deep consequences in analysis and geometry.
%We briefly mention some of them here for culture.
%
%%Include T_1 in the definition of normal?  or determine if (partitions of unity) needs T_1
%
%\begin{fact}(Tietze Extension Theorem)
%Let $A$ be a closed subset of a normal space $X$.  
%A continuous function $f: A \rightarrow \R$ 
%can be extended to a continuous function $f: X \rightarrow \R$.
%\end{fact}
%The proof uses heavy analysis and 
%requires the notion of uniform convergence of functions.
%The idea is to use Urysohn's Lemma to construct a sequence of continuous 
%functions on the whole space which converge uniformly and converges to
%$f$ on $A$.  Then its limit is continuous and has the desired property.

Remember our strategy for exploring a new concept is to consider how the new concept relates to various previously defined notions, such as subspaces and products.  We saw before that subspaces of metric spaces are metric spaces.

%A subspace of a metrizable space is metrizable---just use the inherited metric.  

What about the product of two metric spaces?   To prove the next result, your challenge is to define a metric on the product such that the metric topology on the product is the same as the product topology.

\begin{thm}
Let $(X,d)$ and $(Y,e)$ be metric spaces. Then $X \times Y$ is a metric space.
\end{thm}

In fact, the product of countably many metric spaces is also metrizable. 

%%%%%
%\marginnote{I said what the metric was, but it could be a hint too.}
%%%%%
\begin{thm}    Let $\{ (X_i, d_i)\}_{i\in\omega_0}$ be a countable collection of metric spaces.  
Then $\prod_{i\in\omega_0} X_i$ is metrizable using the metric 
$d({\bf x},{\bf y}) = \sup_i \frac{\bar d_{i}(x_i,y_i)}{i}$,
where $\bar d(a,b)=\min\{d(a,b),1\}$.
\end{thm}

\opt{
The space $\R^\omega$ (the countable product of $\R$ with itself)
is metrizable via the following metric:  if ${\bf x}, {\bf y} \in
\R^\omega$, define
$d({\bf x},{\bf y}) = \sup_i \frac{\bar d(x_i,y_i)}{i}$,
where $\bar d(a,b)=\min\{|a-b|,1\}$ is the standard bounded metric for $\R$.

(Do something similar with other metric spaces.)

It is easy to check that $d$ is a metric; the triangle equality holds
for fixed $i$, then take sup of the right side, then sup of the left
to get the general triangle inequality.

We show that every open ball $B(x,1/N)$ 
about $x$ (from the metric) contains an
open set $U$ about $x$ from the product topology.
Let 
$$
U=(x_1-1/N, x_1+1/N) \times ... \times (x_N-1/N, x_N+1/N) \times 
\R \times \R ...
$$
If $y \in U$ then it is easy to see that $d(x,y)$ is less than $1/N$.

We show that every open set $U$ about $x$ from the product topology
contains an open ball $B(x,r)$.  Say $U=U_1\times U_2 \times...$ where
$U_i$ is open in $\R$ for finitely many indices $i_1, ..., i_n$ and
otherwise all of $\R$.  For each of these finitely many indices $i$,
choose an interval $(x_i-r_i, x_i+r_i)$ contained in $U_i$.  Let
$r$ be the minimum of all $r_i/i$ from this set.  Then if 
$d(x,y)$ is less than $r$, we see that $y$ is in $U$.

This shows the topologies are equivalent.
}


However, the product of uncountably many non-trivial metric spaces is never a metric space. 

\begin{thm}
The product of uncountably many spaces, each with more than one point, is not a metrizable space.
\end{thm}

\begin{exercise}
Consider the set $\R^\omega$ with the box topology, and show that it is not metrizable.  In fact, in the box topology the product of \emph{countably} many non-trivial metric spaces is not metrizable.
\end{exercise}


One of the basic questions about metrizability is to characterize metrizable spaces in terms of the topological features they have. Urysohn's Lemma is called a lemma, because it first appeared as a lemma to the following metrization theorem. The challenge to proving this theorem, or any metrization theorem, is to use the hypothesized topological features to define a metric on the space, that is, a distance between points, in such a way that the metric induces the given topology. 

\begin{UrysohnMetrization}
Every regular, $T_1$, $2^{nd}$ countable space is metrizable.
  \begin{hint}
Show the space is normal.  Now take the space and find a way
to imbed it in $\R^\omega$, which we know to be metrizable.  Urysohn's
Lemma comes in by finding a countable collection of functions such
that for any point $p$ in an open set $U$, one of the functions is
positive at $p$ and vanishes outside $U$.  One can check that this 
collection of functions gives the imbedding of $X$ into $\R^\omega$.
  \end{hint}
\end{UrysohnMetrization}

% Needs $T_1$ if not already in definition of regularity.  (think about indiscrete space)
% Recall that 2nd countable implies Lindel\"of, and with regularity this gives normality.

%The basic idea of the proof is to take the space and find a way
%to imbed it in $\R^\omega$, which we know to be metrizable.  Urysohn's
%Lemma comes in by finding a countable collection of functions such
%that for any point $p$ in an open set $U$, one of the functions is
%positive at $p$ and vanishes outside $U$.  One can check that this 
%collection of functions gives the imbedding of $X$ into $\R^\omega$.

Urysohn's Metrization Theorem implies some facts about compact spaces. 

\begin{thm}
Let $X$ be a compact Hausdorff space that is $2^{nd}$ countable. Then $X$ is metrizable. 
\end{thm}

And putting together some insights about continuous functions, we can conclude that the images of compact metric spaces must be metrizable if the image is Hausdorff. 

\begin{thm}
Let $X$ be a compact metric space, $Y$ be a Hausdorff space, and $f: X \to Y$ be a continuous, surjective function. Then $Y$ is a compact metric space.
\end{thm}

One way to characterize compact metric spaces is as the continuous image of the Cantor set. 

\begin{thm}
Let $X$ be a Hausdorff space, and let $C$ be the standard Cantor set. Then $X$ is a compact metric space if and only if %$X$ is the continuous image of the Cantor set. 
there exists a continuous surjective function $f: C \rightarrow X$.
\end{thm}


Urysohn's Metrization Theorem gives a good characterization of the metrizability of $2^{nd}$ countable spaces. You may recall that, using Urysohn's Lemma, every normal, $T_1$ topological space can be embedded in a product of $[0,1]$'s.  The following theorem has a similar flavor of embedding a space in a product of intervals. 
In this case the space is a separable metric space and the product is a countable product.

%a topological space $X$ is completely regular if for every point $p$ and closed set $C$ not containing $p$ there is a continuous function $f: X \to [0,1]$ such that $p \in f^{-1}(0)$ and $C \in f^{-1}(1)$. In other words, points and closed sets could be separated by a continuous function in that way. We saw that every completely regular space can be embedded in a product of $[0,1]$'s. The following theorem has a similar flavor of embedding a space in a product of intervals. In this case the space is a separable, metric space and the product is a countable product. 

\begin{thm}
Every separable metric space can be embedded in a countable product of $[0,1]$'s. 
\end{thm}

%; however, characterizing non-second countable spaces is more difficult. 


If a metric space is not separable, then it cannot be embedded in a countable product of intervals. However, in the next section you will see that any metric space \emph{can} be embedded in a countable product of hedgehogs.


\starsection{Advanced Metrization Theorems}

Metric spaces do not necessarily have a countable basis; however, they have bases that are the unions of countably many collections of appealing sets. The theorems in this section describe assumptions on bases for a topological space that imply that there exists a metric on the space that generates its topology. These metrization theorems were proved independently in the early 1950's by Bing, Nagata, and Smirnov. These theorems are similar, so they are often collectively referred to as the Bing-Nagata-Smirnov Metrization Theorem. Since their statements involve some technical terms, we explore a few ideas before stating the theorems in full. 

We begin by defining a metric space called a \emph{hedgehog}--named in reference to the many spines that stick out of that bristly beast. 

\begin{dfn}
Let $X = \bigcup_{\alpha \in \lambda} I_\alpha$ be the space created by taking a potentially uncountable disjoint union of unit intervals with the standard topology. Let $H$ be the quotient space obtained from $X$ by identifying all the $0$ endpoints in all the intervals to a single point. The space $H$ is called a \bf{hedgehog}. 
\end{dfn}

\begin{exercise}
Show that a hedgehog is a metric space where the distance between two points can be described as taking the distance from one point to the $0$ on its spine and then adding the distance out to the second point on the other point's spine. 
\end{exercise}

\begin{thm}
The countable product of hedgehogs is metrizable. 
\end{thm}

One method to prove one direction of the Bing-Nagata-Smirnov Metrization Theorem below is to show that the hypotheses allow us to embed the space into a countable product of hedgehogs in a manner similar to how normal, $T_1$ spaces with a countable basis can be embedded in a countable product of intervals. Indeed our hypothesis about the basis is designed to allow us to produce such an embedding. 

\begin{dfn}
\index{$\sigma$-discrete basis}
\index{basis!$\sigma$-discrete basis}
\begin{enumerate}
\item A collection of subsets $\{E_\alpha\}_{\alpha \in \lambda}$ of a topological space $X$ is a \textbf{discrete collection} if and only if for every point $x \in X$, there exists an open set $U$ with $x \in U \subset X$ such that $U$ intersects at most one $E_\alpha$.
\item A basis $\mathcal{B}$ of a space $X$ is a \textbf{$\sigma$-discrete basis} if and only if $\mathcal{B} = \bigcup_{i \in \N} B_i$ where each $\mathcal{B}_i = \{B_{i,\alpha}\}_{\alpha \in \lambda_{i}}$ is a discrete collection of open sets. 
\end{enumerate}
\end{dfn}

This first theorem uses the Normality Lemma to establish the normality of a regular, $T_1$ space with a $\sigma$-discrete basis.

\begin{thm}
A regular space with a $\sigma$-discrete basis is normal. In fact, given a discrete collection of closed sets $\{C_\alpha\}_{\alpha \in \lambda}$, there exists a discrete collection of open sets $\{U_\alpha\}_{\alpha \in \lambda}$ such that for each $\alpha$, $C_\alpha \subset U_\alpha$. 
\end{thm}

R.H. Bing proved his Metrization Theorem in 1951. It is an 'if and only if' statement. Both directions are difficult. The following theorem is one of those directions.  Try to prove that the existence of a $\sigma$-discrete basis implies that the space can be embedded in a countable product of hedgehogs.  We will give some guidance about how you might approach the other direction later. 

\begin{thm}
A regular, $T_1$ space $X$ with a $\sigma$-discrete basis is metrizable.
\end{thm}

To show that a metric space $X$ has a $\sigma$-discrete basis, a good strategy is to fix a natural number $n$ and to consider the open cover of $X$ by $\frac{1}{n}$-balls and show that we can produce a countable number of discrete collections of open sets each of which is a refinement of the cover and such that the union of all the sets in all of the countable collection of sets covers $X$. Repeating this process for each natural number $n$ generates our desired $\sigma$-discrete basis. This approach has an intermediate step of producing a countable number of collections of discrete closed sets that are refinements and whose union is the whole space. 

To deal with the general case of any metric space, the cover of $X$ by $\frac{1}{n}$-balls could well have an uncountable number of open sets in the cover. Let's learn a useful technique by considering a simpler case where we start with a countable open cover. So here is a practice lemma. 

\begin{lemma}
Let $\{U_i\}_{i \in \N}$ be a countable open cover of a metric space $X$. For each point $x \in X$ let $m(x)$ be the natural number such that $x \in U_i$ but $x \not \in U_j$ for $j<i$. Then for every $n \in \N$ there exists a discrete collection of closed sets $\{C_{i,n}\}$ such that 
\begin{enumerate}
\item for each $i$, $C_{i,n} \subset U_i$;
\item for each $x \in C_{i,n}$, $B(x, \frac{1}{n}) \subset U_i$;
\item for each $i$, $C_{i,n}$ does not intersect $U_j$ for $j<i$; and
\item for each $i$, $C_{i,n}$ contains every point $x \in U_i$ for which $m(x) = i$ and for which $d(x, X-U_i) > \frac{1}{n}$.
\end{enumerate}

Then $\bigcup C_{i,n} = X$ and for each $n$, the collection of $\frac{1}{3n}$ neighborhoods of the $C_{i,n}$'s, that is, 
$$
\left\{\bigcup_{x \in C_{i,n}} B(x,\frac{1}{3n})\right\}_{i \in \N},
$$
is a discrete collection of open sets.
\end{lemma}

The above lemma demonstrates a construction that also works for collections that are not countable. To deal with uncountable covers, we can use well-ordering. Recall that a set is well-ordered if and only it is totally ordered and every non-empty subset has a least element. The proof of the following lemma is basically the same as the proof of the lemma above. Notice that the function $m(x)$ in the statement below relies on the index set being well-ordered. 

\begin{lemma}
Let $\{U_\alpha\}_{\alpha \in \lambda}$ be an open cover of a metric space $X$ where the index set $\lambda$ is well-ordered. For each point $x \in X$ let $m(x)$ be the ordinal number $\alpha$ such that $x \in U_\alpha$ but $x \not \in U_\beta$ for $\beta<\alpha$. Then for every $n \in \N$ there exists a discrete collection of closed sets $\{C_{\alpha,n}\}$ such that 
\begin{enumerate}
\item for each $\alpha$, $C_{\alpha,n} \subset U_\alpha$;
\item for each $x \in C_{\alpha,n}$, $B(x, \frac{1}{n}) \subset U_\alpha$;
\item for each $\alpha$, $C_{\alpha,n}$ does not intersect $U_\beta$ for $\beta<\alpha$; and
\item for each $\alpha$, $C_{\alpha,n}$ contains every point $x \in U_\alpha$ for which $m(x) = \alpha$ and for which $d(x, X-U_\alpha) > \frac{1}{n}$.
\end{enumerate}
 
Then $\bigcup C_{\alpha,n} = X$ and for each $n$, the collection of $\frac{1}{3n}$ neighborhoods of the $C_{\alpha,n}$'s, that is, 
$$\left\{\bigcup_{x \in C_{\alpha,n}} B(x,\frac{1}{3n})\right\}_{\alpha \in \lambda},$$ 
is a discrete collection of open sets.
\end{lemma}

You are now in a position where you can prove the other direction of Bing's Metrization Theorem, namely, proving that a metric space has a $\sigma$-discrete basis, thereby completing the proof of Bing's Metrization Theorem.

\begin{Bing}
\index{Bing's Metrizability Theorem}
A regular, $T_1$ space $X$ is metrizable if and only if $X$ has a $\sigma$-discrete basis.
\end{Bing}

The similar metrization theorem by Nagata and Smirnov characterizes a metric space as having a $\sigma$-locally finite basis rather than a $\sigma$-discrete basis. We will recall the definition of a collection of subsets of a space being locally finite, and define what it means for a collection to be $\sigma$-locally finite.

\begin{dfn}
\begin{enumerate}
\item 
A collection of subsets $\{E_\alpha\}_{\alpha \in \lambda}$ of a topological space $X$ is a \textbf{locally finite collection} if and only if for every point $x \in X$, there exists an open set $U$ with $x \in U \subset X$ such that $U$ intersects at most a finite number of the $E_\alpha$.
\item A basis $\mathcal{B}$ of a space $X$ is a \textbf{$\sigma$-locally finite} if and only if $\mathcal{B} = \bigcup_{i \in \N} B_i$ where each $\mathcal{B}_i = \{B_{i,\alpha}\}_{\alpha \in \lambda_{i}}$ is a locally finite collection of open sets. 
\end{enumerate}
\end{dfn}

Once again, we begin by asserting that a regular space with a $\sigma$-locally finite basis is normal. 

\begin{thm}
A regular space with a $\sigma$-locally finite basis is normal. In fact, given a discrete collection of closed sets $\{C_\alpha\}_{\alpha \in \lambda}$, there exists a discrete collection of open sets $\{U_\alpha\}_{\alpha \in \lambda}$ such that for each $\alpha$, $C_\alpha \subset U_\alpha$. 
\end{thm}

\begin{Nagata-Smirnov} 
\index{Nagata-Smirnov Metrizability Theorem}
A regular, $T_1$ space $X$ is metrizable if and only if $X$ has a $\sigma$-locally finite basis.
\end{Nagata-Smirnov}

Since a $\sigma$-discrete basis is a $\sigma$-locally finite basis, Bing's Metrization Theorem proves one direction of this theorem already, namely that a metric space has a $\sigma$-locally finite basis. So the only remaining challenge is to prove that a normal, $T_1$ space $X$ with a $\sigma$-locally finite basis has a $\sigma$-discrete basis. Several steps are useful. The first follows the strategy of the lemma above. 

\begin{lemma}
Let $X$ be a space with a $\sigma$-locally finite basis $\{\{B_{\alpha,n}\}_{\alpha \in \lambda_i}\}_{n \in \N}$. Let $\{U_\alpha\}_{\alpha \in \lambda}$ be a locally finite collection of open sets in a space $X$ where the index set $\lambda$ is well-ordered. (In the application, this collection of $U_\alpha$'s will be one of the locally finite collections of basis elements.)  For each point $x \in \bigcup_{\alpha \in \lambda} U_\alpha$ let $m(x)$ be the ordinal number $\alpha$ such that $x \in U_\alpha$ but $x \not \in U_\beta$ for $\beta<\alpha$. Then for every $n \in N$ there exists a discrete collection of closed sets $\{C_{\alpha,n}\}$ such that 
\begin{enumerate}
\item for each $\alpha$, $C_{\alpha,n} \subset U_\alpha$;
\item for each $\alpha$, $C_{\alpha,n}$ does not intersect $U_\beta$ for $\beta<\alpha$; and
\item for each $\alpha$, $C_{\alpha,n}$ contains every point $x \in U_\alpha$ for which $m(x) = \alpha$ and for which $x \in \{B_{\alpha,n}\}$.
 \end{enumerate}
Then 
\begin{enumerate}
\item for each $n$, $\{C_{\alpha,n}\}_{\alpha \in \lambda}$ is a discrete collection of closed sets;
\item $\bigcup_{\alpha \in \lambda; n \in \N} C_{\alpha,n} = \bigcup_{\alpha \in \lambda} U_\alpha$; and \item for each $n$, there exists a discrete collection of open sets $\{V_{\alpha,n}\}_{\alpha \in \lambda}$ such that for each $\alpha \in \lambda$, $C_{\alpha,n} \subset V_{\alpha,n} \subset \overline{V_{\alpha,n}} \subset U_\alpha$.
\end{enumerate}
\end{lemma}

This lemma can be used to prove that a normal, $T_1$ space with a $\sigma$-locally finite basis has a $\sigma$-discrete basis. From this fact, the Nagata-Smirnov Metrization Theorem follows from Bing's Metrization Theorem above. As an historical note, originally Nagata and Smirnov independently constructed proofs of their theorem without going through Bing's Theorem.


\section{Complete Spaces}

In compact spaces, every infinite set has a limit point. Although not every infinite subset of the real line with the standard topology has a limit point, Cauchy sequences \emph{do} converge, which observation gives rise to the concept of a complete metric and a complete metric space. 

\begin{dfn}
\begin{enumerate}
\item Let $X$ be a metric space with metric $d$. A sequence $\{x_i\}_{i \in \N}$ of points in $X$ is a \textbf{Cauchy sequence} if and only if for each $\epsilon > 0$, there is an integer $M$ such that for all $m,n > M$, $d(x_m,x_n) < \epsilon$. 
\item Let $d$ be a metric for the metric space $X$. Then $d$ is a \textbf{complete metric} for $X$ if and only if every $d$-Cauchy sequence in $X$ converges.
\item A metric space $(X,d)$ is a \textbf{complete} if and only $d$ is a complete metric for $X$.
\item A topological space $(X,\mathcal{T})$ is \textbf{topologically complete} if and only if there is a complete metric $d$ on $X$ that generates the topology of $X$.
\end{enumerate}
\end{dfn}

The primary example of a complete metric space is $\R^{n}$ with the usual metric.

\begin{exercise}
\begin{enumerate}
\item The space $\R^n$ is complete.
\item There is a metric that generates the standard topology on $\R^1$ that is not a complete metric.
\end{enumerate}
\end{exercise}

A first natural question to ask, as we have done many times before, is to take a space with a given property and ask which subsets also have this property?

\begin{thm}
Every closed subset of a complete metric space is complete.
\end{thm}

The product of two complete metric spaces is complete.

\begin{thm}
If $X$ and $Y$ are complete metric spaces, then $X \times Y$ is complete.
\end{thm}

Consider $(0,\infty)$, an open subset of $\R$.  Notice that even though $\R$ is a complete metric space, $(0,\infty)$ is not complete under the standard metric, because the Cauchy sequence $1/2, 1/3, 1/4, ...$ does not converge to a point in this space.  However, there is a complete metric for $(0,\infty)$ that generates the subspace topology on $(0,\infty)$, for instance, $$d(a,b)=\sqrt{(b-a)^{2} + (\frac{1}{b}-\frac{1}{a})^{2}}.$$
This metric is obtained by embedding $(0,\infty)$ as the graph of $f(x)=1/x$ on $(0,\infty)$ in $\R^{2}$, which is a closed subset of $\R^{2}$, and using the standard Euclidean metric on $\R^{2}$.  Thus $(0,\infty)$ is topologically complete using a metric that is not the same as the complete metric it inherited from $\R$.   The next theorem generalizes this idea.

\begin{thm}
Let $U$ be an open subset of a complete metric space $X$.  Then $U$ is topologically complete, that is, there is a complete metric on $U$ that generates the relative topology of $U$.
\end{thm}
Hint: embed $U$ as a closed subset of $X \times \R$.

The countable product of complete metric spaces admits a complete metric.

\begin{thm}
If $\{X_i\}_{i \in \N}$ is a collection of complete metric spaces, then $\prod_{i \in \N} X_i$ is complete. 
\end{thm}

These ideas may help if you are in the mood for the following two challenging theorems.
\begin{thm}
Let $\{U_i\}_{i \in \N}$ be a countable collection of open sets in a complete space $X$.  Then 
 $Y= \bigcap _{i \in \N} U_i$ is complete.
\end{thm}
Hint: try to embed $Y$ as a closed subset of the product of $X$ with a countable number of copies of $\R$.

The converse of this theorem is also true, so this gives us a characterization of when subsets of complete spaces are complete.

\begin{thm}
Let $X$ be a complete space.  Then $Y \subset X$ is complete if and only if there exists a countable collection of open sets $\{U_i\}_{i \in \N}$ such that $Y= \bigcap _{i \in \N} U_i$.
\end{thm}

%

You saw in the exercise above that some metrics that generate the standard topology on $\R$ are complete and some metrics that generate that same topology are not complete. For compact metric spaces, the situation is different. All metrics on compact spaces are complete. 

\begin{thm}
Let $X$ be a compact metric space. Then every metric for $X$ is a complete metric. 
\end{thm}

One of the basic theorems about complete metric spaces can be described in two different ways--one way is to talk about the intersection of dense open sets and the second is to talk about the union of nowhere dense sets. Each one of these two equivalent statements is called the Baire Category Theorem. 

\begin{thm} [The Baire Category Theorem]
Let $X$ be a complete metric space and $\{U_i\}_{i \in \N}$ be a collection of dense open sets. Then $\bigcap_{i \in \N}U_i$ is a dense set.
\end{thm}

\begin{dfn}
A subset $Y$ of a space $X$ is \textbf{nowhere dense} if and only if $Int(Cl(Y)) = \emptyset$.
\end{dfn}

\begin{thm} [The Baire Category Theorem]
Let $X$ be a complete metric space. Then $X$ is not the union of countably many nowhere dense sets.
\end{thm}



\section{Continuous Functions Between Metric Spaces}

The definition of continuous function for topological spaces has a characterization on metric spaces that uses the metrics involved.  This $\varep-\delta$ description of continuity may be familiar to you if you've taken a course in real analysis or if you remember the technical part of the section in your calculus book about continuity that you probably skipped. The $\varep-\delta$ formulation was probably the first definition of a continuous function that you ever saw. Fortunately, in metric spaces that definition of continuity coincides with the topological definition of continuity. You'll want to use our earlier definition of continuous functions between topological spaces to prove this theorem.

\begin{thm}
A function $f$ from a metric space $(X,d_X)$ to a 
metric space $(Y,d_Y)$ is continuous at the point $x$ (in the topological sense) 
if and only if for each $\varep >0$ there exists a $\delta >0$ such that 
for every $y \in X$, if $d_X(x,y) <\delta$, then $d_Y(f(x),f(y)) <\varep$.
The function $f$ is continuous if and only if it is continuous at every point $x \in X$.
\end{thm}

%We write $f:X \rightarrow Y$ when the metrics on $X$ and $Y$ are understood.% 
In the definition of a continuous function above, for a fixed $\varep > 0$,  we may be required to select different $\delta$'s at different points in the space. If we have a continuous function such that for each $\varep >0$ a fixed $\delta >0$ works for every point in the space, then such a function has a stronger type of continuity called uniform continuity.

\begin{dfn}%[uniformly continuous]%
\index{uniform continuity}\index{continuity!uniform}%
\index{function!uniformly continuous}    
A function $f$ from a metric space $(X,d_X)$ to a 
metric space $(Y,d_Y)$ is \textbf{uniformly continuous} if and only if
for each $\varep >0$ there exists a $\delta >0$ such that 
for every $x$, $y \in X$, if $d_X(x,y) <\delta$,
then $d_Y(f(x),f(y)) <\varep$.
\end{dfn} 

\begin{exercise}
Give an example of a continuous function from $\R^1$ to $\R^1$ with the standard topology that 
is not uniformly continuous. 
\end{exercise}

\begin{thm} 
Let $f:X\to Y$ be a continuous function
from a compact metric space to a metric space $Y$.  Then $f$ is
uniformly continuous.
\end{thm}

One reason for being interested in complete spaces is that they allow us to state some important theorems about convergence of certain sequences of functions. 

\begin{dfn}
Let $X$ be a topological space, and let $(Y,d)$ be a metric space. A sequence of continuous functions $f_i:X\to Y$ \textbf{converges uniformly} if and only if for every $\epsilon > 0$, there is an integer $M$ such that for every $x \in X$ and $m,n > M$, $d(f_m(x),f_n(x)) < \epsilon$.
\end{dfn}

Uniformly convergent continuous functions into a complete metric space will converge to a continuous function.

\begin{thm}
Let $X$ be a topological space and let $Y$ be a complete metric space. If a sequence of continuous functions $f_i:X \to Y$ converges uniformly, then $f(x): = \lim f_i(x)$ exists and is continuous. 
\end{thm}


% 
% Say more here?
%



\section{Metric Continua}

\begin{defn}
A \textbf{metric continuum} is a metric space that is also a continuum, that is, a metric continuum is a connected, compact metric space.
\end{defn}

\begin{dfn}
 \index{Peano Continuum}
 \index{continuum!Peano}   
  A \textbf{ Peano Continuum\/} is a locally connected metric continuum.
 \end{dfn} 

 \begin{thm}    
 A Hausdorff space $X$ is a Peano Continuum if and only if  
 $X$ is the image of $[0,1]$ 
 under a continuous, surjective function.
 \end{thm}
 %uses Theorem \label{compact-Hausdorff-2ndcountable}
 %there is a harder direction
 

 \begin{thm}    A Peano Continuum is path connected and
 locally path connected.
 \end{thm}

 \begin{thm}    An open, connected subset of a Peano Continuum is path connected.
 \end{thm}


%\begin{thm}
% Let $X$ be a metric continuum.  Then $X$ has at  least two non-separating points.
%\end{thm}

One of the goals of topology is to describe the essential features of familiar spaces that characterize those spaces. The following theorem shows us that the unit interval is the only metric continuum with exactly two non-separating points.

\begin{thm}
 Let $X$ be a metric continuum with exactly two non-separating points.  Then $X$ is homeomorphic to $[0,1]$.
\end{thm}
 
The next theorem characterizes the circle as the only metric continuum where no point separates it, but every pair of points separates it. 
 
 \begin{thm}
 Let $X$ be a metric continuum with more than one point where no point separates $X$ but every pair of points separates $X$.  Then $X$ is homeomorphic to $\Sph^1$.
 \end{thm}

The following theorem is known as the Kline Sphere Characterization Theorem. Don't work too hard on it, because it is very difficult.

 \begin{thm}
 Let $X$ be a metric continuum with more than one point where no pair of points separates $X$, but every subset of $X$ homeomorphic to $\Sph^1$ separates $X$.  Then $X$ is homeomorphic to $\Sph^2$.
 \end{thm}
 
 
%F: this next part should be moved.

%\marginpar{this next part doesn't seem it belongs here}
%Even harder is the Poincare Conjecture that was unsolved for about 100 years and a proof was announced in 2003. The Poincare Conjecture was so famous and viewed as so important that the Clay Institute offered a million dollars to the person who settled the conjecture. Grigori Perelman proved the theorem and was offered the prize; however, he declined the prize saying that the mathematician Richard Hamilton was equally deserving of the prize since Perelman's proof followed an outline suggested by Hamilton. Apparently Perelman never thought of the idea of splitting the prize with Hamilton, or perhaps division of large numbers like a million was too difficult. Of course, Perelman's thoughts about attributing mathematical success are actually accurate, that is, mathematicians always stand on the shoulders of their predecessors and merely see a small way further (as Newton famously noted). In any case, here is the Poincare Conjecture, now the Poincare Theorem. 
%
%\begin{thm} [Poincare Conjecture]
%Let $X$ be a compact, metric space such that for every point $p$ in $X$, there is an open set $U$ containing $p$ such that $U$ is homeomorphic to $\R^3$ and let $D^2$ be the unit disk, whose boundary is the unit circle $S^1$. Suppose for every continuous function $f: S^1 \to X$, there exists a continuous function $F: D^2 \to X$ that extends $f$. Then $X$ is homeomorphic to $S^3$. 
%\end{thm}
%
%Just to give you the usual vocabulary to refer to parts of this theorem, a space that is a metric space in which every point $p$ in $X$ has an open set $U$ containing $p$ such that $U$ is homeomorphic to $\R^3$ is called a '3-manifold'. A space that is connected in which for every continuous function $f: S^1 \to X$, there exists a continuous function $F: D^2 \to X$ that extends $f$ is called 'simply connected.' So the Poincare Conjecture can be rephrased as follows. 
%
% \begin{thm} [Poincare Conjecture]
% Let $X$ be a compact, simply connected 3-manifold. Then $X$ is homeomorphic to $\Sph^3$. 
% \end{thm}
 
  
 
 \starsection{Paracompactness of Metric Spaces}
% \marginpar{this was after metrication theorems but I moved it here}

Recall that a space is paracompact if and only if it is Hausdorff and every open cover of $X$ has a locally finite refinement. The challenge of proving paracompactness of a space is to keep in mind that there are three open covers involved: the given open cover, the locally finite refinement, and the set of open sets that demonstrate that the refinement is locally finite. So the key to proving compactness is often to produce the collection of sets that demonstrate the local finiteness at the same time you are producing the refinement itself. 

The fact that every metric space has a $\sigma$-discrete basis makes proving the paracompactness of a general metric space quite similar to proving the paracompactness of a 2nd countable space. So let's begin by dealing with a 2nd countable space. This lemma statement is really designed to outline an approach to constructing a locally finite refinement. You may have developed these ideas back in Section \ref{sec:paracompactness}. 

\begin{lemma}
Let $\{B_i\}_{i \in \N}$ be a countable basis of a regular space $X$. Let $\{U_\alpha\}_{\alpha \in \lambda}$ be an open cover of $X$. Let $\{C_i\}_{i \in \N}$ be the set of all $B_i$'s such that each $C_i$ lies in some $U_\alpha$ in the open cover. Then $\{C_i\}_{i \in \N}$ is an open refinement of the open cover $\{U_\alpha\}_{\alpha \in \lambda}$; however, it is not locally finite. Let $\{D_i\}_{i \in \N}$ be the set of all $B_i$'s such that each $\Cl{D_i}$ is a subset of some $C_i$. For each $i \in \N$ let $E_i = C_i - \bigcup \{D_j | j < i \text{ and } \Cl{D_j} \subset C_k \text{ for some } k<i \}$. Then $\{E_i\}_{i \in \N}$ is a locally finite refinement of $\{U_\alpha\}_{\alpha \in \lambda}$. 
\end{lemma}

Now you are ready to use the fact that metric spaces have a $\sigma$-discrete basis to prove that metric spaces are paracompact. 

\begin{thm}
Metric spaces are paracompact. 
\end{thm}

  
 
