Fundamentals of Topology & Metric Spaces

In this brief post, we investigate the topological foundations of analysis. We limit the scope to the topology of a metric space. In particular, we provide the knowledge that is needed for the application to probability and measure theory.

A good introduction for all German-speakers is also provided by Prof. Dr. Edmund Weitz as embedded in the Appendix.

The objective of the next section is to prepare the very basic concept for the definition of a topological space. We start by defining an open and a closed ball, a neighborhood, interior point, an open and a closed set. All these definitions are interlinked to each other as we will see later on.

Parts of this post are based on [1] and [2].

Basic Definitions & Properties

Balls, Open & Closed Sets & Neighborhoods

Let X:=(X, d) denote a metric space.

Definition 1.1
An (open) ball B of radius r and center x_0 is the set of all points of distance less than r from x_0, i.e. B(x_0, r):=\{x\in \mathbb{R} : d(x, x_0)<r \}.

Rendered by QuickLaTeX.com

A closed ball \overline{B} of radius r is the set of all points of distance less than or equal to r from x_0, i.e. \overline{B}(x_0, r):=\{x\in \mathbb{R} : d(x, x_0)\leq r \}.

Rendered by QuickLaTeX.com

A subset U of X is called a neighborhood of x_0\in X if there is some r>0 such that B(x_0, r)\subseteq U.

Rendered by QuickLaTeX.com

An element x_0\in A\subseteq X is called an interior point of A if there is a neighborhood U of x_0 such that U\subseteq A.

A set A of X is called open if every point of A is an interior point.

\square

The introduced concepts “interior point” and “open set” (and hence also the concept of “closed sets”) depend on the surrounding metric space (X, d). It is sometimes useful to make this explicit by saying “x_0 is an interior point of A with respect to (X, d)” or “A is open in (X, d)“.

By definition, every superset of a ball is considered to be a neighborhood. Neighborhoods can be defined without mentioning explicitly the corresponding metric space.

Example 1.1
An open ball in \mathbb{R} is an open interval I. However, if we consider \mathbb{R} embedded in \mathbb{R}^2, then I is apparently not an open ball in \mathbb{R}^2.

Rendered by QuickLaTeX.com

For the sake of illustration we sketch a 2-dimensional open ball (i.e. an open interval) as a rectangle even though it would actually be a line without end-points. These end-points are illustrated by the lines crossing the x-axis.

The heuristic reasoning for that is that a one-dimensional interval cannot contain an open two-dimensional ball not matter how small the radius of this ball might be.

\square

Apparently, x_0 is an interior point of A if and only if there is some real \epsilon >0 such that B(x_0, \epsilon) \subseteq A. In addition, A is open if and only if A is a neighborhood of each of its points.

Example 1.2
Let us consider open and closed balls in X:=\mathbb{R}^n along with the standard Euclidean metric d. Every open ball B(x_0, r), r>0 in (X, d) is an open set. Let b \in B be an arbitrary point. Set s := d(x_0, b) and consider B(b, \epsilon) with \epsilon:= r - s>0.

Rendered by QuickLaTeX.com

For all x\in B(b, \epsilon) we have

    \begin{align*}    d(x,b) \leq d(x, x_0) + d(x_0, b) < \epsilon +s = r, \end{align*}

and so B(b, \epsilon) is contained in B(x_0, r). This shows that the arbitrary point b is an interior point of B(x_0,r) and thus an open ball B(x_0, r) is an open set.

\square

That is, a set A is open if and only if for every x_0\in A an open ball B(x_0, \epsilon) exists such that B(x_0, \epsilon) \subseteq A.

Definition 1.2 (Boundary Point)
Let A\subseteq X and x\in X. Then, x is called boundary point for A if

(1)   \begin{align*} B(x, \epsilon) &\cap A \neq \emptyset \quad \text{ and } \\ B(x, \epsilon) &\cap A^C \neq \emptyset \\ \end{align*}

