Section The Euclidean Metric on \(\R^n\)
The metric space that is most familiar to us is the metric space \((\R^2, d_E)\text{,}\) where
\begin{equation*}
d_E((x_1,x_2), (y_1,y_2)) = \sqrt{(x_1-y_1)^2 + (x_2-y_2)^2}
\end{equation*}
The metric \(d_E\) called the standard or Euclidean metric on \(\R^2\text{.}\)
We can generalize this Euclidean metric from \(\R^2\) to any dimensional real space. Let \(n\) be a positive integer and let \(x = (x_1, x_2, \ldots,
x_n)\) and \(y = (y_1, y_2, \ldots,
y_n)\) be in \(\R^n\text{.}\) We define \(d_E : \R^n \times \R^n \to \R\) by
\begin{equation*}
d_E(x,y) = \sqrt{(x_1-y_1)^2 + (x_2-y_2)^2 + \cdots (x_n-y_n)^2} = \sqrt{\sum_{i=1}^n (x_i-y_i)^2}\text{.}
\end{equation*}
In the next activity we will show that \(d_E\) satisfies the first three properties of a metric.
Activity 3.3.
Let \(x = (x_1, x_2, \ldots,
x_n)\) and \(y = (y_1, y_2, \ldots,
y_n)\) be in \(\R^n\text{.}\)
(a)
Show that \(d_E(x,y) \geq 0\text{.}\)
(b)
Show that \(d_E(x,y) = d_E(y,x)\text{.}\)
(c)
Show that if \(x=y\text{,}\) then \(d_E(x,y) = 0\text{.}\)
(d)
Show that if \(d_E(x,y) = 0\text{,}\) then \(x=y\text{.}\)
Proving that the triangle inequality is satisfied is often the most difficult part of proving that a function is a metric. We will work through this proof with the help of the Cauchy-Schwarz Inequality.
Lemma 3.9. Cauchy-Schwarz Inequality.
Let \(n\) be a positive integer and \(x = (x_1, x_2, \ldots,
x_n)\text{,}\) \(y=(y_1, y_2, \ldots, y_n)\) be in \(\R^n\text{.}\) Then
\begin{equation}
\sum_{i=1}^n x_iy_i \leq \left(\sqrt{\sum_{i=1}^n x_i^2}\right) \left(\sqrt{\sum_{i=1}^n y_i^2}\right)\text{.}\tag{3.1}
\end{equation}
Activity 3.4.
Before we prove the Cauchy-Schwarz Inequality, let us analyze it in two specific situations.
(a)
Let \(x=(1,4)\) and \(y = (3,2)\) in \(\R^2\text{.}\) Verify the Cauchy-Schwarz Inequality in this case.
(b)
Let \(x=(1,2, -3)\) and \(y = (-4, 0, -1)\) in \(\R^3\text{.}\) Verify the Cauchy-Schwarz Inequality in this case.
Now we prove the Cauchy-Schwarz Inequality.
Proof.
Let
\(n\) be a positive integer and
\(x = (x_1, x_2, \ldots,
x_n)\text{,}\) \(y=(y_1, y_2, \ldots, y_n)\) be in
\(\R^n\text{.}\) To verify
(3.1) it suffices to show that
\begin{equation*}
\left(\sum_{i=1}^n x_iy_i\right)^2 \leq \left(\sum_{i=1}^n x_i^2\right) \left(\sum_{i=1}^n y_i^2\right)\text{.}
\end{equation*}
This is difficult to do directly, but there is a nice trick one can use. Consider the expression
\begin{equation*}
\sum (x_i-\lambda y_i)^2\text{.}
\end{equation*}
(All of our sums are understood to be from 1 to \(n\text{,}\) so we will omit the limits on the sums for the remainder of the proof.) Now
\begin{align}
0 \amp \leq \sum (x_i-\lambda y_i)^2\notag\\
\amp = \sum \left(x_i^2 - 2\lambda x_iy_i + \lambda^2 y_i^2 \right)\notag\\
\amp = \left( \sum y_i^2 \right)\lambda^2 - 2\left(\sum x_iy_i\right) \lambda + \left(\sum x_i^2\right)\text{.}\tag{3.2}
\end{align}
To interpret this last expression more clearly, let
\(a=\sum y_i^2\text{,}\) \(b=-2\sum x_iy_i\) and
\(c = \sum x_i^2\text{.}\) The inequality defined by
(3.2) can then be written in the form
\begin{equation*}
p(\lambda) = a \lambda^2 + b \lambda + c \geq 0\text{.}
\end{equation*}
So we have a quadratic \(p(\lambda)\) that is never negative. This implies that the quadratic \(p(\lambda)\) can have at most one real zero. The quadratic formula gives the roots of \(p(\lambda)\) as
\begin{equation*}
\frac{-b \pm \sqrt{b^2-4ac}}{2a}\text{.}
\end{equation*}
If \(b^2-4ac \gt 0\text{,}\) then \(p(\lambda)\) has two real roots. Therefore, in order for \(p(\lambda)\) to have at most one real zero we must have
\begin{equation*}
0 \geq b^2-4ac = 4 \left(\sum x_iy_i\right)^2 - 4\left(\sum y_i^2\right)\left(\sum x_i^2\right)
\end{equation*}
or
\begin{equation*}
\left(\sum y_i^2\right)\left(\sum x_i^2\right) \geq \left(\sum x_iy_i\right)^2\text{.}
\end{equation*}
This establishes the Cauchy-Schwarz Inequality.
One consequence of the Cauchy-Schwarz Inequality that we will need to show that \(d_E\) is a metric is the following.
Corollary 3.10.
Let \(n\) be a positive integer and \(x = (x_1, x_2, \ldots,
x_n)\text{,}\) \(y=(y_1, y_2, \ldots, y_n)\) be in \(\R^n\text{.}\) Then
\begin{equation*}
\sqrt{\sum_{i=1}^n (x_i+y_i)^2} \leq \sqrt{\sum_{i=1}^n x_i^2} + \sqrt{\sum_{i=1}^n y_i^2}\text{.}
\end{equation*}
Activity 3.5.
Before we prove the corollary, let us analyze it in two specific situations.
(a)
Let
\(x=(1,4)\) and
\(y = (3,2)\) in
\(\R^2\text{.}\) Verify
Corollary 3.10 in this case.
(b)
Let
\(x=(1,2, -3)\) and
\(y = (-4, 0, -1)\) in
\(\R^3\text{.}\) Verify
Corollary 3.10 in this case.
Proof.
Let \(n\) be a positive integer and \(x = (x_1, x_2, \ldots,
x_n)\text{,}\) \(y=(y_1, y_2, \ldots, y_n)\) be in \(\R^n\text{.}\) Now
\begin{align*}
\sum \left(x_i+y_i\right)^2 \amp = \sum \left(x_i^2 +2x_iy_i + y_i^2 \right)\\
\amp = \sum x_i^2 + 2\sum x_iy_i + \sum y_i^2\\
\amp \leq \sum x_i^2 + 2\left(\sqrt{\sum x_i^2}\right) \left(\sqrt{\sum y_i^2} \right) + \sum y_i^2\\
\amp = \left(\sqrt{\sum x_i^2} + \sqrt{\sum y_i^2}\right)^2\text{.}
\end{align*}
Taking the square roots of both sides yields the desired inequality.
We can now complete the proof that \(d_E\) is a metric.
Activity 3.6.
Let
\(n\) be a positive integer and
\(x = (x_1, x_2, \ldots,
x_n)\text{,}\) \(y=(y_1, y_2, \ldots, y_n)\text{,}\) and
\(z=(z_1, z_2, \ldots, z_n)\) be in
\(\R^n\text{.}\) Use
Corollary 3.10 to show that
\begin{equation*}
d_E(x,y) \leq d_E(x,z)+d_E(z,y)\text{.}
\end{equation*}
This concludes our proof that the Euclidean metric is in fact a metric.
We have seen several metrics in this section, some of which are given special names. Let \(x = (x_1, x_2, \ldots,
x_n)\) and \(y = (y_1, y_2, \ldots, y_n)\)
The Euclidean metric \(d_E\text{,}\) where
\begin{align*}
d_E(x,y) \amp = \sqrt{(x_1-y_1)^2 + (x_2-y_2)^2 + \cdots (x_n-y_n)^2}\\
\amp = \sqrt{\sum_{i=1}^n (x_i-y_i)^2}\text{.}
\end{align*}
The Taxicab metric \(d_T\text{,}\) where
\begin{equation*}
d_T(x,y) = |x_1-y_1| + |x_2-y_2| + \cdots + |x_n-y_n| = \sum_{i=1}^n \{|x_i-y_i|\}\text{.}
\end{equation*}
The max metric \(d_M\text{,}\) where
\begin{align*}
d_M(x,y) \amp = \max\{| x_1-y_1 |, | x_2-y_2 |, |x_3-y_3|, \ldots, |x_n-y_n| \}\\
\amp = \max_{1 \leq i \leq n} \{|x_i-y_i|\}\text{.}
\end{align*}
We have only shown that
\(d_T\) and
\(d_M\) are metrics on
\(\R^2\text{,}\) but similar arguments apply in
\(\R^n\text{.}\) Proofs are left to
Exercise 5 and
Exercise 6. In addition, the
discrete metric
\begin{equation*}
d(x,y) = \begin{cases}0 \amp \text{ if } x=y \\ 1 \amp \text{ if } x \neq y \end{cases}
\end{equation*}
makes any set
\(X\) into a metric space. The proof is left to
Exercise 1.