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(X,d){\displaystyle (X,d)} where X{\displaystyle X} is a non-empty set and d:X×X→[0,∞){\displaystyle d:X\times X\rightarrow [0,\infty )}, is a function which is called the metric which satisfies the requirement that for all a,b,c∈X{\displaystyle a,b,c\in X}:

d(a,b)=0{\displaystyle \ d(a,b)=0} if and only if a=b{\displaystyle a=b}

An important example is the discrete metric. It may be defined on any non-empty set X as follows d(x,y)={1if x≠y0if x=y{\displaystyle d(x,y)=\left\{{\begin{array}{ll}1&{\text{if }}x\neq y\\0&{\text{if }}x=y\\\end{array}}\right.}

On the set of real numbers R{\displaystyle \mathbb {R} }, define d(x,y)=|x−y|{\displaystyle d(x,y)=|x-y|\,} (The absolute distance between x and y).
To prove that this is indeed a metric space, we must show that d is really a metric. To begin with, d(x,y)=|x−y|≥0{\displaystyle d(x,y)=|x-y|\geq 0} for any

On the plane R2{\displaystyle \mathbb {R} ^{2}} as the space, and let d((x1,y1),(x2,y2))=(x1−x2)2+(y1−y2)2.{\displaystyle d((x_{1},y_{1}),(x_{2},y_{2}))={\sqrt {(x_{1}-x_{2})^{2}+(y_{1}-y_{2})^{2}}}.}

This is the euclidean distance between (x1,y1){\displaystyle (x_{1},y_{1})} and (x2,y2){\displaystyle (x_{2},y_{2})}).

We can generalize the two preceding examples. Let V{\displaystyle V} be a normed vector space (over R{\displaystyle \mathbb {R} } or C{\displaystyle \mathbb {C} }). We can define the metric to be: d(x,y)=||x−y||{\displaystyle d(x,y)=||x-y||\,}. Thus every normed vector space is a metric space.

For the vector space Cn{\displaystyle \mathbb {C} ^{n}} we have an interesting norm. Let x=(x1,x2,…,xn){\displaystyle x=(x_{1},x_{2},\ldots ,x_{n})} and y=(y1,y2,…,yn){\displaystyle y=(y_{1},y_{2},\ldots ,y_{n})} two vectors of Cn{\displaystyle \mathbb {C} ^{n}}. We define the p-norm: ||x||p=(∑i=1n|xi|p)1p{\displaystyle ||x||_{p}=(\sum _{i=1}^{n}{|x_{i}|^{p}})^{\frac {1}{p}}}. For each p-norm there is a metric based on it. Interesting cases of p are:

The Hilbert space is a metric space on the space of infinite sequences {ak} such that∑i=1∞ak2{\displaystyle \sum _{i=1}^{\infty }a_{k}^{2}}
converges, with a metric d({ai}, {bi})=∑i=1∞(ai−bi)2{\displaystyle {\sqrt {\sum _{i=1}^{\infty }(a_{i}-b_{i})^{2}}}}.

The concept of the Erdős number suggests a metric on the set of all mathematicians. Take x and y to be two mathematicians, and define d(x, y) as 0 if x and y are the same person; 1 if x and y have co-authored a paper; n if the shortest sequence ({x,a1},{a1,a2},...,{an−1,y}){\displaystyle (\{x,a_{1}\},\{a_{1},a_{2}\},...,\{a_{n-1},y\})}, where each step pairs two people who have co-authored a paper, is of length n; or ∞ if x ≠ y 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 d(x, y) as the sum of the Erdős numbers of x and y, then d would not be a metric, as it would not satisfy d(x,y)=0⟺x=y{\displaystyle d(x,y)=0\iff x=y}. For example, if x = y = Stanisław Ulam, then d(x, y) = 2.

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 Rn,Cn{\displaystyle \mathbb {R} ^{n},\mathbb {C} ^{n}} is the euclidean metric d2{\displaystyle d_{2}}.

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.

Why is this called a ball? Let's look at the case of R3{\displaystyle \mathbb {R} ^{3}}: d((x1,x2,x3),(y1,y2,y3))=(x1−y1)2+(x2−y2)2+(x3−y3)2{\displaystyle d((x_{1},x_{2},x_{3}),(y_{1},y_{2},y_{3}))={\sqrt {(x_{1}-y_{1})^{2}+(x_{2}-y_{2})^{2}+(x_{3}-y_{3})^{2}}}}.

Therefore Br((0,0,0)){\displaystyle B_{r}((0,0,0))} is exactly x12+x22+x32<r2{\displaystyle {x_{1}}^{2}+{x_{2}}^{2}+{x_{3}}^{2}<r^{2}} - The ball with (0,0,0){\displaystyle (0,0,0)} at center, of radius r{\displaystyle r}. In R3{\displaystyle R^{3}} the ball is called open, because it does not contain the sphere (x12+x22+x32=r2{\displaystyle {x_{1}}^{2}+{x_{2}}^{2}+{x_{3}}^{2}=r^{2}}).

Definition: We say that x is an interior point of A iff there is an ϵ>0{\displaystyle \epsilon >0} such that: Bϵ(x)⊆A{\displaystyle B_{\epsilon }(x)\subseteq A}. 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 int(A){\displaystyle int(A)}. Useful notations: int⁡(S)={x∈S|x is an interior point of S}{\displaystyle \operatorname {int} (S)=\{x\in S|x{\text{ is an interior point of }}S\}} and int⁡(S)=∪{A⊆S|A is open }{\displaystyle \operatorname {int} (S)=\cup \{A\subseteq S|A{\text{ is open }}\!\!\}\!\!{\text{ }}}.

Proof of the first:
We need to show that: x∈int(A)⇒x∈A{\displaystyle x\in int(A)\Rightarrow x\in A}. But that's easy! by definition, we have that x∈Bϵ(x)⊆A{\displaystyle x\in B_{\epsilon }(x)\subseteq A} and therefore x∈A{\displaystyle x\in A}

Proof of the second:
In order to show that int(int(A))=int(A){\displaystyle int(int(A))=int(A)\,}, we need to show that int(int(A))⊆int(A){\displaystyle int(int(A))\subseteq int(A)} and int(int(A))⊇int(A){\displaystyle int(int(A))\supseteq int(A)}.
The " ⊆{\displaystyle \subseteq }" direction is already proved: if for any set A, int(A)⊆A{\displaystyle int(A)\subseteq A}, then by taking int(A){\displaystyle int(A)} as the set in question, we get int(int(A))⊆int(A){\displaystyle int(int(A))\subseteq int(A)}.
The " ⊇{\displaystyle \supseteq }" direction:
let x∈int(A){\displaystyle x\in int(A)}. We need to show that x∈int(int(A)){\displaystyle x\in int(int(A))}.
If x∈int(A){\displaystyle x\in int(A)} then there is a ball Bϵ(x)⊆A{\displaystyle B_{\epsilon }(x)\subseteq A}. Now, every point y, in the ball Bϵ2(x){\displaystyle B_{\frac {\epsilon }{2}}(x)} an internal point to A (inside int(A){\displaystyle int(A)}), because there is a ball around it, inside A: y∈Bϵ2(x)⇒Bϵ2(y)⊂Bϵ(x)⊂A{\displaystyle y\in B_{\frac {\epsilon }{2}}(x)\Rightarrow B_{\frac {\epsilon }{2}}(y)\subset B_{\epsilon }(x)\subset A}.
We have that x∈Bϵ2(x)⊂int(A){\displaystyle x\in B_{\frac {\epsilon }{2}}(x)\subset int(A)} (because every point in it is inside int(A){\displaystyle int(A)}) and by definition x∈int(int(A)){\displaystyle x\in int(int(A))}.
Hint: To understand better, draw to yourself x,Bϵ(x),Bϵ2(x),y,Bϵ2(y){\displaystyle x,B_{\epsilon }(x),B_{\frac {\epsilon }{2}}(x),y,B_{\frac {\epsilon }{2}}(y)}.

For the metric space R{\displaystyle \mathbb {R} } (the line), we have:

int([a,b])=(a,b){\displaystyle int([a,b])=(a,b)}

int((a,b])=(a,b){\displaystyle int((a,b])=(a,b)}

int([a,b))=(a,b){\displaystyle int([a,b))=(a,b)}

int((a,b))=(a,b){\displaystyle int((a,b))=(a,b)}

Let's prove the first example (int([a,b])=(a,b){\displaystyle int([a,b])=(a,b)}). Let x∈(a,b){\displaystyle x\in (a,b)} (that is: a<x<b{\displaystyle a<x<b}) we'll show that x{\displaystyle x} is an internal point.
Let ϵ=min{x−a,b−x}{\displaystyle \epsilon =\min\{x-a,b-x\}}. Note that x+ϵ≤x+b−x=b{\displaystyle x+\epsilon \leq x+b-x=b} and x−ϵ≥x−x+a=a{\displaystyle x-\epsilon \geq x-x+a=a}. Therefore Bϵ(x)=(x−ϵ,x+ϵ)⊂(a,b){\displaystyle B_{\epsilon }(x)=(x-\epsilon ,x+\epsilon )\subset (a,b)}.
We have shown now that every point x in (a,b){\displaystyle (a,b)} is an internal point. Now what about the points a,b{\displaystyle a,b} ? let's show that they are not internal points. If a{\displaystyle a} was an internal point of [a,b]{\displaystyle [a,b]}, there would be a ball Bϵ(a)⊂[a,b]{\displaystyle B_{\epsilon }(a)\subset [a,b]}. But that would mean, that the point a−ϵ2{\displaystyle a-{\frac {\epsilon }{2}}} is inside[a,b]{\displaystyle [a,b]}. but because a−ϵ2<a{\displaystyle a-{\frac {\epsilon }{2}}<a} that is a contradiction. We show similarly that b is not an internal point.
To conclude, the set (a,b){\displaystyle (a,b)} contains all the internal points of [a,b]{\displaystyle [a,b]}. And we can mark int([a,b])=(a,b){\displaystyle int([a,b])=(a,b)}

A set is said to be open in a metric space if it equals its interior (A=Int(A){\displaystyle A=Int(A)}). 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: int(∅)=∅{\displaystyle int(\emptyset )=\emptyset }).

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 A∩B{\displaystyle A\cap B} is open. Hence finite intersections of open sets are open.