for all \epsilon>0. The set of all boundary points is denoted by \partial A.

\square

Boundary points are just points on the boundary between the set A and the surrounding basis set X (i.e. A^C) of the metric space (X, d).

Rendered by QuickLaTeX.com

\partial A can be contained in A or in A^C. If all boundary points \partial A are outside of A, i.e. if A \cap \partial A = \emptyset, then it is an open set.

Definition 1.3 (Closed Set)
A set A of X is called closed in X if its complement A^C is open in X.

\square

Equivalently, if all boundary points of \partial A are inside the set A, i.e. if A \cup \partial A = A, then it is a closed set. This also means that the set \overline{A}:= A \cup \partial A is always a closed set no matter what A is. The set \overline{A} is then also called the closure of A.

Example 1.3
(a) The interval A:= [a, \infty) is closed in X:=(\mathbb{R}, d(x,y)=|x-y|).
Let y denote a real number that is not an element of A. Then, y<a and the ball B(y, \epsilon) with \epsilon:=(a-y)/2 has empty intersection with A.

Hence, the complement A^C is open and so the set A is closed.

Rendered by QuickLaTeX.com

For the sake of illustration we sketch a 2-dimensional open ball as a rectangle even though it would actually be a line without end-points.

Note that all closed intervals in X=(\mathbb{R}, |.|) are of the form [a,b], [a, \infty), (-\infty, b], \emptyset and \mathbb{R}.

Let us now consider the set A':= (a, \infty). For all x\in A' and \epsilon':=(x-a)/2 we have B(x, \epsilon') \subseteq A. Hence, the set A' is open in X.

Note that all open intervals in X=(\mathbb{R}, |.|) are of the form (a,b), (a, \infty), (-\infty, b), \emptyset and \mathbb{R}.

(b) Now consider the metric space (X, d) with X:= (0,1] \cup (5,\infty) with the same distance function d(x,y)=|x-y|, x,y\in X as in (a).

The set A:=(0,1] is an open set since for all x\in A we consider the open ball B(x, \epsilon) with \epsilon:=0.5 \cdot \min(d(x, 0), d(x, 1)). That is, we determine the shortest distance between x and the two points 0 and 1 and divide it by 2. Then, the corresponding open ball B(x, \epsilon) is contained within the set A. For the point x=1, we can consider the open ball B(x, \epsilon) with \epsilon=1, for instance. This open ball equals B(x=1, \epsilon=1)=(0,1] since all the figures right from x=1 until 5 are not contained in X. Hence, A is open.

The set A is also closed since \partial A=\emptyset is included in A. Note that 0 is not a boundary point since it is not an element of the metric space X. The point x=1 is not a boundary point since for \epsilon=0.5, for instance, B(x=1, \epsilon=0.5) \cap A^C= (0.5, 1] \cap (5, \infty) = \emptyset holds true.

(c) Let us consider the metric space X:=\mathbb{Z} of all integers together with the discrete metric d(x,y)=\begin{cases} 0 & x=y \\ 1 & x\neq y \end{cases} for all x,y\in X. It follows that the open ball B(x_0, r)= \{x\in X| \ d(x_0, x)<r\} of radius r>0, r\in \mathbb{R} and center at x_0 is either \{x_0\} if 1\geq r >0 or X if r>1.

(d) Let us consider open and closed balls in X:=\mathbb{R}^n along with the standard Euclidean metric d. Every closed ball \overline{B(x_0, r)}, r\geq 0 in (X, d) is a closed set. That is, we need to show that the complement set B(x_0, r)^C =\mathbb{R}^n \setminus B(x_0, r) is open. Let y_0\in B(x_0, r)^C. Set \epsilon:= \frac{d(x_0, y_0) - r}{2} and consider the open ball B(y_0, \epsilon), that does not intersect with the closed ball \overline{B(x_0, r)} due to the choice of \epsilon: Let x\in B(y_0, \epsilon), then the following holds due to the triangular property.

    \begin{align*} d(x_0, y_0) \leq d(x,x_0)+d(x, y_0) \leq d(x, x_0)+\epsilon \end{align*}

