Before we discuss topological spaces in their full generality, we will first turn our attention to a special type of topological space, a metric space. This abstraction has a huge and useful family of special cases, and it therefore deserves special attention. Also, the abstraction is picturesque and accessible; it will subsequently lead us to the full abstraction of a topological space.
A metric space is a Cartesian pair
where
is a non-empty set and
, is a function which is called the metric which satisfies the requirement that for all
:
if and only if 
(symmetry)
(triangle inequality)
Note that some authors do not require metric spaces to be non-empty. We annotate
when we talk of a metric space
with the metric
.
- An important example is the discrete metric. It may be defined on any non-empty set X as follows

- On the set of real numbers
, define
(The absolute distance between
and
).
To prove that this is indeed a metric space, we must show that
is really a metric. To begin with,
for any real numbers
and
.



- On the plane
as the space, and let
.
- This is the euclidean distance between
and
).
- We can generalize the two preceding examples. Let
be a normed vector space (over
or
). We can define the metric to be:
. Thus every normed vector space is a metric space.
- For the vector space
we have an interesting norm. Let
and
two vectors of
. We define the p-norm:
. For each
-norm there is a metric based on it. Interesting cases of
are:
- The great-circle distance between two points on a sphere is a metric.
- The Hilbert space is a metric space on the space of infinite sequences
such that
converges, with a metric
.
The concept of the Erdős number suggests a metric on the set of all mathematicians. Take
to be two mathematicians, and define
as 0 if
are the same person; 1 if
have co-authored a paper;
if the shortest sequence
, where each step pairs two people who have co-authored a paper, is of length
; or
if
and no such sequence exists.
This metric is easily generalized to any reflexive relation (or undirected graph, which is the same thing).
Note that if we instead defined
as the sum of the Erdős numbers of
, then
would not be a metric, as it would not satisfy
. For example, if
= Stanisław Ulam, then
.
Throughout this chapter we will be referring to metric spaces. Every metric space comes with a metric function. Because of this, the metric function might not be mentioned explicitly. There are several reasons:
- We don't want to make the text too blurry.
- We don't have anything special to say about it.
- The space has a "natural" metric. E.g. the "natural" metric for
is the euclidean metric
.
As this is a wiki, if for some reason you think the metric is worth mentioning, you can alter the text if it seems unclear (if you are sure you know what you are doing) or report it in the talk page.
The open ball is the building block of metric space topology. We shall define intuitive topological definitions through it (that will later be converted to the real topological definition), and convert (again, intuitively) calculus definitions of properties (like convergence and continuity) to their topological definition. We shall try to show how many of the definitions of metric spaces can be written also in the "language of open balls". Then we can instantly transform the definitions to topological definitions.
Given a metric space
an open ball with radius
around
is defined as the set

Intuitively it is all the points in the space, that are less than
distance from a certain point
.
Why is this called a ball? Let's look at the case of
:

Therefore
is exactly
– The ball with
at center, of radius
. In
the ball is called open, because it does not contain the sphere (
).
The Unit ball is a ball of radius 1. Lets view some examples of the
unit ball of
with different
-norm induced metrics. The unit ball of
with the norm
is:
![{\displaystyle B_{1}{\bigl (}(0,0){\bigr )}={\Big \{}(x,y)\in \mathbb {R} ^{2}:d{\bigl (}(x,y),(0,0){\bigr )}<1{\Big \}}={\Big \{}(x,y):{\bigl \|}(x,y)-(0,0){\bigr \|}_{p}<1{\Big \}}={\Big \{}(x,y):\|(x,y)\|_{p}<1{\Big \}}={\Big \{}(x,y):{\sqrt[{p}]{|x|^{p}+|y|^{p}}}<1{\Big \}}}](https://wikimedia.org/api/rest_v1/media/math/render/svg/b8ebf9c0bf5f2d66d2fe08844d3548e60e3a9868)
- The metric induced by
in that case, the unit ball is: 
- The metric induced by
in that case, the unit ball is: 
- The metric induced by
in that case, the unit ball is: 
As we have just seen, the unit ball does not have to look like a real ball. In fact sometimes the unit ball can be one dot:
- The discrete metric, The unit ball is

Definition: We say that x is an interior point of A iff there is an
such that:
.
This intuitively means, that x is really 'inside' A - because it is contained in a ball inside A - it is not near the boundary of A.
Illustration:
Interior Point
|
Not Interior Points
|
|
|
Definition: The interior of a set A is the set of all the interior points of A. The interior of a set A is marked
.
Useful notations:
and
.
Some basic properties of int (For any sets A,B):




Proof of the first:
We need to show that:
. But that's easy! by definition, we have that
and therefore
Proof of the second:
In order to show that
, we need to show that
and
.
The "
" direction is already proved: if for any set A,
, then by taking
as the set in question, we get
.
The "
" direction:
let
. We need to show that
.
If
then there is a ball
. Now, every point y, in the ball
an internal point to A (inside
), because there is a ball around it, inside A:
.
We have that
(because every point in it is inside
) and by definition
.
Hint: To understand better, draw to yourself
.
Proof of the rest is left to the reader.
- [a, b] : all the points x, such that

- (a, b) : all the points x, such that

For the metric space
(the line), we have:
![{\displaystyle int([a,b])=(a,b)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/cd3d977333a969ec5d8d06a91b7021d52842188f)
![{\displaystyle int((a,b])=(a,b)}](https://wikimedia.org/api/rest_v1/media/math/render/svg/bfed9af226d984832f234c50d6da2f32e3142aed)


Let's prove the first example (
). Let
(that is:
) we'll show that
is an internal point.
Let
. Note that
and
. Therefore
.
We have shown now that every point x in
is an internal point. Now what about the points
? let's show that they are not internal points. If
was an internal point of
, there would be a ball
. But that would mean, that the point
is inside
. but because
that is a contradiction. We show similarly that b is not an internal point.
To conclude, the set
contains all the internal points of
. And we can mark
A set is said to be open in a metric space if it equals its interior (
). When we encounter topological spaces, we will generalize this definition of open.
However, this definition of open in metric spaces is the same as that as if we regard our
metric space as a topological space.
Properties:
- The empty-set is an open set (by definition:
).
- An open ball is an open set.
- For any set B, int(B) is an open set. This is easy to see because: int(int(B))=int(B).
- If A,B are open, then
is open. Hence finite intersections of open sets are open.
- If
(for any set if indexes I) are open, then their union
is open.
Proof of 2:
Let
be an open ball. Let
. Then
.
In the following drawing, the green line is
and the brown line is
. We have found a ball to contain
inside
.
Proof of 4:
A, B are open. we need to prove that
. Because of the first propriety of int, we only need to show that
, which means
. Let
. We know also, that
from the premises A, B are open and
. That means that there
are balls:
. Let
, we have that
.
By the definition of an internal point we have that
(
is the required ball).
Interestingly, this property does not hold necessarily for an infinite intersection of open sets. To see an example on the real line, let
. We then see that
which is closed.
Proof of 5:
Proving that the union of open sets is open, is rather trivial: let
(for any set if indexes I) be a set of open sets.
we need to prove that
: If
then it has a ball
. The same ball that made a point an internal point in
will make it internal in
.
Proposition: A set is open, if and only if it is a union of open-balls.
Proof: Let A be an open set. by definition, if
there there a ball
. We can then compose A:
. The equality is true because:
because
.
in each ball we have the element
and we unite balls of all the elements of
.
On the other hand, a union of open balls is an open set, because every union of open sets is open.
- As we have seen, every open ball is an open set.
- For every space
with the discrete metric, every set is open.
Proof: Let
be a set. we need to show, that if
then
is an internal point. Lets use the ball around
with radius
. We have
. Therefore
is an internal point.
- The space
with the regular metric. Every open segment
is an open set. The proof of that is similar to the proof that
, that we have already seen.
In any metric space X, the following three statements hold:
- 1) The union of any number of open sets is open.
- Proof: Let
be a collection of open sets, and let
. Then there exists a
such that
.
- So there exists an
such that
. Therefore
.
- 2) The intersection of a finite number of open sets is open.
- Proof: Let
, where
is a finite collection of open sets.
- So
for each
. Let
. For each
, there exists an
such that
. Let
{
}. Therefore
and
.
- 3) The empty set and X are both open.
In any metric space X, the following statements hold:
- 1) The intersection of any number of closed sets is closed.
- 2) The union of a finite number of closed sets is closed.
First, Lets translate the calculus definition of convergence, to the "language" of metric spaces:
We say that a sequence
converges to
if for every
exists
that for each
the following holds:
.
Equivalently, we can define converges using Open-balls: A sequence
converges to
If for every
exists
that for each
the following holds:
.
The latter definition uses the "language" of open-balls, But we can do better - We can remove the
from the definition of convergence, thus making the definition more topological. Let's define that
converges to
(and mark
) , if for every ball
around
, exists
that for each
the following holds:
.
is called the limit of the sequence.
The definitions are all the same, but the latter uses topological terms, and can be easily converted to a topological definition later.
- If a sequence has a limit, it has only one limit.
Proof Let a sequence
have two limits,
and
. If they are not the same, we must have
. Let
be smaller than this distance. Now for some
, for all
, it must be the case that both
and
by virtue of the fact
and
are limits. But this is impossible; the two balls are separate. Therefore the limits are coincident, that is, the sequence has only one limit.
- If
, then almost by definition we get that
. (
Is the sequence of distances).
- In
with the natural metric, The series
converges to
. And we note it as follows: 
- Any space, with the discrete metric. A series
converges, only if it is eventually constant. In other words:
If and only if, We can find
that for each
, 
- An example you might already know:
The space
For any p-norm induced metric, when
. Let
. and let
.
Then,
If and only if
.
A sequence of functions
is said to be uniformly convergent on a set
if for any
, there exists an
such that when
and
are both greater than
, then
for any
.
Definition: The point
is called a point of closure of a set
if there exists a sequence
, such that
.
In other words, the point
is a point of closure of a set
if there exists a sequence in
that converges on
. Note that
is not necessarily an element of the set
.
An equivalent definition using balls: The point
is called a point of closure of a set
if for every open ball
containing
, we have
. In other words, every open ball containing
contains at least one point in
that is distinct from
.
The proof is left as an exercise.
Intuitively, a point of closure is arbitrarily "close" to the set
. It is so close, that we can find a sequence in the set that converges to any point of closure of the set.
Example: Let A be the segment
, The point
is not in
, but it is a point of closure: Let
.
(
, and therefore
) and
(that's because
).
Definition: The closure of a set
, is the set of all points of closure. The closure of a set A is marked
or
.
Note that
. a quick proof: For every
, Let
.
For the metric space
(the line), and let
we have:
![{\displaystyle Cl([a,b])=[a,b]}](https://wikimedia.org/api/rest_v1/media/math/render/svg/c3eddea72fcc1b24b538915dc798b35c9bf0f3fb)
![{\displaystyle Cl((a,b])=[a,b]}](https://wikimedia.org/api/rest_v1/media/math/render/svg/bd3263fd4ba19f933af00b15ad9b530b4455eef1)
![{\displaystyle Cl([a,b))=[a,b]}](https://wikimedia.org/api/rest_v1/media/math/render/svg/f40b72d26c5687837bdeeb35c34f4d57fead95a1)
![{\displaystyle Cl((a,b))=[a,b]}](https://wikimedia.org/api/rest_v1/media/math/render/svg/5b4a77748d74b5fd1519d82516bb94536a551e4c)
Definition: A set
is closed in
if
.
Meaning: A set is closed, if it contains all its point of closure.
An equivalent definition is: A set
is closed in
If for every point
, and for every Ball
, then
.
The proof of this definition comes directly from the former definition and the definition of convergence.
Some basic properties of Cl (For any sets
):



is closed iff 
- While the above implies that the union of finitely many closed sets is also a closed set, the same does not necessarily hold true for the union of infinitely many closed sets. To see an example on the real line, let
. We see that
fails to contain its points of closure, 
This union can therefore not be a closed subset of the real numbers.
The proofs are left to the reader as exercises. Hint for number 5: recall that
.
That is, an open set approaches its boundary but does not include it; whereas a closed set includes every point it approaches. These two properties may seem mutually exclusive, but they are not:
- In any metric space
, the set
is both open and closed.
- In any space with a discrete metric, every set is both open and closed.
- In
, under the regular metric, the only sets that are both open and closed are
and
. However, some sets are neither open nor closed. For example, a half-open range like
is neither open nor closed. As another example, the set of rationals is not open because an open ball around a rational number contains irrationals; and it is not closed because there are sequences of rational numbers that converge to irrational numbers (such as the various infinite series that converge to
).
A Reminder/Definition: Let
be a set in the space
. We define the complement of
,
to be
.
A Quick example: let
. Then
.
A very important Proposition: Let
be a set in the space
. Then, A is open iff
is closed.
Proof: (
) For the first part, we assume that A is an open set. We shall show that
. It is enough to show that
because of the properties of closure. Let
(we will show that
).
for every ball
we have, by definition that (*)
. If the point is not in
then
.
is open and therefore, there is a ball
, such that:
, that means that
, contradicting (*).
(
) On the other hand, Lets a assume that
is closed, and show that
is open. Let
be a point in
(we will show that
). If
is not in
then for every ball
we have that
. That means that
. And by definition of closure point
is a closure point of
so we can say that
.
is closed, and therefore
That contradicts the assumption that
Note that, as mentioned earlier, a set can still be both open and closed!
The following is an important theorem characterizing open and closed sets on
.
Theorem: An open set
in
is the union of countably many disjoint open intervals.
Proof: Let
. Let
and let
. There exists an open ball
such that
because
is open. Thus, a≤x-ε and b≥x+ε. Thus, x ∈(a,b). The set O contains all elements of (a,b) since if a number is greater than a, and less than x but is not within O, then a would not be the supremum of {t|t∉O, t<x}. Similarly, if there is a number is less than b and greater than x, but is not within O, then b would not be the infimum of {t|t∉O, t>x}. Thus, O also contains (a,x) and (x,b) and so O contains (a,b). If y≠x and y∈(a,b), then the interval constructed from this element as above would be the same. If y<a, then inf{t|t∉O, t>y} would also be less than a because there is a number between y and a which is not within O. Similarly if y>b, then sup{t|t∉O, t<y} would also be greater than b because there is a number between y and b which is not within O. Thus, all possible open intervals constructed from the above process are disjoint. The union of all such open intervals constructed from an element x is thus O, and so O is a union of disjoint open intervals. Because the rational numbers is dense in R, there is a rational number within each open interval, and since the rational numbers is countable, the open intervals themselves are also countable.
- In any metric space, a singleton
is closed. To see why, consider the open set,
. Let
. Then
, so
. Let
. Then
. So
is open, and hence
is closed.
- In any metric space, every finite set
is closed. To see why, observe that
is open, so
is closed.
- Closed intervals [a,b] are closed.
- Cantor Set Consider the interval [0,1] and call it C0. Let A1 be equal {0,
} and let dn =
. Let An+1 be equal to the set An∪{x|x=a+2dn, a∈An}. Let Cn be
{[a,a+dn]}, which is the finite union of closed sets, and is thus closed. Then the intersection
is called the Cantor set and is closed.
- Prove that a point x has a sequence of points within X converging to x if and only if all balls containing x contain at least one element within X.
- In
the only sets that are both open and closed are the empty set, and the entire set. This is not the case when you look at
. Give an example of a set which is both open and closed in
.
- Let
be a set in the space
. Prove the following:


Let's recall the idea of continuity of functions. Continuity means, intuitively, that you can draw a function on a paper, without lifting your pen from it. Continuity is important in topology. But let's start in the beginning:
The classic delta-epsilon definition: Let
be spaces. A function
is continuous at a point
if for all
there exists a
such that:
for all
such that
, we have that
.
Let's rephrase the definition to use balls: A function
is continuous at a point
if for all
there exists
such that the following holds:
for every
such that
we have that
. Or more simply:
Looks better already! But we can do more.
Definitions:
- A function is continuous in a set S if it is continuous at every point in S.
- A function is continuous if it is continuous in its entire domain.
Proposition:
A function
is continuous, by the definition above
for every open set
in
, The inverse image of
,
, is open in
. That is, the inverse image of every open set in
is open in
.
Note that
does not have to be surjective or bijective for
to be well defined. The notation
simply means
.
Proof:
First, let's assume that a function
is continuous by definition (The
direction). We need to show that for every open set
,
is open.
Let
be an open set. Let
.
is in
and because
is open, we can find and
, such that
. Because f is continuous, for that
, we can find a
such that
. that means that
, and therefore,
is an internal point. This is true for every
- meaning that all the points in
are internal points, and by definition,
is open.
(
)On the other hand, let's assume that for a function
for every open set
,
is open in
. We need to show that
is continuous.
For every
and for every
, The set
is open in
. Therefore the set
is open in
. Note that
. Because
is open, that means that we can find a
such that
, and we have that
.
The last proof gave us an additional definition we will use for continuity for the rest of this book. The beauty of this new definition is that it only uses open-sets, and there for can be applied to spaces without a metric, so we now have two equivalent definitions which we can use for continuity.
- Let
be any function from any space
, to any space
, were
is the discrete metric. Then
is continuous. Why? For every open set
, the set
is open, because every set is open in a space with the discrete metric.
- Let
The identity function.
is continuous: The source of every open set is itself, and therefore open.
- Prove that a function
is continuous
for every closed set
in
, The inverse image of
,
, is closed in
.
In a metric space X, function from X to a metric space Y is uniformly continuous if for all
, there exists a
such that for all
,
implies that
.
An isometry is a surjective mapping
, where
and
are metric spaces and for all
,
.
In this case,
and
are said to be isometric.
Note that the injectivity of
follows from the property of preserving distance:




So an isometry is necessarily bijective.
- Show that a set is a metric open set iff it is a (possibly infinite) union of open balls.
- Show that the discrete metric is in fact a metric.