1.1 Definition and Examples of Metric Spaces

Definition 1.1.1. Let X be a non-empty set. A function \(d:X\times X\rightarrow \mathbb {R}\) is called a metric if it satisfies the following for all \(x,y,z\in X\),

i
\(d(x,y)\geq 0\)
ii
\(d(x,y)=0\) if and only if \(x=y\)
iii
\(d(x,y)=d(y,x)\)
iv
\(d(x,z)\leq d(x,y)+d(y,z)\) (triangle inequality)

The pair \((X,d)\) is called a metric space.

Example 1.1.2. The function \(d(x,y)=|x-y|\) defines a metric on \(\mathbb {R}\). This is called the usual metric on \(\mathbb {R}\).

Proof. By definition, the absolute value on \(\mathbb {R}\) is non-negative. Therefore
\(d(x,y)=|x-y|\geq 0\). Now since \(|x-y|=0\) if and only if \(x=y\). It follows that \(d(x,y)=0\) if and only if \(x=y\). To verify the third axiom, we have
\(d(x,y)=|x-y|=|-(x-y)|=|y-x|=d(y,x)\).
To verify the triangle inequality. Suppose that \(x,y,z\in X\) then
\(d(x,y)=|x-z|=|x-y+y-z|\leq |x-y|+|y-z|=d(x,y)+d(y,z)\)

Thus, \((\mathbb {R},d)\) is a metric space.

Example 1.1.3. The modulus function \(d(z_1,z_2)=|z_1-z_2|\) defines a metric on \(\mathbb {C}\).

In order to prove the next example,the following theorem is required.

Theorem 1.1.4 (Minkowski’s Inequality). Let \(\iota ^2\) be the set of all sequences of real numbers satisfying \(\sum \limits ^{\infty }_{n=1} a^2_n < \infty \). If \(x=(x_n), y=(y_n) \in \ell ^2\), then \(x+y=(x_n+y_n)\in \ell ^2\) and \[\Bigg [\sum \limits ^{\infty }_{n=1} (x_n+y_n)\Bigg ]^{1/2} \leq \Bigg [\sum \limits _{n=1}^{\infty } x^2_n\Bigg ]^{1/2}+\Bigg [\sum \limits _{n=1}^{\infty } y^2_n\Bigg ]^{1/2}\]


Example 1.1.5. The following functions define metrics on \(\mathbb {R}^2\)

i
\(d_1(x,y)=|x_1-y_1|+|x_2-y_2|\), where \(x=(x_1,x_2), y=(y_1,y_2)\in \mathbb {R}^2\)
ii
\(d_2(x,y)=\sqrt {(x_1-y_1)^2 +(x_2-y_2)^2}\)
iii
\(d_3(x,y)=\max \{|x_1-y_1|,|x_2-y_2|\}\)

Proof.

i
Since \(d_1\) is the sum of the absolute value function on \(\mathbb {R}^2\), it is non-negative and \(d_1=|x_1-y_1|+|x_2-y_2| \geq 0\) for all \(x,y\in \mathbb {R}^2\).
To verify that \(d_1(x,y)=0\) if and only if \(x=y\), we have that
\(|x_1-y_1|+|x_2-y_2|=0\) if and only if \(x_1=y_1\) and \(x_2=y_2\). This implies that \(d_1(x,y)=0\) if and only if \(x=y\).
We show that \(d_1(x,y)=d_2(y,x)\) for all \(x,y\in \mathbb {R}^2\). We have that \begin {align*} d_1(x,y) & =|x_1-y_1|+|x_2-y_2|=|-(y_1-x_1)|+|-(y_2-x_2)|\\ & =|y_1-x_1|+|y_2-x_2|\\ & = d_1(y,x) \end {align*}

Finally, we prove that the triangle inequality holds.
Let \(x=(x_1,x_2), y=(y_1,y_2), z=(z_1,z_2)\in \mathbb {R}^2\). Then \begin {align*} d_1(x,z) &=|x_1-z_1|+|x_2-z_2|\\ &=|x_1-y_1+y_1-z_1|+|x_2-y_2+y_2-z_2|\\ &\leq |x_1-y_1|+|y_1-z_1|+|x_2-y_2|+|y_2-z_2|\\ &=(|x_1-y_1|+|x_2-y_2|) +(|y_1-z_1|+|y_2-z_2|)\\ &=d_1(x,y)+d_1(y,z) \end {align*}