and d(x, x_0) \geq \epsilon +r > r \geq 0 because of d(x, y_0)=2\epsilon+r.

Note that this also means that every isolated point in \mathbb{R}^n along with the Euclidean metric is a closed set.

\square

In the following section we are going to outline basic properties of open & closed sets, which will provide the heuristic for the definition of a topological space.

Properties of Open & Closed Sets

The following two propositions state basic properties of open and closed sets. It turns out that these properties characterize a topological space.

Proposition 1.1 (Open Sets)
Let \mathcal{T}:= \{ O \subseteq X: \ O \text{ is open}\} be a family of open sets.
(i) \emptyset, X \in \mathcal{T};
(ii) \bigcup_{i\in I}{O_i}\in \mathcal{T} if O_i \in \mathcal{T} for an arbitrary index set i\in I;
(iii) \bigcap_{i\in I}{O_i}\in \mathcal{T} if O_i \in \mathcal{T} for a finite index set I.

Proof:
(i) The empty set possesses every property since it does not have an element. Hence, the empty set is closed and open. Correspondingly, the set X is open.

(ii) If x\in \bigcup_{i\in I}{O_i} then there must be an index i such that x\in O_i with B(x, \epsilon_i) \subseteq O_i. All the more B(x, \epsilon_i) \subseteq \bigcup_{i\in I}{O_i} holds true.

(iii) Let O_1, \ldots, O_n with n\in \mathbb{N} be open sets. Since x \in (O_1 \cap \ldots \cap O_n) \neq \emptyset there exists a B(x, \epsilon_i) for each i\in I:=\{1, \ldots, n\} with B(x, \epsilon_i) \subseteq O_i. If we set \epsilon:= \min\{\epsilon_1, \ldots, \epsilon_n\} then B(x, \epsilon)\subseteq \bigcap_{i\in I}{O_i} and the assertion follows.

\square

Why (iii) holds only true for finite index sets can also be seen if we try to prove that the intersection of two open balls at a\in X is open again. Just chose \epsilon:= \min\{\epsilon_1,  \epsilon_2\} for the open ball of the intersection B(a, \epsilon_1)\cap B(a, \epsilon_2). This can be iterated provided that the index set is finite.

Please note that the proof above would also be valid if we use neighborhoods instead of balls. This would mean that the proof is not dependent on the used metric space and suggests that we could derive a new mathematical structure from it, where –in general– no algebraic operations, distance functions or orders need to be defined. However, given that we restrict our-self to topology for metric spaces, we will not further outline this idea.

The proof of the corresponding proposition for closed sets is apparent given the definition of a closed set.

Proposition 1.2 (Closed Sets)
Let \mathcal{T}:= \{ C \subseteq X: \ C \text{ is closed}\} be a family of closed sets.
(i) \emptyset, X \in \mathcal{T};
(ii) \bigcap_{i\in I}{O_i}\in \mathcal{T} if O_i \in \mathcal{T} for an arbitrary index set i\in I;
(iii) \bigcup_{i\in I}{O_i}\in \mathcal{T} if O_i \in \mathcal{T} for a finite index set I.

Proof:
Apply the definition and Proposition 1.1 (Open Sets).

\square

Example 1.4
Let us continue Example 1.3. The intersection of a finite number of intervals [a_i, \infty) is closed in X:=(\mathbb{R}, |.|). Without loss of generality, let a_1 \leq a_2 \leq \ldots \leq a_n. All the sets [a_i, \infty) are closed and so is \bigcap_{i=1}^{n}{[a_i, \infty)} = [\max\{a_1, \ldots, a_n\}, \infty) in X.

