Metric spaces are sets on which a metric is defined. A metric is a generalization of the concept of "distance" in the Euclidean sense. Metric spaces arise as a special case of the more general notion of a topological space.
A function $d: M\times M\to \mathbb R$ is called a metric if for all $x,y,z \in M$ we have
- $d(x,y)=0\iff x=y$
- $d(x,y)\geq 0$
- $d(x,y)=d(y,x)$
- $d(x,y)+d(y,z)\geq d(x,z)$.
It is a generalisation of "distance". A metric space is now defined as an ordered pair $(M,d)$, where $M$ is a set and $d:M\times M\to R$ is a metric.
An $\varepsilon$-neighbourhood of $x$ is defined as the set $$B_\epsilon(x):=\{y\in M\mid d(x,y)<\varepsilon\}.$$ $B_\varepsilon(x)$ is commonly also known as the open ball of radius $\varepsilon$ around $x$. All open balls form a base for a topology on $M$. Although all metric spaces are topological spaces, the converse is generally not true.
Some different types of metric space include
Complete metric spaces (every Cauchy sequence converges)
Bounded metric spaces (every metric is bounded by a finite value)
Compact metric spaces (every sequence has a convergent subsequence)
Locally compact metric spaces (every point has a compact neighbourhood)
Separable metric spaces (it possesses a countable dense subset).