Metric Spaces
Table of Contents

Metric Spaces

Before we formally define what a metric space is, we will begin by defining what a metric is, for which the definition of a metric space arises naturally.

Definition: Let $M$ be a set. A function $d : M \times M \to [0, \infty)$ is called a Metric if $d$ has the following properties:
1. For all $x, y \in M$, $d(x, y) = d(y, x)$.
2. For all $x, y \in M$, $d(x, y) = 0$ if and only if $x = y$.
3. For all $x, y, z \in M$, $d(x, y) \leq d(x, z) + d(z, y)$.
Furthermore, for any points $x, y \in M$ we say the nonnegative real number $d(x, y)$ is the Distance between $x$ and $y$ (with respect to the metric $d$).

The term "distance function" is also often used interchangeably with "metric".

We are now able to define a metric space.

Definition: A Metric Space $(M, d)$ is a set $M$ with a metric $d : M \times M \to [0, \infty)$.

Sometimes we may simplify the notation and just say "M" is a metric space. Regardless of the notation, when we say $(M, d)$ is a metric space this will imply that the metric $d : M \times M \to [0, \infty)$ satisfies the three properties above.

There are many examples of metric spaces. For example, consider the set of real numbers $\mathbb{R}$ and the function $d : M \times M \to M$ defined for all $x, y \in \mathbb{R}$ by:

\begin{align} \quad d(x, y) = \mid x - y \mid \end{align}

To verify that $(\mathbb{R}, d)$ is a metric space we only need to verify that the function $d$ satisfies the conditions for being a metrix. Clearly the first condition holds since for all $x, y \in \mathbb{R}$ we have that $\mid x - y \mid = \mid y - x \mid$. Furthermore, suppose that $d(x, y) = 0$. Then $\mid x - y \mid = 0$, but we know this happens if and only if $x - y = 0$, so $x = y$. Now suppose that $x = y$. Then $x - y = 0$ and $d(x, y) = \mid x - y \mid = 0$ so the second condition holds. Lastly, let $x, y, z \in \mathbb{Z}$. Then from the triangle inequality we have that:

\begin{align} \quad d(x, y) = \mid x - y \mid = \mid x - z + z - y \mid \leq \mid x - z \mid + \mid z - y \mid = d(x, z) + d(z, y) \end{align}

Therefore the third condition holds and $(\mathbb{R}, d)$ is a metric space.

Now consider the set $\mathbb{R}^2 = \{ (x_1, x_2) : x_1, x_2 \in \mathbb{R} \}$ and define the function $d : \mathbb{R}^2 \times \mathbb{R}^2 \to [0, \infty)$ for all $x = (x_1, x_2), y = (y_1, y_2) \in \mathbb{R}^2$ by:

\begin{align} \quad d(x, y) = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2} \end{align}

Let's verify that $d$ is a metric. For the first condition, note that for all $a, b \in \mathbb{R}$ we have that:

\begin{align} \quad (a - b)^2 = a^2 - 2ab + b^2 = b^2 - 2ab - a^2 = (b - a)^2 \end{align}

Therefore we see that $(x_2 - x_1)^2 = (x_1 - x_2)^2$ and $(y_2 - y_1)^2 = (y_1 - y_2)^2$. Therefore:

\begin{align} \quad d(x, y) = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2} = \sqrt{(x_1 - x_2)^2 + (y_1 - y_2)^2} = d(y, x) \end{align}

Now for the second condition, suppose that $d(x, y) = 0$. Then:

\begin{align} \quad d(x, y) = 0 \\ \quad \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2} = 0 \\ \quad (x_2 - x_1)^2 + (y_2 - y_1)^2 = 0 \end{align}

Since $(x_2 - x_1)^2, (y_2 - y_1)^2 \geq 0$, we must have that $(x_2 - x_1)^2 = 0$ and $(y_2 - y_1)^2 = 0$, i.e., $x_2 - x_1 = 0$ and $y_2 - y_1 = 0$. Therefore $x_1 = x_2$ and $y_1 = y_2$ so $x = (x_1, x_2) = (y_1, y_2) = y$.

If $(M, d)$ is a metric space, we can obtain another metric space using the metric $d$ by pairing any nonempty subset $S \subseteq M$ with the metric $d$ to obtain $(S, d)$. Such metric spaces are given a special name which we define below.

Definition: If $(M, d)$ is a metric space and $S \subseteq M$ then $(S, d)$ is said to be a corresponding Metric Subspace of $(M, d)$.

If instead we are talking about any general subset of a metric space $S \subseteq M$ without regarding to the induced metric subspace $(S, d)$ then we will often use the term "set" in place of "subset". For example, we will later talk about open sets of a metric space which we really imply open subsets of a metric space.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License