Let us now consider the family of open sets \{ (a_i, \infty) | \ i\in \mathbb{N}\}. For all elements x_i of all open sets (a_i, \infty), we can find an open ball B(x_i, \epsilon_i) \subseteq (a_i, \infty). Hence, the union of these sets also contain open balls for all elements and is thus an open set itself.

\square

Example 1.5
An infinite intersection of open sets need not to be open. Consider \bigcap_{i=1}^{\infty}{B(0, \frac{1}{n})} = \{0\} in (\mathbb{R}, |.|). Apparently, there cannot be an \epsilon>0 such that B(0, \epsilon)\subseteq \{0\}.

Correspondingly, infinite unions of closed sets need not to be closed. To this end, consider \bigcup_{i=1}^{\infty}{B(0, \frac{1}{n})^C} = \mathbb{R} \setminus \{0\} in (\mathbb{R}, |.|).

\square

Accumulation and Limit Points

Closely related to closed sets are so-called accumulation and limit points. In addition, this section will pave the way to one of the below application of a topological space — limits.

Definition 1.2 (Accumulation & Limit Point)
Let A \subseteq X and x\in X. We call x an accumulation point of A if every neighborhood of x in X has non-empty intersection with A.

The element x\in X is called limit point of A if every neighborhood of x in X contains a point of A other than x. Finally we set

    \begin{align*} \overline{A}:= \{ x\in X | x \text{ is an accumulation point of } A \}. \end{align*}

\square

Every point within an open set but also every limit point of this set is an accumulation point as illustrated in the following example. Here, A=(0,1) is the open interval in the standard metric space (X=\mathbb{R}, |\cdot|).

Every point in A=(-1,1) is an interior, an accumulation and a limit point of A. Note that an interior point of A requires to have a neighborhood U that is contained in A. Given that A is an open set this holds true for all points within the set A by definition.

Rendered by QuickLaTeX.com

The ‘boundary’ points x=-1 and x=1 are no interior points but limit and accumulation points of A. Why?
Because we can define any open ball around it and the intersection with A will always contain a point different from x=\pm 1.

Let us now consider a set A=\{0\} with a single isolated point in the metric space (\mathbb{R}, |\cdot|). Is 0, that is the only element of the set, an accumulation and/or a limit point of A?

Apparently, every neighborhood U of x in X has non-empty intersection with A, i.e. A \cap U = \{0\}. However, 0 is not a limit point since the intersection A \cap U = {0} does not contain a point other than 0.

According to our thoughts above, elements of A are accumulation points of A. This fact is also reflected in the next proposition.

Proposition 1.3: Let A be a subset of a metric space X=(X, d).
(i) A \subseteq \overline{A};
(ii) A = \overline{A} if and only if A is closed.

Proof: (i) See argumentation above.
(ii) ‘\Rightarrow' Let x\in A^c=(\overline{A}^c). Since x is not an accumulation point of A, there is some U\in \mathcal{U}(x) of all neighborhoods of x such that U \cap A = \emptyset. Thus, U \subseteq A^c, that is, x is an interior point of A^c. Consequently A^c is open and A is closed in X.

\Leftarrow' Let A be closed in X. Then A^c is open in X according to its definition. For any x\in A^c, there is some U \in \mathcal{U}(x) such that U\subseteq A^c. This means that U and A are disjoint, and so x is not an accumulation point of A, i.e., x\in (\overline{A})^c. Hence, we have proved the inclusion A^c \subseteq (\overline{A})^c, which is equivalent to (\overline{A})^c \subseteq A. With (i), this implies \overline{A} = A.

\square

The limit points of a set A are the limits of certain sequences in A.

Proposition 1.4: An element x of X is a limit point of A if and only if there is a sequence (x_k) in A \setminus \{x\} which converges to x.

