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 is a metric space if is a set and a function such that:
- Distance from it self is zero
- Symmetric function:
- Triangle inequality is satisfied:
Induced topology
If we define the sets to be open, this induces a topology where . This should be easy to verify, but it is mostly uninteresting and quite intuitive (i'm not reasoning like a mathematician now).
Connectedness of
We define the subspace topology of on it's subset 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 such that . We want to build a function that says this gives a contradiction. Let's take two points, and . And let's build a function in the following way:
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 , that are all continuous. But if we have these assumptions we have that for all inputs either or because if it has some values or then by the intermediate value theorem it should take all the values. This contradicts the hypothesis the set is disconnected.