ii
For any \(x=(x_1,x_2), y=(y_1,y_2)\in \mathbb {R}^2\).
we have that \(\sqrt {(x_1-y_1)^2+(x_2-y_2)^2}\geq 0\) so that \(d_2(x,y)\geq 0\).
Also, \((x_1-y_1)^2+(x_2-y_2)^2=0\) if and only if \(x_1-y_1=0\) and \(x_2-y_2=0\). In other words \((x_1-y_1)^2+(x_2-y_2)^2=0\) if and only if \(x_1=y_1\) and \(x_2=y_2\). This means that \(d_2(x,y)=0\) if and only if \(x=y\).
To show that \(d_2(x,y)=d_2(y,x)\), we just observe that
\((x_1-y_1)^2=(-(-x_1+y_1))^2=(y_1-x_1)^2\) and
\((x_2-y_2)^2=(-(-x_2+y_2))^2=(y_2-x_2)^2\).This imply that

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

To verify the triangle inequality, let \(x=(x_1,x_2), (y_1,y_2), (z_1,z_2)\in \mathbb {R}^2\). Then \begin {align*} d_2(x,z) &=\sqrt {(x_1-z_1)^2+(x_2-z_2)^2}\\ &=\sqrt {(x_1-y_1+y_1-z_1)^2+(x_2-y_2+y_2-z_2)^2}\\ &=\sqrt {(a_1+b_1)^2+(a_2+b_2)^2} \end {align*}

where \(a_1=x_1-y_1\), \(b_1=y_1-z_1\), \(a_2=x_2-y_2\), \(b_2=y_2-z_2\).
By applying Minkowski’s inequality, we obtain that \[\sqrt {(a_1+b_1)^2+(a_2+b_2)^2}\leq \sqrt {a^2_1 +a_2^2}+\sqrt {b_1^2+b_2^2}\] Substituting for \(a_1,a_2,b_1,b_2\) we obtain that \[d_2(x,z)\leq d_2(x,y)+d_2(y,z).\]

iii
If \(x=(x_1,x_2), y=(y_1,y_2) \in \mathbb {R}^2\), we see that \(|x_1-y_1|\geq 0\) and \(|x_2-y_2|\geq 0\) so that \(d_3(x,y)=\max \{|x_1-y_1|,|x_2-y_2|\}\geq 0\).
Also, \(\max \{|x_1-y_1|,|x_2-y_2|\}=0\) if and only if \(|x_1-y_1|=0\) and \(|x_2-y_2|=0\), which means that \(\max \{|x_1-y_1|,|x_2-y_2|\}=0\) if and only if \(x_1=y_1\) and \(x_2=y_2\). Thus \(d_3=0\) if and only if \(x=y\).
We show that \(d_3(x,y)=d_3(y,x)\). Since \[\max \{|x_1-y_1|,|x_2-y_2|\}=\max \{|y_1-x_1|,|y_2-x_2|\}\] we have that \(d_3(x,y)=d_3(y,x)\).
To show the triangle inequality holds, let \(x=(x_1,x_2), y=(y_1,y_2),\\ z=(z_1,z_2)\in \mathbb {R}^2\). Then \begin {align*} d_3(x,z) &=\max \{|x_1-z_1|,|x_2-z_2|\}\\ &=\max \{|x_1-y_1+y_1-z_1|,|x_2-y_2+y_2-z_2|\}\\ &\leq \max \{|x_1-y_1|+|y_1-z_1|,|x_2-y_2|+|y_2-z_2|\}\\ &\leq \max \{|x_1-y_1|,|x_2-y_2|\} +\max \{|y_1-z_1|,|y_2-z_2|\}\\ &=d_3(x,y) +d_3(y,z). \end {align*}

Example 1.1.6. The function \(d(x,y)=\sum \limits _{n=1}^{\infty } |x_n-y_n|\) defines a metric on the set \(\ell \) of sequences of real numbers with the property \(\sum \limits ^{\infty }_{n=1} |x_n| <\infty \).

Proof. Let \(x=(x_n),y=(y_n)\in \ell \). Since \(|x_n-y_n|\geq 0\) for all \(n\in \mathbb {N}\), we obtain that \(d(x,y)=\sum \limits ^{\infty }_{n=1} |x_n-y_n|\geq 0\). Also since \(|x_n-y_n|=0\) if and only if \(x_n=y_n\), it follows that \(d(x,y)=0\) if and only if \(x=y\).
From \(|x_n-y_n|=|-(-x_n+y_n)|=|y_n-x_n|\), we get that \(d(x,y)=d(y,x)\).
To verify the triangle inequality, let \(x=(x_n), y=(y_n), z=(z_n)\in \ell \). From properties of the absolute value on the set of real numbers, we have that \begin {align*} \sum ^n_{k=1} |x_k-z_k| &=\sum _{k=1}^n |x_k-y_k+y_k-z_k|\\ &\leq \sum ^n_{k=1} |x_k-y_k| +\sum ^n_{k=1} |y_k-z_k| \end {align*}