Proof: Let x be a limit point of A. For each k\in \{1,2, \ldots \}, choose some element x_k \neq x in B(x, \frac{1}{k}). Then (x_k) is a sequence in A\setminus \{x\} such that x_k \rightarrow x.

Conversely, let (x_k) be a sequence in A \setminus \{x\} such that x_k \rightarrow x. Then, for each neighborhood U of x, there is some k\in \mathbb{N} such that x_k\in U. This means that x_k\in U\cap (A\setminus \{x\}). Hence, each neighborhood of x contains an element of A other than x.

\square

Corollary 1.1: An element x\in X is an accumulation point of A if and only if there is a sequence (x_k) in A such that x_k \rightarrow x.

Proof: If x is a limit point, then the claim follows from Proposition 1.4. Otherwise, if x is an accumulation point, but not a limit point of A, then there is a neighborhood U of x such that U \cap A = \{x\}. Thus, x\in A, and the constant sequence (x_k) with x_k=x for all k\in \mathbb{N} has the desired property.

\square

We can also characterize closed sets using convergent sequences by simply using the fact that a closed set is the complement of an open set.

Proposition 1.5: For A \subseteq X, the following are equivalent:
(i) A is closed;
(ii) A contains all its limit points;
(iii) Every sequence in A, which converges in X, has its limit in A.

Proof: ‘(i) \Rightarrow (ii)’ Any limit point of A is also an accumulation point and so is contained in \overline{A}. Since A is closed and Proposition 1.3, A=\overline{A}, and so all limit points are in A.

‘(ii) \Rightarrow (iii)’ Let (x_k) be a sequence in A such that x_k \rightarrow x in X. Then, by Corollary 1.1, x is an accumulation point of A. This means that, either x is in A, or x is a limit point of A, so, by assumption, x\in A.

‘(iii) \Rightarrow (i)’ This implication follows from Proposition 1.3 and Corollary 1.1.

\square

Compact Sets

Compact sets are so important since they possess important properties, that are known from finite sets:

The famous Heine-Borel Theorem will show that compact sets in metric spaces do indeed have these properties. However, we will only partly prove this theorem but will provide links and references to full proofs.

The analogy is also outlined in this really nice video (in German only) by Prof. Dr. Edmund Weitz.

Let us start with very basic but important definitions.

Definition 1.3 ((Open) Cover and Open Sub-Cover)
By an open cover \mathcal{O} of a set D in a metric space X, we mean a collection \mathcal{O}=\{O_i | \ i\in I\} of (open) subsets of X such that D \subseteq \bigcup_{i\in I}{O_i}.

