-
Notifications
You must be signed in to change notification settings - Fork 26
/
ch-metric.tex
3679 lines (3268 loc) · 124 KB
/
ch-metric.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\chapter{Metric Spaces} \label{ms:chapter}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Metric spaces}
\label{sec:metric}
\sectionnotes{1.5 lectures}
As mentioned in the introduction, the main idea in analysis is to take
limits. In \chapterref{seq:chapter} we learned to take limits of sequences of
real numbers. And in \chapterref{lim:chapter} we learned to take limits
of functions as a real number approached some other real number.
We want to take limits in more complicated contexts. For
example, we want to have sequences of points in 3-dimensional space.
We wish to define continuous functions of several variables.
We even want to define functions on spaces that are a little harder to
describe, such as the surface of the earth. We still want to talk about
limits there.
Finally, we have seen the limit of a sequence of
functions in \chapterref{fs:chapter}.
We wish to unify all these notions so that we do not have to
reprove theorems over and over again in each context. The concept of a
metric space is an elementary yet powerful tool in analysis. And while it
is not sufficient to describe every type of limit we find in modern
analysis, it gets us very far indeed.
\begin{defn}
Let $X$ be a set, and let
$d \colon X \times X \to \R$
be a function such that for all $x,y,z \in X$
\begin{enumerate}[(i)]
%
\item \label{metric:pos}
%mbxSTARTIGNORE
\makebox[2.8in][l]{$d(x,y) \geq 0$.}
%mbxENDIGNORE
%mbxlatex $d(x,y) \geq 0$. \qquad
(\emph{nonnegativity})\index{nonnegativity of a metric}
%
\item \label{metric:zero}
%mbxSTARTIGNORE
\makebox[2.8in][l]{$d(x,y) = 0$ if and only if $x = y$.}
%mbxENDIGNORE
%mbxlatex $d(x,y) = 0$ if and only if $x = y$.
(\emph{\myindex{identity of indiscernibles}})
%
\item \label{metric:com}
%mbxSTARTIGNORE
\makebox[2.8in][l]{$d(x,y) = d(y,x)$.}
%mbxENDIGNORE
%mbxlatex $d(x,y) = d(y,x)$. \qquad
(\emph{symmetry})\index{symmetry of a metric}
%
\item \label{metric:triang}
%mbxSTARTIGNORE
\makebox[2.8in][l]{$d(x,z) \leq d(x,y)+ d(y,z)$.}
%mbxENDIGNORE
%mbxlatex $d(x,z) \leq d(x,y)+ d(y,z)$. \qquad
(\emph{\myindex{triangle inequality}})
\end{enumerate}
The pair $(X,d)$ is called a \emph{\myindex{metric space}}. The
function $d$ is called the \emph{\myindex{metric}} or the
\emph{\myindex{distance function}}.
Sometimes we write just $X$ as the metric space instead of $(X,d)$
if the metric is clear from context.
\end{defn}
The geometric idea is that $d$ is the distance between two points.
Items \ref{metric:pos}--\ref{metric:com} have obvious geometric
interpretation: Distance is always nonnegative, the only point that is
distance 0 away from $x$ is $x$ itself, and finally that the distance from
$x$ to $y$ is the same as the distance from $y$ to $x$. The triangle
inequality \ref{metric:triang} has the interpretation given in
\figureref{fig:mstriang}.
\begin{myfigureht}
\subimport*{figures/}{ms-triang.pdf_t}
\caption{Diagram of the triangle inequality in metric spaces.\label{fig:mstriang}}
\end{myfigureht}
For the purposes of drawing, it is convenient to draw figures and
diagrams in the plane with the metric being the euclidean distance.
However, that is only one particular metric space. Just because a
certain fact seems to be clear from drawing a picture does not mean it is
true in every metric space.
You might be getting sidetracked by intuition from euclidean geometry,
whereas the concept of a metric space is a lot more general.
Let us give some examples of metric spaces.
\begin{example}
The set of real numbers $\R$ is a metric space with the metric
\begin{equation*}
d(x,y) \coloneqq \abs{x-y} .
\end{equation*}
Items \ref{metric:pos}--\ref{metric:com} of the definition
are easy to verify. The
triangle inequality \ref{metric:triang} follows immediately
from the standard triangle inequality for real numbers:
\begin{equation*}
d(x,z) = \abs{x-z} =
\abs{x-y+y-z} \leq
\abs{x-y}+\abs{y-z} =
d(x,y)+ d(y,z) .
\end{equation*}
This metric is the \emph{\myindex{standard metric on $\R$}}. If we talk
about $\R$ as a metric space without mentioning a specific metric, we
mean this particular metric.
\end{example}
\begin{example}
We can also put a different metric on the set of real numbers.
For example, take the set of real numbers $\R$ together with the metric
\begin{equation*}
d(x,y) \coloneqq
\frac{\abs{x-y}}{\abs{x-y}+1} .
\end{equation*}
Items \ref{metric:pos}--\ref{metric:com} are again easy to verify. The
triangle inequality \ref{metric:triang} is a little bit more difficult.
Note that $d(x,y) = \varphi(\abs{x-y})$ where $\varphi(t) =
\frac{t}{t+1}$ and $\varphi$ is an increasing function
(positive derivative, see \figureref{fig:tovertp1}).
Hence
\begin{equation*}
\begin{split}
d(x,z) = \varphi(\abs{x-z})
& =
\varphi(\abs{x-y+y-z}) \\
& \leq
\varphi(\abs{x-y}+\abs{y-z})
\\
& =
\frac{\abs{x-y}+\abs{y-z}}{\abs{x-y}+\abs{y-z}+1} \\
& =
\frac{\abs{x-y}}{\abs{x-y}+\abs{y-z}+1} +
\frac{\abs{y-z}}{\abs{x-y}+\abs{y-z}+1}
\\
& \leq
\frac{\abs{x-y}}{\abs{x-y}+1} +
\frac{\abs{y-z}}{\abs{y-z}+1} =
d(x,y)+ d(y,z) .
\end{split}
\end{equation*}
The function $d$ is thus a metric, and gives
an example of a nonstandard metric on $\R$. With this metric,
$d(x,y) < 1$ for all $x,y \in \R$. That is,
every two points are less than 1 unit apart.
\begin{myfigureht}
\includegraphics{figures/tovertp1graph}
\caption{Graph of $\frac{t}{t+1}$ for positive $t$ with an asymptote at 1.\label{fig:tovertp1}}
\end{myfigureht}
\end{example}
An important metric space is the
$n$-dimensional \emph{\myindex{euclidean space}}
\glsadd{not:euclidspace}
$\R^n = \R \times \R \times \cdots \times \R$. We use the following
notation for points: $x =(x_1,x_2,\ldots,x_n) \in \R^n$. We will not write
$\vec{x}$ nor $\mathbf{x}$ for a point in $\R^n$ as is common in
multivariable calculus,
we simply give it a name such as $x$ and we will remember that $x$
is an element of $\R^n$.
We also
write simply $0 \in \R^n$ to mean the point $(0,0,\ldots,0)$. Before
making $\R^n$ a metric space, we prove an important inequality, the
so-called Cauchy--Schwarz inequality.
\begin{lemma}[\myindex{Cauchy--Schwarz inequality}%
\footnote{%
Sometimes it is called the \myindex{Cauchy--Bunyakovsky--Schwarz inequality}.
\href{https://en.wikipedia.org/wiki/Hermann_Schwarz}{Karl Hermann Amandus
Schwarz} (1843--1921) was a German mathematician and
\href{https://en.wikipedia.org/wiki/Viktor_Bunyakovsky}{Viktor Yakovlevich
Bunyakovsky} (1804--1889) was a Ukrainian mathematician. What we
stated should really be called the Cauchy inequality, as
Bunyakovsky and Schwarz provided proofs for infinite-dimensional versions.}]
Suppose $x =(x_1,x_2,\ldots,x_n) \in \R^n$, $y =(y_1,y_2,\ldots,y_n) \in \R^n$.
Then
\begin{equation*}
{\biggl( \sum_{k=1}^n x_k y_k \biggr)}^2
\leq
\biggl(\sum_{k=1}^n x_k^2 \biggr)
\biggl(\sum_{k=1}^n y_k^2 \biggr) .
\end{equation*}
\end{lemma}
\begin{proof}
A square of a real number is nonnegative. Hence a sum of squares is
nonnegative:
\begin{equation*}
\begin{split}
0 & \leq
\sum_{k=1}^n \sum_{\ell=1}^n {(x_k y_\ell - x_\ell y_k)}^2
\\
& =
\sum_{k=1}^n \sum_{\ell=1}^n \bigl( x_k^2 y_\ell^2 + x_\ell^2 y_k^2 - 2 x_k
x_\ell y_k
y_\ell \bigr)
\\
& =
\biggl( \sum_{k=1}^n x_k^2 \biggr)
\biggl( \sum_{\ell=1}^n y_\ell^2 \biggr)
+
\biggl( \sum_{k=1}^n y_k^2 \biggr)
\biggl( \sum_{\ell=1}^n x_\ell^2 \biggr)
-
2
\biggl( \sum_{k=1}^n x_k y_k \biggr)
\biggl( \sum_{\ell=1}^n x_\ell y_\ell \biggr) .
\end{split}
\end{equation*}
We relabel and divide by 2 to obtain precisely what we wanted,
\begin{equation*}
0 \leq
\biggl( \sum_{k=1}^n x_k^2 \biggr)
\biggl( \sum_{k=1}^n y_k^2 \biggr)
-
{\biggl( \sum_{k=1}^n x_k y_k \biggr)}^2 .
\qedhere
\end{equation*}
\end{proof}
\begin{example}
Let us construct the
standard metric\index{standard metric on $\R^n$} for $\R^n$. Define
\begin{equation*}
d(x,y) \coloneqq
\sqrt{
{(x_1-y_1)}^2 +
{(x_2-y_2)}^2 +
\cdots +
{(x_n-y_n)}^2
} =
\sqrt{
\sum_{k=1}^n
{(x_k-y_k)}^2
} .
\end{equation*}
For $n=1$, the real line, this metric agrees with what we defined above.
For $n > 1$,
the only tricky part of the definition to check, as before, is the triangle inequality.
It is less messy to work with the square of the metric. In the
following estimate, note the use of the Cauchy--Schwarz inequality.
\begin{equation*}
\begin{split}
{\bigl(d(x,z)\bigr)}^2 & =
\sum_{k=1}^n
{(x_k-z_k)}^2
\\
& =
\sum_{k=1}^n
{(x_k-y_k+y_k-z_k)}^2
\\
& =
\sum_{k=1}^n
\Bigl(
{(x_k-y_k)}^2+{(y_k-z_k)}^2 + 2(x_k-y_k)(y_k-z_k)
\Bigr)
\\
& =
\sum_{k=1}^n
{(x_k-y_k)}^2
+
\sum_{k=1}^n
{(y_k-z_k)}^2
+
2
\sum_{k=1}^n
(x_k-y_k)(y_k-z_k)
\\
& \leq
\sum_{k=1}^n
{(x_k-y_k)}^2
+
\sum_{k=1}^n
{(y_k-z_k)}^2
+
2
\sqrt{
\sum_{k=1}^n
{(x_k-y_k)}^2
\sum_{k=1}^n
{(y_k-z_k)}^2
}
\\
& =
{\left(
\sqrt{
\sum_{k=1}^n
{(x_k-y_k)}^2
}
+
\sqrt{
\sum_{k=1}^n
{(y_k-z_k)}^2
}
\right)}^2
=
{\bigl( d(x,y) + d(y,z) \bigr)}^2 .
\end{split}
\end{equation*}
Because the square root is an increasing function, the
inequality is preserved when we
take the square root of both sides, and we obtain the triangle inequality.
\end{example}
\begin{example}
The set of complex numbers $\C$ is the set of numbers $z = x+iy$, where $x$
and $y$ are in $\R$. By imposing $i^2 = -1$, we make $\C$ into a
field.
For the purposes of taking limits,
the set $\C$ is regarded as the metric space $\R^2$, where $z=x+iy \in \C$
corresponds to $(x,y) \in \R^2$.
For $z=x+iy$ define the \emph{\myindex{complex modulus}}\index{modulus}
by $\sabs{z} \coloneqq \sqrt{x^2+y^2}$.
Then for two complex numbers
$z_1 = x_1 + iy_1$ and $z_2 = x_2 + iy_2$, the distance is
\begin{equation*}
d(z_1,z_2) = \sqrt{{(x_1-x_2)}^2+ {(y_1-y_2)}^2} = \sabs{z_1-z_2}.
\end{equation*}
Furthermore, when working with complex numbers
it is often convenient to write the metric in terms of
the so-called
\emph{\myindex{complex conjugate}}: The conjugate of $z=x+iy$
is $\bar{z} \coloneqq x-iy$. Then
${\sabs{z}}^2 = x^2 +y^2 = z\bar{z}$, and so ${\sabs{z_1-z_2}}^2 =
(z_1-z_2)\overline{(z_1-z_2)}$.
\end{example}
\begin{example}
An example to keep in mind is the so-called
\emph{\myindex{discrete metric}}.
For any set $X$, define
\begin{equation*}
d(x,y) \coloneqq
\begin{cases}
1 & \text{if } x \not= y, \\
0 & \text{if } x = y.
\end{cases}
\end{equation*}
That is, all points are equally distant from each other. When $X$ is a
finite set, we can draw a diagram, see for example
\figureref{fig:msdiscmetric}. Of course, in the diagram the distances
are not the normal euclidean distances in the plane.
Things become subtle when $X$ is an infinite set such
as the real numbers.
\begin{myfigureht}
\subimport*{figures/}{msdiscmetric.pdf_t}
\caption{Sample discrete metric space $\{ a,b,c,d,e \}$, the distance
between any two points is $1$.\label{fig:msdiscmetric}}
\end{myfigureht}
While this particular
example may seldom come up in practice, it gives a useful
\myquote{smell test.} If you make a statement about metric spaces,
try it with the discrete metric.
To show that $(X,d)$ is indeed a metric space is left as an exercise.
\end{example}
\begin{example} \label{example:msC01}
Let $C\bigl([a,b],\R\bigr)$\glsadd{not:contfuncs} be the set of
continuous real-valued functions on the interval $[a,b]$.
Define the metric on $C\bigl([a,b],\R\bigr)$ as
\begin{equation*}
d(f,g) \coloneqq \sup_{x \in [a,b]} \abs{f(x)-g(x)} .
\end{equation*}
Let us check the properties. First, $d(f,g)$ is finite as
$\abs{f(x)-g(x)}$ is a continuous function on a closed bounded interval
$[a,b]$, and so is bounded.
It is clear that $d(f,g) \geq 0$,
it is the supremum of nonnegative numbers. If $f = g$,
then $\abs{f(x)-g(x)} = 0$ for all $x$, and hence $d(f,g) = 0$. Conversely,
if $d(f,g) = 0$, then for every $x$, we have $\abs{f(x)-g(x)} \leq d(f,g) = 0$,
and hence $f(x) = g(x)$ for all $x$, and so $f=g$. That $d(f,g) = d(g,f)$
is equally trivial. To show the triangle inequality we use the standard
triangle inequality;
\begin{equation*}
\begin{split}
d(f,g) & =
\sup_{x \in [a,b]} \abs{f(x)-g(x)} =
\sup_{x \in [a,b]} \abs{f(x)-h(x)+h(x)-g(x)}
\\
& \leq
\sup_{x \in [a,b]} \bigl( \abs{f(x)-h(x)}+\abs{h(x)-g(x)} \bigr)
\\
& \leq
\sup_{x \in [a,b]} \abs{f(x)-h(x)}+
\sup_{x \in [a,b]} \abs{h(x)-g(x)} = d(f,h) + d(h,g) .
\end{split}
\end{equation*}
When treating $C\bigl([a,b],\R\bigr)$ as a metric space without mentioning a metric,
we mean this particular metric.
Notice that $d(f,g) = \norm{f-g}_{[a,b]}$, the uniform norm of \defnref{def:unifnorm}.
This example may seem esoteric at first, but it turns out that working with
spaces such as $C\bigl([a,b],\R\bigr)$ is really the meat of a large part of modern
analysis. Treating sets of functions as metric spaces allows us to
abstract away a lot of the grubby detail and prove powerful results such as
\hyperref[thm:fs:picard]{Picard's theorem} with less work.
\end{example}
\begin{example}
Another useful example of a metric space is the sphere
with a metric usually called the \emph{\myindex{great circle distance}}.
Let $S^2$ be the \myindex{unit sphere}\index{sphere} in $\R^3$,
that is $S^2 \coloneqq \{ x \in \R^3 : x_1^2+x_2^2+x_3^2 = 1 \}$.
Take $x$ and $y$ in $S^2$, draw a line through the origin and $x$,
and another line through the origin and $y$,
and let $\theta$ be the angle that the two lines make.
Then define $d(x,y) \coloneqq \theta$. See \figureref{fig:spheremetric}.
The law of cosines from vector calculus says
$d(x,y) = \arccos(x_1y_1+x_2y_2+x_3y_3)$.
It is relatively easy to see that this function satisfies the first three
properties of a metric.
Triangle inequality is harder to prove, and requires a bit more
trigonometry and linear algebra than we wish to indulge in right now, so let
us leave it without proof.
\begin{myfigureht}
\subimport*{figures/}{spheremetric.pdf_t}
\caption{The great circle distance on the unit
sphere.\label{fig:spheremetric}}
\end{myfigureht}
This distance is the shortest distance between points on a sphere if
we are allowed to travel on the sphere only. It is easy to
generalize to arbitrary diameters. If we take a sphere of radius
$r$, we let the distance be $d(x,y) \coloneqq r \theta$. As an example, this is the
standard distance you would use if you compute a distance on the
surface of the earth, such as computing the distance a plane travels from London to
Los Angeles.
\end{example}
Oftentimes it is useful to consider a subset of a larger metric space
as a metric space itself. We obtain the following proposition, which has
a trivial proof.
\begin{prop}
Let $(X,d)$ be a metric space and $Y \subset X$. Then the restriction
$d|_{Y \times Y}$ is a metric on $Y$.
\end{prop}
\begin{defn}
If $(X,d)$ is a metric space, $Y \subset X$, and $d' \coloneqq d|_{Y \times Y}$,
then $(Y,d')$ is said to be a \emph{\myindex{subspace}} of $(X,d)$.
\end{defn}
It is common to simply write $d$ for the metric on $Y$, as it is
the restriction of the metric on $X$. Sometimes we say $d'$ is
the \emph{\myindex{subspace metric}} and $Y$ has the
\emph{\myindex{subspace topology}}.
\medskip
A subset of the real
numbers is bounded whenever all its elements are at most some fixed distance
from 0.
When dealing with an arbitrary metric space there may not be some
natural fixed point 0, but for the purposes of boundedness it does not matter.
\begin{defn}
Let $(X,d)$ be a metric space. A subset $S \subset X$ is said to be
\emph{bounded}\index{bounded set} if there exists a $p \in X$ and a
$B \in \R$ such that
\begin{equation*}
d(p,x) \leq B \quad \text{for all } x \in S.
\end{equation*}
We say $(X,d)$ is bounded if $X$ itself is a bounded subset.
\end{defn}
For example, the set of real numbers with the standard metric is not a
bounded metric space. It is not hard to see that a
subset of the real numbers is bounded in the
sense of \chapterref{rn:chapter} if and only if it is bounded as a subset of the
metric space of real numbers with the standard metric.
On the other hand, if we take the real numbers with the discrete metric,
then we obtain a bounded metric space. In fact, any set with the
discrete metric is bounded.
There are other equivalent ways we could generalize boundedness,
and are left as exercises. Suppose $X$ is nonempty to avoid a technicality.
Then $S \subset X$ being bounded is equivalent to either
\begin{enumerate}[(i)]
\item
For every $p \in X$, there exists a $B > 0$ such that $d(p,x) \leq B$ for
all $x \in S$.
\item
\glsadd{not:diam}%
$\operatorname{diam}(S) \coloneqq \sup \bigl\{ d(x,y) : x,y \in S \bigr\} < \infty$.
\end{enumerate}
The quantity $\operatorname{diam}(S)$ is called the
\emph{\myindex{diameter}} of a set and is usually only defined for
a nonempty set.
\subsection{Exercises}
\begin{exercise}
Show that for every set $X$, the discrete metric ($d(x,y) = 1$ if $x\not=y$ and
$d(x,x) = 0$) does give a metric space $(X,d)$.
\end{exercise}
\begin{exercise}
Let $X \coloneqq \{ 0 \}$ be a set. Can you make it into a metric space?
\end{exercise}
\begin{exercise}
Let $X \coloneqq \{ a, b \}$ be a set. Can you make it into two distinct metric
spaces? (define two distinct metrics on it)
\end{exercise}
\begin{exercise}
Let the set $X \coloneqq \{ A, B, C \}$ represent 3 buildings on campus. Suppose we
wish our distance to be the time it takes to walk from one building to
the other.
It takes 5 minutes either way between buildings $A$ and $B$. However,
building $C$ is on a hill and it takes 10 minutes from $A$ and 15 minutes
from $B$ to get to $C$. On the other hand it takes 5 minutes to go
from $C$ to $A$ and 7 minutes to go from $C$ to $B$, as we are going
downhill. Do these distances define a metric? If so, prove it, if not, say
why not.
\end{exercise}
\begin{exercise}
Suppose $(X,d)$ is a metric space and
$\varphi \colon [0,\infty) \to \R$ is
an increasing function such that
$\varphi(t) \geq 0$ for all $t$ and $\varphi(t) = 0$ if and only if
$t=0$. Also suppose $\varphi$ is \emph{\myindex{subadditive}},
that is, $\varphi(s+t) \leq \varphi(s)+\varphi(t)$.
Show that with $d'(x,y) \coloneqq \varphi\bigl(d(x,y)\bigr)$, we obtain a new
metric space $(X,d')$.
\end{exercise}
\begin{exercise} \label{exercise:mscross}
Let $(X,d_X)$ and $(Y,d_Y)$ be metric spaces.
\begin{enumerate}[a)]
\item
Show that $(X \times Y,d)$ with
$d\bigl( (x_1,y_1), (x_2,y_2) \bigr) \coloneqq d_X(x_1,x_2) + d_Y(y_1,y_2)$ is
a metric space.
\item
Show that $(X \times Y,d)$ with
$d\bigl( (x_1,y_1), (x_2,y_2) \bigr) \coloneqq \max \bigl\{ d_X(x_1,x_2) ,
d_Y(y_1,y_2) \bigr\}$ is
a metric space.
\end{enumerate}
\end{exercise}
\begin{exercise}
Let $X$ be the set of continuous functions on $[0,1]$. Let $\varphi \colon
[0,1] \to (0,\infty)$ be continuous. Define
\begin{equation*}
d(f,g) \coloneqq \int_0^1 \abs{f(x)-g(x)}\varphi(x)\,dx .
\end{equation*}
Show that $(X,d)$ is a metric space.
\end{exercise}
\begin{exercise} \label{exercise:mshausdorffpseudo}
Let $(X,d)$ be a metric space. For nonempty bounded subsets $A$ and $B$ let
\begin{equation*}
d(x,B) \coloneqq \inf \bigl\{ d(x,b) : b \in B \bigl\}
\qquad \text{and} \qquad
d(A,B) \coloneqq \sup \bigl\{ d(a,B) : a \in A \bigr\} .
\end{equation*}
Now define the \emph{\myindex{Hausdorff metric}} as
\begin{equation*}
d_H(A,B) \coloneqq \max \bigl\{ d(A,B) , d(B,A) \bigr\} .
\end{equation*}
Note: $d_H$ can be defined for arbitrary nonempty subsets if we allow the
extended reals.
\begin{enumerate}[a)]
\item
Let $Y \subset \sP(X)$ be the set of bounded nonempty subsets.
Prove that
$(Y,d_H)$ is a so-called \emph{\myindex{pseudometric space}}:
$d_H$ satisfies the metric properties
\ref{metric:pos},
\ref{metric:com},
\ref{metric:triang}, and further
$d_H(A,A) = 0$ for all $A \in Y$.
\item
Show by example that $d$ itself is not symmetric, that is $d(A,B) \not=
d(B,A)$.
\item
Find a metric space $X$ and two different
nonempty bounded subsets $A$ and $B$ such that $d_H(A,B) = 0$.
\end{enumerate}
\end{exercise}
\begin{exercise}
Let $(X,d)$ be a nonempty metric space and $S \subset X$ a subset. Prove:
\begin{enumerate}[a)]
\item
$S$ is bounded if and only if
for every $p \in X$, there exists a $B > 0$ such that $d(p,x) \leq B$ for
all $x \in S$.
\item
A nonempty $S$ is bounded if and only if
$\operatorname{diam}(S) \coloneqq \sup \{ d(x,y) : x,y \in S \} < \infty$.
\end{enumerate}
\end{exercise}
\begin{exercise}
\pagebreak[2]
\leavevmode
\begin{enumerate}[a)]
\item
Working in $\R$, compute $\operatorname{diam}\bigl([a,b]\bigr)$.
\item
Working in $\R^n$, for every $r > 0$, let $B_r \coloneqq \{ x_1^2+x_2^2+\cdots+x_n^2
< r^2 \}$. Compute $\operatorname{diam}(B_r)$.
\item
Suppose $(X,d)$ is a metric space with at least two points,
$d$ is the discrete metric, and $p \in X$.
Compute
$\operatorname{diam}(\{ p \})$ and $\operatorname{diam}(X)$,
then conclude that $(X,d)$ is bounded.
\end{enumerate}
\end{exercise}
\begin{exercise}
\pagebreak[2]
\leavevmode
\begin{enumerate}[a)]
\item
Find a metric $d$ on $\N$ such that $\N$ is an unbounded set in $(\N,d)$.
\item
Find a metric $d$ on $\N$ such that $\N$ is a bounded set in $(\N,d)$.
\item
Find a metric $d$ on $\N$ such that for every $n \in \N$ and every $\epsilon > 0$,
there exists an $m \in \N$ such that $d(n,m) < \epsilon$.
\end{enumerate}
\end{exercise}
\begin{exercise} \label{exercise:C1ab}
Let $C^1\bigl([a,b],\R\bigr)$\glsadd{not:contdifffuncs} be the set of once continuously differentiable
functions on $[a,b]$.
Define
\begin{equation*}
d(f,g) \coloneqq \snorm{f-g}_{[a,b]} + \snorm{f'-g'}_{[a,b]},
\end{equation*}
where $\snorm{\cdot}_{[a,b]}$ is the uniform norm. Prove that $d$ is a metric.
\end{exercise}
\begin{samepage}
\begin{exercise}
Consider $\ell^2$ the set of sequences $\{ x_n \}_{n=1}^\infty$
of real numbers
such that $\sum_{n=1}^\infty x_n^2 < \infty$.
\begin{enumerate}[a)]
\item
Prove the \myindex{Cauchy--Schwarz inequality} for two sequences
$\{x_n \}_{n=1}^\infty$ and $\{ y_n \}_{n=1}^\infty$ in $\ell^2$: Prove that
$\sum_{n=1}^\infty x_n y_n$ converges (absolutely) and
\begin{equation*}
{\biggl( \sum_{n=1}^\infty x_n y_n \biggr)}^2
\leq
\biggl(\sum_{n=1}^\infty x_n^2 \biggr)
\biggl(\sum_{n=1}^\infty y_n^2 \biggr) .
\end{equation*}
\item
Prove that $\ell^2$ is a metric space with the metric
$d(x,y) \coloneqq \sqrt{\sum_{n=1}^\infty {(x_n-y_n)}^2}$.
Hint: Don't forget to show that the series for $d(x,y)$ always converges
to some finite number.
\end{enumerate}
\end{exercise}
\end{samepage}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\sectionnewpage
\section{Open and closed sets}
\label{sec:mettop}
%mbxINTROSUBSECTION
\sectionnotes{2 lectures}
\subsection{Topology}
Before we get to convergence,
we define the so-called \emph{\myindex{topology}}.
That is,
we define open and closed sets in a metric space.
And before that,
we define two special open and closed sets.
\begin{defn}
Let $(X,d)$ be a metric space, $x \in X$, and $\delta > 0$. Define
the \emph{\myindex{open ball}}, or simply \emph{\myindex{ball}}, of radius $\delta$
around $x$ as
\glsadd{not:openball}
\begin{equation*}
B(x,\delta) \coloneqq \bigl\{ y \in X : d(x,y) < \delta \bigr\} .
\end{equation*}
Define the \emph{\myindex{closed ball}} as
\glsadd{not:closedball}
\begin{equation*}
C(x,\delta) \coloneqq \bigl\{ y \in X : d(x,y) \leq \delta \bigr\} .
\end{equation*}
\end{defn}
When dealing with different metric spaces, it is sometimes
vital to emphasize which metric space the ball is in. We do this by
writing $B_X(x,\delta) \coloneqq B(x,\delta)$ or $C_X(x,\delta) \coloneqq C(x,\delta)$.
\begin{example}
Take the metric space $\R$ with the standard metric. For
$x \in \R$ and $\delta > 0$,
\begin{equation*}
B(x,\delta) = (x-\delta,x+\delta) \qquad \text{and} \qquad
C(x,\delta) = [x-\delta,x+\delta] .
\end{equation*}
\end{example}
\begin{example}
Be careful when working on a subspace. Consider the
metric space $[0,1]$ as a subspace of $\R$. Then in $[0,1]$,
\begin{equation*}
B(0,\nicefrac{1}{2}) = B_{[0,1]}(0,\nicefrac{1}{2})
= \bigl\{ y \in [0,1] : \abs{0-y} < \nicefrac{1}{2} \bigr\}
= [0,\nicefrac{1}{2}) .
\end{equation*}
This is different from $B_{\R}(0,\nicefrac{1}{2}) =
(\nicefrac{-1}{2},\nicefrac{1}{2})$.
The important thing to keep in mind is which metric space we are working
in.
\end{example}
\begin{defn}
Let $(X,d)$ be a metric space. A subset $V \subset X$
is \emph{open}\index{open set}
if for every $x \in V$, there exists a $\delta > 0$ such that
$B(x,\delta) \subset V$. See \figureref{fig:msopenset}. A subset $E \subset X$ is
\emph{closed}\index{closed set} if the complement $E^c = X \setminus E$ is open.
When the ambient space $X$ is not clear from context,
we say \emph{$V$ is open in $X$} and \emph{$E$ is closed in $X$}.
If $x \in V$ and $V$ is open, then we say
$V$ is an \emph{\myindex{open neighborhood}} of $x$ (or
sometimes just \emph{\myindex{neighborhood}}).
\end{defn}
\begin{myfigureht}
\subimport*{figures/}{msopenset.pdf_t}
\caption{Open set in a metric space. Note that $\delta$ depends on $x$.\label{fig:msopenset}}
\end{myfigureht}
Intuitively, an open set $V$ is a set that does not include its
\myquote{boundary.}
Wherever we are in $V$,
we are allowed to \myquote{wiggle} a little bit and
stay in $V$. Similarly, a set $E$ is closed if everything not in $E$
is some distance away from $E$.
The open and closed balls are examples of open and closed sets
(this must still be proved).
But not every set is either open or closed. Generally, most subsets are neither.
\begin{example}
The set $(0,\infty) \subset \R$ is open: Given any $x \in (0,\infty)$,
let $\delta \coloneqq x$. Then $B(x,\delta) = (0,2x) \subset (0,\infty)$.
The set $[0,\infty) \subset \R$ is closed: Given $x \in (-\infty,0) =
[0,\infty)^c$,
let $\delta \coloneqq -x$. Then $B(x,\delta) = (-2x,0) \subset
(-\infty,0) = [0,\infty)^c$.
The set $[0,1) \subset \R$ is neither open nor closed. First,
every ball in $\R$ around $0$, $B(0,\delta) = (-\delta,\delta)$, contains negative
numbers and hence is not contained in $[0,1)$. So $[0,1)$ is not open.
Second, every ball in $\R$ around $1$,
$B(1,\delta) = (1-\delta,1+\delta)$, contains
numbers strictly less than 1 and greater than 0
(e.g.\ $1-\nicefrac{\delta}{2}$ as long as $\delta < 2$).
Thus $[0,1)^c = \R \setminus
[0,1)$ is not open, and $[0,1)$ is not closed.
If $(X,d)$ is any metric space, and $x \in X$ is a point, then $\{ x \}$ is
closed (exercise).
On the other hand, $\{ x \}$ may or may not be open depending on $X$.
The set $\{ 0 \} \subset \R$ is not open as $B(0,\delta)$
contains nonzero numbers for every $\delta > 0$.
If $X=\{ x \}$, then $\{ x \}$ is open.
\end{example}
\begin{prop} \label{prop:topology:open}
Let $(X,d)$ be a metric space.
\begin{enumerate}[(i)]
\item \label{topology:openi} $\emptyset$ and $X$ are open.
\item \label{topology:openii} If $V_1, V_2, \ldots, V_k$ are open subsets of $X$, then
\begin{equation*}
\bigcap_{j=1}^k V_j
\end{equation*}
is also open. That is, a finite intersection of open sets is open.
\item \label{topology:openiii} If $\{ V_\lambda \}_{\lambda \in I}$ is
an arbitrary collection of open subsets of $X$, then
\begin{equation*}
\bigcup_{\lambda \in I} V_\lambda
\end{equation*}
is also open. That is, a union of open sets is open.
\end{enumerate}
\end{prop}
The index set $I$ in \ref{topology:openiii} can be arbitrarily large.
By $\bigcup_{\lambda \in I} V_\lambda$, we simply mean the set of
all~$x$ such that $x \in V_\lambda$ for at least one $\lambda \in I$.
\begin{proof}
The sets $\emptyset$ and $X$ are obviously open in $X$.
Let us prove \ref{topology:openii}.
If $x \in \bigcap_{j=1}^k V_j$, then $x \in V_j$ for all $j$.
As $V_j$ are all open, for every $j$ there exists a $\delta_j > 0$
such that $B(x,\delta_j) \subset V_j$. Take $\delta \coloneqq \min \{
\delta_1,\delta_2,\ldots,\delta_k \}$ and notice $\delta > 0$. We have
$B(x,\delta) \subset B(x,\delta_j) \subset V_j$ for every $j$ and so
$B(x,\delta) \subset \bigcap_{j=1}^k V_j$. Consequently the intersection is open.
Let us prove \ref{topology:openiii}.
If $x \in \bigcup_{\lambda \in I} V_\lambda$, then $x \in V_\lambda$ for some
$\lambda \in I$.
As $V_\lambda$ is open, there exists a $\delta > 0$
such that $B(x,\delta) \subset V_\lambda$. But then
$B(x,\delta) \subset \bigcup_{\lambda \in I} V_\lambda$,
and so the union is open.
\end{proof}
\begin{example}
Notice the difference between
items
\ref{topology:openii} and \ref{topology:openiii}.
Item \ref{topology:openii} is not true for an arbitrary intersection.
For instance,
$\bigcap_{n=1}^\infty (\nicefrac{-1}{n},\nicefrac{1}{n}) = \{ 0 \}$,
which is not open.
\end{example}
The proof of the following analogous proposition for closed sets
is left as an exercise.
\begin{prop} \label{prop:topology:closed}
%FIXMEevillayouthack
\pagebreak[2]
Let $(X,d)$ be a metric space.
\begin{enumerate}[(i)]
\item \label{topology:closedi} $\emptyset$ and $X$ are closed.
\item \label{topology:closedii} If $\{ E_\lambda \}_{\lambda \in I}$ is
an arbitrary collection of closed subsets of $X$, then
\begin{equation*}
\bigcap_{\lambda \in I} E_\lambda
\end{equation*}
is also closed. That is, an intersection of closed sets is closed.
\item \label{topology:closediii} If $E_1, E_2, \ldots, E_k$ are closed
subsets of $X$, then
\begin{equation*}
\bigcup_{j=1}^k E_j
\end{equation*}
is also closed. That is, a finite union of closed sets is closed.
\end{enumerate}
\end{prop}
Despite the naming,
we have not yet shown that the open ball is open and the closed ball is
closed. Let us show these facts now to justify the terminology.
\begin{prop} \label{prop:topology:ballsopenclosed}
Let $(X,d)$ be a metric space, $x \in X$, and $\delta > 0$. Then
$B(x,\delta)$ is open and
$C(x,\delta)$ is closed.
\end{prop}
\begin{proof}
Let $y \in B(x,\delta)$. Let $\alpha \coloneqq \delta-d(x,y)$. As $\alpha
> 0$, consider $z \in B(y,\alpha)$. Then
\begin{equation*}
d(x,z) \leq d(x,y) + d(y,z) < d(x,y) + \alpha = d(x,y) + \delta-d(x,y) =
\delta .
\end{equation*}
Therefore, $z \in B(x,\delta)$ for every $z \in B(y,\alpha)$. So
$B(y,\alpha) \subset B(x,\delta)$, and so
$B(x,\delta)$ is open. See \figureref{fig:ballisopen}.
\begin{myfigureht}
\subimport*{figures/}{ballisopen.pdf_t}
\caption{Proof that $B(x,\delta)$ is open: $B(y,\alpha) \subset
B(x,\delta)$ with the triangle inequality illustrated.\label{fig:ballisopen}}
\end{myfigureht}
The proof that $C(x,\delta)$ is closed is left as an exercise.
\end{proof}
Again, be careful about which metric space we are in.
The set $[0,\nicefrac{1}{2})$ is
an open ball in $[0,1]$, and so $[0,\nicefrac{1}{2})$ is
an open set in $[0,1]$. On the other hand, $[0,\nicefrac{1}{2})$
is neither open nor closed in $\R$.
\begin{prop} \label{prop:topology:intervals:openclosed}
Let $a, b$ be two real numbers, $a < b$. Then $(a,b)$, $(a,\infty)$,
and $(-\infty,b)$ are open in $\R$.
Also $[a,b]$, $[a,\infty)$,
and $(-\infty,b]$ are closed in $\R$.
\end{prop}
The proof is left as an exercise. Keep in mind that
there are many other open and
closed sets in the set of real numbers. %$\R$.
\begin{prop} \label{prop:topology:subspaceopen}
Suppose $(X,d)$ is a metric space, and $Y \subset X$. Then $U \subset Y$
is open in $Y$ (in the subspace topology) if and only if
there exists an open set $V \subset X$ (so open in $X$) such that
$V \cap Y = U$.
\end{prop}
For example, let $X \coloneqq \R$, $Y \coloneqq [0,1]$, $U \coloneqq [0,\nicefrac{1}{2})$.
We saw that $U$ is an open set in $Y$.
We may take $V \coloneqq (\nicefrac{-1}{2},\nicefrac{1}{2})$.
\begin{proof}
Suppose $V \subset X$ is open and $V \cap Y = U$.
Let $x \in U$.
As $V$ is open and $x \in V$, there
exists a $\delta > 0$ such that $B_X(x,\delta) \subset V$.
Then
\begin{equation*}
B_Y(x,\delta) = B_X(x,\delta) \cap Y \subset V \cap Y = U .
\end{equation*}
So $U$ is open in $Y$.
The proof of the opposite direction, that is, that if $U \subset Y$
is open in the subspace topology there exists a $V$ is left as
\exerciseref{exercise:mssubspace}.
\end{proof}
A hint for finishing the proof (the exercise) is that
a useful way to think about an open set is as a union of open balls. If $U$ is
open, then for each $x \in U$, there is a $\delta_x > 0$ (depending on $x$) such that
$B(x,\delta_x) \subset U$. Then $U = \bigcup_{x\in U} B(x,\delta_x)$.
In the case of an open subset of an open set or a closed subset of a closed
set, matters are simpler.
\begin{prop} \label{prop:topology:subspacesame}
Suppose $(X,d)$ is a metric space, $V \subset X$ is open,
and $E \subset X$ is closed.
\begin{enumerate}[(i)]
\item \label{prop:topology:subspacesame:i}
$U \subset V$ is open in the subspace topology if and only if $U$ is open
in $X$.
\item \label{prop:topology:subspacesame:ii}
$F \subset E$ is closed in the subspace topology if and only if $F$ is
closed in $X$.
\end{enumerate}
\end{prop}
\begin{proof}
We prove
\ref{prop:topology:subspacesame:i}
and leave
\ref{prop:topology:subspacesame:ii} as an exercise.
If $U \subset V$ is open in the subspace topology, by
\propref{prop:topology:subspaceopen}, there is a set $W \subset X$
open in $X$ such that $U = W \cap V$. Intersection of two open sets
is open so $U$ is open in $X$.
Now suppose $U$ is open in $X$. Then $U = U \cap V$. So
$U$ is open in $V$ again by \propref{prop:topology:subspaceopen}.
\end{proof}
\subsection{Connected sets}
Let us generalize the idea of an interval to general metric spaces. One of
the main features of an interval in $\R$ is that it is
connected---that we can continuously move from one point of it to
another point without jumping.
For example, in $\R$ we usually study functions on intervals,
and in more general metric spaces we usually study functions on connected sets.
\begin{defn}
A nonempty%
\footnote{Some authors do not exclude the empty set from the definition,
and the empty set would then be connected.
We avoid the empty set for essentially the same reason why
1 is neither a prime nor a composite number: Our connected sets have exactly
two clopen subsets and disconnected sets have more than two. The empty set
has exactly one.}
metric space $(X,d)$ is \emph{\myindex{connected}} if the
only subsets of $X$ that are both open and closed (so-called
\emph{\myindex{clopen}} subsets) are $\emptyset$ and $X$ itself.
If a nonempty $(X,d)$ is not connected we say it is
\emph{\myindex{disconnected}}.
When we apply the term \emph{connected} to a nonempty subset $A \subset X$, we