\documentclass[12pt,a4paper]{article}
\usepackage{amsmath,amsxtra,amsthm,amssymb,makeidx,graphics}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{question}[theorem]{Question}
\newtheorem{exercise}[theorem]{Exercise}
\newtheorem{example}[theorem]{Example}
\newtheorem{definition}[theorem]{Definition}
\newtheoremstyle{citing}{3pt}{3pt}{\itshape}{0pt}{\bfseries}%
{.}{ }{\thmnote{#3}}\theoremstyle{citing}\newtheorem*{varthm}{}
\DeclareMathOperator{\card}{card}
\DeclareMathOperator{\Cl}{Cl}
\DeclareMathOperator{\Int}{Int}
\renewcommand{\emptyset}{\varnothing}
\begin{document}
\title{Metric and Topological Spaces}
\author{T.~W.~K\"{o}rner}
\maketitle
\begin{footnotesize}
{\bf Small print} The syllabus for the course is defined by
the Faculty Board Schedules (which are minimal for lecturing
and maximal for examining). What is presented here contains
some results which
it would not, in my opinion, be
fair to set as book-work although they could well appear
as problems. In addition, I have included a small
amount of material which appears in other 1B courses.
I should {\bf very much} appreciate being told
of any corrections or possible improvements
and might even part with a small reward to the
first finder of particular errors.
These notes are written in
\LaTeXe\ and should be available
in tex, ps, pdf and dvi format
from my home page
\begin{center}
{\bf http://www.dpmms.cam.ac.uk/\~{}twk/}
\end{center}
I can send some notes on the exercises in
Sections~\ref{S;exercises one} and~\ref{S;exercises two}
to supervisors by e-mail.
\end{footnotesize}
\tableofcontents
\section{Preface} Within the last sixty years, the material
in this course has been taught at Cambridge
in the fourth (postgraduate), third, second and first years
or left to students to pick up for themselves.
Under present arrangements, students may take the course
either at the end of their first year
(before they have met metric spaces in analysis)
or at the end of their second year
(after they have met metric spaces).

Because of this, the first third of the course presents
a rapid overview of metric spaces (either as revision
or a first glimpse) to set the scene for the main
topic of topological spaces.

The first part of these notes states and discusses the
main results of the course. Usually,
each statement is followed by
directions to a proof in the final part of these notes.
Whilst I do not expect the reader to find all the
proofs by herself,
I do ask that she \emph{tries} to give a proof herself
before looking one up. Some of the more difficult theorems
have been provided with hints as well as proofs.

In my opinion, the two sections on compactness are
the deepest part of the course and the reader who has
mastered the proofs of the results therein is well on
the way to mastering the whole course.

May I repeat that, as I said in the small print,
I welcome corrections and comments.
\section{What is a metric?} If I wish to travel from
Cambridge to Edinburgh, then I may be interested in
one or more of the following numbers.

(1) The distance, in kilometres, from Cambridge to Edinburgh 
`as the crow flies'.

(2) The distance, in kilometres, from Cambridge to Edinburgh by road.

(3) The time, in minutes, of the shortest journey from Cambridge to Edinburgh 
by rail.

(4) The cost, in pounds, of the cheapest journey from Cambridge to Edinburgh
by rail.

Each of these numbers is of interest to someone
and none of them is easily obtained from another.
However, they do have certain properties in common
which we try to isolate in the following definition.

\begin{definition}\label{D;metric} Let $X$ be a 
set\footnote{We thus allow $X=\emptyset$. 
This is purely a question of taste. If we did not
allow this possibility, then, every time we
defined a metric
space $(X,d)$, we would need to prove that $X$ was non-empty.
If we do allow this possibility, and we prefer
to reason about non-empty spaces, then we can begin our proof
with the words `If $X$ is empty, then the result is
vacuously true, so we may assume that $X$ is non-empty.'
(Of course, the result may be false for $X=\emptyset$,
in which case the statement of the theorem must include
the condition $X\neq\emptyset$.)} and
$d:X^{2}\rightarrow{\mathbb R}$ a function with the
following properties:-

(i) $d(x,y)\geq 0$ for all $x,\,y\in X$.

(ii) $d(x,y)=0$ if and only if $x=y$.

(iii) $d(x,y)=d(y,x)$ for all $x,\,y\in X$.

(iv) $d(x,y)+d(y,z)\geq d(x,z)$ for all $x,\,y,\,z\in X$.
(This is called the \emph{triangle inequality} after the
result in Euclidean geometry that the sum of the lengths
of two sides of a triangle is at least as great as the
length of the third side.)

Then we say that $d$ is a \emph{metric} on $X$ and that $(X,d)$
is a \emph{metric space}.
\end{definition}
You should imagine the author muttering under his breath

`(i) Distances are always positive.

(ii) Two points are zero distance apart if and only
if they are the same point.

(iii) The distance from $A$ to $B$ is the same
as the distance from $B$ to $A$.

(iv) The distance from $A$ to $B$ via $C$
is at least as great as the distance from $A$ to $B$
directly.'

\begin{exercise}\label{E;distance positive}
If $d:X^{2}\rightarrow{\mathbb R}$ is a function with the
following properties:-

(ii) $d(x,y)=0$ if and only if $x=y$,

(iii) $d(x,y)=d(y,x)$ for all $x,\,y\in X$,
                                                                            
(iv) $d(x,y)+d(y,z)\geq d(x,z)$ for all $x,\,y,\,z\in X$,

\noindent show that $d$ is a metric on $X$. 

\noindent$[$Thus condition~(i)
of the definition is redundant.$]$
\end{exercise}
\begin{proof}[Solution]
See page~\pageref{P;distance positive} 
for a solution.
\end{proof}
\begin{exercise} Let $X$ be the set of towns on the British
railway system. Consider the $d$ corresponding to
the examples~(1) to~(4) and discuss informally whether
conditions~(i) to~(iv) apply. 

\noindent$[$An open ended question
like this will be more useful if tackled in a spirit of
good will.$]$
\end{exercise}
\begin{exercise}\label{E;not metric}
Let $X=\{a,\,b,\,c\}$ with $a$, $b$ and $c$
distinct. Write down functions $d_{j}:X^{2}\rightarrow{\mathbb R}$ 
satisfying condition~(i) of Definition~\ref{D;metric}
such that:-

(1) $d_{1}$ satisfies conditions~(ii) and~(iii) but not~(iv).

(2) $d_{2}$ satisfies conditions~(iii) and~(iv) and
$d_{2}(x,y)=0$ implies $x=y$,
but it is not
true that $x=y$ implies $d_{2}(x,y)=0$.

(3) $d_{3}$ satisfies conditions~(iii) and~(iv)
and $x=y$ implies $d_{3}(x,y)=0$.
but it is not
true that  $d_{3}(x,y)=0$ implies $x=y$.

(4) $d_{4}$ satisfies conditions~(ii) and~(iv) but not~(iii).

You should verify your statements.
\end{exercise}
\begin{proof}[Solution] See page~\pageref{P;not metric}.
\end{proof}
We give another axiom grubbing exercise as Exercise~\ref{E;axiom grubbing}.
\begin{exercise} Let $X$ be a set and
$\rho:X^{2}\rightarrow{\mathbb R}$ a function with the
following properties.

(i) $\rho(x,y)\geq 0$ for all $x,\,y\in X$.
                                                                               
(ii) $\rho(x,y)=0$ if and only if $x=y$.
                                                                               
(iv) $\rho(x,y)+\rho(y,z)\geq \rho(x,z)$ for all $x,\,y,\,z\in X$.
    
\noindent Show that, if we set $d(x,y)=\rho(x,y)+\rho(y,x)$,
then $(X,d)$ is a metric space.
\end{exercise}

Here are some examples of metric spaces.
You have met (or you will meet) the concept of a normed
vector space both in algebra and analysis courses.
\begin{definition}\label{D;norm}
Let $V$ be a vector space over ${\mathbb F}$
(with ${\mathbb F}={\mathbb R}$ or 
${\mathbb F}={\mathbb C}$) and $N:V\rightarrow{\mathbb R}$ a map such that,
writing $N({\mathbf u})=\|{\mathbf u}\|$, the following results
hold.

(i) $\|{\mathbf u}\|\geq 0$ for all ${\mathbf u}\in V$.

(ii) If  $\|{\mathbf u}\|=0$, then ${\mathbf u}={\boldsymbol 0}$.

(iii) If $\lambda\in{\mathbb F}$ and ${\mathbf u}\in V$,
then $\|\lambda{\mathbf u}\|=|\lambda| \|{\mathbf u}\|$.

(iv) $[$Triangle law.$]$
If ${\mathbf u},\,{\mathbf v}\in V$, then 
$\|{\mathbf u}\|+\|{\mathbf v}\|\geq \|{\mathbf u}+{\mathbf v}\|$.

\noindent Then we call $\|\ \|$ a \emph{norm} and say that
$(V,\|\ \|)$ is a \emph{normed vector space}.
\end{definition}
\begin{exercise} By putting $\lambda=0$ in Definition~\ref{D;norm}~(iii),
show that $\|{\boldsymbol 0}\|=0$.
\end{exercise}
Any normed vector space can be made into a metric space in a natural way.
\begin{lemma}\label{L;norm to metric} 
If $(V,\|\ \|)$ is a normed vector space,
then the condition 
\[d({\mathbf u},{\mathbf v})=\|{\mathbf u}-{\mathbf v}\|\]
defines a metric $d$ on $V$.
\end{lemma}
\begin{proof} The easy proof is given on page~\pageref{P;norm to metric}.
\end{proof}
Many metrics that we meet in analysis arise in this way.

However, not all metrics can be derived from norms.
Here is a metric that turns out to be more important 
and less peculiar than it looks at first sight.
\begin{definition} If $X$ is a set and we define
$d:X^{2}\rightarrow{\mathbb R}$ by 
\begin{equation*}
d(x,y)=
\begin{cases}
0&\text{if $x=y$},\\
1&\text{if $x\neq y$},
\end{cases}
\end{equation*}
then $d$ is called the \emph{discrete metric} on $X$.
\end{definition}
\begin{lemma}\label{L;discrete is metric} 
The discrete metric on $X$
is indeed a metric.
\end{lemma}
\begin{proof} The easy proof is given on page~\pageref{P;discrete is metric}.
\end{proof} 
\begin{exercise}\label{E;worse discrete} 
(We deal with the matter somewhat better
in Exercise~\ref{E;better discrete})
(i) If $V$ is a vector space over ${\mathbb R}$
and $d$ is a metric derived from a norm in the manner described above,
then, if ${\mathbf u}\in V$ 
we have $d({\boldsymbol 0},2{\mathbf u})=2d({\boldsymbol 0},{\mathbf u})$.

(ii) If $V$ is non-trivial (i.e. not zero-dimensional) vector space
over ${\mathbb R}$ and $d$ is the discrete metric on $V$, then
$d$ cannot be derived from a norm on $V$.
\end{exercise}

In algebra you have learnt (or you will learn) about inner product
spaces. You have learnt (or you will learn) that every inner product
gives rise to a norm in a natural way. Most norms in analysis
do not arise in this way\footnote{This is not part of the
course, but see Exercise~\ref{E;parallelogram} if you are interested.},
but the few that do are very important.
\begin{definition} If ${\mathbf x}\in{\mathbb R}^{n}$, we write
\[\|{\mathbf x}\|_{2}=\left(\sum_{j=1}^{n}x_{j}^{2}\right)^{1/2},\]
where the positive square root is taken. We call $\|\ \|_{2}$
the \emph{Euclidean norm} on ${\mathbb R}^{n}$.
\end{definition}
The reader should prove the next lemma before proceeding further.
If she cannot prove it she should be revising earlier courses rather
than reading about new ones.
(Pay particular attention to the triangle inequality.
In my opinion, the easiest proof uses inner products but
this is only an opinion and you may ignore it.).
\begin{lemma} The Euclidean norm on ${\mathbb R}^{n}$ is indeed a norm.
\end{lemma}
The metric derived from the Euclidean norm is called the \emph{Euclidean
metric}. You should test any putative theorems on metric spaces
on both ${\mathbb R}^{n}$ with the Euclidean metric and 
${\mathbb R}^{n}$ with the discrete metric.
\begin{exercise}{\bf [The counting metric.]} If $E$ is a finite
set and ${\mathcal E}$ is the collection of subsets of $E$,
we write $\card C$ for the number of elements in $C$ and
\[d(A,B)=\card A\triangle B.\]
Show that $d$ is a metric on ${\mathcal E}$. The reader may be
inclined to dismiss this metric as uninteresting but it plays an
important role (as the \emph{Hamming metric}) in the Part~II course
\emph{Codes and Cryptography}.
\end{exercise}
Here are two metrics which are included simply to show that
metrics do not have to be as simple as the ones above.
I shall use them as examples once or twice, but
they do not form part of standard mathematical knowledge
and you do not have to learn their definition.
\begin{definition}\label{D;British Rail} (i) If we define 
$d:{\mathbb R}^{2}\times{\mathbb R}^{2}\rightarrow{\mathbb R}$
by
\[
d({\mathbf u},{\mathbf v})=
\begin{cases}
\|{\mathbf u}\|_{2}+\|{\mathbf v}\|_{2},&
\text{if ${\mathbf u}\neq{\mathbf v}$},\\
0&\text{if ${\mathbf u}={\mathbf v}$,}
\end{cases}
\]
then $d$ is called the \emph{British Rail express metric}. (To get from
$A$ to $B$ travel via London.)

(ii) If we define 
$d:{\mathbb R}^{2}\times{\mathbb R}^{2}\rightarrow{\mathbb R}$
by
\[
d({\mathbf u},{\mathbf v})=
\begin{cases}
\|{\mathbf u}-{\mathbf v}\|_{2}&\text{if ${\mathbf u}$ and ${\mathbf v}$
are linearly dependent,}\\
\|{\mathbf u}\|_{2}+\|{\mathbf v}\|_{2}&\text{otherwise,}
\end{cases}
\]
then $d$ is called the \emph{British Rail stopping metric}. (To get from
$A$ to $B$ travel via London unless $A$ and $B$ are on the same London
route.) 
\end{definition}
(Recall that ${\mathbf u}$ and ${\mathbf v}$
are linearly dependent if ${\mathbf u}=\lambda{\mathbf v}$
for some real $\lambda$ and/or ${\mathbf v}={\boldsymbol 0}$.)
\begin{exercise}\label{E;British Rail is metric} 
Show that the British Rail express metric
and the British Rail stopping metric are indeed metrics.
\end{exercise}
\begin{proof}[Solution] On page~\pageref{P;British Rail is metric}
we show that the British Rail stopping metric is indeed a metric.
The British Rail express metric can be dealt with similarly.
\end{proof}
\section{Continuity and open sets for metric spaces}
Some definitions and results transfer essentially unchanged
from classical analysis on ${\mathbb R}$ to metric spaces.
Recall the classical definition of continuity.
\begin{definition}{\bf [Old definition.]} 
A function $f:{\mathbb R}\rightarrow{\mathbb R}$
is called \emph{continuous} if, given $t\in{\mathbb R}$ and $\epsilon>0$,
we can find a $\delta(t,\epsilon)>0$ such that
\[|f(t)-f(s)|<\epsilon\ \text{whenever $|t-s|<\delta(t,\epsilon)$}.\]
\end{definition}
It is not hard to extend this definition to our new, wider context.
\begin{definition}{\bf [New definition.]}\label{D;metric continuity}
Let $(X,d)$ and $(Y,\rho)$ be metric spaces. 
A function $f:X\rightarrow Y$
is called \emph{continuous} if, given $t\in X$ and $\epsilon>0$,
we can find a $\delta(t,\epsilon)>0$ such that
\[\rho(f(t),f(s))<\epsilon\ \text{whenever $d(t,s)<\delta(t,\epsilon)$}.\]
\end{definition}
It may help you grasp this definition
if you read `$\rho(f(t),f(s))$' as `the distance from $f(t)$ to $f(s)$
in $Y$'
and `$d(t,s)$' as `the distance from $t$ to $s$ in $X$'.

\begin{lemma}{\bf [The composition law.]}\label{L;composition metric} 
If $(X,d)$ and $(Y,\rho)$
and $(Z,\sigma)$ are metric spaces and $g:X\rightarrow Y$, $f:Y\rightarrow Z$
are continuous, then so is the composition $fg$.
\end{lemma}
\begin{proof} This is identical to the one we met in classical analysis.
If needed, details are given on page~\pageref{P;composition metric}.
\end{proof}
\begin{exercise}\label{E;exercise composition}
Let ${\mathbb R}$ and ${\mathbb R}^{2}$ have their usual (Euclidean) metric.

(i) Suppose that $f:{\mathbb R}\rightarrow{\mathbb R}$ and
$g:{\mathbb R}\rightarrow{\mathbb R}$ are continuous. Show that
the map $(f,g):{\mathbb R}^{2}\rightarrow{\mathbb R}^{2}$
is continuous.

(ii) Show that the map $M:{\mathbb R}^{2}\rightarrow{\mathbb R}$
given by $M(x,y)=xy$ is continuous.

(iii) Use the composition law to show that the map 
$m:{\mathbb R}^{2}\rightarrow{\mathbb R}$ 
given by $m(x,y)=f(x)g(y)$ is continuous.
\end{exercise}
\begin{proof}[Solution] See page~\pageref{P;exercise composition}.
\end{proof}
Exercise~\ref{E;exercise composition} may look perverse
at first sight, but, in fact, we usually show functions
to be continuous by considering them as compositions
of simpler functions rather than using the definition directly.
Think about 
\[x\mapsto \log\left(2+\sin\frac{1}{1+x^{2}}\right).\]
If you are interested, we continue the chain of thought
in Exercise~\ref{E;extend composition}. If you are not interested
or are mildly confused by all this,
just ignore this paragraph.

Just as there are `well behaved' and `badly behaved' functions
between spaces,
so there are `well behaved' and `badly behaved' subsets
of spaces. In classical analysis and analysis on metric spaces
the notion of continuous function is sufficiently wide
to give us a large collection of interesting functions
and sufficiently narrow to ensure reasonable 
behaviour\footnote{Sentences like this are not mathematical
statements, but many mathematicians find them useful.}.
In introductory analysis we work on ${\mathbb R}$ with
the Euclidean metric and only consider subsets in the
form of intervals. Once we move to ${\mathbb R}^{2}$ with
the Euclidean metric, it becomes clear that there is
no appropriate analogue to intervals. (We want appropriate rectangles
to be well behaved, but we also want to talk about discs and
triangles and blobs.)

Cantor identified two particular classes of `well behaved'
sets. We start with open sets.
\begin{definition}\label{D;metric open set}
Let $(X,d)$ be a metric space.
We say that a subset $E$ is \emph{open} in $X$ if, whenever
$e\in E$, we can find a $\delta>0$ (depending on $e$)
such that 
\[x\in E\ \text{whenever}\ d(x,e)<\delta.\]
\end{definition} 
Suppose we work in ${\mathbb R}^{2}$ with the Euclidean
metric. If $E$ is an open set then any point ${\mathbf e}$ in $E$
is the centre of a disc of strictly positive radius
all of whose points lie in $E$. If we are sufficiently
short sighted, every point that we can see from ${\mathbf e}$
lies in $E$. This property turns out to be a key to
many proofs in classical analysis (remember that in the
proof of Rolle's theorem it was vital that the maximum
did not lie at an end point) and complex analysis
(where we examine functions analytic \emph{on an open set}).


Here are a couple of simple examples of an open set 
and a simple example
of a set which is not open.
\begin{example}\label{E;Open ball open} 
(i) Let $(X,d)$ be a metric space.
If $r>0$, then
\[B(x,r)=\{y\,:\,d(x,y)<r\}\]
is open. 

(ii) If we work in ${\mathbb R}^{n}$ with the Euclidean metric,
then the one point set $\{{\mathbf x}\}$ is not open.

(iii) If $(X,d)$ is a discrete metric space, then
\[\{x\}=B(x,1/2)\]
and all subsets of $X$ are open.
\end{example}
\begin{proof} See page~\pageref{P;Open ball open}.\end{proof}

We call $B({\mathbf x},r)$ the \emph{open ball} 
with centre ${\mathbf x}$ and radius $r$.
The following result is very important for the course,
but is also very easy to check.
\begin{theorem}\label{T;properties metric open} 
If $(X,d)$ is a metric space, 
then the following statements are true.

(i) The empty set $\emptyset$ and the space $X$ are open.

(ii) If $U_{\alpha}$ is open for all $\alpha\in A$, then
$\bigcup_{\alpha\in A} U_{\alpha}$ is open. (In other words,
the union of open sets is open.)

(iii) If $U_{j}$ is open for all $1\leq j\leq n$, then
$\bigcap_{j=1}^{n} U_{j}$ is open.
\end{theorem}
\begin{proof} See page~\pageref{P;properties metric open}.
\end{proof}
It is important to realise that we place no restriction on
the size of $A$ in~(ii). In particular, $A$ could be uncountable.
However, conclusion~(iii) cannot be extended.
\begin{example}\label{E;countable intersection open}
Let us work in ${\mathbb R}^{n}$ with the usual metric.
Then $B({\mathbf x},1/j)$ is open, but
$\bigcap_{j=1}^{\infty}B({\mathbf x},1/j)=\{{\mathbf x}\}$ is not.
\end{example}
\begin{proof} See Example~\ref{E;Open ball open}.\end{proof}

There is a remarkable connection between the notion of 
open sets and continuity.
\begin{theorem}\label{T;metric continuous open}
Let $(X,d)$ and $(Y,\rho)$ be metric spaces.
A function $f:X\rightarrow Y$ is continuous if and only
if $f^{-1}(U)$ is open in $X$ whenever $U$ is open in $Y$.
\end{theorem}
\begin{proof} See page~\pageref{P;metric continuous open}.
\end{proof}


Note that the theorem does not work `in the opposite direction'.
\begin{example}\label{E;open not continuous} 
Let $X={\mathbb R}$ and $d$ be the discrete metric.
Let $Y={\mathbb R}$ and $\rho$ be the usual (Euclidean)
metric.

(i) If we define $f:X\rightarrow Y$ by $f(x)=x$, then $f$ is continuous
but there exist open sets $U$ in $X$ such that $f(U)$ is not open.

(ii) If we define $g:Y\rightarrow X$ by $g(y)=y$, then $g$ is not continuous
but $g(V)$ is open in $X$ whenever $V$ is open in $Y$.
\end{example}
\begin{proof} Very easy, but see page~\pageref{P;open not continuous}
if you need.
\end{proof}
The message of this example is reinforced by the more
complicated Exercise~\ref{E;nasty discontinuous}. 

Observe that 
Theorem~\ref{T;metric continuous open}
gives a very neat proof of the composition law.
\begin{varthm}[Theorem~\ref{L;composition metric}]%
\label{New proof composition}  
If $(X,d)$, $(Y,\rho)$,
$(Z,\sigma)$ are metric spaces and $g:X\rightarrow Y$, $f:Y\rightarrow Z$
are continuous, 
then so is the composition $fg$.
\end{varthm}
\begin{proof}[New proof] If $U$ is open in $Z$, then,
by continuity, $f^{-1}(U)$ is open in $Y$ and so,
by continuity, $(fg)^{-1}(U)=g^{-1}\big(f^{-1}(U)\big)$
is open in $X$. Thus $fg$ is continuous.
\end{proof}
This confirms our feeling that the ideas of this chapter
are on the right track.

We finish with an exercise, which may be omitted
at first reading, but which should be done at some time
as examples of what open sets can look like.
\begin{exercise}\label{E;British rail balls} 
Consider ${\mathbb R}^{2}$.
For each of the British rail express and
British rail stopping metrics:-

(i) Describe the open balls. (Consider both large
and small radii.)

(ii) Describe the open sets as well as you can.
(There is a nice description for the British rail express
metric.) Give reasons for your answers.
\end{exercise}
\begin{proof}[Solution] See page~\pageref{P;British rail balls}.
\end{proof}

\section{Closed sets for metric spaces} 
The second class of well behaved sets identified by Cantor
were the closed sets. In order to define closed
sets in metric spaces, we need a notion of limit.
Fortunately, the classical definition generalises
without difficulty.
\begin{definition}\label{D;limit}
Consider a sequence $x_{n}$ in a
metric space $(X,d)$. If $x\in X$ and, given $\epsilon>0$,
we can find an integer $N\geq 1$ (depending on $\epsilon$)
such that
\[d(x_{n},x)<\epsilon\ \text{for all $n\geq N$},\]
then we say that $x_{n}\rightarrow x$ as $n\rightarrow\infty$
and that $x$ is the \emph{limit} of the sequence $x_{n}$.
\end{definition}
\begin{lemma}\label{L;limit unique} 
Consider a metric space $(X,d)$. If
a sequence $x_{n}$ has a limit, then that limit is unique.
\end{lemma}
\begin{proof} The simple proof is given on 
page~\pageref{P;limit unique}. Just as in the
next exercise, it suffices to follow the
`first course in analysis' proof with minimal
changes.
\end{proof}
\begin{exercise}\label{E;sequence continuous} 
Consider two metric spaces $(X,d)$ and $(Y,\rho)$.
Show that a function $f:X\rightarrow Y$ is continuous
if and only if, whenever $x_{n}\in X$ and $x_{n}\rightarrow x$
as $n\rightarrow\infty$, we have $f(x_{n})\rightarrow f(x)$
\end{exercise}
\begin{proof}[Solution] See page~\pageref{P;sequence continuous},
if necessary.
\end{proof} 
\begin{definition}\label{D;metric closed set} 
Let $(X,d)$ be a metric space. A set $F$ in $X$
is said to be \emph{closed} if, whenever $x_{n}\in F$ and
$x_{n}\rightarrow x$ as $n\rightarrow\infty$,
it follows that $x\in F$.
\end{definition}
The following exercises are easy, but instructive.
\begin{exercise} (i) If $(X,d)$ is any metric space,
then $X$ and $\emptyset$ are both open and closed.

(ii) If we consider ${\mathbb R}$ with the usual metric
and take $b>a$, then $[a,b]$ is closed but not open,
$(a,b)$ is open but not closed and $[a,b)$ is neither
open nor closed.
\end{exercise}
\begin{exercise}\label{E;better discrete}
(i) If $(X,d)$ is 
a metric space with discrete metric $d$, then
all subsets of $X$ are both open and closed.

(ii) If $V$ is a vector space over ${\mathbb R}$
and $d$ is a metric derived from a norm, show that the 
one point sets $\{{\mathbf x}\}$ are not open.
Deduce that
$d$ cannot be derived from a norm on $V$.
\end{exercise}
It is easy to see why closed sets will be useful in 
those parts of analysis which involve taking limits.
The reader will recall theorems in elementary analysis
(for example the boundedness of continuous functions)
which were true for closed intervals, but not for
other types of intervals.

Life is made much easier by the very close link between
the notions of closed and open sets given by our next theorem.
\begin{theorem}\label{T;closed complements open}
Let $(X,d)$ be a metric space. A set $F$ in $X$
is closed if and only if its complement is open.
\end{theorem}
\begin{proof} We give the proof on page~\pageref{P;closed complements open}.
\end{proof} 
We can now deduce properties of closed 
sets from properties of open sets 
by complementation.
In particular, we have the following
complementary versions of Theorems~\ref{T;properties metric open}
and~\ref{T;metric continuous open}
\begin{theorem}\label{T;properties metric closed} 
If $(X,d)$ is a metric space, 
then the following statements are true.

(i) The empty set $\emptyset$ and the space $X$ are closed.

(ii) If $F_{\alpha}$ is closed for all $\alpha\in A$, then
$\bigcap_{\alpha\in A} F_{\alpha}$ is closed. (In other words
the intersection of closed sets is closed.)

(iii) If $F_{j}$ is closed for all $1\leq j\leq n$, then
$\bigcup_{j=1}^{n} F_{j}$ is closed.
\end{theorem}
\begin{proof} See page~\pageref{P;properties metric closed}.
\end{proof}
\begin{theorem}\label{T;metric continuous closed}
Let $(X,d)$ and $(Y,\rho)$ be metric spaces.
A function $f:X\rightarrow Y$ is continuous if and only
if $f^{-1}(F)$ is closed in $X$ whenever $F$ is closed in $Y$.
\end{theorem}
\begin{proof} See page~\pageref{P;metric continuous closed}.
\end{proof} 
\section{Topological spaces} We now investigate general
objects which have the structure described by
Theorem~\ref{T;properties metric open}.
\begin{definition}\label{D;topology}
Let $X$ be a set and $\tau$ a collection of subsets of $X$ 
with the following properties.

(i) The empty set $\emptyset\in \tau$ and the space $X\in\tau$.

(ii) If $U_{\alpha}\in\tau$ for all $\alpha\in A$, then
$\bigcup_{\alpha\in A} U_{\alpha}\in\tau$.

(iii) If $U_{j}\in\tau$ for all $1\leq j\leq n$, then
$\bigcap_{j=1}^{n} U_{j}\in\tau$.

Then we say that $\tau$ is a \emph{topology} on $X$ and
that $(X,\tau)$ is a \emph{topological space}. 
\end{definition}
\begin{theorem}\label{T;metric topology}
If $(X,d)$ is a metric space, then the collection
of open sets forms a topology.
\end{theorem}
\begin{proof} This is Theorem~\ref{T;properties metric open}.
\end{proof}
If $(X,d)$ is a metric space we call the collection of
open sets the topology \emph{induced} by the metric.

If $(X,\tau)$ is a topological space we extend the notion of
open set by calling the members of $\tau$ \emph{open sets}.
The discussion above ensures what computer scientists call
`downward compatibility'.

\begin{exercise} If $(X,d)$ is a metric space with the
discrete metric, show that the induced topology consists
of all the subsets of $X$.
\end{exercise}
We call the topology consisting of all subsets of $X$
the \emph{discrete} topology on $X$.

\begin{exercise}\label{E;indiscrete} 
If $X$ is a set and $\tau=\{\emptyset,X\}$,
then $\tau$ is a topology.
\end{exercise}
We call $\{\emptyset,X\}$ the 
\emph{indiscrete} topology on $X$.

\begin{exercise} (i) If $F$ is a  finite set
and $(F,d)$ is a metric space, show that the induced
topology is the discrete topology.

(ii) If $F$ is a finite set with more than one point,
show that the indiscrete topology is not induced by any
metric.
\end{exercise}

You should test any putative theorems on topological spaces
on the discrete topology and the indiscrete topology,
${\mathbb R}^{n}$ with the topology derived from
the Euclidean metric and 
$[0,1]$ with the topology derived from
the Euclidean metric.

The following exercise is tedious but instructive
(the tediousness is the instruction).
\begin{exercise}\label{E;silly count} 
Write ${\mathcal P}(Y)$ for the collection
of subsets of $Y$. If $X$ has three elements, how many
elements does ${\mathcal P}\big({\mathcal P}(X)\big)$
have?

How many topologies are there on $X$?
\end{exercise}
\begin{proof}[Solution] See page~\pageref{P;silly count}.\end{proof}

The idea of downward compatibility suggests `turning
Theorem~\ref{T;metric continuous open} in a definition'.
\begin{definition}\label{D;topological continuity}
Let $(X,\tau)$ and $(Y,\sigma)$ be topological spaces.
A function $f:X\rightarrow Y$ is said to be 
\emph{continuous} if and only
if $f^{-1}(U)$ is open in $X$ whenever $U$ is open in $Y$.
\end{definition}
Theorem~\ref{T;metric continuous open} tells us that
if $(X,d)$ and $(Y,\rho)$ are metric spaces the notion
of a continuous function $f:X\rightarrow Y$ is the same
whether we consider the metrics or the topologies derived from 
them.

The proof of Theorem~\ref{L;composition metric}
given on page~\pageref{New proof composition}
carries over unchanged to give the following generalisation.
\begin{theorem}
If $(X,\tau)$, $(Y,\sigma)$,
$(Z,\mu)$ are topological spaces and 
$g:X\rightarrow Y$, $f:Y\rightarrow Z$
are continuous, then so is the composition $fg$.
\end{theorem}

Downward compatibility suggests the definition of a closed
set for a topological space based on 
Theorem~\ref{T;closed complements open}.
\begin{definition}\label{D;closed topologically}
Let $(X,\tau)$ be a topological space. A set $F$ in $X$
is said to be \emph{closed} if its complement is open.
\end{definition}
Theorem~\ref{T;closed complements open} tells us that
if $(X,d)$ is a metric space the notion
of a closed set is the same
whether we consider the metric or the topology derived 
from it.

Just as in the metric case, we can
deduce properties of closed sets from properties of open sets 
by complementation. In particular, the same proofs as we
gave in the metric case give the following extensions of
Theorems~\ref{T;properties metric closed}
and~\ref{T;metric continuous closed}
\begin{theorem} 
If $(X,\tau)$ is a topological space, 
then the following statements are true.

(i) The empty set $\emptyset$ and the space $X$ are closed.

(ii) If $F_{\alpha}$ is closed for all $\alpha\in A$, then
$\bigcap_{\alpha\in A} F_{\alpha}$ is closed. (In other words,
the intersection of closed sets is closed.)

(iii) If $F_{j}$ is closed for all $1\leq j\leq n$, then
$\bigcup_{j=1}^{n} F_{j}$ is closed.
\end{theorem}
\begin{theorem}
Let $(X,\tau)$ and $(Y,\sigma)$
be topological spaces.
A function $f:X\rightarrow Y$ is continuous if and only
if $f^{-1}(F)$ is closed in $X$ whenever $F$ is closed in $Y$.
\end{theorem}
\section{Interior and closure}\label{S;interior} 
The next section is short, not because 
the ideas are unimportant, but because they are so useful that
the reader will meet them over and over again in other courses.
\begin{definition}\label{D;interior}
Let $(X,\tau)$ be a topological space and
$A$ a subset of $X$. We write
\[\Int A=\bigcup\{U\in\tau\,:\,U\subseteq A\}
\ \text{and}
\ \Cl A=\bigcap\{F\ \text{closed}\,:\,F\supseteq A\}\]
and call $\Cl A$ the \emph{closure} of $A$ and
$\Int A$ the \emph{interior} of $A$.
\end{definition}
Simple complementation, which I leave to the reader,
shows how closely the two notions of closure and interior
are related. (Recall that $A^{c}=X\setminus A$,
the complement of $A$.) 
\begin{lemma} With the notation of Definition~\ref{D;interior}
\[(\Cl A^{c})^{c}=\Int A
\ \text{and}
\ (\Int A^{c})^{c}=\Cl A.\]
\end{lemma}

There are other useful ways of viewing $\Int A$ and $\Cl A$.
\begin{lemma}\label{L;other interiors}  
Let $(X,\tau)$ be a topological space and
$A$ a subset of $X$. 

(i) $\Int A=\{x\in A\,:\,\exists\ U\in\tau\ \text{with}
\ x\in U\subseteq A\}$.

(ii) $\Int A$ is the unique $V\in\tau$ such that
$V\subseteq A$ and, if $W\in\tau$ and $V\subseteq W\subseteq A$,
then $V=W$. (Informally, $\Int A$ is the largest open set
contained in $A$.)
\end{lemma}
\begin{proof} The easy proof is given on 
page~\pageref{P;other interiors}.
\end{proof}
Simple complementation, which I leave to the reader,
gives the corresponding results for closure.
\begin{lemma}\label{L;other closures}  
Let $(X,\tau)$ be a topological space and
$A$ a subset of $X$. 

(i) $\Cl A=\{x\in A:\forall U\in\tau\ \text{with $x\in U$,
we have}
\ A\cap U\neq\emptyset\}$.

(ii) $\Cl A$ is the unique closed set $G$ such that
$G\supseteq A$ and, if $F$ is closed with 
$G\supseteq F\supseteq A$,
then $F=G$. (Informally, $\Cl A$ is the smallest closed set
containing $A$.)
\end{lemma}
\begin{exercise} Prove Lemma~\ref{L;other closures}
directly without using Lemma~\ref{L;other interiors}.
\end{exercise}

Sometimes, when touring an ancient college, you may be shown
a 14th century wall which still plays an important
part in holding up the building. The next lemma
goes back to Cantor and the very beginnings of topology.
(It would then have been a definition rather than
a lemma.) 
\begin{lemma}\label{L;back to the future} Let
$(X,d)$ be a metric space and $A$ a subset of $X$.
Then $\Cl A$ consists of all those $x$ such
that we can find $x_{n}\in A$ with $d(x,x_{n})\rightarrow 0$.
(In old fashioned terminology, the closure of $A$
is its set of \emph{limit points}.)
\end{lemma}
\begin{proof} The easy proof is given on 
page~\pageref{P;back to the future}.
\end{proof}

The idea of closure is strongly linked to the idea
of a dense subset.
\begin{definition}\label{D;dense} 
Let $(X,\tau)$ be a topological 
space and $F$ a closed subset of $X$. We say
that $A\subseteq X$ is \emph{dense} subset of $F$
if $\Cl A=F$. 
\end{definition}
In some sense $A$ is a `skeleton' of $F$ and we may
hope to prove results about $F$ by first proving them
on the dense subset $A$ and then extending the result
by `density'. Sometimes this idea works
(see, for example, part~(i) of Exercise~\ref{E;call me dense})
and sometimes it does not 
(see, for example, part~(ii) of Exercise~\ref{E;call me dense}).
When it does work, this is very powerful technique.
\begin{exercise}\label{E;call me dense}
(i) Let $(X,\tau)$ be a topological space
and $(Y,d)$ a metric space\footnote{We give a slight
improvement in Exercise~\ref{E;call me Hausdorff}.}.
If $f,\,g:X\rightarrow Y$ are continuous and $f(x)=g(x)$
for all $x\in A$, where $A$ is dense in $X$, show that
$f(x)=g(x)$ for all $x\in X$.

(ii) Consider  the unit interval $[0,1]$ with the
Euclidean metric and $A=[0,1]\cap{\mathbb Q}$
with the inherited metric. Exhibit,
with proof, a continuous map 
$f:A\rightarrow{\mathbb R}$
(where ${\mathbb R}$ has the standard metric)
such that there does not exist
a continuous map 
$\tilde{f}:[0,1]\rightarrow{\mathbb R}$
with $\tilde{f}(x)=f(x)$ for all $x\in A$.
\end{exercise} 
\begin{proof}[Solution] We give the solution
on Page~\ref{P;call me dense}
\end{proof}
\section{More on topological structures} Two groups 
are the same for the
purposes of group theory if they are (group) isomorphic.
Two vector spaces are the same for the purposes of 
linear algebra if they are (vector space) isomorphic.
When are two topological spaces $(X,\tau)$
and $(Y,\sigma)$ the same for
the purposes of topology? In other words, when
does there exist a bijection between $X$ and $Y$
in which open sets correspond to open sets,
and the grammar of topology (things like union and inclusion)
is preserved? A little reflection shows that the
next definition provides the answer we want.
(Exercise~\ref{E;inverse} is vaguely relevant.)
\begin{definition}\label{D;homeomorphisms} 
We say that two topological spaces
$(X,\tau)$ and $(Y,\sigma)$ are \emph{homeomorphic} if there
exists a bijection 
$\theta:X\rightarrow Y$ such that $\theta$ and $\theta^{-1}$
are continuous. We call $\theta$ a \emph{homeomorphism}.
\end{definition}
The following exercise acts as useful revision of concepts
learnt last year.
\begin{exercise} Show that homeomorphism is an equivalence
relation on topological spaces.
\end{exercise}
Homeomorphism only implies 
equivalence\label{R;topological properties} 
\emph{for the purposes of topology}. 
To emphasise this, we introduce a couple of related ideas which are
fundamental to analysis on metric spaces, but which will
only be referred to here in this course.
\begin{definition}\label{D;completeness} 
(i) If $(X,d)$ is a metric space,
we say that a sequence $x_{n}$ in $X$ is \emph{Cauchy} if, given
$\epsilon>0$, we can find an $N_{0}(\epsilon)$ with
\[d(x_{n},x_{m})<\epsilon\ \text{whenever $n,\,m\geq N_{0}(\epsilon)$}.\]

(ii) We say that a metric space $(X,d)$ is \emph{complete}
if every Cauchy sequence converges.
\end{definition}
\begin{example}\label{E;Cauchy not topological} 
Let $X={\mathbb R}$ and let $d$ be the usual metric on ${\mathbb R}$.
Let $Y=(0,1)$ (the open interval with end points $0$ and $1$)
and let $\rho$ be the usual metric on $(0,1)$. Then
$(X,d)$ and $(Y,\rho)$ are homeomorphic as topological spaces,
but $(X,d)$ is complete and $(Y,\rho)$ is not.
\end{example}
\begin{proof} See page~\pageref{P;Cauchy not topological}.
\end{proof}
We say that `completeness is not a topological property'.
Exercise~\ref{E;forever incomplete} shows that
there exist metric spaces which are not homeomorphic
to any complete metric space.


In group theory, we usually prove that two groups are isomorphic
by constructing an explicit isomorphism and that two groups
are not isomorphic by finding a group property
exhibited by one but not by the other. Similarly, in
topology, we usually prove that two topological spaces
are homeomorphic
by constructing an explicit homeomorphism and that two
topological spaces
are not homeomorphic by finding a topological property
exhibited by one but not by the other. Later in this course
we will meet some topological properties like being
Hausdorff and compactness and you will be able to
tackle Exercise~\ref{E;homeomorphic, non-homeomorphic}.

We also want to be able to construct new topological
spaces from old. To do this we we make use of a simple,
but useful, lemma.
\begin{lemma}\label{L;coarsest topology} 
Let $X$ be a space and let ${\mathcal H}$ be a
collection of subsets of $X$. Then there exists a unique topology
$\tau_{{\mathcal H}}$ such that 

(i) $\tau_{{\mathcal H}}\supseteq{\mathcal H}$, and

(ii) if $\tau$ is a topology with $\tau\supseteq {\mathcal H}$,
then $\tau\supseteq \tau_{{\mathcal H}}$.
\end{lemma}
\begin{proof} The proof, which follows the standard pattern
for such things, is given on page~\pageref{P;coarsest topology}.
\end{proof}
We call $\tau_{\mathcal H}$ the smallest (or coarsest)  topology
containing ${\mathcal H}$.

\begin{lemma}\label{L;smallest continuous} 
Suppose that $A$ is non-empty and the 
spaces $(X_{\alpha},\tau_{\alpha})$
are topological spaces and we have maps 
$f_{\alpha}:X\rightarrow X_{\alpha}$ $[\alpha\in A]$.
Then there is a smallest topology $\tau$ on $X$ for which
the maps $f_{\alpha}$ are continuous.
\end{lemma}
\begin{proof} A topology $\sigma$ on $X$ makes all the $f_{\alpha}$
continuous if and only if it contains
\[{\mathcal H}=\{f_{\alpha}^{-1}(U)\,:\,
U\in\tau_{\alpha},\ \alpha\in A\}.\]
Now apply Lemma~\ref{L;coarsest topology}.
\end{proof}

Recall that, if $Y\subseteq X$, then the inclusion map $j:Y\rightarrow X$
is defined by $j(y)=y$ for all $y\in Y$.
\begin{definition}\label{D;subspace topology}
If $(X,\tau)$ is a topological space
and $Y\subseteq X$ then the \emph{subspace topology} $\tau_{Y}$ on $Y$
\emph{induced} by $\tau$ is the smallest topology on $Y$ for which the
inclusion map is continuous.
\end{definition}
\begin{lemma}\label{L;subspace topology} 
If $(X,\tau)$ is a topological space
and $Y\subseteq X$, then the subspace topology $\tau_{Y}$ on $Y$
is the collection of sets $Y\cap U$ with $U\in\tau$.
\end{lemma}
\begin{proof} The very easy proof is given on 
page~\pageref{P;subspace topology}.
\end{proof}
\begin{exercise} 
(i) If $(X,\tau)$ is a topological space
and $Y\subseteq X$ is open, 
show that the subspace topology $\tau_{Y}$ on $Y$
is the collection of sets $U\in\tau$ with $U\subseteq Y$.

(ii) Consider ${\mathbb R}$ with the usual topology $\tau$
(that is, the topology derived from the Euclidean metric).
If $Y=[0,1]$, show that $[0,1/2)\in\tau_{Y}$ but $[0,1/2)\notin\tau$.
\end{exercise}
\begin{exercise}
Let $(X,d)$ be a metric space, $Y$ a subset
of $X$ and $d_{Y}$ the metric $d$ restricted to $Y$
(formally, $d_{Y}:Y^{2}\rightarrow{\mathbb R}$ is given by 
$d_{Y}(x,y)=d(x,y)$ for $x,\,y\in Y$). Then if we
give $X$ the topology induced by $d$, the subspace
topology on $Y$ is identical with the topology induced by $d_{Y}$.

\noindent$[$This is an exercise in stating the obvious.$]$
\end{exercise}
Next recall that if $X$ and $Y$ are sets
the projection maps $\pi_{X}:X\times Y\rightarrow X$ and
$\pi_{Y}:X\times Y\rightarrow Y$
are given by
\begin{align*}
\pi_{X}(x,y)&=x,\\
\pi_{Y}(x,y)&=y.
\end{align*}
\begin{definition}\label{D;product topology} 
If $(X,\tau)$ and $(Y,\sigma)$
are topological spaces, then the \emph{product topology}
$\mu$ on $X\times Y$ is
the smallest topology on $X\times Y$ for which the
projection maps $\pi_{X}$ and $\pi_{Y}$ are continuous.
\end{definition}
\begin{lemma}\label{L;product topology} 
Let $(X,\tau)$ and $(Y,\sigma)$
be topological spaces and $\lambda$ the product topology
on $X\times Y$.
Then $O\in\lambda$ if and only if, given $(x,y)\in O$,
we can find $U\in \tau$ and $V\in \sigma$ such that
\[(x,y)\in U\times V\subseteq O.\]
\end{lemma}
\begin{proof} See page~\pageref{P;product topology}.
\end{proof}
We give a slightly different treatment of the matter
in Exercise~\ref{E;products via basis}. 

The next remark is useful for proving results
like those in Exercise~\ref{E;metric product}.
\begin{lemma}\label{L;same topology}
Let $\tau_{1}$ and $\tau_{2}$ be two topologies
on the same space $X$. 

(i) We have $\tau_{1}\subseteq\tau_{2}$
if and only if, given $x\in U\in\tau_{1}$, we can find
$V\in\tau_{2}$ such that $x\in V\subseteq U$.

(ii)We have $\tau_{1}=\tau_{2}$
if and only if, given $x\in U\in\tau_{1}$, we can find
$V\in\tau_{2}$ such that $x\in V\subseteq U$
and, given $x\in U\in\tau_{2}$, we can find
$V\in\tau_{1}$ such that $x\in V\subseteq U$.
\end{lemma}
\begin{proof} The easy proof is given on Page~\pageref{P;same topology}
\end{proof}
\begin{exercise}\label{E;metric product} 
Let $(X_{1},d_{1})$ and $(X_{2},d_{2})$ be metric
spaces. Let $\tau$ be the product topology on $X_{1}\times X_{2}$
where $X_{j}$ is given the topology induced by $d_{j}$ $[j=1,2]$.

Define $\rho_{k}:(X_{1}\times X_{2})^{2}\rightarrow {\mathbb R}$
by
\begin{align*}
\rho_{1}((x,y),(u,v))&=d_{1}(x,u),\\ 
\rho_{2}((x,y),(u,v))&=d_{1}(x,u)+d_{2}(y,v),\\
\rho_{3}((x,y),(u,v))&=\max(d_{1}(x,u),d_{2}(y,v)),\\
\rho_{4}((x,y),(u,v))&=(d_{1}(x,u)^{2}+d_{2}(y,v)^{2})^{1/2}.
\end{align*}

Establish that $\rho_{1}$ is not a metric
and that $\rho_{2}$, $\rho_{3}$ and $\rho_{4}$ are.
Show that each of the $\rho_{j}$ with $2\leq j\leq 4$ induces the
product topology $\tau$ on $X_{1}\times X_{2}$.
\end{exercise}
It is easy to extend our definitions and results to
any finite product of topological spaces\footnote{Once you
are confident with the material you may wish to look
at Exercise~\ref{E;every which way}, but this exercise
is confusing for the beginner and trivial to the
expert.}. In fact,
it is not difficult to extend our definition
to the product of an infinite collection
of topological spaces, but I feel
that it is important for the reader to concentrate on
first thoroughly 
understanding the finite product case and I have relegated the 
infinite case to an exercise (Exercise~\ref{E;Infinite product}).  

We conclude this chapter by looking briefly at the
quotient topology. This will not play a major part in
our course and the reader should not worry too much about it.

If $\sim$ is an equivalence relation on a 
set $X$,
then we know from previous courses that it gives
rise to equivalence classes
\[[x]=\{y\in X\,:\,y\sim x\}.\]
There is a natural map $q$ from $X$ to the space $X/\negthinspace\sim$
of equivalence classes given by $q(x)=[x]$. When
we defined the subspace and product topologies,
we used natural maps from the new spaces to the
old spaces. Here, we have a natural map from
the old space to the new, so our definition 
has to take a different form.

Since intersection and union behave well under
inverse mappings, it is 
easy to check the following statement.
\begin{lemma}\label{L;quotient lemma} 
Let $(X,\tau)$ be a topological space
and $\sim$ an equivalence relation on $X$.
Write $q$ for the map from $X$ to the 
quotient space $X/\negthinspace\sim$
given by $q(x)=[x]$. Then
\[\sigma=\{U\subseteq X/\negthinspace\sim\,:\,q^{-1}(U)\in\tau\}\]
is a topology.
\end{lemma}
\begin{definition} Under the assumptions and with the notation
of Lemma~\ref{L;quotient lemma} we call $\sigma$ the 
\emph{quotient topology} on $X/\negthinspace\sim$.
\end{definition}
The following is just a restatement of the definition.
\begin{lemma} Under the assumptions and with the notation
of Lemma~\ref{L;quotient lemma}, the quotient topology
consists of the sets $U$ such that
\[\bigcup_{[x]\in U}[x]\in\tau.\]
\end{lemma}
Later we shall give an example (Exercise~\ref{E;circle as quotient})
of a nice quotient topology.
Exercise~\ref{E;nasty line}, which requires
ideas from later in the course, is an example of really
nasty  quotient topology.

In general, the quotient topology can be extremely
unpleasant (basically because equivalence relations
form a very wide class) and although nice equivalence
relations sometimes give very useful quotient topologies,
you should always think before using one.
Exercises~\ref{E;quotient remarks} and~\ref{E;quotient non Hausdorff}
give some
further information.
\section{Hausdorff spaces}\label{S;Hausdorff spaces} 
When we work in a metric space, we make
repeated use of the fact that, if $d(x,y)=0$ then $x=y$.
The metric is `powerful enough to separate points'.
The indiscrete topology, on the other hand, clearly
cannot separate points.

When Hausdorff first crystallised the modern idea
of a topological space, he included an extra condition
to ensure `separation of points'. It was later
discovered that topologies without this extra condition
could be useful, so it is now considered separately.

\begin{definition} A topological space $(X,\tau)$ is called
\emph{Hausdorff} if, whenever $x,\,y\in X$ and $x\neq y$, we can
find $U,\,V\in\tau$ such that $x\in U$, $y\in V$ and
$U\cap V=\emptyset$.
\end{definition}
In the English educational system, it is traditional
to draw $U$ and $V$ as little huts containing $x$ and $y$
and to say that $x$ and $y$ are `housed off from each other'.

The next exercise requires a one line answer, but you should
write that line down.
\begin{exercise} Show that, 
if $(X,d)$ is a metric space, then the
derived topology is Hausdorff.
\end{exercise}

Although we defer the discussion of neighbourhoods
in general to towards the end of the course, it is natural
to introduce the following locution here.
\begin{definition}\label{D;open neighbourhood}
If $(X,\tau)$ is a topological space and $x\in U\in\tau$,
we call $U$ an \emph{open neighbourhood} of $x$.
\end{definition}
\begin{exercise}\label{E;open via neighbourhood} 
If $(X,\tau)$ is a topological space, then
a subset $A$ of $X$ is open if and only if every
point of $A$ has an open neighbourhood $U\subseteq A$.
\end{exercise}
\begin{proof} The easy proof is given on 
page~\pageref{P;open via neighbourhood}.
\end{proof}
\begin{lemma}\label{L;Hausdorff point}
If $(X,\tau)$ is a Hausdorff space, then the one
point sets $\{x\}$ are closed.
\end{lemma}
\begin{proof} The easy proof is given on 
page~\pageref{P;Hausdorff point}.
\end{proof}
The following exercise shows that the converse 
to Lemma~\ref{L;Hausdorff point} is false
and that, if we are to acquire any intuition about
topological spaces, we will need to study a wide range
of examples.
\begin{exercise}\label{E;finite complement} 
Let $X$ be infinite (we could take $X={\mathbb Z}$
or $X={\mathbb R}$).
We say that a subset $E$ of $X$ lies in $\tau$ if
either $E=\emptyset$ or $X\setminus E$ is finite.
Show that $\tau$ is a topology 
and that every one
point set $\{x\}$ is closed but that $(X,\tau)$
is not Hausdorff.

What happens if $X$ is finite?
\end{exercise}
\begin{proof}[Solution] See page~\pageref{P;finite complement}.
\end{proof}
\begin{exercise}\label{E;call me Hausdorff} 
Prove 
Exercise~\ref{E;call me dense}~(i)
with `$(Y,d)$ a metric space' replaced by
`$(Y,\sigma)$ a Hausdorff topological space'.
\end{exercise}


It is easy to give examples of topologies which are not 
derived from metrics. It is somewhat harder to give examples
of Hausdorff topologies which are not derived from metrics.
An example is given in Exercise~\ref{E;Hausdorff not metric}.

The next two lemmas are very useful.
\begin{lemma}\label{L;inherit Hausdoff subspace}
If $(X,\tau)$ is a Hausdorff topological space
and $Y\subseteq X$, then $Y$ with the subspace topology
is also Hausdorff.
\end{lemma}
\begin{proof} The easy proof is given on 
page~\pageref{P;inherit Hausdoff subspace}.
\end{proof}
\begin{lemma}\label{L;inherit Hausdoff product}
If $(X,\tau)$ and $(Y,\sigma)$ are Hausdorff topological spaces,
then $X\times Y$ with the product topology
is also Hausdorff.
\end{lemma}
\begin{proof} The proof is easy (but there is one place where
you can make a silly mistake). We give it on
page~\pageref{P;inherit Hausdoff product}.
\end{proof}

Exercise~\ref{E;quotient non Hausdorff} shows that, even when
the original topology is Hausdorff, the resulting quotient 
topology need not be.
\section{Compactness} Halmos says somewhere that if
an idea is used once it is a trick, if used twice it
is a method, if used three times a theorem but if used
four times it becomes an axiom.

Several important theorems in analysis
hold for closed bounded intervals. Heine
used a particular idea to prove one of
these. Borel isolated the idea as a theorem
(the Heine--Borel theorem), essentially 
Theorem~\ref{T;Heine--Borel} below.
Many treatments of analysis (for example,
Hardy's \emph{Pure Mathematics}) use the 
Heine--Borel theorem as a basic tool.
The notion of compactness represents the last stage in
in the Halmos progression.

\begin{definition}\label{D;compact} 
A topological space $(X,\tau)$
is called \emph{compact} if, whenever we have a collection
$U_{\alpha}$ of open sets $[\alpha\in A]$
with $\bigcup_{\alpha\in A}U_{\alpha}=X$, we can find a
finite subcollection $U_{\alpha(1)}$,
$U_{\alpha(2)}$, \dots, $U_{\alpha(n)}$
with $\alpha(j)\in A$ $[1\leq j\leq n]$
such that $\bigcup_{j=1}^{n}U_{\alpha(j)}=X$.
\end{definition}
\begin{definition} If $(X,\tau)$ is a topological space,
then a subset $Y$ is called \emph{compact} if the subspace topology
on $Y$ is compact.
\end{definition}
The reader should have no difficulty in combining
these two definitions to come up with the
following restatement,
\begin{lemma}\label{L;compact equivalence} If $(X,\tau)$ 
is a topological space,
then a subset $Y$ is compact if, whenever we have a collection
$U_{\alpha}$ of open sets $[\alpha\in A]$
with $\bigcup_{\alpha}U_{\alpha}\supseteq Y$, we can find a
finite subcollection $U_{\alpha(1)}$,
$U_{\alpha(2)}$, \dots, $U_{\alpha(n)}$
with $\alpha(j)\in A$ $[1\leq j\leq n]$
such that $\bigcup_{j=1}^{n}U_{\alpha(j)}\supseteq Y$.
\end{lemma}
In other words, `a set is compact if any cover by
open sets has a finite subcover'.

The reader is warned that compactness is a subtle
property which requires time and energy 
to master\footnote{My generation only reached compactness 
after a long exposure to the classical Heine--Borel
theorem.}.
(At the simplest level, a substantial minority
of examinees fail to get the definition correct.)
Up to this point most of the proofs in this course
have been simple deductions from
definitions. Several of our theorems
on compactness go much deeper and have quite intricate proofs.

Here are some simple examples of compactness and non-compactness.
\begin{exercise}\label{E;simple compact examples}
(i) Show that, if $X$ is finite, every
topology on $X$ is compact.

(ii) Show that the discrete topology on a set $X$ is
compact if and only if $X$ is finite.

(iii) Show that the indiscrete topology is always compact.

(iv) Show that the topology described in 
Exercise~\ref{E;finite complement} is compact.

(v) Let $X$ be uncountable (we could take
$X={\mathbb R}$).
We say that a subset $A$ of $X$ lies in $\tau$ if
either $A=\emptyset$ or $X\setminus A$ is countable.
Show that $\tau$ is a topology
but that $(X,\tau)$
is not compact.
\end{exercise}
\begin{proof}[Solution] We give a partial solution for
parts~(iv) and~(v) on page~\pageref{P;simple compact examples}.
\end{proof}

We now come to our first major
theorem.
\begin{theorem}{\bf [The Heine--Borel Theorem.]}%
\label{T;Heine--Borel}
Let ${\mathbb R}$ be given its usual
topology (that is to say the topology derived 
from the usual Euclidean metric). Then the closed bounded interval
$[a,b]$ is compact.
\end{theorem}
\begin{proof} I give a hint on page~\pageref{H;Heine--Borel}
and a proof on ~\pageref{P;Heine--Borel}.
An alternative proof, which is much less instructive,
is given on page~\pageref{Alternative Heine--Borel}.
\end{proof}
Lemma~\ref{L;compact equivalence} gives the following
equivalent statement.
\begin{theorem}\label{T;closed interval compact}
Let $[a,b]$ be given its usual topology
(that is to say the topology derived 
from the usual Euclidean metric).
Then the derived topology is compact.
\end{theorem}

We now have a couple of very useful
results.
\begin{theorem}\label{T;closed subset compact} 
A closed subset of a compact set is compact.
$[$More precisely, if $E$ is compact and $F$ closed 
in a given topology, then, if $F\subseteq E$, it follows that
$F$ is compact.$]$
\end{theorem}
\begin{proof} This is easy if you look at it the right way.
See page~\pageref{P;closed subset compact}.
\end{proof}
\begin{theorem}\label{T;compact closed} 
If $(X,\tau)$ is Hausdorff, then every compact set is closed.
\end{theorem}
\begin{proof} This is harder, though it becomes easier if you realise
that you must use the fact that $\tau$ is Hausdorff
(see Example~\ref{E;compact not closed} below).
We give a hint on page~\pageref{H;compact closed}
and a proof on page~\pageref{P;compact closed}.
\end{proof}
\begin{example}\label{E;compact not closed} 
Give an example of a topological space $(X,\tau)$
and a compact set in $X$ which is not closed.
\end{example}
\begin{proof} There is a topological space with two points
which will do. See page~\pageref{P;compact not closed}.
\end{proof}
Combining the Heine--Borel theorem with
Theorems~\ref{T;closed subset compact}
and~\ref{T;compact closed} and a little thought,
we get a complete characterisation of the compact subsets
of ${\mathbb R}$ (with the standard topology).
\begin{theorem}~\label{T;closed bounded}
Consider $({\mathbb R},\tau)$ with the standard 
(Euclidean) topology. A set $E$ is compact if and
only if it is closed and bounded
(that is to say, there exists a 
$M$ such that $|x|\leq M$ for all $x\in E$).
\end{theorem}
\begin{proof} The easy proof is given
on page~\pageref{P;closed bounded}.
\end{proof}

In Example~\ref{E;open not continuous} we saw that the
continuous image of an open set need not be open.
It also easy to see that the
continuous image of a closed set need not be closed.
\begin{exercise} Let ${\mathbb R}$ have the usual metric.
Give an example of a continuous injective function
$f:{\mathbb R}\rightarrow{\mathbb R}$ such that
$f({\mathbb R})$ is not closed.
\end{exercise}
\begin{proof}[Hint] Look at the solution
of Example~\ref{E;Cauchy not topological}
if you need a hint.
\end{proof}

However, the continuous image of a compact set
is always compact.
\begin{theorem}\label{T;compact image} 
Let $(X,\tau)$ and $(Y,\sigma)$
be topological spaces and $f:X\rightarrow Y$ a continuous
function. If $K$ is a compact subset of $X$,
then $f(K)$ is a compact subset of $Y$.
\end{theorem}
\begin{proof} This is easy if you look at it the right way.
See page~\pageref{P;compact image}.
\end{proof}

This result has many delightful consequences.
Recall, for example, that the quotient topology
$X/\negthinspace\sim$ is defined in such a way that the
quotient map $q:X\rightarrow X/\negthinspace\sim$ is continuous.
Since $q(X)=X/\negthinspace\sim$,
Theorem~\ref{T;compact image} gives us
a positive property of the quotient topology.
\begin{theorem}\label{T;quotient compact} 
Let $(X,\tau)$ be a compact topological space
and $\sim$ an equivalence relation on $X$.
Then the quotient topology on $X/\negthinspace\sim$ is compact.
\end{theorem}
The next result follows at once from our
characterisation of compact sets for the real
line with the usual topology.
\begin{theorem} 
Let ${\mathbb R}$ have the usual metric.
If $K$ is a closed and bounded subset of ${\mathbb R}$
and $f:K\rightarrow{\mathbb R}$ is continuous,
then $f(K)$ is closed and bounded.
\end{theorem}
This gives a striking extension of one of the
crowning glories of a first course in analysis.
\begin{theorem}\label{T;attains bounds} 
Let ${\mathbb R}$ have the usual metric.
If $K$ is a
closed and bounded subset of ${\mathbb R}$
and $f:K\rightarrow{\mathbb R}$ is continuous,
then $f$ is bounded and attains its bounds.
\end{theorem}
\begin{proof} The straightforward proof 
is given on 
page~\pageref{P;attains bounds}.
\end{proof}
Theorem~\ref{T;attains bounds} is complemented
by the following observation.
\begin{exercise}\label{E;converse attains bounds} 
Let ${\mathbb R}$ have the usual metric.
If $K$ is subset of ${\mathbb R}$ with the property
that, whenever $f:K\rightarrow{\mathbb R}$ is continuous,
$f$ is bounded, it follows
that $K$ is closed and bounded.
\end{exercise}
\begin{proof} See page~\pageref{P;converse attains bounds}.
\end{proof}
Theorem~\ref{T;attains bounds}
has the following straightforward generalisation
whose proof is left to the reader.
\begin{theorem}\label{T;compact attains bounds}
If $K$ is a compact space
and $f:K\rightarrow{\mathbb R}$ is continuous
then $f$ is bounded and attains its bounds.
\end{theorem}
 
We also have the following useful result.
\begin{theorem}\label{T;bijection compact} 
Let $(X,\tau)$ be a compact and $(Y,\sigma)$
a Hausdorff topological space. If $f:X\rightarrow Y$ 
is a continuous bijection, then it is a homeomorphism.
\end{theorem}
\begin{proof} There is a hint on page~\pageref{H;bijection compact}
and a proof on page~\pageref{P;bijection compact}.
\end{proof}
 
Theorem~\ref{T;bijection compact} is illuminated by the following 
almost trivial remark.
\begin{lemma} Let $\tau_{1}$ and $\tau_{2}$ be topologies
on the same space $X$. The identity map
\[\iota:(X,\tau_{1})\rightarrow(X,\tau_{2})\]
from $X$ with topology $\tau_{1}$ to 
$X$ with topology $\tau_{2}$ given by $\iota(x)=x$
is continuous if and only if $\tau_{1}\supseteq\tau_{2}$.
\end{lemma} 
\begin{theorem}\label{T;compare topologies} 
Let $\tau_{1}$ and $\tau_{2}$ be topologies
on the same space $X$.

(i) If $\tau_{1}\supseteq \tau_{2}$ and $\tau_{1}$ is compact,
then so is $\tau_{2}$.

(ii) If $\tau_{1}\supseteq \tau_{2}$ and $\tau_{2}$ is Hausdorff,
then so is $\tau_{1}$.

(iii) If $\tau_{1}\supseteq \tau_{2}$, $\tau_{1}$ is compact
and $\tau_{2}$ is Hausdorff, then $\tau_{1}=\tau_{2}$.
\end{theorem}
\begin{proof} The routine proof is given 
on page~\pageref{P;compare topologies}.
\end{proof}
The reader may care to
recall that `Little Bear's porridge was neither too hot nor
too cold but just right'.

With the hint given by the previous theorem it should
be fairly easy to do do the next exercise.
\begin{exercise}\label{E;too hot}
(i) Give an example of a Hausdorff space $(X,\tau)$ and 
a compact Hausdorff space $(Y,\sigma)$
together with a continuous bijection $f:X\rightarrow Y$ 
which is not a homeomorphism.

(ii) Give an example of a compact Hausdorff space $(X,\tau)$ and 
a compact space $(Y,\sigma)$
together with a continuous bijection $f:X\rightarrow Y$ 
which is not a homeomorphism.
\end{exercise}
\begin{proof}[Solution] See page~\pageref{P;too hot}.
\end{proof}
We shall give a (not terribly convincing) example 
of the use of Theorem~\ref{T;bijection compact}
in our proof of Exercise~\ref{E;circle as quotient}.

The reader may have gained the impression that
compact Hausdorff spaces form an ideal backdrop
for continuous functions to the reals.
Later work shows that the impression is
absolutely correct,
but it must be remembered that many important
spaces (including the real line with the usual topology)
are not compact. 
\section{Products of compact spaces} The course contains one 
further major theorem on compactness.
\begin{theorem}\label{T;product compact}
The product of two compact spaces is compact.
(More formally, if $(X,\tau)$ and $(Y,\sigma)$ are compact
topological spaces and $\lambda$ is the product topology,
then $(X\times Y,\lambda)$ is compact.)
\end{theorem}
\begin{proof} We give a very substantial hint on
page~\pageref{H;product compact} and a proof on
page~\pageref{P;product compact}.
\end{proof}

Tychonov showed that
the general product of compact spaces
is compact (see the note to Exercise~\ref{E;Infinite product})
so Theorem~\ref{T;product compact} is often
referred to as Tychonov's theorem.

The same proof, or the remark that the subspace topology
of a product topology is the product topology of the subspace
topologies (see Exercise~\ref{E;Product subspace}),
gives the closely related result.
\begin{theorem}\label{T;product subspace compact}
Let $(X,\tau)$ and $(Y,\sigma)$ be topological spaces
and let $\lambda$ be the product topology.
If $K$ is a compact subset of $X$ and
$L$ is a compact subset of $Y$, then $K\times L$
is a compact in $\lambda$.
\end{theorem}
We know (see Exercise~\ref{E;metric product}) that the topology
on ${\mathbb R}^{2}$ derived from the Euclidean metric
is the same as the product topology when we
give ${\mathbb R}$ the topology derived from the Euclidean metric.
Theorem~\ref{T;closed interval compact} thus has the following 
corollary.
\begin{theorem}
Let $[a,b]\times[c,d]$ with its usual (Euclidean) is compact.
\end{theorem}
The arguments of the previous section carry over to give
results like the following\footnote{Stated more poetically by Conway.
\begin{verse}
If $E$'s closed and bounded, says Heine--Borel,\\
And also Euclidean, then we can tell\\
That, if it we smother\\
With a large open cover,\\
There's a finite refinement as well.
\end{verse}
}.
\begin{theorem}
Consider ${\mathbb R}^{2}$ with the standard 
(Euclidean) topology. A set $E$ is compact if and
only if it is closed and bounded
(that is to say, there exists a 
$M$ such that $\|{\mathbf x}\|\leq M$ for all ${\mathbf x}\in E$).
\end{theorem}
\begin{theorem}\label{T;compact Euclidean} 
Let ${\mathbb R}^{2}$ have the usual metric.
If $K$ is a
closed and bounded subset of ${\mathbb R}^{2}$
and $f:K\rightarrow{\mathbb R}$ is continuous,
then $f$ is bounded and attains its bounds.
\end{theorem}
\begin{exercise} 
Let ${\mathbb R}^{2}$ have the usual metric.
If $K$ is a subset of ${\mathbb R}^{2}$ with the property
that, whenever $f:K\rightarrow{\mathbb R}$ is continuous,
then $f$ is bounded, it follows
that $K$ is closed and bounded.
\end{exercise}
The generalisation to ${\mathbb R}^{n}$ is left to the reader.

The next exercise brings together many of the themes of this course.
The reader should observe that we \emph{know} what we want
the circle to look like. This exercise \emph{checks} that
defining the circle via quotient maps gives us what we want.
\begin{exercise}\label{E;circle as quotient} 
Consider the complex plane with its usual metric.
Let 
\[{\partial}D=\{z\in{\mathbb C}\,:\,|z|=1\}\]
and give ${\partial}D$ the subspace topology $\tau$.
Give ${\mathbb R}$ its usual topology and define
an equivalence relation $\sim$ by $x\sim y$ if $x-y\in{\mathbb Z}$.
We write ${\mathbb R}/\negthinspace\sim={\mathbb T}$ and give ${\mathbb T}$
the quotient topology. The object of this exercise
is to show that ${\partial}D$ and ${\mathbb T}$ are homeomorphic.

(i) Verify that $\sim$ is indeed an equivalence relation.

(ii) Show that, if we define
$f:{\mathbb R}\rightarrow {\partial}D$
by $f(x)=\exp(2\pi ix)$, then $f(U)$ is
open whenever $U$ is open.

(iii) If $q:{\mathbb R}\rightarrow {\mathbb T}$ is the quotient map 
$q(x)=[x]$ show that $q(x)=q(y)$ if and only if $f(x)=f(y)$.
Deduce that $q\big(f^{-1}(\{\exp(2\pi ix)\})\big)=[x]$
and that the equation $F(\exp(2\pi ix))=[x]$ gives a well
defined bijection $F:{\partial}D\rightarrow{\mathbb T}$.

(iv) Show that $F^{-1}(V)=f\big(q^{-1}(V)\big)$ and deduce
that $F$ is continuous.

(v) Show that ${\mathbb T}$ is Hausdorff and explain why
${\partial}D$ is compact. Deduce that $F$ is a homeomorphism.
\end{exercise}
\begin{proof}[Solution] See page~\pageref{P;circle as quotient}.
\end{proof}   

\section{Connectedness} This section deals with a problem
which the reader will meet (or has met) in her first
complex variable course. Here is a similar problem that
occurs on the real line. Suppose that $U$ is an open
subset of ${\mathbb R}$ (in the usual topology)
and $f:U\rightarrow {\mathbb R}$ is a differentiable function
with $f'(u)=0$ for all $u\in U$. We would like to
conclude that $f$ is constant, but the example
$U=(-2,-1)\cup (1,2)$, $f(u)=1$ if $u>0$,
$f(u)=-1$ if $u<0$ shows that the general result
is false. What extra condition should we put on $U$
to make the result true?

After some experimentation, mathematicians have come up
with the following idea.
\begin{definition}\label{D;disconnected} 
A topological space $(Y,\sigma)$ is
said to be \emph{disconnected} if we can find non-empty
open sets $U$ and $V$ such that $U\cup V=Y$
and $U\cap V=\emptyset$. A space which is not
disconnected is called \emph{connected}.
\end{definition}
\begin{definition} If $E$ is a subset of a topological
space $(X,\tau)$ then $E$ is called \emph{connected} (respectively
\emph{disconnected}) if the subspace topology on $E$ is
connected (respectively
disconnected).
\end{definition}
The definition of a subspace topology gives the following
alternative characterisation which the reader may prefer.
\begin{lemma} If $E$ is a subset of a topological
space $(X,\tau)$, then $E$ is disconnected if 
and only if we can find  
open sets $U$ and $V$ such that $U\cup V\supseteq E$,
$U\cap V\cap E=\emptyset$, $U\cap E\neq\emptyset$
and $V\cap E\neq\emptyset$
\end{lemma}
Here is another alternative characterisation which
shows that we are on the right track.
\begin{theorem}\label{T;connected via integer} 
If $E$ is a subset of a topological
space $(X,\tau)$, then $E$ is disconnected if and
only if we can find a non-constant continuous
function $f:E\rightarrow{\mathbb R}$ which only
takes the value $0$ or $1$.
\end{theorem}
\begin{proof} The proof is not hard once
you see what is involved. We give the proof on 
page~\pageref{P;connected via integer}.
\end{proof}

The following deep result is now easy to prove.
\begin{theorem}\label{T;reals connected}
If we give ${\mathbb R}$ the usual topology,
then ${\mathbb R}$ and the  intervals $[a,b]$
and $(a,b)$ are connected.
\end{theorem} 
\begin{proof} See page~\pageref{P;reals connected}.
\end{proof}

The reader will find it instructive to
use Theorem~\ref{T;connected via integer}
to prove parts~(i) and~(iii) of the next exercise.
\begin{exercise}\label{E;quotient connected}
(i) If $(X,\tau)$ and $(Y,\sigma)$ are topological spaces,
$E$ is a connected subset of $X$ and $g:E\rightarrow Y$
is continuous, then $g(E)$ is connected.
(More briefly, the continuous image of a connected
set is connected.)

(ii) If $(X,\tau)$ is a connected topological space
and $\sim$ is an equivalence relation on $X$, then $X/\negthinspace\sim$
with the quotient topology is connected.

(iii) If $(X,\tau)$ and $(Y,\sigma)$ are 
connected topological spaces, then $X\times Y$ 
with the product topology is connected.

(iv) If $(X,\tau)$ is a 
connected topological space and $E$ is a subset of $X$,
it does not follow that $E$ with the subspace topology is connected.
\end{exercise}
\begin{proof}[Solution] 
See page~\pageref{P;quotient connected}.\end{proof}
The proof of the next example is particularly
important because it gives a standard technique
for using connectedness in practice.
\begin{example}\label{E;locally constant}
Suppose that  $E$ is a connected subset of a topological
space $(X,\tau)$. Suppose that $f:E\rightarrow{\mathbb R}$
is `locally constant' in the sense that, given any
$e\in E$, we can find an open neighbourhood $U$ of $e$
such that $f$ is constant on $U\cap E$. Then $f$
is constant.
\end{example}
\begin{proof} There is a hint on page~\pageref{H;locally constant}
and a proof on page~\pageref{P;locally constant}.
\end{proof}
\begin{exercise}\label{E;locally constant converse}
Suppose that $E$ is subset of a topological
space $(X,\tau)$ such that any locally constant
$f:E\rightarrow{\mathbb R}$ is constant.
Show that $E$ is connected.
\end{exercise}
\begin{proof} If you need a hint, look at the
proof of Theorem~\ref{T;connected via integer}. 
\end{proof}
Example~\ref{E;locally constant} and 
Exercise~\ref{E;locally constant converse} together
completely settle the question posed in the first paragraph
of this section.

The following lemma outlines a very natural development.
\begin{lemma}\label{L;connected components}
We work in a topological space $(X,\tau)$.

(i) Let $x_{0}\in X$. If $x_{0}\in E_{\alpha}$ 
and $E_{\alpha}$ is connected for all $\alpha\in A$,
then $\bigcup_{\alpha\in A}E_{\alpha}$ is connected.

(ii) Write $x\sim y$ if there exists a connected set $E$
with $x,\,y\in E$. Then $\sim$ is an equivalence relation.

(iii) The equivalence classes $[x]$ are connected.


(iv) If $F$ is connected and $F\supseteq [x]$, then $F=[x]$.
\end{lemma}
\begin{proof} If you need more details,
see page~\pageref{P;connected components}.
\end{proof}
The sets $[x]$ are known as the \emph{connected components}
of $(X,\tau)$.


Connectedness is related to  another, older, concept.
\begin{definition}\label{D;path-connected}
Let $(X,\tau)$ be a topological space.
We say that $x,\,y\in X$ are \emph{path-connected} if 
(when $[0,1]$ is given its standard Euclidean topology)
there exists a continuous
function $\gamma:[0,1]\rightarrow X$ with
$\gamma(0)=x$ and $\gamma(1)=y$.
\end{definition}
Of course, $\gamma$ is referred to as a \emph{path}
from $x$ to $y$.
\begin{lemma}\label{L;path-connected equivalence}
If $(X,\tau)$ is a topological space and
we write $x\sim y$ if $x$ is path-connected
to $y$, then $\sim$ is an equivalence relation.
\end{lemma}
\begin{proof} This just a question of getting the
notation under control. We give a proof
on page~\pageref{P;path-connected equivalence}.
\end{proof}
We say that a topological space is \emph{path-connected} if every two
points in the space are path-connected.

The following theorem is often useful.
\begin{theorem}\label{T;path-connected to connected}
If a topological space is path-connected, then it
is connected.
\end{theorem}
\begin{proof} This is not hard. We give a proof on
page~\pageref{P;path-connected to connected}.
\end{proof}
The converse is false (see Example~\ref{E;connected not path-connected}
below) but there is one very important case where connectedness
implies path-connectedness.
\begin{theorem}\label{T;connected to path}
If we give ${\mathbb R}^{n}$ the usual topology,
then any open set $\Omega$ which is connected is path-connected.
\end{theorem}
\begin{proof} We give a hint on page~\pageref{H;connected to path}
and a proof on page~\pageref{P;connected to path}.
\end{proof}
The following example shows that, even in ${\mathbb R}^{2}$,
we cannot remove the condition $\Omega$ open.
\begin{example}\label{E;connected not path-connected}
We work in ${\mathbb R}^{2}$ with the usual topology.
Let
\[E_{1}=\{(0,y)\,:\,|y|\leq 1\}
\ \text{and}
\ E_{2}=\{(x,\sin 1/x)\,:\,0<x\leq 1\}\]
and set $E=E_{1}\cup E_{2}$.

(i) Sketch $E$.

(ii) Explain why $E_{1}$ and $E_{2}$ are path-connected
and show that $E$ is closed and connected.

(iii) Suppose, if possible, that ${\mathbf x}:[0,1]\rightarrow E$
is continuous and ${\mathbf x}(0)=(1,0)$, ${\mathbf x}(1)=(0,0)$.
Explain why we can find $0<t_{1}<t_{2}<t_{3}<\dots$ such that
$x(t_{j})=\big((j+\tfrac{1}{2})\pi)^{-1}$. By considering the behaviour
of $t_{j}$ and $y(t_{j})$, obtain a contradiction.

(iv) Deduce that $E$ is not path-connected.
\end{example}
\begin{proof} Parts~(ii) to~(iv) are done on
page~\pageref{P;connected not path-connected}.
\end{proof}
Paths play an important role in complex analysis and
algebraic topology.
\section{Compactness in metric spaces} When we work in ${\mathbb R}$
(or, indeed, in ${\mathbb R}^{n}$) with the usual metric, 
we often use the theorem of Bolzano--Weierstrass that every
sequence in a bounded closed set has a subsequence with a limit
in that set. It is also easy to see that closed bounded
sets are the only subsets of ${\mathbb R}^{n}$ which have the
property that every sequence in the set 
has a subsequence with a limit in that set. This suggests
a series of possible theorems some of which turn out to be false.
\begin{example}\label{E;bounded not convergent} 
Give an example of metric space
$(X,d)$ which is bounded (in the sense that there exists an $M$
with $d(x,y)\leq M$ for all $x,\,y\in X$) but 
for which there exist sequences with no convergent subsequence.
\end{example}
\begin{proof}[Solution] We can find such a space within our standard
family of examples. See page~\pageref{P;bounded not convergent}.
\end{proof}

Fortunately we do have a very neat and useful true theorem.
\begin{definition}\label{D;sequential compactness}
A metric space $(X,d)$ is said to be
\emph{sequentially compact} if every sequence in $X$ has a 
convergent subsequence.
\end{definition}
\begin{theorem}\label{T;sequence same}
A metric space is sequentially compact if and only if it
is compact.
\end{theorem}

We prove the if and only if parts separately.
The proof of the if part is quite simple when you see how.
\begin{theorem}\label{T;compact implies sequence}
If the metric space $(X,d)$ is compact,
then it is sequentially compact.
\end{theorem}
\begin{proof} There is a hint on page~\pageref{H;compact implies sequence}
and a proof on page~\pageref{P;compact implies sequence}
\end{proof}

The only if part is more difficult to prove (but also,
in my opinion, less important).
We start by proving a result of independent interest.
\begin{lemma}\label{L;Lebesgue}
Suppose that $(X,d)$ is a sequentially compact
metric space and that the collection $U_{\alpha}$
with $\alpha\in A$ is an open cover of $X$.
Then there exists a $\delta>0$ such that, given any
$x\in X$, there exists an $\alpha(x)\in A$
such that the open ball $B(x,\delta)\subseteq U_{\alpha(x)}$.
\end{lemma}
\begin{proof} There is a hint on page~\pageref{H;Lebesgue}
and a proof on page~\pageref{P;Lebesgue}.
\end{proof}

We now prove the required result.

\begin{theorem}\label{T;sequence implies compact}
If the metric space $(X,d)$ is sequentially 
compact, it is compact.
\end{theorem}
\begin{proof} There is a hint on page~\pageref{H;sequence implies compact}
and a proof on page~\pageref{P;sequence implies compact}.
\end{proof}

This gives an alternative, but less instructive,
proof of the theorem of Heine--Borel.
\begin{proof}[Alternative proof of Theorem~\ref{T;Heine--Borel}]%
\label{Alternative Heine--Borel}
By the Bolzano--Weierstrass theorem, $[a,b]$ is
sequentially compact. Since we are in a metric space,
it follows that $[a,b]$ is compact.
\end{proof}


If you prove a theorem on metric spaces using
sequential compactness it is good practice to
try and prove it directly by compactness.
(See, for example,
Exercise~\ref{E;uniform continuity}.)

The reader will hardly need to be warned that this chapter
dealt only with metric spaces. Naive generalisations
to general topological spaces are likely to be meaningless
or false.
\section{The language of neighbourhoods}
One of the lines of thought involved in the birth 
of analytic topology was initiated by Riemann.
We know that many complicated mathematical structures
can be considered as a space which locally looks like a simpler
space. Thus the surface of the globe we live on is sphere 
but we consider it locally as a plane (ie like ${\mathbb R}^{2}$).
The space we live in looks locally like ${\mathbb R}^{3}$
but its global structure could be very different.
For example, Riemann says `Space would necessarily be
finite if \dots [we] ascribed to it a constant curvature,
as long as that curvature had a positive value, however small.'
[Riemann's discussion 
\emph{On the Hypotheses which lie at the Foundations of Geometry}
is translated and discussed in the second volume of Spivak's
\emph{Differential Geometry}.]

Unfortunately the mathematical language of his time 
was not broad enough to allow the expression of
Riemann's insights. If we are given a particular
surface such as sphere, it is easy, starting with
the complete structure, to see what `locally'
and `resembles' might mean, but, in general, we seem to be stuck
in a vicious circle with `locally' only meaningful
when the global structure is known and the global structure
only knowable when the meaning of `locally' is known.

The key to the problem was found by Hilbert who,
in the course of his investigations into the axiomatic 
foundations of geometry, produced an axiomatisation of
the notion of neighbourhood in the Euclidean plane
${\mathbb R}^{2}$. By developing Hilbert's ideas,
Weyl obtained what is essentially the modern definition
of a Riemann surface (this object, which looks locally like
${\mathbb C}$, was another brilliant creation of Riemann).

However, although the notion of an abstract space with 
an abstract notion of closeness was very much in the air,
there were a large number of possible candidates
for such an abstraction. It was the achievement
of Hausdorff to see in Hilbert's work the general notion
of a neighbourhood. 

Although Hausdorff defined topologies in terms of neighbourhoods,
it appears to be technically easier to define 
topologies in terms of open sets as we have done in this course.
However, topologists still use the notion of neighbourhoods.

We have already defined an open neighbourhood of $x$ to be
an open set containing $x$. We now give the more general 
definition.
\begin{definition}\label{D;neighbourhood} 
Let $(X,\tau)$ be a topological space.
If $x\in X$, we say that $N$ is a \emph{neighbourhood} of $x$
if we can find $U\in\tau$ with $x\in U\subseteq N$.
\end{definition}
The reader may check her understanding by proving
the following easy lemmas.
\begin{lemma}\label{L;open topology via neighbourhood} 
Let $(X,\tau)$ be a topological space.
Then $U\in\tau$ if and only if, given $x\in U$,
we can find a neighbourhood $N$ of $x$ 
with $N\subseteq U$.
\end{lemma}
\begin{proof} The easy proof is given on
page~\pageref{P;open topology via neighbourhood}.
\end{proof}
\begin{lemma}\label{L;continuous via neighbourhood} 
Let $(X,\tau)$ and $(Y,\sigma)$ be topological spaces.
Then $f:X\rightarrow Y$ is continuous
if and only if, given $x\in X$ and $M$
a neighbourhood of $f(x)$ in $Y$,
we can find a neighbourhood $N$ of $x$ 
with $f(N)\subseteq M$.
\end{lemma}
\begin{proof} The easy proof is given on
page~\pageref{P;continuous via neighbourhood}.
\end{proof} 
\begin{exercise}\label{E;non-closed neighbourhood}
(i) If $(X,d)$ is a metric space, show that $N$
is a neighbourhood of $x$ if and only we can find an 
$\epsilon>0$ such that the open ball 
$B(x,\epsilon)\subseteq N$.

(ii) Consider ${\mathbb R}$ with the usual topology.
Give an example of a neighbourhood which is
not an open neighbourhood. Give an example  of 
an unbounded neighbourhood. Give an example  of
a neighbourhood which is not connected.
\end{exercise}

Here is another related way of looking at topologies
which we have not used explicitly, but which can 
be useful.
\begin{definition}\label{D;basis}
Let $X$ be a set. A collection ${\mathcal B}$
of subsets is called a \emph{basis} if
the following conditions hold.

(i) $\bigcup_{B\in{\mathcal B}}B=X$.

(ii) If $B_{1},\,B_{2}\in{\mathcal B}$ and
$x\in B_{1}\cup B_{2}$ we can find a 
$B_{3}\in{\mathcal B}$ such that
$x\in B_{3}\subseteq B_{1}\cap B_{2}$ 
\end{definition}
\begin{lemma}\label{L;basis works} Let $X$ be a set
and ${\mathcal B}$ a collection
of subsets of $X$. Let $\tau_{\mathcal B}$
be the collection of sets $U$ such that,
whenever $x\in U$ we can find a $B\in{\mathcal B}$
such that $x\in B\subset U$.

Then $\tau_{\mathcal B}$ is a topology if and
only if ${\mathcal B}$ is a basis.
\end{lemma}
\begin{proof} The routine proof is given
on
page~\pageref{P;basis works}.
\end{proof}
\begin{definition} If ${\mathcal B}$ is a basis
and $\tau_{\mathcal B}$ is as in 
Lemma~\ref{L;basis works}, we say that ${\mathcal B}$
is a \emph{basis\footnote{Sometimes ${\mathcal B}$
is called a \emph{basis of open neighbourhoods}.} for} $\tau_{\mathcal B}$.
\end{definition}
\begin{exercise} Consider ${\mathbb R}^{2}$ with
the Euclidean norm. Show that the open discs
\[B({\mathbb q},1/n)
=\{{\mathbf x}\,:\,\|{\mathbf x}-{\mathbf q}\|<1/n\}\]
with ${\mathbf q}\in{\mathbb Q}^{2}$ and $n\geq 1$, 
$n\in{\mathbb Z}$ form a countable basis ${\mathcal B}$
for the Euclidean topology. Is it true that 
the intersection of two elements of ${\mathcal B}$
lies in ${\mathcal B}$? Give reasons.
\end{exercise}
\begin{exercise}\label{E;products via basis} 
Let $(X,\tau)$ and $(Y,\sigma)$
be topological spaces. Show that 
\[{\mathcal B}=\{U\times V\,:\,U\in\tau,\,V\in\sigma\}\]
is a basis and check, using Lemma~\ref{L;product topology}
that it generates the product topology. 
\end{exercise}
We end the course with a warning. Just as it is
possible to define continuous functions in terms
of neighbourhoods so it is possible to define convergence
in terms of neighbourhoods.
This works well in metric spaces.
\begin{lemma}\label{L;convergence, neighbourhood, metric} 
If $(X,d)$ is a metric space, then $x_{n}\rightarrow x$,
if and only if
given $N$ a neighbourhood of $x$, we can find an
$n_{0}$ (depending on $N$) such that $x_{n}\in N$
for all $n\geq n_{0}$.
\end{lemma}
\begin{proof} Immediate.
\end{proof}

However, things are not as simple in general topological spaces.
\begin{definition}{\bf [WARNING. Do not use this definition
without reading the commentary that follows.]}%
\label{R;treacherous}
Let $(X,\tau)$ be a topological space. If $x_{n}\in X$
and $x\in X$ then we say $x_{n}\rightarrow x$
if, given $N$ a neighbourhood of $x$ we can find
$n_{0}$ (depending on $N$) such that $x_{n}\in N$
for all $n\geq n_{0}$.
\end{definition}

Any hopes that limits of sequences
will behave as well in general topological spaces
are dashed by the following example.
\begin{example} Let $X=\{a,\,b\}$ with $a\neq b$.
If we give $X$ the indiscrete topology, then,
if we set $x_{n}=a$ for all $n$, we have
$x_{n}\rightarrow a$ and $x_{n}\rightarrow b$.
\end{example}
Thus limits need not be unique.

Of course, it is possible to persist in
spite of this initial shock, but the reader
will find that she cannot prove the links
between limits of sequences and topology
that we would wish to be true. This failure
is not the reader's fault. Deeper investigations
into set theory reveal that sequences are
inadequate tools for the study of topologies
which have neighbourhood systems which are `large
in the set theoretic sense'. (Exercise~\ref{E;large set}
represents an attempt to show what this means.)
It turns out that the deeper study of set theory
reveals not only the true nature of the problem
but also solutions via \emph{nets} (a kind of generalised sequence)
or \emph{filters} (preferred by the majority of mathematicians).

\section{Final remarks and books} 
Because the notion of a topological space is so general
it applies to vast collection of objects. Many
useful results apply only to some subcollection
and this means that the subject contains many
counterexamples to show that such and such a 
condition is required for a certain theorem to be true.

To the generality of mankind, 
the longer and more complicated a
piece of mathematics appears
to be, the more impressive it is. 
Mathematicians know that the simpler a
proof or a counterexample is, the easier it
is to check, understand and use.
Just as it is worth taking time
to see if a proof can be made simpler, so
it is worth taking time to see
if there is a simpler counterexample
for the purpose in hand.

When searching for a counterexample 
we may start by looking at ${\mathbb R}$
and  ${\mathbb R}^{n}$ with the standard
metrics and subspaces like ${\mathbb Q}$, $[a,b]$, $(a,b)$
and $[a,b)$. Then we might look at
the discrete and indiscrete topologies
on on a space. It is often worth looking
at possible topologies on spaces with a small number
of points (typically $3$). 

As her experience grows, the reader will have a much wider
range of spaces to think about. Some like those of
Exercises~\ref{E;new metrics},~\ref{E;little elk},
and~\ref{E;Cantor} are very useful in their own right.
Some, like that of Exercise~\ref{E;scatter},
merely provide object lessons in how
strange topologies can be,


If the reader looks at a very old book on \emph{general}
(or \emph{analytic})
topology, she may find both the language and the contents
rather different from what she is used to. In 1955, Kelley
wrote a book \emph{General Topology}~\cite{Kelley} 
which stabilised the content and notation which
might be expected in advanced course on the subject.

Texts like~\cite{Mendeleson} (now in a very 
cheap Dover reprint\footnote{October, 2012.})
and~\cite{Mansfield} (out of print) 
which extracted a natural elementary
course quickly appeared and later texts followed the
established pattern. Both~\cite{Mendeleson}
and~\cite{Mansfield} are short and sweet.
With luck, they should be in your college library.
The book of Sutherland~\cite{Sutherland}
has the possible advantage of being written for a British audience
and the certain advantage of being in print.

Many books on Functional Analysis, Advanced Analysis, Algebraic
Topology and Differential Geometry cover the material in this
course and then go on to develop it in the directions demanded
by their particular subject.
\begin{thebibliography}{9}
\bibitem{Kelley} Kelley,~J.~L, \emph{General Topology}, Princeton~N.~J,.
Van Nostrand, 1955. [Reissued by Springer in 1975
and Ishi Press in 2008.]
\bibitem{Mansfield} Mansfield,~M.~J.,
\emph{Introduction to Topology},  Princeton~N.~J.,
Van Nostrand, 1963.
\bibitem{Mendeleson} Mendeleson,~B., \emph{Introduction to Topology},
Boston Mass., Allyn and Bacon, 1962. [Now available in
a Dover reprint, New York, Dover, 1990]
\bibitem{Sutherland} Sutherland~W.~A., 
\emph{Introduction to Metric and Topological Spaces}, Oxford,
OUP, 1975.
\end{thebibliography}
\section{Exercises}\label{S;exercises one}
\begin{exercise}\label{E;axiom grubbing}
Let $X$ be a set and
$d:X^{2}\rightarrow{\mathbb R}$ a function with the
following properties.

(i)$'$ $d(x,x)=0$ for all $x\in X$.
                                                                               
(ii)$'$ $d(x,y)=0$ implies $x=y$.
                                                                               
(iv)$'$ $d(y,x)+d(y,z)\geq d(x,z)$ for all $x,\,y,\,z\in X$.

\noindent Show that $d$ is a metric on $X$.
\end{exercise}
\begin{exercise}\label{E;parallelogram} (i) If $V$ is a
real inner product
space and $\|\ \|$ is the standard norm derived from the inner product,
prove the parallelogram law
\[\|{\mathbf a}+{\mathbf b}\|^{2}+\|{\mathbf a}-{\mathbf b}\|^{2}
=2(\|{\mathbf a}\|^{2}+\|{\mathbf b}\|^{2}).\]

(ii) Give an example of a normed vector space where
the norm cannot be derived from an inner product
in a standard way.
\end{exercise} 
\begin{exercise}\label{E;extend composition}
Let ${\mathbb R}^{N}$ have its usual (Euclidean) metric.

(i) Suppose that $f_{j}:{\mathbb R}^{n_{j}}\rightarrow{\mathbb R}^{m_{j}}$
is continuous for $1\leq j\leq k$. Show that the map 
$f:{\mathbb R}^{n_{1}+n_{2}+\dots+n_{k}}\rightarrow
{\mathbb R}^{m_{1}+m_{2}+\dots+m_{k}}$
given by
\[f({\mathbf x}_{1},{\mathbf x}_{2},\dots,{\mathbf x}_{k})
=(f_{1}({\mathbf x}_{1}),f_{2}({\mathbf x}_{2}),\dots,f_{k}({\mathbf x}_{k}))\]
is continuous.

(ii) Show that the map $U:{\mathbb R}^{n}\rightarrow{\mathbb R}^{kn}$
given by
\[U({\mathbf x})=({\mathbf x},{\mathbf x},\dots,{\mathbf x})\]
is continuous.

(iii)  Suppose that $g_{j}:{\mathbb R}^{n}\rightarrow{\mathbb R}^{m_{j}}$
is continuous for $1\leq j\leq k$.
Use the composition law to show that the map 
$g:{\mathbb R}^{n}\rightarrow
{\mathbb R}^{m_{1}+m_{2}+\dots+m_{k}}$
given by
\[g({\mathbf x})
=(g_{1}({\mathbf x}),g_{2}({\mathbf x}),\dots,g_{k}({\mathbf x}))\]
is continuous.

(iv) Show that the maps $A,B:{\mathbb R}^{2}\rightarrow{\mathbb R}$
given by $A(x,y)=x+y$, $B(x,y)=xy$ are continuous.

(v) Use the composition law repeatedly to show that the map 
$f:{\mathbb R}^{2}\rightarrow{\mathbb R}$
given by
\[f(x,y)=\sin\left(\frac{xy}{x^{2}+y^{2}+1}\right)\]
is continuous. (You may use results about maps 
$g:{\mathbb R}\rightarrow{\mathbb R}$

\noindent$[$If you have difficulty with (v), try smaller subproblems.
For example, can you show that $(x,y)\mapsto x^{2}+y^{2}$ is continuous?$]$
\end{exercise}
\begin{exercise}\label{E;nasty discontinuous} 
Consider ${\mathbb R}$ with the ordinary 
Euclidean metric. 

(i) We know that $\sin:{\mathbb R}\rightarrow{\mathbb R}$
is continuous. Show that, if $U={\mathbb R}$, then $U$ is open, 
but $\sin U$ is not.

(ii) We define a function $f:{\mathbb R}\rightarrow{\mathbb R}$ as follows.
If $x\in{\mathbb R}$, set $\langle x\rangle=x-[x]$ and write
\[\langle x\rangle=.x_{1}x_{2}x_{3}\dots\]
as a decimal, choosing the terminating form in case of ambiguity.
If $x_{2n+1}=0$ for all sufficiently large $n$, let $N$ be the
least integer such that $x_{2n+1}=0$ for all $n\geq N$, and set
\[f(x)=(-1)^{N}\sum_{j=1}^{\infty}x_{2N+2j}10^{N-j}.\]
We set $f(x)=0$ otherwise.

Show that if $U$ is a non-empty open set,
$f(U)={\mathbb R}$ and so $f(U)$ is open. Show that $f$ is not 
continuous.
\end{exercise}
\begin{exercise}\label{E;closed ball} 
Let $(X,d)$ be a metric space
and let $r>0$.
Show that
\[\overline{B(x,r)}=\{y\,:\,d(x,y)\leq r\}\]
is a closed set:-

(a) By using the definition of a closed set in terms of limits.

(b) By showing that the complement of $\overline{B(x,r)}$
is open.

We call $\overline{B(x,r)}$ the \emph{closed ball} centre $x$ and radius
$r$.
\end{exercise}
\begin{exercise}\label{E;close shave} 
Prove Theorems~\ref{T;properties metric closed}
and~\ref{T;metric continuous closed}
directly from 
the definition of a closed set in terms of limits
without using open sets.
\end{exercise}
\begin{exercise}\label{E;new metrics}
(i) Let $(X,d)$ be a metric space. Show that
\[\rho(x,y)=\frac{d(x,y)}{1+d(x,y)}\]
defines a new metric on $X$.
                                                                               
(ii) Show that, in~(i), $d$ and $\rho$ have the
the same open sets.
                                                                            
(iii) Suppose that $d_{1}$, $d_{2}$, \dots are metrics
on $X$. Show that
\[\theta(x,y)=\sum_{n=1}^{\infty}
\frac{2^{-n}d_{n}(x,y)}{1+d_{n}(x,y)}\]
defines a metric $\theta$ on $X$.
\end{exercise}

\begin{exercise}\label{E;inverse} 
(This is just intended
to remind of you of some elementary results on maps.)
Let $X$ and $Y$ be non-empty sets and $f:X\rightarrow Y$
be a function. Suppose that $A,\,A'\subseteq X$, $B,\,B'\subseteq Y$,
$A_{\gamma}\subseteq X$, $B_{\gamma}\subseteq Y$
for all $\gamma\in\Gamma$. Which of the following statements
are always true and which may be false?
Give a counterexample or a brief explanation in each case.


(i) $f(\bigcup_{\gamma\in\Gamma}A_{\gamma})
= \bigcup_{\gamma\in\Gamma}f(A_{\gamma})$.

(ii) $f(\bigcap_{\gamma\in\Gamma}A_{\gamma})
= \bigcap_{\gamma\in\Gamma}f(A_{\gamma})$.

(iii) $f(A\setminus A')=f(A)\setminus f(A')$.

(iv) $f^{-1}(\bigcup_{\gamma\in\Gamma}B_{\gamma})
= \bigcup_{\gamma\in\Gamma}f^{-1}(B_{\gamma})$.

(v) $f^{-1}(\bigcap_{\gamma\in\Gamma}B_{\gamma})
= \bigcap_{\gamma\in\Gamma}f^{-1}(B_{\gamma})$.

(vi) $f^{-1}(B\setminus B')=f^{-1}(B)\setminus f^{-1}(B')$.

How would your answers change if $f$ was bijective?
\end{exercise}
\begin{exercise}\label{E;Infinite product}
(i) Suppose that $A$ is non-empty and that $(X_{\alpha},\tau_{\alpha})$
is a topological space. Explain what is meant by saying that
$\tau$ is the smallest topology on
$\prod_{\alpha\in A}X_{\alpha}$ for which each of the projection maps
$\pi_{\beta}:\prod_{\alpha\in A}X_{\alpha}\rightarrow X_{\beta}$
is continuous and explain why we know that it exists.
We call $\tau$ the product topology.

(ii) Show that $U\in\tau$ if and only if,
given $x\in U$, 
we can find $U_{\alpha}\in\tau_{\alpha}$ $[\alpha\in A]$
such that
\[x\in\prod_{\alpha\in A}U_{\alpha}\]
and $U_{\alpha}=X_{\alpha}$ for all but finitely many of the $\alpha$.

(iii) By considering $A=[0,1]$ and taking each $(X_{\alpha},\tau_{\alpha})$ 
to be a copy of ${\mathbb R}$ show that the following 
condition defines a topology $\sigma$
on the space ${\mathbb R}^{[0,1]}$ of functions 
$f:[0,1]\rightarrow{\mathbb R}$.
A set $U\in\sigma$ if and only if, given any $f_{0}\in U$,
there exists an $\epsilon>0$
and $x_{1},\,x_{2},\,\dots,\,x_{n}\in[0,1]$ such that
\[\{f\in {\mathbb R}^{[0,1]}\,:\,
|f(x_{j})-f_{0}(x_{j})|<\epsilon
\ \text{for all $1\leq j\leq n$}\}\subseteq U.\]


\noindent$[$The reader who cannot see the point of this topology
is in good, but mistaken, company. The great topologist
Alexandrov recalled that when Tychonov (then aged only~20)
produced this definition `His chosen \dots definition seemed
not only unexpected but perfectly paradoxical. $[$I remember$]$
with what mistrust $[$I$]$ met Tychonov's proposed definition.
How was it possible that a topology induced by means of
such enormous neighbourhoods, which are only distinguished 
from the whole space by a finite number of the coordinates,
could catch any of the essential characteristics of a
topological product?' However, Tychonov's choice was justified
by its consequences, in particular, the generalisation (by Tychonov)
of Theorem~\ref{T;product compact} to show that the 
(Tychonov) product of compact spaces is compact.
This theorem called \emph{Tychonov's theorem} is
one of the most important in modern analysis.

In common with many of the most brilliant members
of the Soviet school, Tychonov went on to work in
a large number of branches of pure and applied
mathematics. His best known work includes a remarkable
paper on solutions of the heat 
equation\footnote{A substantial part of Volume~22, Number~2
of \emph{Russian Mathematical Surveys} 1967 is devoted
to Tychonov and his work. The quotation from Alexandrov
is taken from there.}.$]$  
\end{exercise}
\begin{exercise}\label{E;Kuratowski}
{\bf [The Kuratowski problem\footnote{So called 
because Kuratowski solved it.}]} 
We work in a topological space $(X,\tau)$.

(i) If $A$ is a subset of $X$ show that $x\in \Cl A\setminus\Int A$
if and only if, whenever $x\in U\in \tau$,
we have $U\cap A\neq \emptyset$
and  $U\cap A^{c}\neq \emptyset$.

(ii) Find a set $A$ of ${\mathbb R}$ with the usual
topology such that $A$, $\Cl A$, $\Cl\Int A$
and $\Cl\Int\Cl A$ are all distinct.

(iii) Show that if $A$ is any subset of $X$ then
\[\Int(\Cl(\Int(\Cl A)))=\Int(\Cl A).\]

(iv) Deduce that, starting from a set $B$, the operations
of taking interior and closure in various orders can produce
at most seven different sets (including $A$ itself).

(v) Find a subset $B$ of ${\mathbb R}$ with the usual
topology  such that the operations of taking closures
and interiors in various orders produce exactly seven
different sets. 
\end{exercise}
\begin{exercise}\label{E;quotient remarks}
(i) Let $X=\{a,\,b\}$ with $a\neq b$. Show that there
does not exist a largest topology contained in 
$\sigma=\{\emptyset,\{a\},\{b\},X\}$. (More formally,
show that there does not exist a topology $\tau$
on $X$ such that $\tau\subseteq \sigma$ and
such that, if $\mu$ is any topology with $\mu\subseteq\sigma$,
then $\mu\subseteq \tau$.) Compare and contrast
Lemma~\ref{L;coarsest topology}.

(ii) Show (with the notation of Lemma~\ref{L;quotient lemma})
that the quotient topology on $X/\negthinspace\sim$ is the largest
topology (in the sense of~(i)) such that
$q:X\rightarrow X/\negthinspace\sim$ is continuous.
\end{exercise}
\begin{exercise}\label{E;quotient non Hausdorff}
Consider ${\mathbb R}$ with the usual (Euclidean)
topology. Let $x\sim y$ if and only if $x-y\in{\mathbb Q}$.
Show that $\sim$ is an equivalence relation. Show that
${\mathbb R}/\negthinspace\sim$ is uncountable but that the quotient
topology on ${\mathbb R}/\negthinspace\sim$ is the indiscrete topology.
\end{exercise}
\begin{exercise}\label{E;Hausdorff not metric}
(i) If $(X,\sigma)$ is a topology derived from a metric,
show that, given $x\in X$, we can find open sets
$U_{j}$ $[1\leq j]$
such that $\{x\}=\bigcap_{j=1}^{\infty}U_{j}$.

(ii) Show, by verifying the conditions for a topological
space directly 
(so you may not quote Exercise~\ref{E;Infinite product}), 
that the following condition defines 
a topology $\tau$
on the space ${\mathbb R}^{[0,1]}$ of 
functions $f:[0,1]\rightarrow{\mathbb R}$.
A set $U\in\tau$ if and only if, given any $f_{0}\in U$,
there exists an $\epsilon>0$
and $x_{1},\,x_{2},\,\dots,\,x_{n}\in[0,1]$ such that
\[\{f\in {\mathbb R}^{[0,1]}\,:\,
|f(x_{j})-f_{0}(x_{j})|<\epsilon\ \text{for $1\leq j\leq n$}\}\subseteq U.\]

(iii) Show that the topology $\tau$ is Hausdorff
but cannot be derived from a metric.
\end{exercise}
\begin{exercise}\label{E;Product subspace}
Let $(X,\tau)$ and $(Y,\sigma)$ be topological spaces
with subsets $E$ and $F$. Let the subspace topology
on $E$ be $\tau_{E}$ and  the subspace topology
on $F$ be $\sigma_{F}$. Let the product topology 
on $X\times Y$ derived from $\tau$ and $\sigma$
be $\lambda$ and let the product topology 
on $E\times F$ derived from $\tau_{E}$ and $\sigma_{F}$
be $\mu$. Show that $\mu$ is the subspace topology on $E\times F$
derived from $\lambda$. 
\end{exercise}
\begin{exercise}\label{E;piano continuity} 
(i) Let ${\mathcal H}_{i}$ be a collection of
subsets of $X_{i}$ and let $\tau_{i}$ be the smallest topology
on $X_{i}$ containing ${\mathcal H}_{i}$ $[i=1,2]$. If
$f:X_{1}\rightarrow X_{2}$ has the property that
$f^{-1}(H)\in {\mathcal H}_{1}$ whenever $H\in{\mathcal H}_{2}$,
show that $f$ is continuous
(with respect to the topologies $\tau_{1}$ and $\tau_{2}$).

(ii) Suppose that $(X,\tau)$ and $(Y,\sigma)$ are topological
space and we give $X\times Y$ the product topology.
If $(Z,\lambda)$ is a topological space, show that
$f:Z\rightarrow X\times Y$ is continuous if and only
if $\pi_{X}\circ f:Z\rightarrow X$ and
$\pi_{Y}\circ f:Z\rightarrow Y$ are continuous.

(iii) Let ${\mathbb R}$ have the usual topology (induced
by the Euclidean metric) and let ${\mathbb R}^{2}$
have the product topology (which we know to be
the usual topology induced by the Euclidean metric).
Define
\[
f(x,y)=
\begin{cases}
\frac{xy}{x^{2}+y^{2}}&\text{if $(x,y)\neq (0,0)$,}\\
0&\text{if $(x,y)=(0,0)$.}
\end{cases}
\]
Show that, if we define $h_{x}(y)=g_{y}(x)=f(x,y)$
for all $(x,y)\in{\mathbb R}^{2}$, then the function
$h_{x}:{\mathbb R}\rightarrow{\mathbb R}$ is continuous
for each $x\in{\mathbb R}$ and the function
$g_{y}:{\mathbb R}\rightarrow{\mathbb R}$ is continuous
for each $y\in{\mathbb R}$. Show, however, that $f$ is not
continuous.
\end{exercise}
\begin{exercise}\label{E;metric on compacta} 
In complex variable theory we encounter
`uniform convergence on compacta'. This question
illustrates the basic idea in the case of
$C(\Omega)$ the space of \emph{continuous}
functions $f:\Omega\rightarrow{\mathbb C}$
where
\[\Omega=\{z\in{\mathbb C}\,:\,|z|<1\}.\]

(i) Show, by means of an example, that an $f\in C(\Omega)$
need not be bounded on $\Omega$.

(ii) Explain why
\[d_{n}(f,g)=\sup_{|z|\leq 1-1/n}|f(z)-g(z)|\]
exists and is finite for each $n\geq 1$ and all
$f,\,g\in C(\Omega)$. Show that $d_{n}$ satisfies the
triangle law and symmetry but give an example of
a pair of functions
$f,\,g\in C(\Omega)$ with $f\neq g$ yet $d_{n}(f,g)=0$.
                                        
(iii) Show that
\[d(f,g)=\sum_{n=1}^{\infty}\frac{2^{-n}d_{n}(f,g)}{1+d_{n}(f,g)}\]
exists and is finite for all
$f,\,g\in C(\Omega)$.
                                                                    
(iv) Show that $d$ is a metric on $C(\Omega)$.

\noindent
$[$If you require a hint, do Exercise~\ref{E;new metrics}~(i).$]$
\end{exercise}
\begin{exercise}\label{E;close connection}
(i) Show that the closure of a connected set is connected.

(ii) Deduce that connected components are closed.

(iii) Show that if there are only finitely many
components they must all be open.

(iv) Find the connected components of
\[\{0\}\cup\bigcup\{1/n\,:\,n\geq 1,\ n\in{\mathbb Z}\}\]
with the usual metric.

Which are open in the subspace topology
and which are not? Give reasons.

(v) Is it true that the interior of a connected set is 
always connected? Give a proof or a counterexample. 
\end{exercise} 
\begin{exercise}\label{E;quotient path-connected}
(i) If $(X,\tau)$ and $(Y,\sigma)$ are topological spaces,
$E$ is a path-connected subset of $X$ and $g:E\rightarrow Y$
is continuous, show that $g(E)$ is path-connected.
(More briefly, the continuous image of a path-connected
set is path-connected.)

(ii) If $(X,\tau)$ is a path-connected topological space
and $\sim$ is an equivalence relation on $X$, 
show that $X/\negthinspace\sim$
with the quotient topology is path-connected.

(iii) If $(X,\tau)$ and $(Y,\sigma)$ are 
path-connected topological spaces, show that $X\times Y$ 
with the product topology is path-connected.

(iv) If $(X,\tau)$ is a 
path-connected topological space and $E$ is a subset of $X$,
show that it does not follow that $E$ with the subspace 
topology is path-connected.
\end{exercise}
\begin{exercise}\label{E;uniform continuity} 
Suppose that $(X,d)$ is a compact metric space,
$(Y,\rho)$ is a metric space and $f:X\rightarrow Y$
is continuous. Explain why, given $\epsilon>0$,
we can find, for each $x\in X$, a $\delta_{x}>0$
such that, if $d(x,y)<2\delta_{x}$, it follows that
$\rho(f(x),f(y))<\epsilon$. By considering
the open cover $B(x,\delta_{x})$ and using compactness,
show that there exists a $\delta>0$ such that
$d(x,y)<\delta$ implies $\rho(f(x),f(y))<\epsilon$.
(In other words, a continuous function from a 
compact metric space to a metric space is uniformly continuous.)
\end{exercise}
\begin{exercise}\label{E;homeomorphic, non-homeomorphic}
Which of the following spaces are
homeomorphic and which are not? Give reasons.

(i) ${\mathbb R}$ with the usual topology.

(ii) ${\mathbb R}$ with the discrete topology.

(iii) ${\mathbb Z}$ with the discrete topology.

(iv) $[0,1]$ with the usual topology.

(v) $(0,1)$ with the usual topology.

\noindent
$[$This is rather feeble question but in this short
course we have not found enough topological properties
to distinguish between some clearly distinguishable
topological spaces. We return to this matter
in Exercise~\ref{E;dimension}.$]$
\end{exercise}
\begin{exercise}\label{E;dimension}
Suppose that $f:[0,1]\rightarrow{\mathbb R}$
and $g:[0,1]\rightarrow{\mathbb R}$
are continuous maps with $f(0)=-1$, $f(1)=2$,
$g(0)=0$ and $g(1)=1$. Show that
\[f([0,1])\cap g([0,1])\neq\emptyset\]
(In other words, the two paths must cross.)

Show that ${\mathbb R}$ and ${\mathbb R}^{2}$
with the usual topologies are not homeomorphic.
Are $[0,1]$ and the circle
\[\{z\in{\mathbb C}\,:\,|z|=1\}\]
homeomorphic and why?

(But are ${\mathbb R}^{2}$ and ${\mathbb R}^{3}$
homeomorphic? Questions like this form the beginning of modern
algebraic topology.)
\end{exercise}
\begin{exercise}\label{E;mind the door} 
Which of the following statements
are true and which false. Give a proof or counter-example.

(i) If a topological space $(X,\tau)$ is connected 
then the only sets which
are both open and closed are $X$ and $\emptyset$.

(ii) If every set in a topological space $(X,\tau)$
is open or closed (or both) then $\tau$ is the discrete
topology.

(iii) Every open cover of ${\mathbb R}$ with the usual topology
has a countable subcover.

(iv) Suppose that $\tau$ and $\sigma$ are topologies
on a space $X$ with $\sigma\supseteq\tau$. Then,
if $(X,\tau)$ is connected, so is $(X,\sigma)$.

(v) Suppose that $\tau$ and $\sigma$ are topologies
on a space $X$ with $\sigma\supseteq\tau$. Then,
if $(X,\sigma)$ is connected, so is $(X,\tau)$.
\end{exercise}  
\begin{exercise}{\bf [Bases of neighbourhoods.]}%
\label{E;bases of neighbourhoods}% 
(i) Let $(X,\tau)$ be a
topological space.
Write ${\mathcal N}_{x}$ for the set of neighbourhoods
of $x\in X$. Prove the following results.

\ \ (1) ${\mathcal N}_{x}\neq\emptyset$.

\ \ (2) If $N\in {\mathcal N}_{x}$, then $x\in N$.

\ \ (3) If $N,\ M\in {\mathcal N}_{x}$,
then $N\cap M\in{\mathcal N}_{x}$.

\ \ (4) If $N\in{\mathcal N}_{x}$ and $M\supseteq N$,
then $M\in{\mathcal N}_{x}$.

\ \ (5) If $N\in{\mathcal N}_{x}$ then there exists
an $U\in{\mathcal N}_{x}$ such that
$U\subseteq N$ and $U\in{\mathcal N}_{y}$ for all
$y\in U$.

(ii) Suppose that $X$ is a set such that each $x\in X$
is associated with a collection ${\mathcal N}_{x}$
of subsets of $X$. If conditions (1) to (4) of
part~(ii) hold, show that the family $\tau$ of sets
$U$ such that, if $x\in U$, then we can
find an $N\in{\mathcal N}_{x}$ with $N\subseteq U$
is a topology on $X$. If, in addition, condition~(5)
holds show that ${\mathcal N}_{x}$ is a collection
of $\tau$-neighbourhoods of $x$ for each $x\in X$.
\end{exercise}
\begin{exercise}\label{E;nasty line} 
Consider ${\mathbb R}^{2}$ 
with the usual Euclidean topology.
Let
\[E=\{(x,-1)\,:\,x\in{\mathbb R}\}\cup
\{(x,1)\,:\,x\in{\mathbb R}\}\]
and give $E$ the subspace topology.

Define a relation $\sim$ on $E$ by taking 
\begin{align*}
(x,y)\sim(x,y)&\qquad\text{for all $(x,y)\in E$}\\
(x,y)\sim(x,-y)&\qquad\text{for all $(x,y)\in E$ with $x\neq 0$}.
\end{align*}
Show that that $\sim$ is an equivalence relation on $E$.

Now give $E/\negthinspace\sim$ the equivalence relation. Show
that if $[(x,y)]\in E/\negthinspace\sim$ we can find an open neighbourhood
$U$ of $[(x,y)]$ which is homeomorphic to ${\mathbb R}$.
Show, however, that $E/\negthinspace\sim$ is not Hausdorff.

\noindent$[$This nasty example shows that `looks nice locally'
is not sufficient to give `looks nice globally'.
It is good start to a course in differential geometry
to ask what extra conditions are required to make
sure that a space that `looks locally like a line'
`looks globally like a line or a circle'.$]$
\end{exercise}
\section{More exercises}\label{S;exercises two} 
There is an ancient
superstition in Cambridge that 12 exercises 
are necessary and sufficient to learn six hours of
lectures. If the reader does not share this superstition
she may find the following exercises useful.


\begin{exercise}\label{E,adicts} 
Suppose that $p$ is a prime. If $m,\,n\in{\mathbb Z}$
we set $d(m,n)=0$ if $m\neq 0$ and, otherwise,
$d(m,n)=\frac{1}{r}$ where $p^{r}$ divides $m-n$
but $p^{r+1}$ does not. Show that $d$ is a metric on
${\mathbb Z}$. Show that the sequence $2013$, $20013$,
$200013$, $\ldots$ tends to a limit in this metric.

Show that the sequence $5^{n}+5^{n-1}+\ldots+5+1$
is Cauchy but does not converge.
\end{exercise}
\begin{exercise}\label{E;little elk} 
Let $q\geq 1$. Let $l^{q}$ be the set of 
sequences of real numbers
${\mathbf a}=(a_{1},a_{2},\ldots)$ with 
$\sum_{j=1}^{\infty}|a_{j}|^{q}$ convergent.
We write $\|{\mathbf a}\|_{q}=
\left(\sum_{j=1}^{\infty}|a_{j}|^{q}\right)^{1/q}.$.

(i) If ${\mathbf a}$ is a sequence and we write
\[{\mathbf a}[N]=(a_{1},a_{2},\ldots,a_{N},0,0,\ldots)\]
show that ${\mathbf a}\in l^{q}$ if and only if
$\|{\mathbf a}[N]\|_{q}$ is bounded and
that, if ${\mathbf a}\in l^{q}$, then 
\[\|{\mathbf a}[N]\|_{q}\rightarrow\|{\mathbf a}\|_{q}\]
as $N\rightarrow\infty$.

(ii) Show, using~(i), that $l^{1}$ and $l^{2}$ are real
vector spaces, that $\|\ \|_{1}$ is a norm on $l^{1}$
and  that $\|\ \|_{2}$ is a norm on $l^{2}$.

(iii) Show that $l^{2}\supseteq l^{1}$..

(iv) Show that the identity map
\[\iota:(l^{1},\|\ \|_{2})\rightarrow(l^{1},\|\ \|_{1})\]
(that is to say from $l^{1}$ with the subspace
norm derived from $\|\ \|_{2}$ to $l^{1}$ with the 
norm $\|\ \|_{2}$) is not continuous.

Show that the identity map
\[\iota:(l^{1},\|\ \|_{1})\rightarrow(l^{1},\|\ \|_{2})\]
is continuous.

(v) If $f(a_{1},a_{2},\ldots)=(a_{1},a_{2}/2,a_{3}/3,\ldots)$
show that 


Show that 
\[f(l^{1},\|\ \|_{1})\rightarrow(l^{1},\|\ \|_{2})\]
is well defined and continuous.
\end{exercise}
\begin{exercise}\label{E;same difference} 
Suppose that $d_{1}$ and $d_{2}$
are metrics on a space $X$. Show that it is a sufficient
condition for them to generate the same topology
that there exists a $K\geq 1$ with
\[Kd_{1}(x,y)\geq d_{2}(x,y)\geq K^{-1}d_{1}(x,y)\]
for all $x,\,y\in X$ 

By considering $d$ defined by $d(x,y)=|x-y|^{1/2}$ for
$x,\,y\in{\mathbb R}$, or otherwise, show that the condition is not
necessary.

Show, however, that, if $\|\ \|_{A}$ and $\|\ \|_{B}$ are norms
on a vector space $V$, then it is a necessary and sufficient
condition for them to generate the same topology
that there exists a $K\geq 1$ with
\[K\|{\mathbf x}\|_{A}\geq \|{\mathbf x}\|_{B}\geq K^{-1}\|{\mathbf x}\|_{A}\]
for all ${\mathbf x}\in V$.
\end{exercise}
\begin{exercise}\label{E;Furstenberg}
There are many proofs that there
exist an infinity of primes. Here is a remarkable
one published by F{\"u}rstenberg in 1955 when he was
still an undergraduate.

Consider ${\mathbb Z}$. Let ${\cal A}$ be the collection
of arithmetic progressions
\[\{an+b\,:\,n\in{\mathbb Z}\}\]
with $a\neq 0$ and let $\tau$ be the collection of unions
of sets in  ${\cal A}$ together with ${\mathbb Z}$.

(i) Show that $\tau$ is a topology.

(ii) Show that every $A\in{\cal A}$ is closed in the topology $\tau$.

(iii If ${\mathcal A}^{*}$ consists of the arithmetic progressions
\[\{ap\,:\,n\in{\mathbb Z}\}\]
with $p$ prime, 
identify
\[{\mathbb Z}\setminus \bigcup_{A\in{\mathcal A}^{*}}A.\]

(iv) Suppose, if possible, there are only finitely many primes.
Use parts~(ii) and~(iii) to obtain
a contradiction.

(v) Applaud.
\end{exercise}
\begin{exercise}\label{E;interior} 
Show by means of an example that the following statement
may be false.

If $E$ is subset of ${\mathbb R}$, 
with the usual topology, then  there exists a unique
open set $V$ such that
                                                                          
\ \ (a) $V\supseteq E$, 
                                                         
\ \ (b) if $U$ is a open set with $U\supseteq E$,
then $U\supseteq V$.
\end{exercise}
\begin{exercise}\label{E;various Hausdorff}
Show that the following statements about a 
topological space $(Y,\sigma)$ are equivalent.

(i) $(Y,\sigma)$ is Hausdorff.

(ii) If $Y\times Y$ is given the product topology, the diagonal
\[\{\Delta=\{(y,y)\,:y\in Y\}\]
is closed.

(iii) For any topological space $(X,\tau)$
and any continuous functions $f,\,g:X\rightarrow Y$,
the set
\[\{x\in X:f(x)=g(x)\}\]
is closed.


Use the equivalence of (i) and (iii) to produce
an alternative proof of the result of 
Exercise~\ref{E;call me Hausdorff}.
 
\end{exercise}
\begin{exercise}\label{E;much compare} 
We work on ${\mathbb R}$. Let $\tau_{1}$
be the collection of sets which are unions
of half open intervals $[a,b)$ (including $\emptyset$).
Let $\tau_{2}$ be the collection of subsets of $E$
such that either $E=\emptyset$ or ${\mathbb R}\setminus E$
is finite.

(i) Show that $\tau_{1}$ and $\tau_{2}$ are topologies.

(ii) Is $\tau_{1}$ Hausdorff?

(iii) Is $\tau_{2}$ Hausdorff?

(iv) Is $\tau_{1}$ compact?

(v) Is $\tau_{2}$ compact?

(vi) Is $\tau_{1}$ connected?

(vii)  Is $\tau_{2}$ connected?

(viii) Is the identity map 
$\iota:({\mathbb R},\tau_{1})\rightarrow({\mathbb R},\tau_{2})$
continuous?

(ix) Is the identity map 
$\iota:({\mathbb R},\tau_{2})\rightarrow({\mathbb R},\tau_{1})$
continuous?
\end{exercise}
\begin{exercise}\label{E;every which way} Let
$(X,\tau_{X})$, $(Y,\tau_{Y})$, $(Z,\tau_{Z})$
be topological spaces. Suppose that
we give $X\times Y$ the product topology $\tau_{X\times Y}$
derived from $\tau_{X}$ and $\tau_{Y}$,
$(X\times Y)\times Z$  the product topology $\tau_{X\times Y}$
derived from $\tau_{X\times Y}$ and $\tau_{Z}$ and so on.

(i) Show that $(X\times Y,\tau_{X\times Y})$ and
$(Y\times X,\tau_{Y\times X})$ are homeomorphic.

(ii)  Show that $((X\times Y)\times Z,\tau_{(X\times Y)\times Z})$ 
and $(X\times (Y\times Z),\tau_{X\times (Y\times Z)})$ are homeomorphic.
\end{exercise} 
\begin{exercise}\label{E;compact rationals}
Does there exist an infinite compact subset
of the rationals (with the usual metric)? Give reasons.
\end{exercise}
\begin{exercise} {\bf [The finite intersection property]}%
\label{E;finite intersection}

(i) (This result is almost trivial but very useful.)
Show that a topological space $(X,\tau)$ is compact
if and only if it has the following property.

If ${\mathcal F}$ is a collection of closed sets
with the `finite intersection property'
\[F_{1},\,F_{2},\,\ldots,\,F_{n}\in {\mathcal F}
\Rightarrow \bigcap_{j=1}^{n}F_{j}\neq \emptyset,\]
then 
\[\bigcap_{F\in{\mathcal F}}F\neq\emptyset.\]

(ii) We work in ${\mathbb R}$ with the usual metric.
Give an example of of sequence of non-empty bounded open sets
$O_{j}$ such that 
\[O_{1}\supseteq O_{2}\supseteq O_{3}\supseteq\ldots,
\ \text{but}
\ \bigcap_{j=1}^{\infty}O_{j}=\emptyset.\]

Give an example of of sequence of non-empty closed sets
$F_{j}$ such that 
\[F_{1}\supseteq F_{2}\supseteq F_{3}\supseteq\ldots,
\ \text{but}
\ \bigcap_{j=1}^{\infty}F_{j}=\emptyset.\]
\end{exercise}.
\begin{exercise}\label{E;no Heine}
Consider the space $C_{\mathbb R}([0,1])$
of continuous functions $f:[0,1]\rightarrow{\mathbb R}$
(with the usual metrics). Show that
\[\|f\|_{\infty}=\sup_{t\in[0,1]}|f(t)|\]
is a well defined norm on $C_{\mathbb R}([0,1])$.
The general principle of uniform convergence which
you meet in Analysis~II tells you that this norm is complete.

Show that
\[B=\{f\,:\|f\|_{\infty}\leq 1\}\]
is closed and bounded but not compact.

\noindent$[$Contrast the theorem of Heine--Borel.$]$
\end{exercise} 
\begin{exercise} (Traditional)\label{E;fairyland} 
Fairyland may be considered
as a perfectly flat, endless plane. Good Queen Ermentrude
has planted an infinite forest of trees in such a way that,
wherever she looks from her throne, she sees a tree.
A troop of renegade beavers decide to gnaw down all but
a finite set of trees without being seen by the Queen.
Can they always do this? (Queen Ermentrude is open minded
and only plants open trees.)
\end{exercise}
\begin{exercise}{\bf [The one point compactification]}%
\label{E;beer mug}
Let $(X,tau)$ be a topological space (which may or may not
be compact). 

(i) Write $X^{*}=X\cup\{\infty\}$. (Note that
$\infty$ is just an object which is not in $X$. We could
follow Hilbert and take it to be `beer mug'.)

Let $\tau^{*}$ be the collection of sets $E\subseteq X^{*}$ such that
either $E\in\tau$ or $E=(X\setminus K)\cup\{\infty\}$, 
where $K$ is a closed compact subset
of $X$. Show that $\tau^{*}$ is topology on $X^{*}$ and
$(X^{*},\tau^{*})$ is compact. Show that the subspace
topology $\tau^{*}_{X}$ induced on $X$ by $\tau^{*}$ is
$\tau$.

(ii) (A well known variation.) Let 
$\tilde{\mathbb R}={\mathbb R}\cup\{-\infty,\infty\}$ 
(so, this time, we add a beer mug
and a sherry glass). 

Show that the collection ${\mathcal E}$ of sets
of the form 
\[[-\infty,a)={-\infty}\cup\{x\in{\mathbb R}\,:\,x<a\},
\ (b,\infty]={-\infty}\cup\{x\in{\mathbb R}\,:\,b<x\}\]
together with the open intervals $(a,b)$ form the basis
for a compact topology $\tilde{\tau}$ on $\tilde{\mathbb R}$.
\end{exercise} 
\begin{exercise}\label{E;underground} 
Let $P_{1}$, $P_{2}$, \ldots, $P_{n}$
be distinct points in ${\mathbb R}^{2}$
and $A=\{P_{1}, P_{2}, \ldots, P_{n}\}$. Let
${\mathbf x}\sim{\mathbf y}$ if and only if ${\mathbf x}={\mathbf y}$
or ${\mathbf x},\,{\mathbf y}\in A$. Show that $\sim$
is an equivalence relation on ${\mathbb R}^{2}$.

If $\tau$ is the usual Euclidean topology on ${\mathbb R}^{2}$,
show that the topology $\tau/\sim$ on ${\mathbb R}^{2}/\sim$
can be derived from a metric.

\noindent$[$Hint: The metric usually chosen is called
the London underground metric.$]$
\end{exercise}
\begin{exercise}\label{E;squash flat} Let $X$ and $Y$ be 
non-empty topological spaces,
and give $X\times Y$ the product topology. Show that
\[(x,y)\sim(u,v)\Leftrightarrow y=v\]
is an equivalence relation on $X\times Y$
Show that, as one might hope, the space $X\times Y/\sim$
with the quotient topology is homeomorphic to $Y$.
\end{exercise}
\begin{exercise}\label{E;point and close}
If $(X,d)$ is a metric space,
$x\in X$ and $E$ is non-empty subset of $X$,
we set
\[f_{E}(x)=d(x,E)=\inf\{d(x,e)\,:\,e\in E\}.\]

(i) Show that the map $f_{E}$ from $(X,d)$ to ${\mathbb R}$
with its usual metric is continuous.

(ii) Show that $E$ is closed if and only if $d(x,E)>0$ for
all $x\notin E$.

(iii) By using the functions $f_{E_{1}}$ and  $f_{E_{2}}$,
or otherwise, show that, if $E_{1}$ and $E_{2}$ are
disjoint closed subsets of $X$ then there exists a continuous
function $f:X\rightarrow{\mathbb R}$ with the
properties that $1\geq f(x)\geq 0$ for all $x\in X$
and
\[f(x)=
\begin{cases}
1&\text{if $x\in E_{1},$}\\
0&\text{if $x\in E_{2}.$}
\end{cases}
\]
Deduce that we can find disjoint open sets $U_{1}$
and $U_{2}$ such that $U_{1}\supseteq E_{1}$
and
$U_{2}\supseteq E_{2}$.
\end{exercise}
\begin{exercise}\label{E;point and compact} 
(This continues on from
parts~(i)
and (ii) of Exercise~\ref{E;point and close}.) 

(i) We work in a metric space $(X,d)$.
Consider two non-empty disjoint sets
$E$ and $G$. 
If $E$ is compact and $G$ is closed, show that there
exists a $\delta>0$ such that
\[d(e,g)\geq\delta\]
for all $e\in E$ and $g\in G$.

(ii) Find two non-empty disjoint closed sets $E$ and $G$
in ${\mathbb R}$ with the usual metric such that 
\[\inf_{e\in E,g\in G}|e-g|=0.\]
\end{exercise}
\begin{exercise}\label{E;scatter} We work on ${\mathbb R}$.
Let $\tau$ consist of all sets of the form $U\cup S$
where $U$ is an open set for the usual Euclidean
topology and $S$ is a subset of the irrationals.

(i) Show that $\tau$ is a topology. (It is called
the `scattered topology'.)

(ii) Show that $\tau$ is Hausdorff.

(iii) Show that $\{x\}$ is open if and only if $x$ is irrational.
\end{exercise}
\begin{exercise}\label{E;extend} 
Let $(X,\tau)$ be a topological space
and $E$ and $F$ subsets with the subspace topologies
$\tau_{E}$, $\tau_{F}$. Suppose that $E\cup F=X$,
that $(Y,\sigma)$ is another topological space
and $g:X\rightarrow Y$ a function. Suppose
that $g|_{E}:(E,\tau_{E})\rightarrow (Y,\sigma)$
and  $g|_{F}:(F,\tau_{F})\rightarrow (Y,\sigma)$
are continuous. 


Which of the
following statements are always true and which
may be false? Give proofs or counterexamples.

(i) If $E$ and $F$ are open, 
then $g:(X,\tau)\rightarrow (Y,\sigma)$
is continuous.

(ii) If $E$ and $F$ are closed, 
then $g:(X,\tau)\rightarrow (Y,\sigma)$
is continuous.

(iii) If $E$ is open and $F=X\setminus E$, 
then $g:(X,\tau)\rightarrow (Y,\sigma)$
is continuous.
\end{exercise}
\begin{exercise}\label{E;space fill} (Requires
the idea of uniform convergence from Analysis~II.) 
This example of a space filling curve
due to Liu Wen is simple rather than pretty.

Let $\delta_{k}=[k/10,(k+1)/10]$ for $0\leq k\leq 9$.
Let $f,g:[0,1]\rightarrow{\mathbb R}$ satisfy the following 
conditions:-
\[f(t)=\begin{cases}
0&\text{when $t\in\delta_{1}\cup\delta_{3}$}\\
1&\text{when $t\in\delta_{5}\cup\delta_{7}$} 
\end{cases}
\ \ g(t)=\begin{cases}
0&\text{when $t\in\delta_{1}\cup\delta_{5}$}\\
1&\text{when $t\in\delta_{3}\cup\delta_{7}$}
\end{cases}
\]
and $f(0)=f(1)=0$, $g(0)=g(1)=0$.
Sketch such a function. 

Set $F(t+n)=f(t)$, $G(t+n)=g(t)$ for all $t\in[0,1]$ and 
$n\in{\mathbb Z}$. Explain why, if we set
\[\phi(t)=\sum_{k=1}^{\infty} 2^{-k}F(10^{k-1})t),
\ \psi(t)=\sum_{k=1}^{\infty} 2^{-k}G(10^{k-1})t),\]
the map $t\mapsto\big(\phi(t),\psi(t\big)$
is a continuous map of $[0,1]$ to $[0,1]^{2}$ (with the usual metrics).

If
\[x=\sum_{j=1}^{\infty} x_{j}2^{-j}
\ \text{and}\ y=\sum_{j=1}^{\infty} y_{j}2^{-j}\]
with $x_{j},\,y_{j}\in\{0,1\}$, find
$t_{j}\in\{1,3,5,7\}$ such that, writing
\[t=\sum_{j=1}^{\infty} t_{j}10^{-j},\]
we have $\big(\phi(t),\psi(t)\big)=(x,y)$.

Conclude that there is a continuous surjective map
from $[0,1]$ to $[0,1]^{2}$.
\end{exercise}
\begin{exercise}\label{E;quart pot} We use the standard Euclidean metrics. 
Show that there does not exist a continuous
injection $f:[0,1]^{2}\rightarrow[0,1]$.

\noindent$[$Hint: Let $E=[0,1]^{2}\setminus\{{\mathbf a}\}$ 
for some fixed ${\mathbf a}$ and consider $f|_{E}$.$]$
\end{exercise}
\begin{exercise}\label{E;flea} 
We use the standard metric. Show that there
does not exist a continuous function $f:{\mathbb R}\rightarrow{\mathbb R}$
such that
\[x\in{\mathbb Q}\Leftrightarrow  f(x)\notin {\mathbb Q}.\]

Does there exist a continuous function $g:{\mathbb R}\rightarrow{\mathbb R}$
such that
\[x\in{\mathbb Q}\Leftrightarrow  g(x)\in {\mathbb Q}\ ?\]
Give reasons for your answer.
\end{exercise}
\begin{exercise}\label{E;chess}
Which, if any, of the following subsets of ${\mathbb R}^{2}$
with the usual topology are connected?

(i) $A=\{(x,y)\,:\,x\in{\mathbb Q}\}$.

(ii) $A=\{(x,y)\,:\,x\in{\mathbb Q}\}\cup\{(x,y)\,:\,y\in{\mathbb Q}\}$.
\end{exercise} 
\begin{exercise}\label{E;space out}
Consider a compact metric space $(X,d)$. Show
that there exists a $K$ such that $d(x,y)\leq K$ for
all $x,\,y\in X$. If $E$ is a non-empty subset of 
of $X$, we define the diameter $\Delta(E)$ of $E$ by
\[\Delta(E)=\sup_{(x,y)\in E}d(x,y).\]

Show that if $\{U_{\lambda}\}_{\lambda\in\Lambda}$
is an open cover of $X$, then there exists
a $\delta>0$ such that every non-empty subset $E$
with $\Delta E<\delta$ lies in some $U_{\lambda}$.
\end{exercise}
\begin{exercise}\label{E;intersection connected}
We work in a metric space $X,d)$. 
Suppose that $E_{1}$, $E_{2}$, \ldots
are connected sets with
$E_{1}\supseteq E_{2}\supseteq\ldots$. Show that,
if the $E_{j}$ are compact, $\bigcap_{j=1}^{\infty}E_{j}$
is connected.

\noindent$[$Hint: You may find Exercise~\ref{E;point and close}~(iii)
useful.$]$

Give an example in ${\mathbb R}^{2}$ with the usual Euclidean
topology to show that the result may fail if we replace `compact'
by `closed'.
\end{exercise}
\begin{exercise}\label{E;much product} 
In this question you may quote the result that
the product of two compact spaces is compact, but no other
result on product topologies.

Suppose that $(X,\tau)$, $(Y,\sigma)$ are topological
spaces and we give $X\times Y$ the product topology $\rho$.

(i) Show that, if $x\in X$, then
\[\big\{\{y\in Y\,:\,(x,y)\in U\}\,:\,U\in\rho\big\}=\sigma.\]

(ii) Give an example with $X$ and $Y$ each consisting of $2$ points
of a topology $\eta$ on $X\times Y$ such that
\[\big\{\{x\in X\,:\,(x,y)\in U\}\,:\,U\in\eta\big\}=\sigma\]
for each $y\in Y$
and
\[\big\{\{y\in Y\,:\,(x,y)\in U\}\,:\,U\in\eta\big\}=\tau\]
for each $x\in X$,
but $\eta\neq\rho$.

(iii) Prove the following results.

\ \ (a) $\rho$ Hausdorff $\Leftrightarrow\tau,\sigma$ Hausdorff.

\ \ (b) $\rho$ compact $\Leftrightarrow\tau,\sigma$ compact.

\ \ (c) $\rho$ connected $\Leftrightarrow\tau,\sigma$ connected.

\ \ (d) $\rho$ path-connected $\Leftrightarrow\tau,\sigma$  
path-connected.
\end{exercise}
\begin{exercise}\label{E;Cantor} 
Consider the space of sequences of
zeros and ones $X=\{0,1\}^{\mathbb N}$. Let us set
\[d({\mathbf x},{\mathbf y})=2^{-n}\]
if $x_{j}=y_{j}$ for $1\leq j\leq n-1$, $x_{n}\neq y_{n}$
and $d({\mathbf x},{\mathbf x})=0$.

(i) Show that $d$ is a metric.

(ii) Show that $(X,d)$ is complete.

(iii) Show that $(X,d)$ is compact.

(iv) Show that no point in $(X,d)$ is isolated (that is to say,
no one point set $\{{\mathbf x}\}$ is open).

(v) Show that the connected components of $(X,d)$ are the
one point sets.

(vi) Show that $X\times X$ with the product topology is
homeomorphic to $X$.
\noindent$[$The space just described may look nasty 
at first sight, but is, in fact,
both elegant and useful.$]$
\end{exercise}
\begin{exercise}\label{E;dense but counting} 
(i) Consider a topological space $(X,\tau)$.
If $X$ has a countable dense subset show that
so does every subset of $X$ (for the subspace topology).

(ii) Consider a metric space $(Y,\rho)$. If $Y$
has a countable dense subset show that the associated
topology has a countable basis. 
\end{exercise} 
\begin{exercise}\label{E;long non metric} Show that the collection of
half open intervals $[a,b)$ form a basis.
Consider
the `half open topology' $\tau_{H}$
on ${\mathbb R}$ is generated by this basis.

(i) Show that $\tau_{H}$ is Hausdorff

(ii) Show that the connected components of $({\mathbb R},\tau_{H})$ are the
one point sets $\{x\}$.

(iii) Show that $[a,b]$ with $a<b$ is not compact in $\tau_{H}$.

(vi) Consider ${\mathbb R}^{2}$ with the product
topology $\sigma_{H}$ obtained from $\tau_{H}$. Show
that ${\mathbb R}\times{\mathbb R}$ has a countable
dense subset.

(v) Show that the subspace topology
on  $Z=\{(x,x)\,:\,x\in{\mathbb R}\}$ derived from $\sigma_{H}$
is discrete.

(vii) Use Exercise~\ref{E;dense but counting} to show that
$\sigma_{H}$ is not derived from a metric. Deduce that
$\tau_{H}$ is not derived from a metric.
\end{exercise}
\begin{exercise}\label{E;large set} 
Consider the collection $X_{*}$ of all 
functions
$f:[0,1]\rightarrow{\mathbb R}$ with $f(x)>0$ for $x>0$,
$f(0)=0$ and $f(x)\rightarrow 0$ as $x\rightarrow 0$.
We take $X=X_{*}\cup\{f_{0}\}$ where $f_{0}$ is
the zero function
defined by $f_{0}(x)=0$ for all $x\in [0,1]$.
If $g\in X_{*}$, write
\[U_{g}=\{f\in X\,:\, f(x)/g(x)\rightarrow 0
\ \text{as $x\rightarrow 0$}\}.\]
Show that, given  $g_{1},\,g_{2}\in X_{*}$ we can find 
a $g_{3}\in X_{*}$ such that 
\[U_{g_{3}}\subseteq U_{g_{1}}\cap U_{g_{2}}.\]
Conclude that, if $\tau$ consists of $\emptyset$ together
with all those sets $V$ such that $V\supseteq U_{g}$ for
some $g\in X_{*}$, then $\tau$ is a topology on $X$.
Show that 
\[\bigcap_{g\in X_{*}}U_{g}=\{f_{0}\}.\]

Now suppose $g_{j}\in X^{*}$.
If we set $g(0)=0$ and
\[g(t)=n^{-1}\min_{1\leq j\leq n}g_{j}(t)
\ \text{for $t\in\big((n+1)^{-1},n^{-1}\big]$},\]
show that $g\in X^{*}$ and $g_{j}\notin U_{g}$.
Conclude that, although every open neighbourhood
of $f_{0}$ contains infinitely many points
and the intersection of the open neighbourhoods of
$f_{0}$ is the one point set $\{f_{0}\}$, there is no sequence 
$g_{j}$ with $g_{j}\neq f_{0}$ such that
$g_{j}\rightarrow f_{0}$.
 
\noindent$[$If you just accept this result without thought, it
is not worth doing the question. You should compare
and contrast the metric case. I would say that $f_{0}$
is `surrounded by too many neighbourhood-shells to be approached
by a sequence', but the language of the course is inadequate
to make this thought precise.

I am told that the ancient Greek geometers used a similar
counterexample for a related purpose.$]$
\end{exercise}
\begin{exercise}\label{E;forever incomplete}
(i) Show that the following two statements 
about a metric space $(X,d)$ are equivalent.

\qquad (A) There is a complete metric $\rho$ on $X$
which induces the same topology as $d$.

\qquad (B) There is a complete metric space $(Y,\theta)$
which is homeomorphic to $(X,d)$.

(ii) Consider ${\mathbb Q}$ with the usual metric $d$
and a metric $\rho$ which induces the same topology
as $d$. Write ${\mathbb Q}=\{q_{1},q_{2},\ldots\}$.
Let $y_{0}=0$, $r_{0}=1$. Show that we can find
inductively $y_{n}\in{\mathbb Q}$ and $r_{n}>0$ 
such that $r_{n}\leq 2^{-n}$
and

(a) $\rho(x,y_{n+1})\leq r_{n+1}
\Rightarrow \rho(x,y_{n})\leq r_{n}$,

(b) $\rho(x_{n+1},y_{n+1})\geq 2r_{n+1}$.

(iii) Continuing with (ii), show that the $y_{n}$ form
a Cauchy sequence for $\rho$ which does not converge.

(iv) Deduce that $({\mathbb Q},d)$ is not homeomorphic
to a complete metric space. 
\end{exercise}  

\begin{exercise}\label{E;topological groups} 
We get interesting results when we allow
for an interplay between algebra and topology. Consider
a \emph{topological group}, that is to say a group $G$
together with a topology $\tau$ on $G$ such that
(if we give $G\times G$ the associated product
topology) the multiplication function
$m:G\times G\rightarrow G$ (given by $m(x,y)=xy$)
and the inverse function $j:G\rightarrow G$ 
(given by $j^{-1}(x)=x^{-1}$) are continuous.
Typical examples include the matrix groups
such as $SO({\mathbb R}^{3})$ and $U({\mathbb C}^{3}$.

(i) (Homogeneity) Show that that, if $u,\,v\in G$, there
exists a homeomorphism $\phi:G\rightarrow G$ with $\phi(u)=v$.

(ii) Show that $G$ is Hausdorff if and only if $\{e\}$ is closed.

(iii) If $\{e\}$ is closed, show that the diagonal
\[\Delta G=\{(x,x)\,:\,x\in G\}\]
is a closed subgroup of $G\times G$ (i.e both a subgroup and closed
in the product topology).

(iv) If $\{e\}$ is closed, show that the centre
\[Z(G)=\{g\,:\,gh=hg\ \forall h\in G\}\]
is a  closed normal subgroup.

(v) Suppose that $H$ is a subgroup of $G$. Consider the
collection $X$ of cosets of $H$. Show that, if we
give $X$ the natural quotient topology, the map $\pi:G\rightarrow X$
given by $\pi(g)=gH$ is open (that is to say $\pi$ maps
open sets to open sets).

(vi) Show that $X$, as given in (v),
 is Hausdorff if and only if $H$ is closed in $G$.
\end{exercise}

\section{Some hints}
\begin{varthm}[Theorem~\ref{T;Heine--Borel}]%
\label{H;Heine--Borel}
{\bf [The Heine--Borel Theorem.]}
Let ${\mathbb R}$ be given its usual (Euclidean)
topology. Then the closed bounded interval
$[a,b]$ is compact.
\end{varthm}
\begin{proof}[Hint] Suppose that ${\mathcal C}$
is an open cover of $[a,b]$. If  ${\mathcal C}_{1}$
is a finite subcover of $[a,c]$
and ${\mathcal C}_{2}$
is a finite subcover of $[c,a]$,
then ${\mathcal C}_{1}\cup{\mathcal C}_{2}$
is a finite cover of $[a,b]$. We can use this
as a basis for a lion hunting (bisection)
argument.

[Return to page~\pageref{T;Heine--Borel}
or go to a full proof on ~\pageref{P;Heine--Borel}.]
\end{proof}
\begin{varthm}[Theorem~\ref{T;compact closed}]% 
\label{H;compact closed}
If $(X,\tau)$ is Hausdorff, then every compact set is closed.
\end{varthm}
\begin{proof}[Hint] Let $K$ be a compact set. If $x\notin K$,
then, given any $k\in K$, we know that $k\neq x$ and so,
since $X$ is Hausdorff, we can find open sets $U_{k}$
and $V_{k}$ such that
\[k\in V_{k},\ x\in U_{k}\ \text{and}\ V_{k}\cap U_{k}=\emptyset.\]
Now use compactness.

[Return to page~\pageref{T;compact closed}
or go to a full proof on ~\pageref{P;compact closed}.]
\end{proof}
\begin{varthm}[Theorem~\ref{T;bijection compact}]%
\label{H;bijection compact}
Let $(X,\tau)$ be a compact and $(Y,\sigma)$
a Hausdorff topological space. If $f:X\rightarrow Y$ 
is a continuous bijection, then it is a homeomorphism.
\end{varthm}
\begin{proof}[Hint] Observe that we need only show
that $f(K)$ is closed whenever $K$ is closed.

[Return to page~\pageref{T;bijection compact}
or go to a full proof on ~\pageref{P;bijection compact}.]
\end{proof}
\begin{varthm}[Theorem~\ref{T;product compact}]%
\label{H;product compact} 
The product of two compact spaces is compact.
(More formally, if $(X,\tau)$ and $(Y,\sigma)$ are compact
topological spaces and $\lambda$ is the product topology,
then $(X\times Y,\lambda)$ is compact.)
\end{varthm}
\begin{proof}[Hint] Let $\{O_{\alpha}\}_{\alpha\in A}$ be an open
cover for $X\times Y$. Then given $(x,y)\in X\times Y$ we can find
$U_{x,y}\in\tau$, $V_{x,y}\in\sigma$ and $\alpha(x,y)\in A$ such
that
\[(x,y)\in U_{x,y}\times V_{x,y}\subseteq O_{\alpha(x,y)}.\]
Now show that, for each $x\in X$, we can find a positive
integer $n(x)$ and $y(x,j)\in Y$ $[1\leq j\leq n(x)]$
such that
\[\bigcup_{j=1}^{n(x)}V_{x,y(x,j)}=Y.\]
Now consider the $U_{x}=\bigcap_{j=1}^{n(x)}U_{x,y(x,j)}$.

[Return to page~\pageref{T;product compact}
or go to a full proof on ~\pageref{P;product compact}.]
\end{proof}
\begin{varthm}[Example~\ref{E;locally constant}]
\label{H;locally constant}
Suppose that  $E$ is a connected subset of a topological
space $(X,\tau)$. Suppose that $f:E\rightarrow{\mathbb R}$
is `locally constant' in the sense that, given any
$e\in E$, we can find an open neighbourhood $U$ of $e$
such that $f$ is constant on $U\cap E$. Then $f$
is constant.
\end{varthm}
\begin{proof}[Hint] There is no loss in generality
in taking $E=X$ and $X\neq\emptyset$.
Choose an $x_{0}\in X$ and set $c=f(x_{0})$.
Now consider the sets
\[U=\{x\in X\,:\,f(x)=c\}\ \text{and}
\ V=\{x\in X\,:\,f(x)\neq c\}.\]

[Return to page~\pageref{E;locally constant}
or go to a full proof on ~\pageref{P;locally constant}.]
\end{proof}
\begin{varthm}[Theorem~\ref{T;connected to path}]%
\label{H;connected to path}
If we give ${\mathbb R}^{n}$ the usual topology,
then any open set $\Omega$ which is connected is path-connected.
\end{varthm}
\begin{proof}[Hint] 
Pick ${\mathbf x}\in\Omega$, let $U$ be the set of all points
in $\Omega$ which are path-connected to ${\mathbf x}$ 
and let $V$ be the set 
of all points in $\Omega$ which are not. We need to prove
that $U$ and $V$ are open and to do this we make use
of the fact that any point in an open ball is path-connected
to the centre of the ball.

[Return to page~\pageref{T;connected to path}
or go to a full proof on page~\pageref{P;connected to path}.]
\end{proof}
\begin{varthm}[Theorem~\ref{T;compact implies sequence}]%
\label{H;compact implies sequence}
If the metric space $(X,d)$ is compact, it is sequentially compact.
\end{varthm}
\begin{proof}[Hint] Let $x_{n}$ be a sequence in $X$. If
it has no convergent subsequence, then, for each $x\in X$,
we can find a $\delta(x)>0$ and an $N(x)$ such that
$x_{n}\notin B(x,\delta(x))$ for all $n\geq N(x)$.

[Return to page~\pageref{T;compact implies sequence}
or go to a full proof on page~\pageref{P;compact implies sequence}.]
\end{proof}
\begin{varthm}[Lemma~\ref{L;Lebesgue}]%
\label{H;Lebesgue}
Suppose that $(X,d)$ is a sequentially compact
metric space and that the collection $U_{\alpha}$
with $\alpha\in A$ is an open cover of $X$.
Then there exists a $\delta>0$ such that, given any
$x\in X$, there exists an $\alpha(x)\in A$
such that the open ball $B(x,\delta)\subseteq U_{\alpha(x)}$.
\end{varthm}
\begin{proof}[Hint]  Suppose the first sentence is true and the
second sentence false. Then, for each $n\geq 1$,
we can find an $x_{n}$ such that $B(x_{n},1/n)\not\subseteq U_{\alpha}$
for all $\alpha\in A$.

[Return to page~\pageref{L;Lebesgue}
or go to a full proof on page~\pageref{P;Lebesgue}.]
\end{proof}
\begin{varthm}[Theorem~\ref{T;sequence implies compact}]%
\label{H;sequence implies compact}
If the metric space $(X,d)$ is sequentially compact, it is compact.
\end{varthm}
\begin{proof}[Hint] Let $(U_{\alpha})_{\alpha\in A}$ be an open cover
and let $\delta$ be defined as in Lemma~\ref{L;Lebesgue}.
The $B(x,\delta)$ form a cover of $X$. If they have no finite
subcover then, given $x_{1}$, $x_{2}$, \dots $x_{n}$,
we can find an $x_{n+1}\notin\bigcup_{j=1}^{n}B(x_{j},\delta)$. 

[Return to page~\pageref{T;sequence implies compact}
or go to a full proof on page~\pageref{P;sequence implies compact}.]
\end{proof}
\section{Some proofs}
\begin{varthm}[Exercise~\ref{E;distance positive}]%
\label{P;distance positive}
If $d:X^{2}\rightarrow{\mathbb R}$ is a function with the
following properties:-
                                                                               
(ii) $d(x,y)=0$ if and only if $x=y$,
                                                                               
(iii) $d(x,y)=d(y,x)$ for all $x,\,y\in X$,
                                                                               
(iv) $d(x,y)+d(y,z)\geq d(x,z)$ for all $x,\,y,\,z\in X$,
                                                                               
\noindent show that $d$ is a metric on $X$. 
\end{varthm}
\begin{proof}[Solution] 
Setting $z=x$ in condition~(iv) and using
(iii) and (ii), we have
\[2d(x,y)=d(x,y)+d(y,x)\geq d(x,x)=0\]
so $d(x,y)\geq 0$. 

[Return to page~\pageref{E;distance positive}.] 
\end{proof}
\begin{varthm}[Exercise~\ref{E;not metric}]%
\label{P;not metric}
Let $X=\{a,\,b,\,c\}$ with $a$, $b$ and $c$
distinct. Write down functions $d_{j}:X^{2}\rightarrow{\mathbb R}$ 
satisfying condition~(i) of Definition~\ref{D;metric}
such that

(1) $d_{1}$ satisfies conditions~(ii) and~(iii) but not~(iv).

(2) $d_{2}$ satisfies conditions~(iii) and~(iv) but it is not
true that $x=y$ implies $d(x,y)=0$.

(3) $d_{3}$ satisfies conditions~(iii) and~(iv)
and $x=y$ implies $d_{3}(x,y)=0$.
but it is not
true that  $d_{3}(x,y)=0$ implies $x=y$.

(4) $d_{4}$ satisfies conditions~(ii) and~(iv) but not~(iii).

You should verify your statements.
\end{varthm}
\begin{proof}[Solution] Here are some possible choices.

(1) Take $d_{1}(x,x)=0$ for all $x\in X$,
$d_{1}(a,b)=d_{1}(b,a)=d_{1}(a,c)=d_{1}(c,a)=1$
and $d_{1}(b,c)=d_{1}(c,b)=3$. Conditions~(ii) and~(iii)
hold by inspection, but
\[d_{1}(b,a)+d_{1}(a,c)=2<3=d_{1}(b,c).\]

(2) Take $d_{2}(x,x)=1$
and $d_{2}(x,y)=2$ if $x\neq y$. Condition~(ii) fails
and condition~(iii) holds by inspection. We observe that
\[d_{2}(x,y)+d_{2}(y,z)\geq 1+1=2\geq d_{2}(x,z)\]
so the triangle law holds.

(3) Take
$d_{2}(x,y)=0$ for all $x,\,y\in X$.

(4) Take $d_{4}(x,x)=0$ for all $x\in X$,
$d_{4}(a,b)=d_{4}(b,a)=d_{4}(a,c)=d_{4}(c,a)=1$
and $d_{1}(b,c)=d_{1}(c,b)=\tfrac{5}{4}$. Conditions~(ii) holds,
and condition~(iii) fails by inspection
and
\begin{alignat*}{2}
d(x,y)+d(y,z)&=d(x,y)=d(x,z)\geq d(x,z)&&\qquad\text{if $y=z$},\\
d(x,y)+d(y,z)&=d(y,z)=d(x,z)\geq d(x,z)&&\qquad\text{if $x=y$},\\
d(x,y)+d(y,z)&\geq 
1+1=2\geq\tfrac{5}{4}\geq d(x,z)&&\qquad\text{otherwise,}
\end{alignat*}
so the triangle law holds.

[Return to page~\pageref{E;not metric}.] 
\end{proof}

\begin{varthm}[Exercise~\ref{L;norm to metric}]%
\label{P;norm to metric} 
If $(V,\|\ \|)$ is a normed vector space,
then the condition 
\[d({\mathbf u},{\mathbf v})=\|{\mathbf u}-{\mathbf v}\|\]
defines a metric $d$ on $V$.
\end{varthm}
\begin{proof}[Solution] We observe that
\[d({\mathbf u},{\mathbf v})=\|{\mathbf u}-{\mathbf v}\|\geq 0\]
and 
\[d({\mathbf u},{\mathbf u})=\|{\boldsymbol 0}\|=
\|0{\boldsymbol 0}\|=|0|\|{\boldsymbol 0}\|
=0\|{\boldsymbol 0}\|=0.\]
Further, if $d({\mathbf u},{\mathbf v})=0$, 
then $\|{\mathbf u}-{\mathbf v}\|=0$
so ${\mathbf u}-{\mathbf v}={\boldsymbol 0}$ and ${\mathbf u}={\mathbf v}$.
We also observe that
\[d({\mathbf u},{\mathbf v})=\|{\mathbf u}-{\mathbf v}\|=
\|(-1)({\mathbf v}-{\mathbf u})\|
=|-1|\|{\mathbf v}-{\mathbf u}\|=d({\mathbf v},{\mathbf u})\]
and
\begin{align*}
d({\mathbf u},{\mathbf v})+d({\mathbf v},{\mathbf w})&=
\|{\mathbf u}-{\mathbf v}\|+\|{\mathbf v}-{\mathbf w}\|\\
&\geq \|({\mathbf u}-{\mathbf v})+({\mathbf v}-{\mathbf w})\|\\
&=\|{\mathbf u}-{\mathbf w}\|=
d({\mathbf u},{\mathbf w}).
\end{align*}

[Return to page~\pageref{L;norm to metric}.] 
\end{proof}
\begin{varthm}[Lemma~\ref{L;discrete is metric}]\label{P;discrete is metric}
The discrete metric on $X$
is indeed a metric.
\end{varthm}
\begin{proof} The only non-evident condition is the triangle law.
But
\begin{alignat*}{2}
d(x,y)+d(y,z)&=d(x,y)=d(x,z)\geq d(x,z)&&\qquad\text{if $y=z$},\\
d(x,y)+d(y,z)&=d(y,z)=d(x,z)\geq d(x,z)&&\qquad\text{if $x=y$},\\
d(x,y)+d(y,z)&\geq 1+1=2\geq 1\geq d(x,z)&&\qquad\text{otherwise,}
\end{alignat*}
so we are done.

[Return to page~\pageref{L;discrete is metric}.] 
\end{proof}
\begin{varthm}[Lemma~\ref{E;British Rail is metric}]%
\label{P;British Rail is metric} 
Show that the British Rail express metric
and the British Rail stopping metric are indeed metrics.
\end{varthm}
\begin{proof}[Solution]
We show that the British Rail stopping metric is indeed a metric.
The case of the British Rail express metric is left to the reader.

Let $d$ be the British rail stopping metric on ${\mathbb R}^{2}$.
It is easy to see that $d({\mathbf u},{\mathbf v})\geq 0$
and that $d({\mathbf u},{\mathbf v})=d({\mathbf v},{\mathbf u})$.
Since ${\mathbf u}$ and ${\mathbf u}$ are linearly dependent,
\[d({\mathbf u},{\mathbf u})=\|{\mathbf u}-{\mathbf u}\|_{2}
=\|{\boldsymbol 0}\|_{2}=0.\]

If $d({\mathbf u},{\mathbf v})=0$, then we know that at least one
of the following statements is true

(1) $\|{\mathbf u}-{\mathbf v}\|_{2}=0$ and so 
${\mathbf u}-{\mathbf v}={\boldsymbol 0}$,

(2) $\|{\mathbf u}\|_{2}+\|{\mathbf v}\|_{2}=0$ and so
$\|{\mathbf u}\|_{2}=\|{\mathbf v}\|_{2}=0$, whence 
${\mathbf u}={\mathbf v}={\boldsymbol 0}$.

\noindent In either case ${\mathbf u}={\mathbf v}$ as required.

It only remains to prove the triangle inequality.
Observe that, if ${\mathbf v}$ and ${\mathbf w}$ are not linearly
dependent,
\[d({\mathbf u},{\mathbf v})+d({\mathbf v},{\mathbf w})
\geq \|{\mathbf u}-{\mathbf v}\|_{2}
+\|{\mathbf v}\|_{2}+\|{\mathbf w}\|_{2}
\geq \|{\mathbf u}\|_{2}+\|{\mathbf w}\|_{2}\geq d({\mathbf u},{\mathbf w}).\]
By similar reasoning
\[d({\mathbf u},{\mathbf v})+d({\mathbf v},{\mathbf w})
\geq d({\mathbf u},{\mathbf w})\]
if ${\mathbf u}$ and ${\mathbf v}$ are not linearly
dependent. Finally, if ${\mathbf u}$ and ${\mathbf v}$ are linearly
dependent and ${\mathbf v}$ and ${\mathbf w}$ are linearly
dependent, then ${\mathbf u}$ and ${\mathbf w}$ are linearly
dependent so
\[d({\mathbf u},{\mathbf v})+d({\mathbf v},{\mathbf w})
= \|{\mathbf u}-{\mathbf v}\|_{2}
+\|{\mathbf v}-{\mathbf w}\|_{2}
\geq \|{\mathbf u}-{\mathbf w}\|_{2}=d({\mathbf u},{\mathbf w}).\]
Thus the triangle law holds.

[Return to page~\pageref{E;British Rail is metric}.]
\end{proof}
\begin{varthm}[Lemma~\ref{L;composition metric}]%
\label{P;composition metric}{\bf [The composition law.]} 
If $(X,d)$ and $(Y,\rho)$
and $(Z,\sigma)$ are metric spaces and $g:X\rightarrow Y$, $f:Y\rightarrow Z$
are continuous, then so is the composition $fg$.
\end{varthm}
\begin{proof} Let $\epsilon>0$ be given and let $x\in X$. Since
$f$ is continuous, we can find a $\delta_{1}>0$
(depending on $\epsilon$ and $fg(x)=f(g(x))$ with
\[\sigma(f(g(x)),f(y))<\epsilon\ \text{whenever $\rho(g(x),y)<\delta_{1}$}.\]
Since $g$ is continuous, we can find a $\delta_{2}>0$ such that
\[\rho(g(x),g(t))<\delta_{1}\ \text{whenever $d(x,t)<\delta_{2}$}.\]
We now have 
\[\sigma(f(g(x)),f(g(t)))<\epsilon\ \text{whenever $d(x,t)<\delta_{2}$}\]
as required.

[Return to page~\pageref{L;composition metric}.]
\end{proof}
\begin{varthm}[Exercise~\ref{E;exercise composition}]%
\label{P;exercise composition}
Let ${\mathbb R}$ and ${\mathbb R}^{2}$ have their usual (Euclidean) metric.

(i) Suppose that $f:{\mathbb R}\rightarrow{\mathbb R}$ and
$g:{\mathbb R}\rightarrow{\mathbb R}$ are continuous. Show that
the map $(f,g):{\mathbb R}^{2}\rightarrow{\mathbb R}^{2}$
is continuous.

(ii) Show that the map $M:{\mathbb R}^{2}\rightarrow{\mathbb R}$
given by $M(x,y)=xy$ is continuous.

(iii) Use the composition law to show that the map 
$m:{\mathbb R}^{2}\rightarrow{\mathbb R}$ 
given by $m(x,y)=f(x)g(y)$ is continuous.
\end{varthm} 
\begin{proof}[Solution] (i) Let $(x,y)\in{\mathbb R}^{2}$.
Given $\epsilon>0$, we can find $\delta_{1}>0$ such that
\[|f(x)-f(s)|<\epsilon/2\ \text{whenever $|x-s|<\delta_{1}$}\]
and  
$\delta_{2}>0$ such that
\[|g(y)-g(t)|<\epsilon/2\ \text{whenever $|y-t|<\delta_{2}$}.\]
If we set $\delta=\min(\delta_{1},\delta_{2})$, then
$\|(x,y)-(s,t)\|_{2}<\delta$ implies
\[
|x-s|<\delta\leq\delta_{1}
\ \text{and}\ |y-t|<\delta\leq\delta_{2}
\]
so that
\[|f(x)-f(s)|<\epsilon/2\ \text{and}\ |g(y)-g(t)|<\epsilon/2\]
whence
\begin{align*}
\|(f(x),g(y))-(f(s),g(t))\|_{2}
&\leq \|(f(x),0)-(f(s),0)\|_{2}+\|(0,g(y))-(0,g(t))\|_{2}\\
&=|f(x)-f(s)|+|g(y)-g(t)|<\epsilon
\end{align*}
as required.

[Return to page~\pageref{E;exercise composition}.]
\end{proof}
\begin{varthm}[Example~\ref{E;Open ball open}]%
\label{P;Open ball open} 
(i) Let $(X,d)$ be a metric space.
If $r>0$, then
\[B(x,r)=\{y\,:\,d(x,y)<r\}\]
is open. 

(ii) If we work in ${\mathbb R}^{n}$ with the Euclidean metric,
then the one point set $\{{\mathbf x}\}$ is not open.

(iii) If $(X,d)$ is a discrete metric space, then
\[\{x\}=B(x,1/2)\]
and all subsets of $X$ are open.
\end{varthm}
\begin{proof} (i) If $y\in B(x,r)$, then 
$\delta=r-d(x,y)>0$ and,
whenever $d(z,y)<\delta$,
the triangle inequality gives us
\[d(x,z)\leq d(x,y)+d(y,z)<r\]
so $z\in B(x,r)$. Thus $B(x,r)$ is open.

(ii) Choose ${\mathbf e}\in{\mathbb R}^{n}$ with $\|{\mathbf e}\|_{2}=1$.
(We could take ${\mathbf e}=(1,0,0,\dots,0)$.) If $\delta>0$,
then, setting ${\mathbf y}={\mathbf x}+(\delta/2){\mathbf e}$, we have
$\|{\mathbf x}-{\mathbf y}\|_{2}<\delta$, 
yet ${\mathbf y}\notin\{{\mathbf x}\}$.
Thus $\{{\mathbf x}\}$ is not closed.

(iii) Observe that $d(x,x)=0<1/2$ and $d(x,y)=1>1/2$ for $x\neq y$.
If $x\in E$ then $d(x,y)<1/2$ implies $y=x\in E$, so $E$ is open.

[Return to page~\pageref{E;Open ball open}.]
\end{proof}
\begin{varthm}[Theorem~\ref{T;properties metric open}]%
\label{P;properties metric open} 
If $(X,d)$ is a metric space, 
then the following statements are true.

(i) The empty set $\emptyset$ and the space $X$ are open.

(ii) If $U_{\alpha}$ is open for all $\alpha\in A$, then
$\bigcup_{\alpha\in A} U_{\alpha}$ is open. (In other words,
the union of open sets is open.)

(iii) If $U_{j}$ is open for all $1\leq j\leq n$, then
$\bigcap_{j=1}^{n} U_{j}$ is open.
\end{varthm}
\begin{proof}
(i) Since there are no points $e$ in $\emptyset$, the statement
\[x\in \emptyset\ \text{whenever}\ d(x,e)<1\]
holds for all $e\in \emptyset$. Since every point $x$ belongs to $X$,
the statement
\[x\in X\ \text{whenever}\ d(x,e)<1\]
holds for all $e\in X$.

(ii) If $e\in \bigcup_{\alpha\in A} U_{\alpha}$, then we can find
a particular $\alpha_{1}\in A$ with $e\in U_{\alpha_{1}}$.
Since $U_{\alpha_{1}}$ is open, we can find a $\delta>0$
such that
\[x\in U_{\alpha_{1}}\ \text{whenever}\ d(x,e)<\delta.\]
Since $U_{\alpha_{1}}\subseteq \bigcup_{\alpha\in A} U_{\alpha}$,
\[x\in \bigcup_{\alpha\in A} U_{\alpha}  \text{whenever}\ d(x,e)<\delta.\]
Thus $\bigcup_{\alpha\in A} U_{\alpha}$ is open.

(iii) If $e\in \bigcap_{j=1}^{n} U_{j}$, then
$e\in U_{j}$ for each $1\leq j\leq n$. Since
$U_{j}$ is open, we can find a $\delta_{j}>0$
such that
\[x\in U_{j}\ \text{whenever}\ d(x,e)<\delta_{j}.\]
Setting $\delta=\min_{1\leq j\leq n}\delta_{j}$, we
have $\delta>0$ and
\[x\in U_{j}\ \text{whenever}\ d(x,e)<\delta\]
for all $1\leq j\leq n $. Thus
\[x\in \bigcap_{j=1}^{n} U_{j}\ \text{whenever}\ d(x,e)<\delta\]
and we have shown that $\bigcap_{j=1}^{n} U_{j}$ is open.


[Return to page~\pageref{T;properties metric open}.]
\end{proof} 
\begin{varthm}[Theorem~\ref{T;metric continuous open}]%
\label{P;metric continuous open}
Let $(X,d)$ and $(Y,\rho)$ be metric spaces.
A function $f:X\rightarrow Y$ is continuous if and only
if $f^{-1}(U)$ is open in $X$ whenever $U$ is open in $Y$.
\end{varthm}
\begin{proof} Suppose first that $f$ is continuous
and that $U$ is open in $Y$. If $x\in f^{-1}(U)$, then
we can find a $y\in U$ with $f(x)=y$. Since $U$ is
open in $Y$, we can find an $\epsilon>0$ such that
\[z\in U\ \text{whenever $\rho(y,z)<\epsilon$}.\]
Since $f$ is continuous, we can find a $\delta>0$
such that
\[\rho(y,f(w))=\rho(f(x),f(w))<\epsilon
\ \text{whenever $d(x,w)<\delta$}.\]
Thus 
\[f(w)\in U\ \text{whenever $d(x,w)<\delta$}.\]
In other words,
\[w\in f^{-1}(U)\ \text{whenever $d(x,w)<\delta$}.\]
We have shown that $f^{-1}(U)$ is open.

We now seek the converse result. Suppose that
$f^{-1}(U)$ is open in $X$ whenever $U$ is open in $Y$.
Suppose $x\in X$ and $\epsilon>0$. We know that the
open ball
\[B(f(x),\epsilon)=\{y\in Y\,:\, \rho(f(x),y)<\epsilon\}\]
is open. Thus
$x\in f^{-1}B\big(f(x),\epsilon\big)$ and
$f^{-1}B\big(f(x),\epsilon\big)$ is open. It follows that
there is a $\delta>0$ such that
\[w\in f^{-1}B\big(f(x),\epsilon\big)\ \text{whenever $d(x,w)<\delta$},\]
so, in other words,
\[\rho(f(x),f(w))<\epsilon\ \text{whenever $d(x,w)<\delta$}.\]
Thus $f$ is continuous.

[Return to page~\pageref{T;metric continuous open}.]
\end{proof}
\begin{varthm}[Example~\ref{E;open not continuous}]%
\label{P;open not continuous} 
Let $X={\mathbb R}$ and $d$ be the discrete metric.
Let $Y={\mathbb R}$ and $\rho$ be the usual (Euclidean)
metric.

(i) If we define $f:X\rightarrow Y$ by $f(x)=x$, then $f$ is continuous
but there exist open sets $U$ in $X$ such that $f(U)$ is not open.

(ii) If we define $g:Y\rightarrow X$ by $g(y)=y$, then $g$ is not continuous
but $g(V)$ is open in $X$ whenever $V$ is open in $Y$.
\end{varthm}
\begin{proof} Since every set is open in $X$, we have
$f^{-1}(V)=g(V)$ open for every $V$ in $Y$ and so, in particular, 
for every open set. Thus $f$ is continuous.

We observe that $U=\{0\}$ is open in $X$ 
and $g^{-1}(U)=f(U)=U=\{0\}$
is not open in $Y$. Thus $g$ is not continuous.

[Return to page~\pageref{E;open not continuous}.]
\end{proof}
\begin{varthm}[Exercise~\ref{E;British rail balls}]%
\label{P;British rail balls} 
Consider ${\mathbb R}^{2}$.
For each of the British rail express and
British rail stopping metrics:-

(i) Describe the open balls. (Consider both large
and small radii.)

(ii) Describe the open sets as well as you can.
(There is a nice description for the British rail express
metric.) Give reasons for your answers.
\end{varthm}
\begin{proof}[Solution] We start with the British rail express metric.
Write
\[B_{E}(\delta)=\{{\mathbf x}\,:\,\|{\mathbf x}\|_{2}<\delta\}\]
for the Euclidean ball centre ${\boldsymbol 0}$ $[\delta>0]$.
If $0<r<\|{\mathbf x}\|_{2}$, then
\[B({\mathbf x},r)=\{{\mathbf x}\}.\]
If $\|{\mathbf x}\|_{2}>r>0$, then
\[B({\mathbf x},r)=\{{\mathbf x}\}\cup B_{E}(r-\|{\mathbf x}\|).\]
Since open balls are open and the union of open sets is open,
we deduce that every set not containing ${\boldsymbol 0}$ and every
set containing $B_{E}(\delta)$ for some $\delta>0$ is open.

On the other hand, if $U$ is open and ${\mathbf 0}\in U$ then
$U$ must contain $B_{E}(\delta)$ for some $\delta>0$.
It follows that the collection of sets described 
in the last sentence of the previous
paragraph constitute the open sets for the British rail express metric.

We turn now to the stopping metric. We observe that
\[B({\boldsymbol 0},r)=B_{E}(r)\]
for $r>0$. If ${\mathbf x}\neq{\boldsymbol 0}$  and $0<r<\|{\mathbf x}\|_{2}$,
then
\[B({\mathbf x},r)=\left\{\lambda\frac{\mathbf x}{{\|{\mathbf x}\|_{2}}}
\,:\,\lambda\in(\|{\mathbf x}\|_{2}-r,\|{\mathbf x}\|_{2}+r)\right\}.\]
If ${\mathbf x}\neq{\boldsymbol 0}$ and $\|{\mathbf x}\|_{2}>r>0$, then
\[B({\mathbf x},r)=\left\{\lambda\frac{\mathbf x}{{\|{\mathbf x}\|_{2}}}
\,:\,\lambda\in(0,\|{\mathbf x}\|_{2}+r)\right\}
\cup B_{E}(r-\|{\mathbf x}\|).\]
A similar argument to the previous paragraph shows that the open sets are 
precisely the unions of sets of the form
\[l({\mathbf e},(a,b))=\{\lambda{\mathbf e}\,:\,\lambda\in(a,b)\}\]
where ${\mathbf e}$ is a unit vector and $0\leq a<b$
together with
some  $B_{E}(\delta)$ with $\delta>0$.

[Return to page~\pageref{E;British rail balls}.]
\end{proof}
\begin{varthm}[Lemma~\ref{L;limit unique}]%
\label{P;limit unique} 
Consider a metric space $(X,d)$. If
a sequence $x_{n}$ has a limit, then that limit is unique.
\end{varthm}
\begin{proof} Suppose $x_{n}\rightarrow x$ and $x_{n}\rightarrow y$.
Then, given any $\epsilon>0$, we can find $N_{1}$ and $N_{2}$ such that
\[
d(x_{n},x)<\epsilon/2\ \text{for all $n\geq N_{1}$ and}
\ d(x_{n},y)<\epsilon/2\ \text{for all $n\geq N_{2}$}.
\]
Taking $N=\max(N_{1},N_{2})$, we obtain
\[d(x,y)\leq d(x_{N},x)+d(x_{N},y)<\epsilon/2+\epsilon/2=\epsilon.\]
Since $\epsilon$ was arbitrary, $d(x,y)=0$ and $x=y$.

[Return to page~\pageref{L;limit unique}.]
\end{proof}

\begin{varthm}[Exercise~\ref{E;sequence continuous}]%
\label{P;sequence continuous}
Consider two metric spaces $(X,d)$ and $(Y,\rho)$.
Show that a function $f:X\rightarrow Y$ is continuous
if and only if, whenever $x_{n}\in X$ and $x_{n}\rightarrow x$
as $n\rightarrow\infty$, we have $f(x_{n})\rightarrow f(x)$
\end{varthm}
\begin{proof}[Solution]
Suppose that $f$ is continuous and  $x_{n}\rightarrow x$.
Then, given $\epsilon>0$, we can find a $\delta>0$
such that
\[d(z,x)<\epsilon\Rightarrow \rho\big(f(z),f(x)\big)
<\delta\]
and then find an $N$ such that
\[n\geq N\Rightarrow d(x_{n},x)<\epsilon\]
and so
\[n\geq N\Rightarrow \rho\big(f(z),f(x)\big)
<\delta.\]
Thus  $f(x_{n})\rightarrow f(x)$.

If $f$ is not continuous, we can find a $\delta>0$
such that, given any $\epsilon>0$, there exists an
$z\in X$ with $d(z,x)<\epsilon$ and
$\rho\big(f(z),f(x)\big)>\delta$. In particular,
we can find $x_{n}\in X$ such that
$d(x_{n},x)<1/n$ but $\rho\big(f(x_{n}),f(x)\big)>\delta$.
Thus $x_{n}\rightarrow x$, but 
 $f(x_{n})\not\rightarrow f(x)$.

[Return to page~\pageref{E;sequence continuous}]
\end{proof}
\begin{varthm}[Theorem~\ref{T;closed complements open}]%
\label{P;closed complements open}
Let $(X,d)$ be a metric space. A set $F$ in $X$
is closed if and only if its complement is open.
\end{varthm}
\begin{proof}\emph{Only if} Suppose that
$F$ is closed and $E=X\setminus F$.
If $E$ is not open, we can find an $e\in E$ such that
$B(e,\delta)\cap F\neq\emptyset$ for all $\delta>0$.
In particular, we can find $x_{n}\in F$ such that $d(x_{n},e)<1/n$
for each $n\geq 1$. Since $x_{n}\rightarrow e$ and $F$ is closed,
we have $e\in F$ contradicting our initial assumption that
$e\in E$. Thus $E$ is open.

\emph{If} We now establish the converse. Suppose $E$ is open
and $F=X\setminus E$. Suppose $x_{n}\in F$ and $x_{n}\rightarrow x$.
If $x\in E$, then, since $E$ is open
 we can find a $\delta>0$ such that $B(x,\delta)\subseteq E$.
Thus $d(x_{n},x)\geq \delta$ for all $n$ which is absurd.
Thus $x\in F$ and $F$ is closed.

[Return to page~\pageref{T;closed complements open}.]
\end{proof}
\begin{varthm}[Theorem~\ref{T;properties metric closed}]%
\label{P;properties metric closed} 
If $(X,d)$ is a metric space, 
then the following statements are true.

(i) The empty set $\emptyset$ and the space $X$ are closed.

(ii) If $F_{\alpha}$ is closed for all $\alpha\in A$, then
$\bigcap_{\alpha\in A} F_{\alpha}$ is closed. (In other words
the intersection of closed sets is closed.)

(iii) If $F_{j}$ is closed for all $1\leq j\leq n$, then
$\bigcup_{j=1}^{n} F_{j}$ is open.
\end{varthm}
\begin{proof} (i) Observe that $\emptyset=X\setminus X$
and $X=X\setminus \emptyset$.

(ii) Since $F_{\alpha}$ is closed, $X\setminus F_{\alpha}$
is open for all $\alpha\in A$. It follows that
\[X\setminus \bigcap_{\alpha\in A} F_{\alpha}
=\bigcup_{\alpha\in A}(X\setminus F_{\alpha})\]
is open and so  $\bigcap_{\alpha\in A} F_{\alpha}$ is closed.

(iii) Since $F_{j}$ is closed, $X\setminus F_{j}$
is open for all $1\leq j\leq n$. It follows that
\[X\setminus \bigcup_{j=1}^{n} F_{j}
=\bigcap_{j=1}^{n}(X\setminus F_{j})\]
is open and so  $\bigcup_{j=1}^{n} F_{j}$ is closed.

[Return to page~\pageref{T;properties metric closed}.]
\end{proof}
\begin{varthm}[Theorem~\ref{T;metric continuous closed}]%
\label{P;metric continuous closed}
Let $(X,d)$ and $(Y,\rho)$ be metric spaces.
A function $f:X\rightarrow Y$ is continuous if and only
if $f^{-1}(F)$ is closed in $X$ whenever $F$ is closed in $Y$.
\end{varthm}
\begin{proof} 
\emph{If} Suppose that
$f$ is continuous. If $F$ is closed in $Y$,
then $Y\setminus F$
is open, so 
\[X\setminus f^{-1}(F)=f^{-1}(Y\setminus F)\]
is open. Thus $f^{-1}(F)$ is closed.

\emph{Only if} Suppose $f^{-1}(F)$ is closed whenever $F$ is.
If $U$ is open in $Y$,
then $Y\setminus U$
is closed, so 
\[X\setminus f^{-1}(U)=f^{-1}(Y\setminus U)\]
is closed. Thus $f^{-1}(U)$ is open.
We have shown that $f$ is continuous.

[Return to page~\pageref{T;metric continuous closed}.]
\end{proof}  
\begin{varthm}[Exercise~\ref{E;silly count}]%
\label{P;silly count} 
Write ${\mathcal P}(Y)$ for the collection
of subsets of $Y$. If $X$ has three elements, how many
elements does ${\mathcal P}\big({\mathcal P}(X)\big)$
have?

How many topologies are there on $X$?
\end{varthm}
\begin{proof}[Solution] 
If $Y$ has $n$ elements ${\mathcal P}(Y)$ has $2^{n}$
elements so ${\mathcal P}\big({\mathcal P}(X)\big)$ 
has $2^{2^{3}}=2^{8}=256$ elements.

Let $X=\{x,y,z\}$. We set out the types of possible
topologies below.
\begin{center}
\begin{tabular}{c|c}
type&number of this type\\
$\{\emptyset,X\}$&$1$\\
$\{\emptyset,\{x\},X\}$&$3$\\
$\{\emptyset,\{x\},\{y\},\{x,y\},X\}$&$3$\\
${\mathcal P}(X)$&$1$\\
$\{\emptyset,\{x,y\},X\}$&$3$\\
$\{\emptyset,\{x\},\{x,y\},X\}$&$6$\\
$\{\emptyset,\{z\},\{x,y\},X\}$&$3$\\
$\{\emptyset,\{x\},\{z\},\{x,y\},\{x,z\},X\}$&$6$\\
$\{\emptyset,\{x\},\{x,y\},\{x,z\},X\}$&$3$
\end{tabular}
\end{center}

There are that $29$ distinct topologies on $X$.

The moral of this question is that although there are far
fewer topologies than simple collections of subsets
and even fewer different types (non-homeomorphic
topologies in later terminology) there are still
quite a lot even for spaces of three points.

[Return to page~\pageref{E;silly count}.]
\end{proof}

\begin{varthm}[Lemma~\ref{L;other interiors}]%
\label{P;other interiors} 
Let $(X,\tau)$ be a topological space and
$A$ a subset of $X$. 

(i) $\Int A=\{x\in A:\exists\ U\in\tau\ \text{with}
\ x\in U\subseteq A\}$.

(ii) $\Int A$ is the unique $V\in\tau$ such that
$V\subseteq A$ and, if $W\in\tau$ and $V\subseteq W\subseteq A$,
then $V=W$. (Informally, $\Int A$ is the largest open set
contained in $A$.)
\end{varthm}
\begin{proof} (i) This is just the observation that
\begin{align*}
\Int A&=\bigcup\{U\in\tau\,:\, U\subseteq A\}\\
&=\{x\in A\,:\,\exists\ U\in\tau\ \text{with}
\ x\in U\subseteq A\}
\end{align*}

(ii) Since
\[\Int A=\bigcup\{U\in\tau\,:\, U\subseteq A\}\]
we know that $\Int A\subseteq A$. Since the union
of open sets is open, $\Int A\in\tau$. If
$W\in\tau$ and $W\subseteq A$ then
\[\Int A=\bigcup\{U\in\tau\,:\, U\subseteq A\}\supseteq W,\]
so, if $W\supseteq\Int A$, $W=\int A$.

To prove uniqueness, suppose that $V'$
is an open subset of $A$ and
has the property that,
if $U$ in $\tau$ and $V'\subseteq U\subseteq A$.
then $V'=U$. Since $V'$
is an open subset of $A$, we have
$V'\subseteq \Int A\subseteq A$
so $V'=\Int A$.

[Return to page~\pageref{L;other interiors}.]
\end{proof}

\begin{varthm}[Lemma~\ref{L;back to the future}]%
\label{P;back to the future} 
Let
$(X,d)$ be a metric space and $A$ a subset of $X$.
Then $\Cl A$ consists of all those $x$ such
that we can find $x_{n}\in A$ with $d(x,x_{n})\rightarrow 0$.
(In old fashioned terminology, the closure of $A$
is its set of \emph{limit points}.)
\end{varthm}
\begin{proof}
Suppose that $x_{n}\in A$ with $d(x,x_{n})\rightarrow 0$.
Then, since $A\subseteq \Cl A$, $x_{n}\in \Cl A$
and so, since $\Cl A$ is closed, $x\in \Cl A$.

Suppose conversely that $x\in \Cl A$. Since
$\Cl A=X\setminus \Int A^{c}$, we know that the
open ball $B(x,1/n)$ of radius $1/n$ and centre $x$
cannot lie entirely within $A^{c}$, so there exists
an $x_{n}\in B(x,1/n)\cap A$. 
We have $d(x,x_{n})\rightarrow 0$, so we are done.

[Return to page~\pageref{L;back to the future}.]
\end{proof}

\begin{varthm}[Exercise~\ref{E;call me dense}]%
\label{P;call me dense}
(i) Let $(X,\tau)$ be a topological space
and $(Y,d)$ a metric space.
If $f,\,g:X\rightarrow Y$ are continuous and $f(x)=g(x)$
for all $x\in A$, where $A$ is dense in $X$, show that
$f(x)=g(x)$ for all $x\in X$.

(ii) Consider  the unit interval $[0,1]$ with the
Euclidean metric and $A=[0,1]\cap{\mathbb Q}$
with the inherited metric. Exhibit,
with proof, a continuous map 
$f:A\rightarrow{\mathbb R}$
(where ${\mathbb R}$ has the standard metric)
such that there does not exist
a continuous map 
$\tilde{f}:[0,1]\rightarrow{\mathbb R}$
with $\tilde{f}(x)=f(x)$ for all $x\in [0,1]$.
\end{varthm}
\begin{proof}[Solution]
(i) Suppose $f(b)\neq g(b)$ for some $b\in X$. We
can find open sets $U$ and $V$ such that
$f(b)\in U$, $g(b)\in V$ and $U\cap V=\emptyset$.
Now $f^{-1}(U)$ is  open as is $g^{-1}(U)$ 
so $b\in f^{-1}(U)\cap g^{-1}(V)\in\tau$.
Since $A$ is dense we can find an $a\in A$
with $a\in f^{-1}(U)\cap g^{-1}(V)$.
Now $f(a)\in U$ and $g(a)\in V$, but $f(a)=g(a)$,
so  $f(a)\in U\cap V$, contradicting our earlier
assertion that $U\cap V=\emptyset$. The
result follows by contradiction.

(ii) We observe that $x\in A\Rightarrow x^{2}\neq \tfrac{1}{2}$. 
If $x\in A$, set
\[f(x)=
\begin{cases}0&\text{if $x^{2}<\tfrac{1}{2}$,}\\
1&\text{otherwise.}
\end{cases}\]
Observe that, if $y\in A$ and $y^{2}<\tfrac{1}{2}$,
we can find a $\delta>0$ such that
\[|y-x|<\delta\Rightarrow x^{2}<\tfrac{1}{2}
\Rightarrow f(x)=f(y).\]
Similarly if $y\in A$ and $y^{2}>\tfrac{1}{2}$
we can find a $\delta>0$ such that
\[|y-x|<\delta\Rightarrow x^{2}>\tfrac{1}{2}
\Rightarrow f(x)=f(y).\]
Thus $f$ is continuous.

Suppose that $\tilde{f}:[0,1] \rightarrow{\mathbb R}$.
is such that  $\tilde{f}(x)=f(x)$ for all $x\in A$.
Choose $p_{n},\,q_{n}\in A$
such that $p_{n}^{2}>\tfrac{1}{2}>q_{n}^{2}$
and $|p_{n}-2^{-1/2}|,\,|q_{n}-2^{-1/2}|\rightarrow 0$.
Then
\[|f(p_{n})-f(2^{-1/2})|+|f(q_{n})-f(2^{-1/2})|
\geq |f(p_{n})-f(q_{n})|=1,\]
so $f$ cannot be continuous.

[Return to page~\pageref{E;call me dense}.]
\end{proof}

\begin{varthm}[Example~\ref{E;Cauchy not topological}]%
\label{P;Cauchy not topological}
Let $X={\mathbb R}$ and let $d$ be the usual metric on ${\mathbb R}$.
Let $Y=(0,1)$ (the open interval with end points $0$ and $1$)
and let $\rho$ be the usual metric on $(0,1)$. Then
$(X,d)$ and $(Y,\rho)$ are homeomorphic as topological spaces,
but $(X,d)$ is complete and $(Y,\rho)$ is not.
\end{varthm}
\begin{proof} We know from first year analysis that
$f(x)=\tan(\pi(y-1/2))$ is a bijective function $f:Y\rightarrow X$
which is continuous with continuous inverse. (Recall that a strictly increasing
continuous function has continuous inverse.)  Thus
$(X,d)$ and $(Y,\rho)$ are homeomorphic. We know that
$(X,d)$ is complete by the general principle of convergence.

However, $1/n$ is a Cauchy sequence in $Y$ with no limit
in $Y$. (If $y\in (0,1)$, then there exists an $N$ with
$y>N^{-1}$. If $m\geq 2N$, then $|1/m-y|\geq 1/(2N)$ 
so $1/n\nrightarrow y$.)

[Return to page~\pageref{E;Cauchy not topological}.]
\end{proof}
\begin{varthm}[Lemma~\ref{L;coarsest topology}]%
\label{P;coarsest topology} 
Let $X$ be a space and let ${\mathcal H}$ be a
collection of subsets of $X$. Then there exists a unique topology
$\tau_{{\mathcal H}}$ such that 

(i) $\tau_{{\mathcal H}}\supseteq{\mathcal H}$, and

(ii) if $\tau$ is a topology with $\tau\supseteq {\mathcal H}$,
then $\tau\supseteq \tau_{{\mathcal H}}$.
\end{varthm}
\begin{proof} The proof follows a standard pattern, which is
worth learning.

\noindent\emph{Uniqueness} Suppose that $\sigma$ and $\sigma'$ are topologies
such that

(i) $\sigma\supseteq{\mathcal H}$,

(ii) if $\tau$ is a topology with $\tau\supseteq {\mathcal H}$,
then $\tau\supseteq \sigma$,

(i)$'$ $\sigma'\supseteq{\mathcal H}$,

(ii)$'$ if $\tau$ is a topology with $\tau\supseteq {\mathcal H}$,
then $\tau\supseteq \sigma'$.

\noindent By (i) and (ii)$'$, we have $\sigma\supseteq \sigma'$
and by (i)$'$ and (ii), we have $\sigma'\supseteq \sigma$.
Thus $\sigma=\sigma'$.

\noindent\emph{Existence} Let $T$ be the set of topologies
$\tau$ with $\tau\supseteq {\mathcal H}$. Since the discrete
topology contains ${\mathcal H}$, $T$ is non-empty.
Set 
\[\tau_{\mathcal H}=\bigcap_{\tau\in T}\tau.\]
By construction, $\tau_{\mathcal H}\supseteq{\mathcal H}$ and
$\tau\supseteq \tau_{\mathcal H}$ whenever $\tau\in T$.
Thus we need only show that $\tau_{\mathcal H}$ is a topology
and this we now do.

(a) ${\emptyset},\,X\in\tau$ for all $\tau\in T$, so
${\emptyset},\,X\in\tau_{\mathcal H}$.

(b) If $U_{\alpha}\in \tau_{\mathcal H}$, then
$U_{\alpha}\in\tau$ for all $\alpha\in A$
and so 
$\bigcup_{\alpha\in A}U_{\alpha}\in\tau$
for all $\tau\in T$, whence
$\bigcup_{\alpha\in A}U_{\alpha}\in \tau_{\mathcal H}$.

(c) If $U_{j}\in \tau_{\mathcal H}$, then
$U_{j}\in\tau$ for all $1\leq j\leq n$ and so 
$\bigcap_{j=1}^{n}U_{j}\in\tau$
for all $\tau\in T$, whence
$\bigcap_{j=1}^{n} U_{j}\in \tau_{\mathcal H}$.

Thus $\tau_{\mathcal H}$ is a topology, as required.

[Return to page~\pageref{L;coarsest topology}.]
\end{proof}
\begin{varthm}[Lemma~\ref{L;subspace topology}]%
\label{P;subspace topology} 
If $(X,\tau)$ is a topological space
and $Y\subseteq X$, then the subspace topology $\tau_{Y}$ on $Y$
is the collection of sets $Y\cap U$ with $U\in\tau$.
\end{varthm}
\begin{proof} Let $j:Y\rightarrow X$ be the inclusion
map given by $j(y)=y$ for all $y\in Y$.
Write 
\[\sigma=\{Y\cap U\,:\,U\in\tau\}.\]
Since $Y\cap U=j^{-1}(U)$, we know that $\tau_{Y}$
is the smallest topology containing $\sigma$
and that the result will follow if we show that $\sigma$ is a topology
on $Y$. The following observations show this and complete
the proof.

(a) ${\emptyset}=Y\cap{\emptyset}$ and $Y=Y\cap X$.

(b) $\bigcup_{\alpha\in A}(Y\cap U_{\alpha})
=Y\cap\bigcup_{\alpha\in A}U_{\alpha}$.

(c) $\bigcap_{j=1}^{n}(Y\cap U_{j})=Y\cap\bigcap_{j=1}^{n}U_{j}$.


[Return to page~\pageref{L;subspace topology}.]
\end{proof}
\begin{varthm}[Lemma~\ref{L;product topology}]%
\label{P;product topology} 
Let $(X,\tau)$ and $(Y,\sigma)$
be topological spaces and $\lambda$ the product topology
on $X\times Y$.
Then $O\in\lambda$ if and only if, given $(x,y)\in O$,
we can find $U\in \tau$ and $V\in \sigma$ such that
\[(x,y)\in U\times V\subseteq O.\]
\end{varthm}
\begin{proof} Let $\mu$ be the collection of subsets
$E$ such that, given $(x,y)\in E$,
we can find $U\in \tau$ and $V\in \sigma$ with
\[(x,y)\in U\times V\subseteq E.\]

If $U\in \tau$, then, since $\pi_{X}$ is continuous
$U\times Y=\pi_{X}^{-1}(U)\in\lambda$. Similarly,
if $V\in\sigma$ then $X\times V\in\lambda$. Thus
\[U\times V=U\times Y\cap X\times V\in\lambda.\]
If $E\in\mu$ then, given $(x,y)\in E$, we can find
$U_{(x,y)}\in \tau$ and $V_{(x,y)}\in \sigma$ such that
\[(x,y)\in U_{(x,y)}\times V_{(x,y)}\subseteq E,.\]
We observe that
\[E\subseteq \bigcup_{(x,y)\in E}U_{(x,y)}\times V_{(x,y)}\subseteq E\]
so $E=\bigcup_{(x,y)\in E}U_{(x,y)}\times V_{(x,y)}$ and, since the
union of open sets is open, $E\in\lambda$. Thus $\mu\subseteq\lambda$.

It is easy to check that $\mu$ is a topology as follows.

(a) $\emptyset\in\mu$ vacuously. If $(x,y)\in X\times Y$,
then $X\in\tau$, $Y\in\sigma$ and 
$(x,y)\in X\times Y\subseteq X\times Y$. Thus $X\times Y\in\mu$.

(b) Suppose $E_{\alpha}\in\mu$ for all $\alpha\in A$.
If $(x,y)\in\bigcup_{\alpha\in A}E_{\alpha}$,
then $(x,y)\in E_{\beta}$ for some $\beta\in A$.
We can find $U\in \tau$ and $V\in \sigma$ such that
\[(x,y)\in U\times V\subseteq E_{\beta}\] 
and so
\[(x,y)\in U\times V\subseteq\bigcup_{\alpha\in A}E_{\alpha}.\]
Thus $\bigcup_{\alpha\in A}E_{\alpha}\in\mu$.

(c) Suppose $E_{j}\in\mu$ for all $1\leq j\leq n$.
If $(x,y)\in\bigcap_{j=1}^{n}E_{j}$,
then $(x,y)\in E_{j}$ for all $1\leq j\leq n$.
We can find $U_{j}\in \tau$ and $V_{j}\in \sigma$ such that
\[(x,y)\in U_{j}\times V_{j}\subseteq E_{j}\] 
and so
\[(x,y)\in \bigcap_{j=1}^{n} U_{j}\times \bigcap_{j=1}^{n} V_{j}
\subseteq\bigcap_{j=1}^{n}E_{j}.\]
Since $\bigcap_{j=1}^{n} U_{j}\in\tau$ 
and $\bigcap_{j=1}^{n} V_{j}\in\sigma$,
we have shown that $\bigcap_{j=1}^{n}E_{j}\in\mu$.

Finally, we observe that, if $U\in\tau$, then 
\[\pi_{X}^{-1}(U)=U\times Y\]
and $(x,y)\in U\times Y\subseteq \pi_{X}^{-1}(U)$ 
with $U\in\tau$, $Y\in\sigma$,
so $\pi_{X}^{-1}(U)\in\mu$. Thus $\pi_{X}:X\times Y\rightarrow X$
is continuous if we give $X\times Y$ the topology $\mu$. A similar
result holds for $\pi_{Y}$ so, by the minimality of $\lambda$, 
$\mu=\lambda$.


[Return to page~\pageref{L;product topology}.]
\end{proof}
\begin{varthm}[Lemma~\ref{L;same topology}]%
\label{P;same topology}
Let $\tau_{1}$ and $\tau_{2}$ be two topologies
on the same space $X$. 

(i) We have $\tau_{1}\subseteq\tau_{2}$
if and only if, given $x\in U\in\tau_{1}$, we can find
$V\in\tau_{2}$ such that $x\in V\subseteq U$.

(ii)We have $\tau_{1}=\tau_{2}$
if and only if, given $x\in U\in\tau_{1}$, we can find
$V\in\tau_{2}$ such that $x\in V\subseteq U$
and, given $x\in U\in\tau_{2}$, we can find
$V\in\tau_{1}$ such that $x\in V\subseteq U$.
\end{varthm}
\begin{proof}  (i) If $\tau_{1}\subseteq\tau_{2}$
and $x\in U\in\tau_{1}$, then setting $V=U$ we
automatically
have $V\in\tau_{2}$ and $x\in V\subseteq U$.

Conversely, suppose that,
given $x\in U\in\tau_{1}$, we can find
$V\in\tau_{2}$ such that $x\in V\subseteq U$.
Then, if $U\in\tau_{1}$ is fixed, we can find
$V_{x}\in\tau_{2}$ such that $x\in V_{x}\subseteq U$
for each $x\in U$.

Now
\[U\subseteq \bigcup_{x\in U}V_{x}\subseteq U\]
so $U=\bigcup_{x\in U}V_{x}$ and, since the union
of open sets is open, $U\in\tau_{2}$. Thus $\tau_{1}\subseteq \tau_{2}$.

(ii) Observe that $\tau_{1}=\tau_{2}$
if and only if $\tau_{1}\subseteq\tau_{2}$
and $\tau_{2}\subseteq\tau_{1}$.

[Return to page~\pageref{L;same topology}.]
\end{proof}
\begin{varthm}[Exercise~\ref{E;open via neighbourhood}]%
\label{P;open via neighbourhood} 
If $(X,\tau)$ is a topological space, then
a subset $A$ of $X$ is open if and only if every
point of $A$ has an open neighbourhood $U\subseteq A$.
\end{varthm}
\begin{proof}[Solution]
If $A$ is open, then $A$ is an open neighbourhood of every $x\in A$.

Conversely, suppose that every $x\in A$ has an open neighbourhood
$U_{x}$ lying entirely within $A$. Then
\[A\subseteq \bigcup_{x\in A} U_{x}\subseteq A\]
so $A= \bigcup_{x\in A} U_{x}$. Thus $A$ is the union of open sets
and so open.

[Return to page~\pageref{E;open via neighbourhood}.]
\end{proof}
\begin{varthm}[Lemma~\ref{L;Hausdorff point}]%
\label{P;Hausdorff point}
If $(X,\tau)$ is a Hausdorff space, then the one
point sets $\{x\}$ are closed.
\end{varthm}
\begin{proof} We must show that $A=X\setminus\{x\}$ is open.
But, if $y\in A$, then $y\neq x$ so, by the Hausdorff condition,
we can find $U,\,V\in\tau$ such that $x\in U$, $y\in V$
and $U\cap V=\emptyset$. We see that $y\in V\subseteq A$,
so every point of $A$ has an open neighbourhood
lying entirely within $A$. Thus $A$ is open. 

[Return to page~\pageref{L;Hausdorff point}.]
\end{proof}
\begin{varthm}[Exercise~\ref{E;finite complement}]%
\label{P;finite complement} 
Let $X$ be infinite (we could take $X={\mathbb Z}$
or $X={\mathbb R}$).
We say that a subset $E$ of $X$ lies in $\tau$ if
either $E=\emptyset$ or $X\setminus E$ is finite.
Show that $\tau$ is a topology 
and that every one
point set $\{x\}$ is closed but that $(X,\tau)$
is not Hausdorff.

What happens if $X$ is finite?
\end{varthm}
\begin{proof}[Solution] 
(a) We are told that $\emptyset\in \tau$.
Since $X\setminus X=\emptyset$, $X\in\tau$.

(b) If $U_{\alpha}\in\tau$ for all $\alpha\in A$, then
either $U_{\alpha}=\emptyset$ for all $\alpha\in A$,
so $\bigcup_{\alpha\in A}U_{\alpha}=\emptyset\in\tau$,
or we can find a $\beta\in A$ such that 
$X\setminus U_{\beta}$ is finite.
In the second case, we observe that
\[X\setminus\bigcup_{\alpha\in A}U_{\alpha}
\subseteq X\setminus U_{\beta},\]so
$X\setminus\bigcup_{\alpha\in A}U_{\alpha}$
is finite and
$\bigcup_{\alpha\in A}U_{\alpha}\in\tau$

(c) If $U_{j}\in\tau$ for all $1\leq j\leq n$ then,
either $U_{k}=\emptyset$ for some $1\leq k\leq n$
so $\bigcap_{j=1}^{n}U_{j}=\emptyset\in\tau$
or $X\setminus U_{j}$ is finite for all $1\leq j\leq n$.
In the second case then, since
\[X\setminus \bigcap_{j=1}^{n}U_{j}
=\bigcup_{j=1}^{n}(X\setminus U_{j}),\]
it follows that
$X\setminus \bigcap_{j=1}^{n}U_{j}$ is finite
and so $\bigcap_{j=1}^{n}U_{j}\in\tau$.

Thus $\tau$ is a topology.

Since $\{x\}$ is finite, $X\setminus\{x\}$ is open
and so $\{x\}$ is closed.

Suppose that $x \neq y$ and $x\in U\in\tau$,
$y\in V\in \tau$. Then $U,\,V\neq\emptyset$,
so $X\setminus U$ and $X\setminus V$ is finite.
It follows that
\[X\setminus U\cap V=(X\setminus U)\cup(X\setminus V)\]
is finite, and so, since $X$ is infinite, $U\cap V\neq\emptyset$.
Thus $\tau$ is not Hausdorff.

If $X$ is finite, then $\tau$ is the discrete metric
which is Hausdorff.

[Return to page~\pageref{E;finite complement}.]
\end{proof}
\begin{varthm}[Lemma~\ref{L;inherit Hausdoff subspace}]%
\label{P;inherit Hausdoff subspace}
If $(X,\tau)$ is a Hausdorff topological space
and $Y\subseteq X$, then $Y$ with the subspace topology
is also Hausdorff.
\end{varthm}
\begin{proof} Write $\tau_{Y}$ for the subspace topology.
If $x,\,y\in Y$ and $x\neq y$, then 
$x,\,y\in X$ and $x\neq y$ so we can find $U,\,V\in\tau$ with
$x\in U$, $y\in V$ and $U\cap V=\emptyset$. Set $\tilde{U}=U\cap Y$
and $\tilde{V}=V\cap Y$. Then
$\tilde{U},\,\tilde{V}\in\tau_{Y}$
$x\in \tilde{U}$, $y\in \tilde{V}$ and $\tilde{U}\cap\tilde{V}=\emptyset$.

[Return to page~\pageref{L;inherit Hausdoff subspace}.]
\end{proof}
\begin{varthm}[Lemma~\ref{L;inherit Hausdoff product}]%
\label{P;inherit Hausdoff product}
If $(X,\tau)$ and $(Y,\sigma)$ are Hausdorff topological spaces,
then $X\times Y$ with the product topology
is also Hausdorff.
\end{varthm}
\begin{proof} Suppose $(x_{1},y_{1}),\,(x_{2},y_{2})$
and $(x_{1},y_{1})\neq(x_{2},y_{2})$. Then we know that at least
one of the statements $x_{1}\neq x_{2}$ and $y_{1}\neq y_{2}$
is true\footnote{But not necessarily both. This is the traditional
silly mistake.}. Without loss of generality, we may suppose
$x_{1}\neq x_{2}$. Since $(X,\tau)$ is Hausdorff, we can find
$U_{1},\,U_{2}$ disjoint open neighbourhoods of $x_{1}$ and $x_{2}$.
We observe that  $U_{1}\times Y$ and $U_{2}\times Y$ 
are disjoint open neighbourhoods of $(x_{1},y_{1})$
and $(x_{2},y_{2})$, so we are done.

[Return to page~\pageref{L;inherit Hausdoff product}.]
\end{proof}
\begin{varthm}[Exercise~\ref{E;simple compact examples}]%
\label{P;simple compact examples}
(iv) Show that the topology described in 
Exercise~\ref{E;finite complement} is compact.

(v) Let $X$ be uncountable (we could take
$X={\mathbb R}$).
We say that a subset $A$ of $X$ lies in $\tau$ if
either $A=\emptyset$ or $X\setminus A$ is countable.
Show that $\tau$ is a topology
but that $(X,\tau)$
is not compact.
\end{varthm}
\begin{proof}[Solution] 
(iv) If $X=\emptyset$ there is nothing to prove.
If not, let $U_{\alpha}$ $[\alpha\in A]$ be an open cover.
Since $X\neq\emptyset$ we can choose a $\beta\in A$
such that $U_{\beta}\neq\emptyset$ and so
$U_{\beta}=X\setminus F$ where $F$ is a finite set.
For each $x\in F$ we know that $x\in X=\bigcup_{\alpha\in A}U_{\alpha}$
so there exists an $\alpha(x)\in A$ with $x\in U_{\alpha(x)}$.
We have
\[U_{\beta}\cup\bigcup_{x\in F}U_{\alpha(x)}=X,\]
giving us the desired open cover.

(v) I leave it the reader to show that $\tau$ is a topology.
Let $x_{1}$, $x_{2}$, \dots, be distinct points of $X$.
Let 
\[U=X\setminus\{x_{j}\,:\,1\leq j\}\]
and $U_{k}=U\cup\{x_{k}\}$. Then $U_{k}\in\tau$ $[k\geq 1]$
and $\bigcup_{k\geq 1}U_{k}=X$. 
Now suppose $k(1)$, $k(2)$,\dots, $k(N)$ given.
If $m=\max_{1\leq r\leq N}k(r)$, then
\[x_{m+1}\notin\bigcup_{r=1}^{N}U_{k(r)}\]
so there is no finite subcover.

[Return to page~\pageref{E;simple compact examples}.]
\end{proof}
\begin{varthm}[Theorem~\ref{T;Heine--Borel}]%
\label{P;Heine--Borel}
{\bf [The Heine--Borel Theorem.]}
Let ${\mathbb R}$ be given its usual (Euclidean)
topology. Then the closed bounded interval
$[a,b]$ is compact.
\end{varthm}
\begin{proof} Suppose that ${\mathcal C}$
is an open cover of $[a,b]$ (i.e. the elements of ${\mathcal C}$
are open sets and $\bigcup_{U\in{\mathcal C}}U\supseteq[a,b]$). 
If  ${\mathcal C}_{1}$
is a finite subcover of $[a,c]$
and ${\mathcal C}_{2}$
is a finite subcover of $[c,b]$
then ${\mathcal C}_{1}\cup{\mathcal C}_{2}$
is a finite subcover of $[a,b]$. 

Suppose now that $[a,b]$ has no finite subcover using ${\mathcal C}$.
Set $a_{0}=a$, $b_{0}=b$, and $c_{0}=(a_{0}+b_{0})/2$.
By the first paragraph at least one of $[a_{0},c_{0}]$
and $[c_{0},b_{0}]$ has no finite subcover using ${\mathcal C}$.
If $[a_{0},c_{0}]$ has no finite subcover, set $a_{1}=a_{0}$,
$b_{1}=c_{0}$. Otherwise, set $a_{1}=c_{0}$,
$b_{1}=b_{0}$. In either case, we know that

(i) $a=a_{0}\leq a_{1}\leq b_{1}\leq b_{0}=b$,

(ii) if ${\mathcal F}$ is a finite subset of ${\mathcal C}$,
then $\bigcup_{U\in{\mathcal F}}U\not\supseteq [a_{1},b_{1}]$,

(iii) $b_{1}-a_{1}=(b-a)/2$.

Proceeding inductively, we obtain

(i)$_{n}$ $a\leq a_{n-1}\leq a_{n}\leq b_{n}\leq b_{n-1}\leq b$.

(ii)$_{n}$ If ${\mathcal F}$ is a finite subset of ${\mathcal C}$,
then $\bigcup_{U\in{\mathcal F}}U\not\supseteq [a_{n},b_{n}]$.

(iii)$_{n}$ $b_{n}-a_{n}=2^{-n}(b-a)$.

The $a_{n}$ form an increasing sequence bounded above by $b$, so,
by the fundamental axiom of analysis, $a_{n}\rightarrow A$
for some $A \leq b$. Similarly $b_{n}\rightarrow B$ for some
$B\geq a$. Since $b_{n}-a_{n}\rightarrow 0$, $A=B=x$, say,
for some $x\in [a,b]$. Since $x\in [a,b]$ and
$\bigcup_{U\in{\mathcal C}}U\supseteq[a,b]$ 
we can find a $V\in {\mathcal C}$
with $x\in V$. Since $V$ is open in the Euclidean metric, 
we can find a $\delta>0$
such that $(x-\delta,x+\delta)\subseteq V$. Since $a_{n},\,b_{n}\rightarrow x$
we can find an $N$ such that $|x-a_{N}|,\,|x-b_{N}|<\delta$ and so
\[[a_{N},b_{N}]\subseteq (x-\delta,x+\delta)\subseteq V\]
contradicting (ii)$_{N}$. (Just take ${\mathcal F}=\{V\}$.) 

The theorem follows by reductio ad absurdum.

[Return to page~\pageref{T;Heine--Borel}.]
\end{proof}
\begin{varthm}[Theorem~\ref{T;closed subset compact}]
\label{P;closed subset compact}
A closed subset of a compact set is compact.
$[$More precisely, if $E$ is compact and $F$ closed 
in a given topology, then, if $F\subseteq E$, it follows that
$F$ is compact.$]$
\end{varthm}
\begin{proof} Suppose $(X,\tau)$ is a topological space,
$E$ is a compact set in $X$ and $F$ is a closed subset of $E$.
If $U_{\alpha}\in\tau$ $[\alpha\in A]$ and 
$\bigcup_{\alpha\in A}U_{\alpha}\supseteq F$, then
$X\setminus F\in\tau$ and 
\[(X\setminus F)\cup\bigcup_{\alpha\in A}U_{\alpha}=X\supseteq E.\]
By compactness, we can find $\alpha(j)\in A$
$[1\leq j\leq n]$ such that
\[(X\setminus F)\cup\bigcup_{j=1}^{n}U_{\alpha(j)}\supseteq E.\]
Since $(X\setminus F)\cap F=\emptyset$ and $E\supseteq F$,
it follows that
\[\bigcup_{j=1}^{n}U_{\alpha(j)}\supseteq F\]
and we are done.
[Return to page~\pageref{T;closed subset compact}.]
\end{proof}
\begin{varthm}[Theorem\ref{T;compact closed}]%
\label{P;compact closed}
If $(X,\tau)$ is Hausdorff, then every compact set is closed.
\end{varthm}
\begin{proof} Let $K$ be a compact set. If $x\notin K$,
then, given any $k\in K$, we know that $k\neq x$ and so,
since $X$ is Hausdorff, we can find open sets $U_{k}$
and $V_{k}$ such that
\[x\in V_{k},\ k\in U_{k}\ \text{and}\ V_{k}\cap U_{k}=\emptyset.\]
Since $\bigcup_{k\in K}U_{k}\supseteq\bigcup_{k\in K}\{k\}=K$,
we have an open cover of $K$. By compactness, we can find
$k(1),\,k(2),\,\dots,\,k(n)\in K$ such that 
\[\bigcup_{j=1}^{n}U_{k(j)}\supseteq K.\]
We observe that the finite intersection $V=\bigcap_{j=1}^{n}V_{k(j)}$
is an open neighbourhood of $x$ and that
\[V\cap K\subseteq V\cap\bigcup_{j=1}^{n}U_{k(j)}=\emptyset,\]
so $V\cap K$ and we have shown that every $x\in X\setminus K$ has an
open neighbourhood lying entirely within $X\setminus K$.
Thus $X\setminus K$ is open and $K$ is closed.  

[Return to page~\pageref{T;compact closed}.]
\end{proof}
\begin{varthm}[Example~\ref{E;compact not closed}]%
\label{P;compact not closed} 
Give an example of a topological space
and a compact set which is not closed.
\end{varthm}
\begin{proof} If $(X,\tau)$ has the indiscrete topology,
then, if $Y\subseteq X$, $Y\neq X,\,\emptyset$, we have $Y$
compact but not closed. We can take $X=\{a,b\}$ with $a\neq b$ 
and $Y=\{a\}$.

[Return to page~\pageref{E;compact not closed}.]
\end{proof}
\begin{varthm}[Theorem~\ref{T;closed bounded}]%
\label{P;closed bounded}
Consider $({\mathbb R},\tau)$ with the standard 
(Euclidean) topology. A set $E$ is compact if and
only if it is closed and bounded
(that is to say, there exists a 
$M$ such that $|x|\leq M$ for all $x\in E$).
\end{varthm}
\begin{proof} If $E$ is bounded, then $E\subseteq [-M,M]$
for some $M$. By the theorem of Heine--Borel, $[-M,M]$
is compact so, if $E$ is closed, $E$ is compact.

Since $({\mathbb R},\tau)$ is Hausdorff any compact set must be closed.
Finally suppose that $E$ is compact. We have
\[E\subseteq \bigcup_{j=1}^{\infty}(-j,j).\]
By compactness,
we can find $j(r)$ such that $E \subseteq\bigcup_{r=1}^{N}(-j(r),j(r))$
Taking $M=\max_{1\leq r\leq n}j(r)$ we have $E\subseteq(-M,M)$ so
$E$ is bounded.

[Return to page~\pageref{T;closed bounded}.]
\end{proof}
\begin{varthm}[Theorem~\ref{T;compact image}]%
\label{P;compact image} 
Let $(X,\tau)$ and $(Y,\sigma)$
be topological spaces and $f:X\rightarrow Y$ a continuous
function. If $K$ is a compact subset of $X$,
then $f(K)$ is a compact subset of $Y$.
\end{varthm}
\begin{proof} Suppose that $U_{\alpha}\in\sigma$ 
for all $\alpha\in A$
and $\bigcup_{\alpha\in A}U_{\alpha}\supseteq f(K)$.
Then
\[\bigcup_{\alpha\in A}f^{-1}(U_{\alpha})
=f^{-1}\left(\bigcup_{\alpha\in A}U_{\alpha}\right)\supseteq K\]
and, since $f$ is continuous $f^{-1}(U_{\alpha})\in\tau$
for all $\alpha\in A$. By compactness, we can find
$\alpha(j)\in A$ $[1\leq j\leq n]$ such that
\[\bigcup_{j=1}^{n}f^{-1}(U_{\alpha(j)})\supseteq K\]
and so
\[\bigcup_{j=1}^{n}U_{\alpha(j)}=
f\left(\bigcup_{j=1}^{n}f^{-1}(U_{\alpha(j)})\right)
\supseteq f(K)\]
and we are done.

[Return to page~\pageref{T;compact image}.]
\end{proof}
\begin{varthm}[Theorem~\ref{T;attains bounds}]%
\label{P;attains bounds} 
Let ${\mathbb R}$ have the usual metric.
If $K$ is a 
closed and bounded subset of ${\mathbb R}$
and $f:K\rightarrow{\mathbb R}$ is continuous,
then $f$ is bounded and attains its bounds.
\end{varthm}
\begin{proof} If $K$ is empty there is nothing to prove,
so we assume $K\neq\emptyset$.
 
Since $K$ is compact and $f$ is continuous,
$f(K)$ is compact. Thus $f(K)$ is a non-empty closed
bounded set. Since $f(K)$ is non-empty and bounded,
it has a supremum $\alpha$, say. Since $f(K)$ is closed, 
it contains its supremum.
[Observe that we can find $k_{n}\in K$ such that
\[\alpha-1/n\leq f(k_{n})\leq \alpha\]
and so $f(k_{n})\rightarrow\alpha$. Since $f(K)$
is closed, $\alpha\in f(K)$.]

[Return to page~\pageref{T;attains bounds}.]
\end{proof}
\begin{varthm}[Exercise~\ref{E;converse attains bounds}]%
\label{P;converse attains bounds} 
Let ${\mathbb R}$ have the usual metric.
If $K$ is a subset of ${\mathbb R}$ with the property
that, whenever $f:K\rightarrow{\mathbb R}$ is continuous,
then $f$ is bounded, it follows
that $K$ is closed and bounded.
\end{varthm} 
\begin{proof} If $K=\emptyset$ there is nothing to prove,
so we assume $K\neq\emptyset$.

Let $f:K\rightarrow {\mathbb R}$ be defined by
$f(k)=|k|$. Since $f$ is bounded, $K$ must be.

If $x\notin K$, then the function $f:K\rightarrow {\mathbb R}$
given by $f(k)=|k-x|^{-1}$ is continuous and so bounded.
Thus we can find an $M>0$ such that $|f(k)|<M$ for all $k\in K$.
It follows that $|x-k|> M^{-1}$ for all $k\in K$
and the open ball $B(x,M^{-1})$ lies entirely in the complement
of $K$. Thus $K$ is closed.
 
[Return to page~\pageref{E;converse attains bounds}.]
\end{proof}
\begin{varthm}[Theorem~\ref{T;bijection compact}]%
\label{P;bijection compact}
Let $(X,\tau)$ be a compact and $(Y,\sigma)$
a Hausdorff topological space. If $f:X\rightarrow Y$ 
is a continuous bijection, then it is a homeomorphism.
\end{varthm}
\begin{proof} Since $f$ is a bijection, $g=f^{-1}$ is a well 
defined function. If $K$ is closed in $X$, then (since a closed
subset of a compact space is compact) $K$ is compact
so $f(K)$ is compact. But a compact subset of a Hausdorff 
space is closed so $g^{-1}(K)=f(K)$ is closed. Thus
$g$ is continuous and we are done. (If $U$ is open in $X$
then $X\setminus U$ is closed so $Y\setminus g^{-1}(U)=g^{-1}(X\setminus U)$
is closed and $g^{-1}(U)$ is open.)

[Return to page~\pageref{T;bijection compact}.]
\end{proof}
 
\begin{varthm}[Theorem~\ref{T;compare topologies}]%
\label{P;compare topologies}
Let $\tau_{1}$ and $\tau_{2}$ be topologies
on the same space $X$.

(i) If $\tau_{1}\supseteq \tau_{2}$ and $\tau_{1}$ is compact,
then so is $\tau_{2}$.

(ii) If $\tau_{1}\supseteq \tau_{2}$ and $\tau_{2}$ is Hausdorff,
then so is $\tau_{1}$.

(iii) If $\tau_{1}\supseteq \tau_{2}$, $\tau_{1}$ is compact
and $\tau_{2}$ is Hausdorff, then $\tau_{1}=\tau_{2}$.
\end{varthm}
\begin{proof} (i) The map $\iota:(X,{\tau}_{1})\rightarrow(X,{\tau}_{2})$
is continuous and so takes compact sets to compact sets. In particular,
since $X$ is compact, in $\tau_{1}$, $X=\iota X$ is compact in $\tau_{2}$.

(ii) If $x\neq y$ we can find $x\in U\in\tau_{2}$ and $y\in V\in\tau_{2}$
with $U\cap V=\emptyset$. Automatically 
$x\in U\in\tau_{1}$ and $y\in V\in\tau_{1}$ so we are done.

(iii) The map $\iota:(X,{\tau}_{1})\rightarrow(X,{\tau}_{2})$
is a continuous bijection and so a homeomorphism.

[Return to page~\pageref{T;compare topologies}.]
\end{proof}
\begin{varthm}[Exercise~\ref{E;too hot}]%
\label{P;too hot}
(i) Give an example of a Hausdorff space $(X,\tau)$ and 
a compact Hausdorff space $(Y,\sigma)$
together with a continuous bijection $f:X\rightarrow Y$ 
which is not a homeomorphism.

(ii) Give an example of a compact Hausdorff space $(X,\tau)$ and 
a compact space $(Y,\sigma)$
together with a continuous bijection $f:X\rightarrow Y$ 
which is not a homeomorphism.
\end{varthm}
\begin{proof}[Solution] Let $\tau_{1}$ be the 
indiscrete topology on $[0,1]$,
$\tau_{2}$ be the usual (Euclidean) topology on $[0,1]$
and $\tau_{3}$ be the discrete topology on $[0,1]$.
Then $({\mathbb R},\tau_{1})$ is compact (but not Hausdorff),
$({\mathbb R},\tau_{2})$ is compact and Hausdorff,
and $({\mathbb R},\tau_{3})$ is Hausdorff (but not compact).
The identity maps $\iota:(X,\tau_{1})\rightarrow(X,\tau_{2})$
and $\iota:(X,\tau_{2})\rightarrow(X,\tau_{3})$ are continuous
bijections but not homeomorphisms.

[Return to page~\pageref{E;too hot}.] 
\end{proof}
\begin{varthm}[Theorem~\ref{T;product compact}]%
\label{P;product compact} 
The product of two compact spaces is compact.
(More formally, if $(X,\tau)$ and $(Y,\sigma)$ are compact
topological spaces and $\lambda$ is the product topology,
then $(X\times Y,\lambda)$ is compact.)
\end{varthm}
\begin{proof} Let $O_{\alpha}\in\lambda$ $[\alpha\in A]$ and
\[\bigcup_{\alpha\in A}O_{\alpha}=X\times Y.\]
Then, given $(x,y)\in X\times Y$, we can find
$U_{x,y}\in\tau$, $V_{x,y}\in\sigma$ and $\alpha(x,y)\in A$ such
that
\[(x,y)\in U_{x,y}\times V_{x,y}\subseteq O_{\alpha(x,y)}.\]
In particular, we have
\[\bigcup_{y\in Y}\{x\}\times V_{x,y}=\{(x,y)\,:\,y\in Y\}\]
for each $x\in X$ and so
\[\bigcup_{y\in Y}V_{x,y}=Y.\]
By compactness, we can find a positive
integer $n(x)$ and $y(x,j)\in Y$ $[1\leq j\leq n(x)]$
such that
\[\bigcup_{j=1}^{n(x)}V_{x,y(x,j)}=Y.\]
Now $U_{x}=\bigcap_{j=1}^{n(x)}U_{x,y(x,j)}$ is the finite intersection
of open sets in $X$ and so open. Further $x\in U_{x}$ and so
\[\bigcup_{x\in X}U_{x}=X.\]
By compactness, we can find $x_{1},\,x_{2},\,\dots,\,x_{m}$ such that
\[\bigcup_{r=1}^{m}U_{x_{r}}=X.\]

It follows that
\begin{align*}
\bigcup_{r=1}^{m}\bigcup_{j=1}^{n(x_{r})}O_{x_{r},y(x_{r},j)}
&\supseteq \bigcup_{r=1}^{m}
\bigcup_{j=1}^{n(x_{r})}U_{x_{r},y(x_{r},j)}\times V_{x_{r},y(x_{r},j)}\\
&\supseteq \bigcup_{r=1}^{m}\bigcup_{j=1}^{n(x_{r})}
U_{x_{r}}\times V_{x_{r},y(x_{r},j)}\\
&\supseteq \bigcup_{r=1}^{m}U_{x_{r}}\times Y\\
&\supseteq X\times Y
\end{align*}
and we are done.

[Return to page~\pageref{T;product compact}.]
\end{proof}
\begin{varthm}[Exercise~\ref{E;circle as quotient}]%
\label{P;circle as quotient}
Consider the complex plane with its usual metric.
Let 
\[{\partial}D=\{z\in{\mathbb C}\,:\,|z|=1\}\]
and give ${\partial}D$ the subspace topology $\tau$.
Give ${\mathbb R}$ its usual topology and define
an equivalence relation $\sim$ by $x\sim y$ if $x-y\in{\mathbb Z}$.
We write ${\mathbb R}/\negthinspace\sim={\mathbb T}$ and give ${\mathbb T}$
the quotient topology. The object of this exercise
is to show that ${\partial}D$ and ${\mathbb T}$ are homeomorphic.

(i) Verify that $\sim$ is indeed an equivalence relation.

(ii) Show that, if we define
$f:{\mathbb R}\rightarrow {\partial}D$
by $f(x)=\exp(2\pi ix)$, then $f(U)$ is
open whenever $U$ is open.

(iii) If $q:{\mathbb R}\rightarrow {\mathbb T}$ is the quotient map 
$q(x)=[x]$ show that $q(x)=q(y)$ if and only if $f(x)=f(y)$.
Deduce that $q\big(f^{-1}(\{\exp(2\pi ix)\})\big)=[x]$
and that the equation $F(\exp(2\pi ix))=[x]$ gives a well
defined bijection $F:{\partial}D\rightarrow{\mathbb T}$.

(iv) Show that $F^{-1}(V)=f\big(q^{-1}(V)\big)$ and deduce
that $F$ is continuous.

(v) Show that ${\mathbb T}$ is Hausdorff and explain why
${\partial}D$ is compact. Deduce that $F$ is a homeomorphism.
\end{varthm}
\begin{proof}[Solution] 
(i) Observe that $x-x=0\in{\mathbb Z}$ so $x\sim x$.

Observe that $x\sim y$ implies $x-y\in{\mathbb Z}$
so $y-x=-(x-y)\in{\mathbb Z}$ and $y\sim x$.

Observe that, if  $x\sim y$ and $y\sim z$, then $x-y,\,y-z\in{\mathbb Z}$
so 
\[x-z=(x-y)+(y-z)=x-z\in{\mathbb Z}\]
and $x\sim z$.

(ii) If $x\in U$ an open set, then we can find a $1>\delta>0$
such that $|x-y|<\delta$ implies $y\in U$.

By simple geometry, any $z\in{\mathbb C}$ with $|z|=1$ and 
$|\exp(2\pi ix)-z|<\delta/100$
can be written as $z=\exp(2\pi iy)$ with $|y-x|<\delta$.
Thus
\[\partial D\cap\{z\in{\mathbb C}\,:\,|z-\exp(2\pi ix)|<\delta/100\}
\subseteq f(U).\]
We have shown that $f(U)$ is open.

(iii) We have
\begin{align*}
q(x)=q(y)&\Leftrightarrow y\in[x] \Leftrightarrow
x-y\in{\mathbb Z} \Leftrightarrow
\exp(2\pi i(x-y))=1\\ 
&\Leftrightarrow \exp(2\pi ix)=\exp(2\pi iy)
\Leftrightarrow f(x)=f(y).
\end{align*}

It follows that the equation $F(\exp(2\pi ix))=[x]$ gives a well
defined bijection $F:{\partial}D\rightarrow{\mathbb T}$.

(iv) Observe that
\[F^{-1}([x])=\{\exp(2\pi it)\,:\,\exp(2\pi it)=\exp(2\pi ix)\}
=f\big(q^{-1}([x])\big)\]
and so $F^{-1}(V)=f\big(q^{-1}(V)\big)$. If $V$ is open,
then, since $q$ is continuous, $q^{-1}(V)$ is open so, by (ii),
$F^{-1}(V)$ is open. Thus $F$ is continuous.

(v) If $[x]\neq [y]$, then we know that $x-y\notin{\mathbb Z}$
and the set 
\[\{|t|\,:\,t-(x-y)\in{\mathbb Z},\,|t|<1\}\]
is finite and non-empty. Thus there exists a $\delta>0$
such that
\[\{|t|\,:\,t-(x-y)\in{\mathbb Z},\,|t|<\delta\}=\{\emptyset\}.\]
Let
\[U_{x}=\bigcup_{j=-\infty}^{\infty}(j+x-\delta/4,j+x+\delta/4)
\ \text{and}
\ U_{y}=\bigcup_{j=-\infty}^{\infty}(j+y-\delta/4,j+y+\delta/4).\]
Observe that $U_{x}$ and $U_{y}$ are open in ${\mathbb R}$
and $q^{-1}\big(q(U_{x}))=U_{x}$, $q^{-1}\big(q(U_{y}))=U_{y}$, 
and so $q(U_{x})$ and $q(U_{y})$ are open in the quotient topology.
Since $[x]\in q(U_{x})$, $[y]\in q(U_{y})$
and $q(U_{x})\cap q(U_{y})=\emptyset$,
we have shown that the quotient topology is Hausdorff.

Since ${\partial}D$ is closed and bounded in ${\mathbb C}$
and we can identify ${\mathbb C}$ with ${\mathbb R}^{2}$ as a metric
space, ${\partial}D$ is compact.

Since a continuous bijection from a compact to a Hausdorff space
is a homeomorphism, $F$ is a homeomorphism.

[Remark. It is just as simple to show that the natural
map from ${\mathbb T}$ (which we know to be compact, why?)
to ${\partial}D$ (which we know to be Hausdorff, why?)
is a bijective continuous map. Or we could show continuity
in both directions and not use the result on continuous bijections.]

[Return to page~\pageref{E;circle as quotient}.]
\end{proof} 
\begin{varthm}[Theorem~\ref{T;connected via integer}]%
\label{P;connected via integer} 
If $E$ is a subset of a topological
space $(X,\tau)$, then $E$ is disconnected if and
only if we can find a non-constant continuous
function $f:E\rightarrow{\mathbb R}$ which only
takes the value $0$ or $1$.
\end{varthm}
\begin{proof} Since we are dealing with a subspace topology,
we can take $E=X$.

If $f:X\rightarrow{\mathbb R}$ is a continuous
non-constant function which only
takes the value $0$ or $1$, then
$U=f^{-1}(\{0\})=f^{-1}((-1/2,1/2))$ is open and non-empty
and similarly $V=f^{-1}(\{1\})$ is. Since $V\cup U=X$ 
and $V\cap U=\emptyset$, it follows that $X$ is disconnected.
 
Conversely, if $X$ is disconnected, we can find non-empty
open sets $U$ and $V$ such that  $V\cup U=X$ 
and $V\cap U=\emptyset$. If we set $f(u)=0$ when $u\in U$
and $f(v)=1$ when $v\in V$, then 
$f:X\rightarrow{\mathbb R}$ is a well defined
non-constant function which only
takes the value $0$ or $1$. If $A\subset{\mathbb R}$,
the $f^{-1}(A)$ must be one of the four sets
$\emptyset$, $U$, $V$ or $X$, all of which are open.
Thus $f$ is continuous.

[Return to page~\pageref{T;connected via integer}.]
\end{proof}
\begin{varthm}[Theorem~\ref{T;reals connected}]%
\label{P;reals connected}
If we give ${\mathbb R}$ the usual topology,
then ${\mathbb R}$ and the  intervals $[a,b]$
and $(a,b)$ are connected.
\end{varthm}
\begin{proof} We prove the result for $(a,b)$. The other
results are proved similarly.

Suppose $f:(a,b)\rightarrow{\mathbb R}$ is continuous
and there exist $c,\,d\in (a,b)$ with $f(c)=0$
and $f(d)=1$. Without loss of generality
we may suppose that $c<d$ and so $a<c<d<b$.
By the intermediate value theorem, we can find $\gamma\in(c,d)$
with $f(\gamma)=1/2$. Since $\gamma\in(a,b)$, $f$ takes
at least three values and $(a,b)$ must be connected.

[Return to page~\pageref{T;reals connected}.]
\end{proof} 
\begin{varthm}[Exercise~\ref{E;quotient connected}]%
\label{P;quotient connected}
(i) If $(X,\tau)$ and $(Y,\sigma)$ are topological spaces,
$E$ is a connected subset of $X$ and $g:E\rightarrow Y$
is continuous, then $g(E)$ is connected.
(More briefly, the continuous image of a connected
set is connected.)

(ii) If $(X,\tau)$ is a connected topological space
and $\sim$ is an equivalence relation on $X$, then $X/\negthinspace\sim$
with the quotient topology is connected.

(iii) If $(X,\tau)$ and $(Y,\sigma)$ are 
connected topological spaces, then $X\times Y$ 
with the product topology is connected.

(iv) If $(X,\tau)$ is a 
connected topological space and $E$ is a subset of $X$,
it does not follow that $E$ with the subspace topology is connected.
\end{varthm}
\begin{proof}  (i) If $g(E)$ is not connected we can find a non-constant
continuous 
$f:g(E)\rightarrow{\mathbb R}$ taking only the values $0$ and $1$.
Setting $F=f\circ g$ (the composition of $f$ and $g$),
we know that $F:E\rightarrow{\mathbb R}$ is non-constant,
continuous and only takes the values $0$ and $1$.
Thus $E$ is not connected.

(ii) $X/\negthinspace\sim$ is the continuous image of $X$ under the 
quotient map which we know to be continuous.

(iii) Suppose $X\times Y$ with the product topology
is not connected. Then we can find
a non-constant continuous function 
$f:X\times Y\rightarrow{\mathbb R}$ taking only the values $0$ and $1$.
Take $(x,y),\,(u,v)\in X\times Y$ with $f(x,y)\neq f(u,v)$.
Then, if $f(x,v)=f(x,y)$, it follows that $f(x,v)\neq f(u,v)$.
Without loss of generality, suppose that $f(x,v)\neq f(x,y)$.
Then we know that the function $\theta:Y\rightarrow X\times Y$
given by $\theta(z)=(x,z)$ is continuous.
(If $\Omega$ is open in $X\times Y$ and $z\in\theta^{-1}(\Omega)$,
then $(x,z)\in\Omega$, so we can find $U$ open in $X$
and $V$ open in $Y$ such that
$(x,z)\in U\times V\subseteq \Omega$. Thus 
$z\in V\subseteq \theta^{-1}(\Omega)$
and we have shown $\theta^{-1}(\Omega)$ open.)
If we set $F=f\circ\theta$, then
$F:Y\rightarrow{\mathbb R}$ is non-constant,
continuous and only takes the values $0$ and $1$.
Thus $Y$ is not connected.

(iv) ${\mathbb R}$ is connected with the usual topology
but $E=(-2,-1)\cup(1,2)$ is not.

[Return to page~\pageref{E;quotient connected}.]
\end{proof}
\begin{varthm}[Example~\ref{E;locally constant}]
\label{P;locally constant}
Suppose that  $E$ is a connected subset of a topological
space $(X,\tau)$. Suppose that $f:E\rightarrow{\mathbb R}$
is `locally constant' in the sense that, given any
$e\in E$, we can find an open neighbourhood $U$ of $e$
such that $f$ is constant on $U\cap E$. Then $f$
is constant.
\end{varthm}
\begin{proof} Since we are dealing with the subspace
topology on $E$, there is no loss in generality
in taking $E=X$. If  $X=\emptyset$ the result is vacuous
so we may take $X\neq\emptyset$.

Choose an $x_{0}\in X$ and set $c=f(x_{0})$.
Now consider the sets
\[U=\{x\in X\,:\,f(x)=c\}\ \text{and}
\ V=\{x\in X\,:\,f(x)\neq c\}.\]
We claim that $U$ and $V$ are open.
For suppose $v\in V$.
Then we can find an open neighbourhood $N$
of $v$ such that $f$ is constant on $N$. Thus $f(x)=f(v)\neq c$
for all $x\in N$, so $N\subseteq V$. It follows that $V$
is open. A similar, slightly simpler, argument shows that $U$ is open.

Since $U\cap V=\emptyset$, $U\cup V=X$ and $U\neq \emptyset$
the connectedness of $X$ tells us that $V=\emptyset$ and $U=X$.
The result follows.

[Return to page~\pageref{E;locally constant}.]
\end{proof}
\begin{varthm}[Lemma~\ref{L;connected components}]
\label{P;connected components}
We work in a topological space $(X,\tau)$.

(i) Let $x_{0}\in X$. If $x_{0}\in E_{\alpha}$ 
and $E_{\alpha}$ is connected for all $\alpha\in A$,
then $\bigcup_{\alpha\in A}E_{\alpha}$ is connected.

(ii) Write $x\sim y$ if there exists a connected set $E$
with $x,\,y\in E$. Then $\sim$ is an equivalence relation.

(iii) The equivalence classes $[x]$ are connected.

(iv) If $F$ is connected and $F\supseteq [x]$, then $F=[x]$.
\end{varthm}
\begin{proof} (i) Let $U$ and $V$ be open sets such that
\[U\cup V\supseteq \bigcup_{\alpha\in A}E_{\alpha}
\ \text{and}
\ U\cap V\cap \bigcup_{\alpha\in A}E_{\alpha}=\emptyset.\]
Without loss of generality, let $x_{0}\in U$.
Then
\[U\cup V\supseteq E_{\alpha}
\ \text{and}
\ U\cap V\cap E_{\alpha}=\emptyset\]
for each $\alpha\in A$. But
$x_{0}\in U\cap E_{\alpha}$ so
$U\cap E_{\alpha}\neq\emptyset$, and so, by the
connectedness of $E_{\alpha}$, we have
\[U\supseteq E_{\alpha}\]
for all $\alpha\in A$. Thus 
$U\supseteq \bigcup_{\alpha\in A}E_{\alpha}$.
We have shown that $\bigcup_{\alpha\in A}E_{\alpha}$ is connected.

(ii) Observe that if $U$ and $V$ are sets (open or not) such that
\[U\cup V\supseteq \{x\},
\ \text{and}
\ U\cap V\cap \{x\}=\emptyset.\]
then either $x\notin U$ and $U\cap\{x\}=\emptyset$
or $x\in U$ so $U\supseteq\{x\}$. Thus the one point set 
$\{x\}$ is connected and $x\sim x$.

The symmetry of the definition tells us that,
if $x\sim y$, then $y\sim x$.

If $x\sim y$ and $y\sim z$, then $x,\,y\in E$ and $y,\,z\in F$
for some connected sets $E$ and $F$. By part~(i),
$E\cup F$ is connected (observe that $y\in E,\,F$)
so, since $x,\,z\in E\cup F$, $x\sim z$. 

We have shown that $\sim$ is an equivalence relation.

(iii) If $y\in [x]$, then there exists a connected set $E_{y}$
with $x,\,y\in E_{y}$. By definition $[x]\supseteq E_{y}$ so
\[[x]=\bigcup_{y\in[x]}\{y\}\subseteq \bigcup_{y\in[x]}E_{y}\subseteq [x]\]
whence
\[[x]=\bigcup_{y\in[x]}E_{y}\]
and, by part~(i), $[x]$ is connected.

(iv) If $F$ is connected and $[x]\subseteq F$, then $x\in F$
and, by definition of $\sim$, $[x]\supseteq F$.
It follows that $F=[x]$.

[Return to page~\pageref{L;connected components}.]
\end{proof}
\begin{varthm}[Lemma~\ref{L;path-connected equivalence}]%
\label{P;path-connected equivalence}
If $(X,\tau)$ is a topological space and
we write $x\sim y$ if $x$ is path-connected
to $y$, then $\sim$ is an equivalence relation.
\end{varthm}
\begin{proof}
If $x\in X$, then the map $\gamma:[0,1]\rightarrow X$ defined by
$\gamma(t)=x$ for all $t$ is continuous.
(Observe that, if $F$ is a closed set in X, then
$\gamma^{-1}(F)$ takes the value $\emptyset$
or $[0,1]$ both of which are closed.) Thus $x\sim x$.

If $x\sim y$, then we can find a continuous map
$\gamma:[0,1]\rightarrow X$ with $\gamma(0)=x$
and $\gamma(1)=y$. The map $T:[0,1]\rightarrow [0,1]$
given by $T(t)=1-t$ is continuous so the composition
$\tilde{\gamma}=\gamma\circ T$ is. Observe
that $\tilde{\gamma}(0)=y$ and $\tilde{\gamma}(1)=x$
so $y\sim x$.

If $x\sim y$ and $y\sim z$, then we can find  continuous maps
$\gamma_{j}:[0,1]\rightarrow X$ with $\gamma_{1}(0)=x$,
$\gamma_{1}(1)=y$, $\gamma_{2}(0)=y$ and $\gamma_{2}(1)=z$.
Define $\gamma:[0,1]\rightarrow X$ by
\[
\gamma(t)=
\begin{cases}
\gamma_{1}(2t)&\text{if $t\in[0,1/2]$}\\
\gamma_{2}(2t-1)&\text{if $t\in(1/2,1]$}.
\end{cases}
\]
If $U$ is open in $X$, then
\[\gamma^{-1}(U)=\{t/2\,:\,t\in\gamma_{1}^{-1}(U)\}
\cup\{(1+t)/2\,:\,t\in\gamma_{2}^{-1}(U)\}\]
is open. 

(If more detail is required we argue as follows.
Suppose $s\in\gamma^{-1}(U)$. If $s\in(0,1/2)$,
then $2s\in \gamma_{1}^{-1}(U)$ so, since $\gamma_{1}^{-1}(U)$
is open we can find a $\delta>0$ with $s>\delta$
such that $(2s-\delta,2s+\delta)\subseteq \gamma_{1}^{-1}(U)$.
Thus $(s-\delta/2,s+\delta/2)\subseteq \gamma^{-1}(U)$.
If $s=0$ then $0\in\gamma_{1}^{-1}(U)$ so, since $\gamma_{1}^{-1}(U)$
is open we can find a $\delta>0$ with $1>\delta$ such that
$[0,\delta)\subseteq \gamma_{1}^{-1}(U)$. Thus
$[s,\delta/2)=[0,\delta/2)\subseteq \gamma^{-1}(U)$.
The cases $s\in(1/2,1]$ are dealt with similarly.
This leaves the case $s=1/2$. Arguing as before, we can find
$\delta_{1},\delta_{2}>0$ with $1>\delta_{1},\delta_{2}$
such that
\[(1-\delta_{1},1]\subseteq \gamma_{1}^{-1}(U)
\ \text{and}
\ [0,\delta_{2})\subseteq \gamma_{2}^{-1}(U).\]
Setting $\delta=\min(\delta_{1},\delta_{2})$ we have
\[(s-\delta/2,s+\delta/2)=(1/2-\delta/2,1/2+\delta/2)
\gamma^{-1}(U).\]
We see that the case $s=1/2$ is really the only one which requires
care.)

Thus $\gamma$ is continuous
and, since $\gamma(0)=x$, $\gamma(1)=z$, $x\sim z$.

[Return to page~\pageref{P;path-connected equivalence}.]
\end{proof}

\begin{varthm}[Theorem~\ref{T;path-connected to connected}]
\label{P;path-connected to connected}
If a topological space is path-connected, then it
is connected.
\end{varthm}
\begin{proof}
Suppose that $(X,\tau)$ is path-connected and 
that $U$ and $V$ are
open sets with $U\cap V=\emptyset$ and $U\cup V=X$.
If $U\neq \emptyset$, choose $x\in U$.
If $y\in X$, we
can find $f:[0,1]\rightarrow X$ continuous with
$f(0)=x$ and $f(1)=y$. Now the continuous image of a connected set
is connected and $[0,1]$ is connected, so $f([0,1])$ is connected.
Since
\[U\cap V\cap f([0,1])=\emptyset,
\ U\cup V\supseteq f([0,1])
\ \text{and}\ U\cap f([0,1])\neq\emptyset,\]
we know that $U\supseteq f([0,1])$ so $y\in U$. Thus $U=X$.
We have shown that $X$ is connected.  

[Return to page~\pageref{T;path-connected to connected}.]
\end{proof}

\begin{varthm}[Theorem~\ref{T;connected to path}]%
\label{P;connected to path}
If we give ${\mathbb R}^{n}$ the usual topology,
then any open set $\Omega$ which is connected is path-connected.
\end{varthm}
\begin{proof} 
If $\Omega=\emptyset$, there is nothing to prove,
so we assume $\Omega$ non-empty.

Pick ${\mathbf x}\in\Omega$ and let $U$ be the set of all points
in $\Omega$ which are path-connected to ${\mathbf x}$ and let $V$ be the set 
of all points in $\Omega$ which are not. 
We shall prove
that $U$ and $V$ are open.

Suppose first that ${\mathbf u}\in U$. Since $\Omega$
is open, we can find an open ball $B({\mathbf u},\delta)$
centre ${\mathbf u}$, radius $\delta>0$ lying entirely within
$\Omega$. If ${\mathbf y}\in B({\mathbf u},\delta)$,
then ${\mathbf u}$ is path-connected to ${\mathbf y}$ in 
$B({\mathbf u},\delta)$ and so in $U$.
(Consider $\gamma:[0,1]\rightarrow\Omega$ given by
$\gamma(t)=t{\mathbf u}+(1-t){\mathbf y}$.)
Since ${\mathbf x}$ is path-connected to ${\mathbf u}$
and
${\mathbf u}$ is path-connected to ${\mathbf y}$,
it follows that
${\mathbf x}$ is path-connected to ${\mathbf y}$
in $\Omega$ so ${\mathbf y}\in U$.

Now suppose that ${\mathbf v}\in V$. Since $\Omega$
is open, we can find an open ball $B({\mathbf v},\delta)$
centre ${\mathbf v}$, radius $\delta>0$ lying entirely within
$\Omega$. If ${\mathbf y}\in B({\mathbf v},\delta)$,
then ${\mathbf v}$ is path-connected to ${\mathbf y}$ in 
$B({\mathbf v},\delta)$ and so in $V$. It follows that,
if ${\mathbf y}$ is path-connected to ${\mathbf x}$,
then so is  ${\mathbf v}$. But ${\mathbf v}\in V$,
so ${\mathbf y}$ is not path-connected to ${\mathbf x}$.
Thus ${\mathbf y}\in V$.

Since $U\cup V=\Omega$ and $U\cap V=\emptyset$, the connectedness
of $\Omega$ shows that $U=\Omega$ and $\Omega$ is path-connected.

[Return to page~\pageref{T;connected to path}.]
\end{proof} 
\begin{varthm}[Example~\ref{E;connected not path-connected}]%
\label{P;connected not path-connected}
We work in ${\mathbb R}^{2}$ with the usual topology.
Let
\[E_{1}=\{(0,y)\,:\,|y|\leq 1\}
\ \text{and}
\ E_{2}=\{(x,\sin 1/x)\,:\,0<x\leq 1\}\]
and set $E=E_{1}\cup E_{2}$.

(i) Sketch $E$.

(ii) Explain why $E_{1}$ and $E_{2}$ are path-connected
and show that $E$ is closed and connected.

(iii) Suppose, if possible, that ${\mathbf x}:[0,1]\rightarrow E$
is continuous and ${\mathbf x}(0)=(1,0)$, ${\mathbf x}(1)=(0,0)$.
Explain why we can find $0<t_{1}<t_{2}<t_{3}<\dots$ such that
$x(t_{j})=\big((j+\tfrac{1}{2})\pi)^{-1}$. By considering the behaviour
of $t_{j}$ and $y(t_{j})$, obtain a contradiction.

(iv) Deduce that $E$ is not path-connected.
\end{varthm}
\begin{proof}[Solution] Part~(i) is left to the reader.

(ii) If $y_{1},\,y_{2}\in[-1,1]$, the function
${\mathbf f}:[0,1]\rightarrow E_{1}$ given by
\[{\mathbf f}(t)=\big(0,(1-t)y_{1}+ty_{2}\big)\]
is continuous and ${\mathbf f}(0)=(x_{1},0)$ and 
${\mathbf f}(1)=(x_{2},0)$,
so $E_{1}$ is path-connected.

If $(x_{1},y_{1}),\,(x_{2},y_{2})\in E_{2}$,
then $y_{j}=\sin 1/x_{j}$ and setting
\[{\mathbf g}(t)=
\biggr((1-t)x_{1}+tx_{2},\sin\big(1/((1-t)x_{1}+tx_{2})\big)\biggr)
\]
we see that ${\mathbf g}$ is continuous and 
${\mathbf g}(0)=(x_{1},y_{1})$ and 
${\mathbf g}(1)=(x_{2},y_{2})$,
so $E_{2}$ is path-connected.

We next show that $E$ is closed. 
Suppose that $(x_{r},y_{r})\in E$
and $(x_{r},y_{r})\rightarrow (x,y)$. If $x=0$, then
we note that, since $|y_{r}|\leq 1$ for all $r$ and
$y_{r}\rightarrow y$, we have $|y|\leq 1$ and 
$(x,y)\in E_{1}\subseteq E$. If $x\neq 0$, then
$1\geq x>0$ (since $x_{r}\geq 0$ for all $r$). We can find an $N$
such that $|x-x_{r}|<x/2$ and so $x_{r}>x/2$ for all $r\geq N$.
Thus, by continuity,
\[(x_{r},y_{r})=(x_{r},\sin 1/x_{r})\rightarrow (x,\sin 1/x)
\in E_{2}\subseteq E.\]
Thus $E$ is closed.

Now suppose, if possible, that $E$ is disconnected.
Then we can find $U$ and $V$ open such that 
\[U\cap E\neq\emptyset,\ V\cap E\neq\emptyset,\ U\cup V\supseteq E
\ \text{and $U\cap V\cap E=\emptyset$}.\]
Then  
\[U\cup V\supseteq E_{j}
\ \text{and $U\cap V\cap E_{j}=\emptyset$}.\]
and so, since $E_{j}$ is path-connected, so connected,
we have $U\cap E_{j}=\emptyset$ or $V\cap E_{j}=\emptyset$
$[j=1,2]$. Without loss of generality, assume $V\cap E_{1}=\emptyset$
so $U\supseteq E_{1}$. Since $(0,0)\in E_{1}$, we have
$(0,0)\in U$. Since $U$ is open, we can find a $\delta>0$
such that $(x,y)\in U$ whenever $\|(x,y)\|_{2}<\delta$.
If $n$ is large, 
\[((n\pi)^{-1},0)\in U\cap E_{2}=U\cap V\cap E,\]
contradicting our initial assumptions.
By reductio ad absurdum, $E$ is connected.

(iii) Write ${\mathbf x}(t)=(x(t),y(t))$. Since ${\mathbf x}$
is continuous, so is $x$. Since $x(0)=1$ and $x(1)=0$,
the intermediate value theorem tells us that we can find
$t_{1}$ with $0<t_{1}<1$ and $x(t_{1})=(\tfrac{3}{2}\pi)^{-1}$.
Applying the  intermediate value theorem again, we can
find $t_{2}$ with $0<t_{2}<t_{1}$ and 
$x(t_{2})=(\tfrac{5}{2}\pi)^{-1}$. We continue inductively.

Since the $t_{j}$ form a decreasing sequence bounded below
by $0$, we have $t_{j}\rightarrow T$ for some $T\in[0,1]$.
Since $y$ is continuous 
\[(-1)^{j}=\sin\big(1/x(t_{j})\big)=y(t_{j})\rightarrow y(T)\]
which is absurd.

(iv) Part~(iii) tells us that there is no path joining
$(0,0)$ and $(1,0)$ in $E$, so $E$ is not path-connected.

[Return to page~\pageref{E;connected not path-connected}.]
\end{proof} 
\begin{varthm}[Example~\ref{E;bounded not convergent}]%
\label{P;bounded not convergent}
Give an example of metric space
$(X,d)$ which is bounded (in the sense that there exists an $M$
with $d(x,y)\leq M$ for all $x,\,y\in X$) but 
for which there exist sequences with no convergent subsequence.
\end{varthm}
\begin{proof}[Solution] Consider the discrete metric on 
${\mathbb Z}$. If $x_{n}=n$ and $x\in {\mathbb Z}$,
then $d(x,x_{n})=1$ for all $n$
with at most one exception. Thus the sequence $x_{n}$ 
can have no convergent subsequence.

[Return to page~\pageref{E;bounded not convergent}.]
\end{proof}
\begin{varthm}[Theorem~\ref{T;compact implies sequence}]%
\label{P;compact implies sequence}
If the metric space $(X,d)$ is compact, it is sequentially compact.
\end{varthm}
\begin{proof} Let $x_{n}$ be a sequence in $X$. If
it has no convergent subsequence, then, for each $x\in X$
we can find a $\delta(x)>0$ and an $N(x)$ such that
$x_{n}\notin B(x,\delta(x))$ for all $n\geq N(x)$.
Since
\[X=\bigcup_{x\in X}\{x\}
\subseteq\bigcup_{x\in X}B(x,\delta(x))\subseteq X,\]
the $B(x,\delta(x))$ form an open cover and, by compactness,
have a finite subcover. In other words, we can find
an $M$ and $y_{j}\in X$ $[1\leq j\leq M]$ such that
\[X=\bigcup_{j=1}^{M}B\big(y_{j},\delta(y_{j})\big).\]

Now set $N=\max_{1\leq j\leq M}N(y_{j})$. Since
$N\geq N(y_{j})$, we have
$x_{N}\notin B\big(y_{j},\delta(y_{j})\big)$
for all $1\leq j\leq M$. Thus 
$x_{N}\notin\bigcup_{j=1}^{M}B\big(y_{j},\delta(y_{j})\big)
=X$ which is absurd.  

The result follows by reductio ad absurdum. 

[Return to page~\pageref{T;compact implies sequence}.]
\end{proof}
\begin{varthm}[Lemma~\ref{L;Lebesgue}]%
\label{P;Lebesgue}
Suppose that $(X,d)$ is a sequentially compact
metric space and that the collection $U_{\alpha}$
with $\alpha\in A$ is an open cover of $X$.
Then there exists a $\delta>0$ such that, given any
$x\in X$, there exists an $\alpha(x)\in A$
such that the open ball $B(x,\delta)\subseteq U_{\alpha(x)}$.
\end{varthm}
\begin{proof} Suppose the first sentence is true and the
second sentence false. Then, for each $n\geq 1$
we can find an $x_{n}$ such that the open ball
$B(x_{n},1/n)\not\subseteq U_{\alpha}$
for all $\alpha\in A$. By sequential compactness,
we can find $y\in X$ and $n(j)\rightarrow\infty$
such that $x_{n(j)}\rightarrow y$.

Since $y\in X$, we must have $y\in U_{\beta}$ 
for some $\beta\in A$. Since $U_{\beta}$ is open,
we can find an $\epsilon$ such that 
$B(y,\epsilon)\subseteq U_{\beta}$.
Now choose $J$ sufficiently large that $n(J)>2\epsilon^{-1}$
and $d(x_{n(J)},y)<\epsilon/2$. We now have,
using the triangle inequality, that
\[B(x_{n(J)},1/n(J))\subseteq B(x_{n(J)},\epsilon/2)
\subseteq B(y,\epsilon)\subseteq U_{\beta},\]
contradicting the definition of $x_{n(J)}$.

The result follows by reductio ad absurdum.

[Return to page~\pageref{L;Lebesgue}.]
\end{proof}
\begin{varthm}[Theorem~\ref{T;sequence implies compact}]%
\label{P;sequence implies compact}
If the metric space $(X,d)$ is sequentially compact, 
it is compact.
\end{varthm}
\begin{proof} Let $(U_{\alpha})_{\alpha\in A}$ be an open cover
and let $\delta$ be defined as in Lemma~\ref{L;Lebesgue}.
The $B(x,\delta)$ form a cover of $X$. If they have no finite
subcover, then given $x_{1}$, $x_{2}$, \dots $x_{n}$
we can find an $x_{n+1}\notin\bigcup_{j=1}^{n}B(x_{j},\delta)$. 
Consider the sequence $x_{j}$ thus obtained.
We have $d(x_{n+1},x_{k})>\delta$ whenever $n\geq k\geq 1$
and so $d(x_{r},x_{s})>\delta$ for all $r\neq s$.
It follows that, if $x\in X$, $d(x_{n},x)>\delta/2$
for all $n$ with at most one exception. Thus
the sequence of $x_{n}$ has no convergent subsequence.

It thus follows, by reductio ad absurdum, that the
$B(x,\delta)$ have a finite subcover. In other words,
we can find
an $M$ and $y_{j}\in X$ $[1\leq j\leq M]$ such that
\[X=\bigcup_{j=1}^{M}B(y_{j},\delta).\]
We thus have
\[X=\bigcup_{j=1}^{M}B(y_{j},\delta)
\subseteq \bigcup_{j=1}^{M}U_{\alpha(y_{j})}\subseteq X\]
so $X=\bigcup_{j=1}^{M}U_{\alpha(y_{j})}$ and we have
found a finite subcover.

Thus $X$ is compact.
 
[Return to page~\pageref{T;sequence implies compact}.]
\end{proof}
\begin{varthm}[Lemma~\ref{L;open topology via neighbourhood}]%
\label{P;open topology via neighbourhood}
Let $(X,\tau)$ be a topological space.
Then $U\in\tau$ if and only if, given $x\in U$,
we can find a neighbourhood $N$ of $x$ 
with $N\subseteq U$.
\end{varthm}
\begin{proof} 
If $U\in\tau$ then $U$ is a neighbourhood of $x$ for all $x\in U$.

Conversely, if given any $x\in U$, we can find a neighbourhood
$N_{x}$ of $x$ with $N_{x}\subseteq U$, then we can find
an open neighbourhood $U_{x}$ of $x$ with $U_{x}\subseteq N_{x}$.
Since 
\[U\subseteq\bigcup_{x\in U}\{x\}
\subseteq\bigcup_{x\in U}U_{x}
\subseteq\bigcup_{x\in U}N_{x}
\subseteq\bigcup_{x\in U}U=U,\]
we have $U=\bigcup_{x\in U}U_{x}\in\tau$.

[Return to page~\pageref{L;open topology via neighbourhood}.]
\end{proof}
\begin{varthm}[Lemma~\ref{L;continuous via neighbourhood}]%
\label{P;continuous via neighbourhood}
Let $(X,\tau)$ and $(Y,\sigma)$ be topological spaces.
Then $f:X\rightarrow Y$ is continuous
if and only if, given $x\in X$ and $M$
a neighbourhood of $f(x)$ in $Y$,
we can find a neighbourhood $N$ of $x$ 
with $f(N)\subseteq M$.
\end{varthm}
\begin{proof}
\noindent\emph{If} If $f:X\rightarrow Y$ is continuous,
$x\in X$ and $M$ is
a neighbourhood of $f(x)$, then we can find
a $V\in\sigma$ with $f(x)\in V\subseteq M$.
Since $f$ is continuous $f^{-1}(V)\in\tau$.
Thus, since $x\in f^{-1}(V)$, we have that $f^{-1}(V)$
is an open neighbourhood and so a neighbourhood of $x$.
Setting $N=f^{-1}(V)$, we have $f(N)=V\subseteq M$
as required.

\vspace{1\baselineskip}

\noindent\emph{Only if} Suppose that, 
given $x\in X$ and $M$
a neighbourhood of $f(x)$ in $Y$,
we can find a neighbourhood $N$ of $x$ 
with $f(N)\subseteq M$.
Let $V$ be open in $Y$. If $x\in X$
and $f(x)\in V$, then $V$ is a neighbourhood
of $f(x)$ so there exists a neighbourhood $N_{x}$
of $x$ with $f(N_{x})\subseteq V$. We now choose
$U_{x}$ an open neighbourhood of $x$ with $U_{x}\subseteq N_{x}$.
We have
\[f(U_{x})\subseteq V\]
and so $U_{x}\subseteq f^{-1}(V)$ for all $x\in f^{-1}(V)$.
Thus
\[f^{-1}(V)=\bigcup_{x\in f^{-1}(V)}\{x\}
\subseteq \bigcup_{x\in f^{-1}(V)}U_{x}
\subseteq \bigcup_{x\in f^{-1}(V)}f^{-1}(V)
=f^{-1}(V).\]
It follows that $f^{-1}(V)=\bigcup_{x\in f^{-1}(V)}U_{x}\in\tau$.
We have shown that $f$ is continuous.

[Return to page~\pageref{L;continuous via neighbourhood}.]
\end{proof} 

\begin{varthm}[Lemma~\ref{L;basis works}]%
\label{P;basis works}
Let $X$ be a set
and ${\mathcal B}$ a collection
of subsets of $X$. Let $\tau_{\mathcal B}$
be the collection of sets $U$ such that,
whenever $x\in U$, we can find a $B\in{\mathcal B}$
such that $x\in B\subset U$.

Then $\tau_{\mathcal B}$ is a topology if and
only if ${\mathcal B}$ is a basis.
\end{varthm}
\begin{proof} We first prove necessity. If $\tau_{B}$
is a topology, then $X\in\tau_{\mathcal B}$ and
so for each $x\in X$ we can find a $B_{x}\in{\mathcal B}$
with $x\in B_{x}$. Thus
\[\bigcup_{B\in{\mathcal B}}B\supseteq \bigcup_{x\in X}B_{x}
\supseteq \bigcup_{x\in X}\{x\}=X\]
so $\bigcup_{B\in{\mathcal B}}B=X$.

Next we observe that, by definition,
${\mathcal B}\subseteq \tau_{\mathcal B}$. Thus
if $B_{1},\,B_{2}\in{\mathcal B}$ we must have
$B_{1}\cup B_{2}\in{\mathcal B}$ and, by definition,
if $x\in B_{1}\cup B_{2}$ we can find a $B_{3}\in{\mathcal B}$
such that $x\in B_{3}\subseteq B_{1}\cup B_{2}$.
Thus ${\mathcal B}$ is a basis.

We now prove sufficiency. Suppose that ${\mathcal B}$ is a basis.
We observe that, using the definition,
${\mathcal B}\subseteq \tau_{\mathcal B}$
and whenever ${\mathcal A}\subseteq\tau_{\mathcal B}$
we have $\bigcup_{A\in\mathcal A}A\in\tau_{\mathcal B}$.

We have $\emptyset\in\tau_{\mathcal B}$ vacuously
and, by the definition of a basis, 
$X=\bigcup_{B\in\mathcal B}B\in\tau_{\mathcal B}$.

Finally, if $U_{1},\,U_{2}\in\tau_{B}$ then whenever
$x\in U_{1}\cap U_{2}$ we can find $B_{1},\,B_{2}\in{\mathcal B}$
with $x\in B_{1}\subset U_{1}$, $x\in B_{2}\subset U_{2}$.
By the definition of a basis, we can find $B_{3}\in{\mathcal B}$
with 
\[x\in B_{3}\subseteq B_{1}\cap B_{2}\subseteq U_{1}\cap U_{2}.\]
Thus $U_{1}\cap U_{2}\in \tau_{\mathcal B}$. Thus
$\tau_{\mathcal B}$ is a topology.

[Return to page~\pageref{L;basis works}.]
\end{proof} 
\section{Executive summary}

\noindent{\bf Metrics}\\
Definition and examples [Page~\pageref{D;metric}].
Continuity [Page~\pageref{D;metric continuity}].
Open sets [Page~\pageref{D;metric open set}].
Characterising continuous functions using open sets
[Theorem~\ref{T;properties metric open},
Page~\pageref{T;properties metric open}].
Limits [Page~\pageref{D;limit}].
Closed sets [Page~\pageref{D;metric closed set}].

\vspace{1\baselineskip}

\noindent{\bf Topology}\\
Definition of a topology [Page~\pageref{D;topology}].
Metric topologies [Theorem~\ref{T;metric topology},
Page~\pageref{T;metric topology}].
Further examples [Page~\pageref{E;indiscrete}].
Continuous functions [Page~\pageref{D;topological continuity}]
and closed sets [Page~\pageref{D;closed topologically}].
Interior and closure [Page~\pageref{S;interior}].
Dense subsets [Page~\pageref{D;dense}]
Homeomorphisms [Page~\pageref{D;homeomorphisms}].
Topological and non-topological properties
[Page~\pageref{R;topological properties}]
illustrated by completeness
[Page~\pageref{D;completeness}].
Subspace
[Page~\pageref{D;subspace topology}],
product
[Page~\pageref{D;product topology}]
and quotient
[Lemma~\ref{L;quotient lemma},
Page~\pageref{L;quotient lemma}]
topologies.
Hausdorff spaces
[Page~\pageref{S;Hausdorff spaces}]. 

\vspace{1\baselineskip}

\noindent{\bf Compactness}\\
Definition using open sets
[Page~\pageref{D;compact}].
Examples: finite sets
[Example~\ref{E;simple compact examples},
Page~\pageref{E;simple compact examples}]
and $[0,1]$
[Theorem~\ref{T;Heine--Borel},
Page~\pageref{T;Heine--Borel}].
Closed subsets of compact sets are compact
[Theorem~\ref{T;closed subset compact},
Page~\pageref{T;closed subset compact}].
Compact subsets of a Hausdorff space must be closed
[Theorem~\ref{T;compact closed},
Page~\pageref{T;compact closed}].
The compact subsets of the real line
[Theorem~\ref{T;closed bounded},
Page~\pageref{T;closed bounded}].
Continuous images of compact sets are compact
[Theorem~\ref{T;compact image},
Page~\pageref{T;compact image}].
Quotient spaces and compactness
[Page~\pageref{T;quotient compact}].
Continuous real valued functions on a compact space
are bounded and attain their bounds
[Theorem~\ref{T;compact attains bounds},
Page~\pageref{T;compact attains bounds}].
The product of two compact spaces is compact
[Theorem~\ref{T;product compact},
Page~\pageref{T;product compact}].
The compact subsets of Euclidean space
[Theorem~\ref{T;compact Euclidean},
Page~\pageref{T;compact Euclidean}].
Sequential compactness
[Page~\pageref{D;sequential compactness}].

\vspace{1\baselineskip}

\noindent{\bf Connectedness}\\
Definition using open sets
[Page~\pageref{D;disconnected}]
and integer valued functions
[Theorem~\ref{T;connected via integer},
Page~\pageref{T;connected via integer}].
Examples, including intervals
[Theorem~\ref{T;reals connected},
Page~\pageref{T;reals connected}].
Continuous image of a connected set
is connected
[Example~\ref{E;quotient connected}~(i),
Page~\pageref{E;quotient connected}].
Components
[Lemma~\ref{L;connected components},
Page~\pageref{L;connected components}].
Path-connectedness
[Page~\pageref{D;path-connected}].
Path-connected spaces are connected
[Theorem~\ref{T;path-connected to connected},
Page~\pageref{T;path-connected to connected}]
but not conversely
[Example~\ref{E;connected not path-connected},
Page~\pageref{E;connected not path-connected}].
Connected open sets in Euclidean space
are path-connected
[Theorem~\ref{T;connected to path},
Page~\pageref{T;connected to path}].

\vspace{1\baselineskip}

\noindent{\bf Neighbourhoods}\\
Open neighbourhoods [Page~\pageref{D;open neighbourhood}].
Neighbourhoods [Page~\pageref{D;neighbourhood}].
Continuity via neighbourhoods
[Lemma~\ref{L;continuous via neighbourhood},
Page~\pageref{L;continuous via neighbourhood}].
Bases [Page~\pageref{D;basis}].
Neighbourhoods
[Exercise~\ref{E;non-closed neighbourhood},
Page~\pageref{E;non-closed neighbourhood}] 
and convergence 
[Lemma~\ref{L;convergence, neighbourhood, metric},
Page~\pageref{L;convergence, neighbourhood, metric}]
in metric spaces.
Limits treacherous concept in general topological
spaces [Page~\pageref{R;treacherous}].
\end{document}