A sub-collection \mathcal{O'}:=\{O_j| \ j\in J\} with J \subseteq I of an (open) cover is called an open sub-cover of \mathcal{O}.

\square

An (open) cover of D is a collection of possibly overlapping open sets in X which, after considering their union globally, contains the set D inside.

Example 1.6 (Real Line)
Let us consider the set D:=\mathbb{R} of the metric space (\mathbb{R}, |\cdot|). Then, \mathcal{O}:=\{(-n, n) | n\in \mathbb{N}\} is an open cover of D because D \subseteq \bigcup_{n\in \mathbb{N}}{(-n, n)}. This cover apparently contains infinitely many open sets (-n, n).

\mathcal{O'}=\{ (-2n, 2n) | \ n\in \mathbb{N}\} is an open subcover of D since D\subseteq \bigcup_{n\in \mathbb{N}}{(-2n, 2n)} but \mathcal{O'} \subset \mathcal{O}. This subcover, however, still contains infinitely many open sets.

\square

Now we have the ingredients for the central definition of this section.

Definition 1.3 (Compact Set)
A subset K of a metric space X is said to be compact if every open cover \mathcal{O} of K contains a finite subcover.

\square

The definition of a compact set contains a very powerful requirement: it requires the existence of a finite open subcover within any possibly infinite open cover. Please also refer to the analogy to the properties of finite sets as mentioned at the beginning of this section.

It is clear that every finite set is compact.

Example 1.7 (Finite Set & Compactness)
Let D:=\{x_0, \ldots, x_n\} be a finite set in the metric space (\mathbb{R}, |\cdot|) and \mathcal{O}:=\{B(x_i, \epsilon=0.1) | \ i\in \{0, 1, \ldots, n\} \}. Note that we could chose any \epsilon>0 for this purpose. Apparently, \mathcal{O} is a finite and open cover of D \subseteq \bigcup_{i=0}^{n}{B(x_i, 0.1)}.

Each point of the finite set D is contained in some open set by the cover depending upon that point. This directly implies that there is a finite sub-cover most the size of the set D.

\square


Let us generalize the approach taken in Example 1.7 for an arbitrary non-empty set D \subseteq \mathbb{R}. By setting

    \begin{align*} \delta:D \rightarrow (0,\infty) \quad \text{ defined by } x \mapsto \delta(x):= B(x, \delta) \end{align*}

with \delta>0, an open set B(x, \delta) is assigned to each point x\in D. Hence, the set \mathcal{O}:=\{\delta(x) | \ x\in D\} is an open cover for any set D.

The Heine-Borel theorem states that every closed and bounded set in \mathbb{R}^n, n\in \mathbb{N} is compact. This theorem is very important for analysis, measure theory and beyond.

Theorem 1.1 (Heine-Borel)
Let D be a subset of the standard Euclidean metric space (\mathbb{R}^n, L_n) with n\in \mathbb{N}. Then the following statements are eqivalent:
(i) D is compact;
(ii) D is closed and bounded;
(iii) Every infinite subset of D has an accumulation point in D.

Part of the Proof for \mathbb{R}:
First, we assume that D is compact i.e. that every open cover admits a finite sub-cover. Define \mathcal{U}:= \{U_x :=(x-1, x+1) | x\in D\}. Then D \subseteq \bigcup_{x\in D}{U_x} simply because the index set is D itself and U_x with x\in D is a open cover and thus there exist a finite sub-cover D \subseteq \mathcal{U}_0:=U_{x_1}, U_{x_2}, \ldots, U_{x_k} with k\in \mathbb{N} and x_i\in D. Note that D \subseteq \mathcal{U}_0 \subseteq (\min\{x_i\}-1,  \max\{x_i\}+1) with i\in \{1, \ldots, k\}. Since this interval is bounded so is D.

Now, let us assume that D is not closed (i.e. complement is open). Then, there must be a limit point of D with y\notin D since a closed set contains all its limit points [according to Proposition 1.5]. Find (y_m)_{m\in \mathbb{N}} \subseteq D such that \lim_{m\rightarrow \infty}{y_m}=y. Define \mathcal{U}:= \{U_x :=(x-\frac{|x-y|}{2}, x+\frac{|x-y|}{2}) | x\in D\}. Apparently, D \subseteq \bigcup_{x\in D}{U_x} and thus because of the assumption that D is compact there must be a finite sub-cover D \subseteq \mathcal{U}_0:=U_{x_1}, U_{x_2}, \ldots, U_{x_k} with k\in \mathbb{N} and x_i\in D. Set \epsilon:= \min\{ |x_1 -y|, \ldots,  |x_k -y|\} and find a N\in \mathbb{N} such that |y-y_N|<\epsilon (which is possible since (y_m) \rightarrow y). According to the definition of \epsilon this implies y_N\notin U_{x_i}, which is a contradiction. Hence, D is closed.

For a general proof of the theorem for \mathbb{R}^n please refer to Theorem 3.31 in [1] or see there. Also note that a visualization by the University of Hannover of one proof can be found on YouTube. There is also a proof analysis of one direction of the Heine-Borel Theorem.

\square

Topological Spaces

Topological spaces can be defined in many ways, however, given our focus on metric spaces and open sets the following definition is the most natural one. Please note that we could also use the properties of closed sets to define a topological space.

Definition 2.1 (Topological Space)
A topological space is a pair (X, \mathcal{T}), where X is a set and \mathcal{T} is a family of subsets that satisfies

(i) \emptyset, X \in \mathcal{T};
(ii) \bigcup_{i\in I}{O_i}\in \mathcal{T} if O_i \in \mathcal{T} for an arbitrary index set i\in I;
(iii) \bigcap_{i\in I}{O_i}\in \mathcal{T} if O_i \in \mathcal{T} for a finite index set I.

\square

The following video provides a rather unorthodox way of thinking about a topology. However, it might help to get a heuristic for topological spaces. It also mentions the connection between metrics and a topology.

Topology vs. “a” Topology by PBS Infinite Series

Example 2.1 (Topologies):

a) If X is a metric space and \mathcal{T}_X is the set of all open sets, then \mathcal{T}_X is a topology according to Proposition 1.1.