Taking limits on both sides as \(n\rightarrow \infty \), we obtain that
\(\sum \limits ^{\infty }_{k=1} |x_k-z_k|\leq \sum \limits _{k=1}^{\infty } |x_k-y_k|+\sum \limits ^{\infty }_{k=1} |y_k-z_k|.\) Hence \(d(x,z)\leq d(x,y)+d(y,z)\).

Example 1.1.7. The function \(d(x,y)=\sum \limits ^{\infty }_{n=1} \dfrac {1}{2^n}\,\dfrac {|x_n-y_n|}{1+|x_n-y_n|}\) defines a metric on the set \(\mathbb {R}^{\mathbb {N}}\) of sequences of real numbers.

Proof. Let \(x=(x_n), y=(y_n)\in \mathbb {R}^{\mathbb {N}}\). Using the properties of the absolute value on the set of real numbers, the properties \(d(x,y)\geq 0\), \(d(x,y)=0\) if and only if \(x=y\) and \(d(x,y)=d(y,x)\) are easily established.
Let \(x=(x_n), y=(y_n), z=(z_n)\in \mathbb {R}^{\mathbb {N}}\). To verify that the triangle inequality holds we prove the inequality \(\dfrac {|a+b|}{1+|a+b|}\leq \dfrac {|a|}{1+|a|}+\dfrac {|b|}{1+|b|}\)
From the fact that \(\dfrac {1}{|a|+|b|}<\dfrac {1}{|a+b|}\), it follows that
\begin {align*} \frac {|a+b|}{1+|a+b|} &=\frac {1}{1+\dfrac {1}{|a+b|}}\\ &\leq \frac {1}{1+\dfrac {1}{|a|+|b|}}=\frac {|a|+|b|}{1+|a|+|b|}\\\\ &=\frac {|a|}{1+|a|+|b|}+\frac {|b|}{1+|a|+|b|}\\\\ &\leq \frac {|a|}{1+|a|}+\frac {|b|}{1+|b|} \end {align*}

Therefore, \(\dfrac {|a+b|}{1+|a+b|}\leq \dfrac {|a|}{1+|a|}+\dfrac {b}{1+b}\), if we take \(a=x_n-y_n\) and
\(b=y_n-z_n\) in this inequality, we obtain that \[\frac {|x_n-z_n|}{1+|x_n-z_n|}\leq \frac {|x_n-y_n|}{1+|x_n-y_n|}+\frac {|y_n-z_n|}{1+|y_n-z_n|}\] from which it follows that \(d(x,z)\leq d(x,y)+d(y,z)\).

Note that alternatively, one can use the fact that \(f(x)=\dfrac {x}{1+x}\) is a
monotone increasing function to prove the last example.


Example 1.1.8. If X is any non-empty set, the map \(d:X\times X\rightarrow \mathbb {R}\) given by
\[ d(x,y)= \begin {cases} 1 & \text {if}\hspace {0.2cm} x\neq y\\ 0 & \text {if}\hspace {0.2cm} x=y \end {cases} \] defines a metric on X. This is called the discrete metric on X.

Proof. By definition \(d(x,y)\geq 0\), \(d(x,y)=0\), if and only if \(x=y\) and
\(d(x,y)=d(y,x)\) for all \(x,y\in X\).
To show that the triangle inequality holds, let \(x, y,z\in X\). if \(x=z\), then \(d(x,z)=0\) and \(d(x,z)\leq d(x,y)+d(y,z)\) holds. Suppose that \(x\neq z\). If \(y=z\), then \(x\neq y\), so that \(d(x,z)=1\), \(d(x,y)=1\) and \(d(y,z)=0\). Thus \(d(x,z)\leq d(x,y)+d(y,z)\). If \(y\neq z\) then \(d(x,z)=1\), \(d(y,z)=1\), which imply that \(d(x,z)\leq d(x,y)+d(y,z)\).


Questions on this section

Stuck on something here? Ask below and it stays attached to this topic.