Skip to main content
Mathematics LibreTexts

1.3: Metric spaces

  • Page ID
    23579
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    The notion of metric space provides a rigorous way to say: “we can mea- sure distances between points”. That is, instead of (i) on Section 1.1, we can say “Euclidean plane is a metric space”.

    Definition

    Let \(\mathcal{X}\) be a nonempty set and \(d\) be a function which returns a real number \(d(A, B)\) for any pair \(A, B \in \mathcal{X}\). Then \(d\) is called metric on \(\mathcal{X}\) if for any \(A, B, C \in \mathcal{X}\), the following conditions are satisfied:

    (a) Positiveness:

    \[d(A, B) \ge 0.\]

    (b) \(A = B\) if and only if

    \[d(A, B) = 0.\]

    (c) Symmetry:

    \[d(A, B) = d(B, A)\]

    (d) Triangle inequality:

    \[d(A, C) \le d(A, B) + d(B, C).\]

    A metric space is a set with a metric on it. More formally, a metric space is a pair \((\mathcal{X}, d)\) where \(\mathcal{X}\) is a set and \(d\) is a metric on \(\mathcal{X}\).

    The elements of \(\mathcal{X}\) are called points of the metric space. Given two points \(A, B \in \mathcal{X}\), the value \(d(A, B)\) is called distance from \(A\) to \(B\).

    Example \(\PageIndex{1}\) Discrete metric

    Let \(\mathcal{X}\) be an arbitrary set. For any \(A, B \in \mathcal{X}\), set \(d(A, B) = 0\) if \(A = B\) and \(d(A, B) = 1\) otherwise. The metric \(d\) is called discrete metric on \(\mathcal{X}\).

    Example \(\PageIndex{2}\) Real line

    Set of all real numbers (\(\mathbb{R}\)) with metric \(d\) defined by

    \[d(A, B) := |A - B|.\]

    Exercise \(\PageIndex{1}\)

    Show that \(d(A, B) = |A - B|^2\) is not a metric on \(\mathbb{R}\).

    Metrics on the plane. Suppose that \(\mathbb{R}^2\) denotes the set of all pairs \((x, y)\) of real numbers. Assume \(A = (x_A, y_A)\) and \(B = (x_B, y_B)\). Consider the following metrics on \(\mathbb{R}^2\):

    • Euclidean metric, denoted by \(d_2\), and defined as
      \[d_2(A, B) = \sqrt{(x_A - x_B)^2 + (y_A - y_B)^2}.\]
    • Manhattan metric, denoted by \(d_1\) and defined as
      \[d_1(A, B) = |x_A - x_B| + |y_A - y_B|.\]
    • Maximum metric, denoted by \(d_{\infty}\) and defined as
      \[d_{\infty}(A, B) = \max \{|x_A - x_B|, |y_A - y_B|\}.\]
    Hint

    Check the triangle inequality for \(A = 0\), \(B = 1\) and \(C = 2\).

    Exercise \(\PageIndex{2}\)

    Prove that the following functions are metrics on \(\mathbb{R}^2\):

    (a) \(d_1\);
    (b) \(d_2\);
    (c) \(d_{\infty}\).

    Answer

    Only the triangle inequality requires a proof — the rest of conditions in Definition 1.1 are evident. Let \(A = x_A, y_A)\), \(B = (x_B, y_B)\), and \(C = (x_C, y_C)\). Set

    \(x_1 = x_B - x_A\), \(y_1 = y_B - y_A\),
    \(x_2 = x_C - x_B\), \(y_2 = y_C - y_B\).

    (a). The inequality

    \[d_1(A, C) \le d_1(A, B) + d_1(B, C)\]

    can be written as

    \[|x_1 + x_2| + |y_1 + y_2| \le |x_1| + |y_1| + |x_2| + |y_2|.\]

    The latter follows since \(|x_1 + x_2| \le |x_1| + |x_2|\) and \(|y_1 + y_2| \le |y_1| + |y_2|\).

    (b). The inequality

    \[d_2(A, C) \le d_2 (A, B) + d_2(B, C)\]

    can be written as

    \[\sqrt{(x_1 + x_2)^2 + (y_1 + y_2)^2} \le \sqrt{x_1^2 + y_1^2} + \sqrt{x_2^2 + y_2^2}.\]

    Take the square of the left and the right hand sides, simplify, take the square again and simplify again. You should get the following inequality

    \[0 \le (x_1 \cdot y_2 - x_2 \cdot y_1)^2,\]

    which is equivalent to 1.3.9 and evidently true.

    (c). The inequality

    \[d_{\infty} (A, C) \le d_{\infty} (A, B) + d_{\infty} (B, C)\]

    can be written as

    \[\max \{|x_1 + x_2|, |y_1 + y_2|\} \le \max \{|x_1|, |y_1|\} + \max \{|x_2|, |y_2|\}.\]

    Without loss of generality, we may assume that

    \[\max \{|x_1 + x_2|, |y_1 + y_2|\} = |x_1 + x_2|.\]

    Further,

    \[|x_1 + x_2| \le |x_1| + |x_2| \le \max \{|x_1|, |y_1|\} + \max \{|x_2|, |y_2|\}.\]

    Hence 1.3.13 follows.


    This page titled 1.3: Metric spaces is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by Anton Petrunin via source content that was edited to the style and standards of the LibreTexts platform.