b) Let X be a set and \mathcal{T}_0=\{\emptyset, X\} then \mathcal{T}_0 is the so-called trivial or indiscrete topology.

c) The power set 2^X of a set X is the so-called discrete topology. In this topology every subset it open.

\square

Continuous Functions, Open and Closed Sets

Now, we connect two important concepts via the following theorem.

Theorem 3.3 (Continuous Functions & Closed/Open Sets):
Let f:X \rightarrow Y be a function between metric spaces X and Y. Then the following are equivalent:

(i) f is continuous;
(ii) f^{-1}(O) is open in X for each open set O\in Y;
(iii) f^{-1}(C) is closed in X for each closed set C\in Y.

Proof: ‘(i) \Rightarrow (ii)’ Suppose f is continuous on X and let O\subseteq Y be an open set. If f^{-1}(O)=\emptyset, then the claim follows from Proposition 1.1 (i). Thus, we suppose that f^{-1}(O)\neq \emptyset.

Let x_0\in f^{-1}(O) \subseteq X. Due to the fact that O is open, we can chose at least one \epsilon >0 such that B(f(x_0), \epsilon)\subseteq O for every f(x_0)\in O \subseteq Y. Given that f is continuous on X, a corresponding \delta >0 exists such that

    \begin{align*}      f(B(x_0, \delta) \cap X) \subseteq B(f(x_0), \epsilon) \end{align*}

and x_0\in f^{-1}(O). That is, x \in B(x_0, \delta) implies f(x)\in B(f(x_0), \epsilon). Thus, B(x_0, \delta) \subseteq f^{-1}(O), which means that f^{-1}(O) is an open set.

‘(ii) \Rightarrow (i)’ Let us suppose that f^{-1}(O) is open whenever O\subseteq Y is open and we aim to prove that f is continuous at each point of X. Given x_0\in X and \epsilon>0, we know that the ball B(f(x_0), \epsilon) is open in Y. By assumption so is f^{-1}(B(f(x_0), \epsilon). Since x_0\in f^{-1}(B(f(x_0), \epsilon) and f^{-1}(B(f(x_0), \epsilon) is an open set, there must be a \delta>0 such that B(x_0, \delta) \subseteq f^{-1}(B(f(x_0), \epsilon). This proves the assertion.

\square

Please also refer to some counterexamples illustrating that the image of an open (closed) set under a continuous function does not need to be open (closed).

Appendix

For all German-speaker, I recommend to listen to the following quite illustrative video about metric spaces and topologies.

In addition, the next video introduces open and closed sets in an illustrative manner.

Literature:
[1]

Rudin, W. (1976) Principles of mathematical analysis. 3d ed. New York: McGraw-Hill (International series in pure and applied mathematics).

[2]
Amann, H. and Escher, J. (2010) Analysis. 1: ... 3. Auflage, 2. Nachdruck. Basel: Birkhäuser (Grundstudium Mathematik).