If Ai:i∈I{\displaystyle {A_{i}:i\in I}} (for any set if indexes I) are open, then their union ∪i∈IAi{\displaystyle \cup _{i\in I}A_{i}} is open.

Proof of 2:
Let Br(x){\displaystyle B_{r}(x)} be an open ball. Let y∈Br(x){\displaystyle y\in B_{r}(x)}. Then y∈Br−d(x,y)(y)⊆Br(x){\displaystyle y\in B_{r-d(x,y)}(y)\subseteq B_{r}(x)}.
In the following drawing, the green line is d(x,y){\displaystyle d(x,y)} and the brown line is r−d(x,y){\displaystyle r-d(x,y)}. We have found a ball to contain y{\displaystyle y} inside Br(x){\displaystyle B_{r}(x)}.

Proof of 4:
A, B are open. we need to prove that int(A∩B)=A∩B{\displaystyle int(A\cap B)=A\cap B}. Because of the first propriety of int, we only need to show that int(A∩B)⊇A∩B{\displaystyle int(A\cap B)\supseteq A\cap B}, which means ∀x∈A∩B:x∈int(A∩B){\displaystyle \forall x\in A\cap B:x\in int(A\cap B)}. Let x∈A∩B{\displaystyle x\in A\cap B}. We know also, that x∈int(A),x∈int(B){\displaystyle x\in int(A),x\in int(B)} from the premises A, B are open and x∈A,x∈B{\displaystyle x\in A,x\in B} . That means that there are balls: Bϵ1(x)⊂A,Bϵ2(x)⊂B{\displaystyle B_{{\epsilon }_{1}}(x)\subset A,B_{{\epsilon }_{2}}(x)\subset B}. Let ϵ=min{ϵ1,ϵ2}{\displaystyle \epsilon =\min\{{\epsilon _{1},\epsilon _{2}}\}}, we have that Bϵ(x)⊂A,Bϵ(x)⊂B⇒Bϵ(x)⊂A∩B{\displaystyle B_{\epsilon }(x)\subset A,B_{\epsilon }(x)\subset B\Rightarrow B_{\epsilon }(x)\subset A\cap B}. By the definition of an internal point we have that x∈int(A∩B){\displaystyle x\in int(A\cap B)} (Bϵ(x){\displaystyle B_{\epsilon }(x)} 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 An={(−1/n,1/n)}{\displaystyle A_{n}=\{(-1/n,1/n)\}}. We then see that ∩i=1∞Ai={0}{\displaystyle \cap _{i=1}^{\infty }A_{i}=\{0\}} which is closed.

Proof of 5:
Proving that the union of open sets is open, is rather trivial: let Ai:i∈I{\displaystyle {A_{i}:i\in I}} (for any set if indexes I) be a set of open sets. we need to prove that int(∪i∈IAi)⊇∪i∈IAi{\displaystyle int(\cup _{i\in I}A_{i})\supseteq \cup _{i\in I}A_{i}}: If x∈Ai{\displaystyle x\in A_{i}} then it has a ball Bϵ(x)⊂Ai⊆∪i∈IAi{\displaystyle B_{\epsilon }(x)\subset A_{i}\subseteq \cup _{i\in I}A_{i}}. The same ball that made a point an internal point in Ai{\displaystyle A_{i}} will make it internal in ∪i∈IAi{\displaystyle \cup _{i\in I}A_{i}}.

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 x∈A{\displaystyle x\in A} there there a ball Bϵx(x)⊆A{\displaystyle B_{\epsilon _{x}}(x)\subseteq A}. We can then compose A: A=∪x∈ABϵx(x){\displaystyle A=\cup _{x\in A}B_{\epsilon _{x}}(x)}. The equality is true because: ∪x∈ABϵx(x)⊆A{\displaystyle \cup _{x\in A}B_{\epsilon _{x}}(x)\subseteq A} because ∀x∈A:Bϵx(x)⊆A{\displaystyle \forall x\in A:B_{\epsilon _{x}}(x)\subseteq A}. ∪x∈ABϵx(x)⊇A{\displaystyle \cup _{x\in A}B_{\epsilon _{x}}(x)\supseteq A} in each ball we have the element x{\displaystyle x} and we unite balls of all the elements of A{\displaystyle A}.
On the other hand, a union of open balls is an open set, because every union of open sets is open.

For every space X{\displaystyle X} with the discrete metric, every set is open.

Proof: Let U{\displaystyle U} be a set. we need to show, that if x∈U{\displaystyle x\in U} then x{\displaystyle x} is an internal point. Lets use the ball around x{\displaystyle x} with radius 12{\displaystyle {\frac {1}{2}}}. We have B12(x)={y∣d(x,y)<12}={x}⊆U{\displaystyle B_{\frac {1}{2}}(x)=\{y\mid d(x,y)<{\frac {1}{2}}\}=\{x\}\subseteq U}. Therefore x{\displaystyle x} is an internal point.

The space R{\displaystyle \mathbb {R} } with the regular metric. Every open segment (a,b){\displaystyle (a,b)} is an open set. The proof of that is similar to the proof that int([a,b])=(a,b){\displaystyle int([a,b])=(a,b)}, that we have already seen.

First, Lets translate the calculus definition of convergence, to the "language" of metric spaces: We say that a sequence xn{\displaystyle x_{n}} converges to x{\displaystyle x} if for every ϵ>0{\displaystyle \epsilon >0} exists N{\displaystyle N} that for each n∗>N{\displaystyle n^{*}>N} the following holds: d(xn∗,x)<ϵ{\displaystyle d(x_{n^{*}},x)<\epsilon }.
Equivalently, we can define converges using Open-balls: A sequence xn{\displaystyle x_{n}} converges to x{\displaystyle x} If for every ϵ>0{\displaystyle \epsilon >0} exists N{\displaystyle N} that for each n∗>N{\displaystyle n^{*}>N} the following holds: xn∗∈Bϵ(x){\displaystyle x_{n^{*}}\in B_{\epsilon }(x)}.

The latter definition uses the "language" of open-balls, But we can do better - We can remove the ϵ{\displaystyle \epsilon } from the definition of convergence, thus making the definition more topological. Let's define that xn{\displaystyle x_{n}}converges to x{\displaystyle x} (and mark xn→x{\displaystyle x_{n}\rightarrow x}) , if for every ballB{\displaystyle B} around x{\displaystyle x} , exists NB{\displaystyle N_{B}} that for each n∗>NB{\displaystyle n^{*}>N_{B}} the following holds: xn∗∈B(x){\displaystyle x_{n^{*}}\in B(x)}. x{\displaystyle x} 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 xn{\displaystyle x_{n}} have two limits, x{\displaystyle x\,} and x′{\displaystyle x^{\prime }}. If they are not the same, we must have 0<d(x,x′){\displaystyle 0<d(x,x^{\prime })}. Let ϵ{\displaystyle \epsilon } be smaller than this distance. Now for some N{\displaystyle N}, for all n>N{\displaystyle n>N}, it must be the case that both xn∈Bϵ/2(x){\displaystyle x_{n}\in B_{\epsilon /2}(x)} and xn∈Bϵ/2(x′){\displaystyle x_{n}\in B_{\epsilon /2}(x^{\prime })} by virtue of the fact x{\displaystyle x\,} and x′{\displaystyle x^{\prime }} 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 xn→x{\displaystyle x_{n}\rightarrow x}, then almost by definition we get that d(xn,x)→0{\displaystyle d(x_{n},x)\rightarrow 0}. (d(xn,x){\displaystyle d(x_{n},x)} Is the sequence of distances).

In R{\displaystyle \mathbb {R} } with the natural metric, The series xn=1n{\displaystyle x_{n}={\frac {1}{n}}} converges to 0{\displaystyle 0}. And we note it as follows: 1n→0{\displaystyle {\frac {1}{n}}\rightarrow 0}

Any space, with the discrete metric. A series xn{\displaystyle x_{n}} converges, only if it is eventually constant. In other words: xn→x{\displaystyle x_{n}\rightarrow x} If and only if, We can find N{\displaystyle N} that for each n∗>N{\displaystyle n^{*}>N}, xn∗=x{\displaystyle x_{n^{*}}=x}

A sequence of functions {fn}{\displaystyle \{f_{n}\}} is said to be uniformly convergent on a set S{\displaystyle S} if for any ϵ>0{\displaystyle \epsilon >0}, there exists an N{\displaystyle N} such that when a{\displaystyle a} and b{\displaystyle b} are both greater than N{\displaystyle N}, then d(fa(x),fb(x))<ϵ{\displaystyle d(f_{a}(x),f_{b}(x))<\epsilon } for any x∈S{\displaystyle x\in S}.

Definition: The point p{\displaystyle p} is called point of closure of a set A{\displaystyle A} if there exists a sequence an,∀n,an∈A{\displaystyle a_{n},\forall n,a_{n}\in A}, such that an→p{\displaystyle a_{n}\rightarrow p}

An equivalent definition using balls: The point p{\displaystyle p} is called point of closure of a set A{\displaystyle A} if for every open ball B,p∈B{\displaystyle B,p\in B}, we have B∩A≠∅{\displaystyle B\cap A\neq \emptyset }.
The proof is left as an exercise.

Intuitively, a point of closure is arbitrarily "close" to the set A{\displaystyle A}. 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 [0,1)∈R{\displaystyle [0,1)\in \mathbb {R} }, The point p=1{\displaystyle p=1} is not in A{\displaystyle A}, but it is a point of closure: Let an=1−1n{\displaystyle a_{n}=1-{\frac {1}{n}}}. an∈A{\displaystyle a_{n}\in A} (n>0{\displaystyle n>0}, and therefore an=1−1n<1{\displaystyle a_{n}=1-{\frac {1}{n}}<1}) and an→1{\displaystyle a_{n}\rightarrow 1} (that's because 1n→0{\displaystyle {\frac {1}{n}}\rightarrow 0}).

Definition: The closure of a set A⊆X{\displaystyle A\subseteq X}(X,d){\displaystyle ({X},d)}, is the set of all points of closure. The closure of a set A is marked A¯{\displaystyle {\bar {A}}} or Cl(A){\displaystyle Cl(A)}.

Definition: A set A⊆X{\displaystyle A\subseteq X} is closed in X{\displaystyle {X}\,} if A=Cl(A){\displaystyle A=Cl(A)}.
Meaning: A set is closed, if it contains all its point of closure.

An equivalent definition is: A set A⊆X{\displaystyle A\subseteq X} is closed in X{\displaystyle {X}\,} If for every point p∈A{\displaystyle p\in A}, and for every Ball B,p∈B{\displaystyle B,p\in B}, then B∩A≠∅{\displaystyle B\cap A\neq \emptyset }.
The proof of this definition comes directly from the former definition and the definition of convergence.

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 An={[−1+1n,1−1n]}{\displaystyle A_{n}=\{[-1+{\frac {1}{n}},1-{\frac {1}{n}}]\}}. We see that ∪i=1∞Ai=(−1,1){\displaystyle \cup _{i=1}^{\infty }A_{i}=(-1,1)} fails to contain its points of closure, ±1.{\displaystyle \pm 1.}

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 Cl(A)=∩{A⊆S|S is closed }{\displaystyle Cl(A)=\cap \{A\subseteq S|S{\text{ is closed }}\!\!\}\!\!{\text{ }}}.

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 (X,d){\displaystyle (X,d)}, the set X{\displaystyle X} is both open and closed.

In any space with a discrete metric, every set is both open and closed.

In R{\displaystyle \mathbb {R} }, under the regular metric, the only sets that are both open and closed are R{\displaystyle \mathbb {R} } and ∅{\displaystyle \emptyset }. However, some sets are neither open nor closed. For example, a half-open range like [0,1){\displaystyle [0,1)} 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 π{\displaystyle \pi }).

A very important Proposition: Let A{\displaystyle A} be a set in the space (X,d){\displaystyle (X,d)}. Then, A is open iff Ac{\displaystyle A^{c}} is closed.Proof: (⇒{\displaystyle \Rightarrow }) For the first part, we assume that A is an open set. We shall show that Ac=Cl(Ac){\displaystyle A^{c}=Cl(A^{c})}. It is enough to show that Cl(Ac)⊆Ac{\displaystyle Cl(A^{c})\subseteq A^{c}} because of the properties of closure. Let p∈Cl(Ac){\displaystyle p\in Cl(A^{c})} (we will show that p∈Ac{\displaystyle p\in A^{c}}).
for every ball B,p∈B{\displaystyle B,p\in B} we have, by definition that (*)B∩Ac≠∅{\displaystyle B\cap A^{c}\neq \emptyset }. If the point is not in Ac{\displaystyle A^{c}} then p∈A{\displaystyle p\in A}. A{\displaystyle A} is open and therefore, there is a ball B{\displaystyle B}, such that: p∈B⊆A{\displaystyle p\in B\subseteq A}, that means that B∩Ac=∅{\displaystyle B\cap A^{c}=\emptyset }, contradicting (*).
(⇐{\displaystyle \Leftarrow }) On the other hand, Lets a assume that Ac{\displaystyle A^{c}} is closed, and show that A{\displaystyle A} is open. Let p{\displaystyle p} be a point in A{\displaystyle A} (we will show that p∈int(A){\displaystyle p\in int(A)}). If p{\displaystyle p} is not in int(A){\displaystyle int(A)} then for every ball B,p∈B{\displaystyle B,p\in B} we have that B⊈A{\displaystyle B\nsubseteq A}. That means that B∩Ac≠∅{\displaystyle B\cap A^{c}\neq \emptyset }. And by definition of closure point p{\displaystyle p} is a closure point of Ac{\displaystyle A^{c}} so we can say that p∈Cl(Ac){\displaystyle p\in Cl(A^{c})}. Ac{\displaystyle A^{c}} is closed, and therefore p∈Ac=Cl(Ac){\displaystyle p\in A^{c}=Cl(A^{c})} That contradicts the assumption that p∈A{\displaystyle p\in A}

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 R1{\displaystyle \mathbb {R} ^{1}}.Theorem: An open set O in R1 is a countable union of disjoint open intervals.
Proof: Let x∈O{\displaystyle x\in O}. Let a=sup{t|t∉O,t<x}{\displaystyle a=\sup\{t|t\notin O,t<x\}} and let b=inf{t|t∉O,t>x}{\displaystyle b=\inf\{t|t\notin O,t>x\}}. There exists an open ball (x-ε,x+ε) such that (x-ε,x+ε) ⊆ O because O 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, every finite set T={x1,x2,...,xn}{\displaystyle T=\{x_{1},x_{2},...,x_{n}\}} is closed. To see why, observe that Tc=[⋃{xi}]c=⋂{xi}c{\displaystyle T^{c}={\Big [}\bigcup \{x_{i}\}{\Big ]}^{c}=\bigcap \{x_{i}\}^{c}} is open, so T{\displaystyle T} is closed.

Closed intervals [a,b] are closed.

Cantor Set Consider the interval [0,1] and call it C0. Let A1 be equal {0, 23{\displaystyle {\tfrac {2}{3}}}} and let dn = (13)n{\displaystyle ({\tfrac {1}{3}})^{n}}. Let An+1 be equal to the set An∪{x|x=a+2dn, a∈An}. Let Cn be ⋃a∈An{\displaystyle \textstyle \bigcup _{a\in A_{n}}}{[a,a+dn]}, which is the finite union of closed sets, and is thus closed. Then the intersection ⋂i=1∞Ci{\displaystyle \textstyle \bigcap _{i=1}^{\infty }{C_{i}}} 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 R{\displaystyle \mathbb {R} } 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 Q⊆R{\displaystyle \mathbb {Q} \subseteq \mathbb {R} }. Give an example of a set which is both open and closed in Q{\displaystyle \mathbb {Q} }.

Let A{\displaystyle A} be a set in the space x{\displaystyle x}. 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 (X,d),(Y,e){\displaystyle (X,d),(Y,e)} be spaces. A function f:X→Y{\displaystyle f:X\rightarrow Y} is continuous at a point x{\displaystyle x} if for all ϵx>0{\displaystyle \epsilon _{x}>0} there exists a δϵx>0{\displaystyle \delta _{\epsilon _{x}}>0} such that: for all x1{\displaystyle x_{1}} such that d(x,x1)<δϵx{\displaystyle d(x,x_{1})<\delta _{\epsilon _{x}}}, we have that e(f(x),f(x1))<ϵx{\displaystyle e(f(x),f(x_{1}))<\epsilon _{x}}.

Let's rephrase the definition to use balls: A function f:X→Y{\displaystyle f:X\rightarrow Y} is continuous at a point x{\displaystyle x} if for all ϵx>0{\displaystyle \epsilon _{x}>0} there exists δϵx>0{\displaystyle \delta _{\epsilon _{x}}>0} such that the following holds: for every x1{\displaystyle x_{1}} such that x1∈Bδϵx(x){\displaystyle x_{1}\in B_{\delta _{\epsilon _{x}}}(x)} we have that f(x1)∈Bϵx(f(x)){\displaystyle f(x_{1})\in B_{\epsilon _{x}}(f(x))}. Or more simply: f(Bδϵx(x))⊆Bϵx(f(x)){\displaystyle f(B_{\delta _{\epsilon _{x}}}(x))\subseteq B_{\epsilon _{x}}(f(x))}

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 f:X→Y{\displaystyle f:X\rightarrow Y} is continuous, by the definition above ⇔{\displaystyle \Leftrightarrow } for every open set U{\displaystyle U} in Y{\displaystyle Y}, The inverse image of U{\displaystyle U}, f−1(U){\displaystyle f^{-1}(U)}, is open in X{\displaystyle X}.
Note that f{\displaystyle f} does not have to be surjective or bijective for f−1{\displaystyle f^{-1}} to be well defined. The notation f−1{\displaystyle f^{-1}} simply means f−1(U)={x∈X:f(x)∈U}{\displaystyle f^{-1}(U)=\{x\in X:f(x)\in U\}}.

Proof: First, let's assume that a function f{\displaystyle f} is continuous by definition (The ⇒{\displaystyle \Rightarrow } direction). We need to show that for every open set U{\displaystyle U}, f−1(U){\displaystyle f^{-1}(U)} is open.

Let U⊆Y{\displaystyle U\subseteq Y} be an open set. Let x∈f−1(U){\displaystyle x\in f^{-1}(U)}. f(x){\displaystyle f(x)} is in U{\displaystyle U} and because U{\displaystyle U} is open, we can find and ϵx{\displaystyle \epsilon _{x}}, such that Bϵx(f(x))⊆U{\displaystyle B_{\epsilon _{x}}(f(x))\subseteq U}. Because f is continuous, for that ϵx{\displaystyle \epsilon _{x}}, we can find a δϵx>0{\displaystyle \delta _{\epsilon _{x}}>0} such that f(Bδϵx(x))⊆Bϵx(f(x))⊆U{\displaystyle f(B_{\delta _{\epsilon _{x}}}(x))\subseteq B_{\epsilon _{x}}(f(x))\subseteq U}. that means that Bδϵx(x)⊆f−1(U){\displaystyle B_{\delta _{\epsilon _{x}}}(x)\subseteq f^{-1}(U)}, and therefore, x{\displaystyle x} is an internal point. This is true for every x{\displaystyle x} - meaning that all the points in f−1(U){\displaystyle f^{-1}(U)} are internal points, and by definition, f−1(U){\displaystyle f^{-1}(U)} is open.

(⇐{\displaystyle \Leftarrow })On the other hand, let's assume that for a function f{\displaystyle f} for every open set U∈Y{\displaystyle U\in Y}, f−1(U){\displaystyle f^{-1}(U)} is open in X{\displaystyle X}. We need to show that f{\displaystyle f} is continuous.

For every x∈X{\displaystyle x\in X} and for every ϵx>0{\displaystyle \epsilon _{x}>0}, The set Bϵx(f(x)){\displaystyle B_{\epsilon _{x}}(f(x))} is open in Y{\displaystyle Y}. Therefore the set V=f−1(Bϵx(f(x))){\displaystyle V=f^{-1}(B_{\epsilon _{x}}(f(x)))} is open in X{\displaystyle X}. Note that x∈V{\displaystyle x\in V}. Because V{\displaystyle V} is open, that means that we can find a δϵx{\displaystyle \delta _{\epsilon _{x}}} such that Bδϵx(x)⊆V{\displaystyle B_{\delta _{\epsilon _{x}}}(x)\subseteq V}, and we have that f(Bδϵx(x))⊆Bϵx(f(x)){\displaystyle f(B_{\delta _{\epsilon _{x}}}(x))\subseteq B_{\epsilon _{x}}(f(x))}.

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 f{\displaystyle f} be any function from any space (X,d){\displaystyle (X,d)}, to any space (Y,e){\displaystyle (Y,e)}, were d{\displaystyle d} is the discrete metric. Then f{\displaystyle f} is continuous. Why? For every open set U{\displaystyle U}, the set f−1(U){\displaystyle f^{-1}(U)} is open, because every set is open in a space with the discrete metric.

Let f:R→R;f(x)=x{\displaystyle f:\mathbb {R} \rightarrow \mathbb {R} ;f(x)=x} The identity function. f{\displaystyle f} is continuous: The source of every open set is itself, and therefore open.

Prove that a function f:X→Y{\displaystyle f:X\rightarrow Y} is continuous ⇔{\displaystyle \Leftrightarrow } for every closed set U{\displaystyle U} in Y{\displaystyle Y}, The inverse image of U{\displaystyle U}, f−1(U){\displaystyle f^{-1}(U)}, is closed in X{\displaystyle X}.

In a metric space X, function from X to a metric space Y is uniformly continuous if for all ϵ{\displaystyle \epsilon }, there exists a δ{\displaystyle \delta } such that for all x1,x2∈X{\displaystyle x_{1},x_{2}\in X}, d(x1,x2)<δ{\displaystyle d(x_{1},x_{2})<\delta } implies that d(f(x1),f(x2))<ϵ{\displaystyle d(f(x_{1}),f(x_{2}))<\epsilon }.