There is a close relationship between topologies and metric spaces. We will see that every metric space directly induces a topology based on its metric. (from a CS point of view, this means topologies are more general than metric spaces).

Definition of Metric Space

🟩 We say that $(\mathcal{X}, d)$ is a metric space if $\mathcal{X}$ is a set and $d$ a function $\mathcal{X} \times \mathcal{X} \to \mathbb{R}$ such that:

  1. Distance from it self is zero $d(a, b) = 0 \iff a = b$
  2. Symmetric function: $d(a, b) = d(b, a), \forall a, b \in \mathcal{X}$
  3. Triangle inequality is satisfied: $\forall a, b, c \in \mathcal{X}: d(a, b) + d(b, c) \geq d(a, c)$

Induced topology

🟩 If we define the sets $B(c, r) = \left\{ p \in \mathcal{X} \mid d(p, c) < r \right\}$ to be open, this induces a topology $(\mathcal{X}, \mathbb{B})$ where $\mathbb{B} := \left\{ B(c, r) \mid c \in \mathcal{X}, r \in\mathbb{R} \right\}$. This should be easy to verify, but it is mostly uninteresting and quite intuitive (i’m not reasoning like a mathematician now).

Connectedness of $\left[ 0, 1 \right]$

🟨 We define the subspace topology of $\mathbb{R}$ on it’s subset $\left[ 0, 1 \right]$ we can prove that this is connected. This is uses the intermediate value theorem see Limiti#Weierstrass e Valore intermedio, the concept is very similar.

Let’s assume the space is disconnected, so there exists two non empty disjoint sets $A, B$ such that $A \cup B = \left[ 0 , 1 \right]$. We want to build a function that says this gives a contradiction. Let’s take two points, $a \in A$ and $b \in B$. And let’s build a function in the following way:

$$ f(x) = \begin{cases} 0 \text{ if } x \in A \\ 1 \text{ if } x \in B \\ \end{cases} $$

We observe that this function is defined for every point in the domain, so it is well defined, and it’s continuous because we have that every set of the domain has a pre-image either $A, B, A \cup B, \varnothing$, that are all continuous. But if we have these assumptions we have that for all inputs either $A = \varnothing$ or $B = \varnothing$ because if it has some values $0$ or $1$ then by the intermediate value theorem it should take all the values. This contradicts the hypothesis the set is disconnected.