Euclidean Distance

# Euclidean Distance

Recall from The Euclidean Norm page that if $\mathbf{x} = (x_1, x_2, ..., x_n) \in \mathbb{R}^n$ then the Euclidean norm of $\mathbf{x}$ denoted $\| \mathbf{x} \|$ is defined to be:

(1)
\begin{align} \quad \| \mathbf{x} \| = \sqrt{\mathbf{x} \cdot \mathbf{x}} = \left ( \sum_{i=1}^{n} x_i^2 \right )^{1/2} \end{align}

With the concept of the Euclidean norm, we can somewhat naturally extend the definition of Euclidean distance (which we familiar with for $n = 1, 2, 3$) into higher dimensions.

 Definition: If $\mathbf{x} = (x_1, x_2, ..., x_n), \mathbf{y} = (y_1, y_2, ..., y_n) \in \mathbb{R}^n$ then the Euclidean Distance between $\mathbf{x}$ and $\mathbf{y}$ is defined to be $\| \mathbf{x} - \mathbf{y} \|$.

Notice that if $n = 1$ then the Euclidean distance between the numbers $x, y \in \mathbb{R}$ on the real number line is what we desire:

(2)
\begin{align} \quad \| x - y \| = \sqrt{(x - y)^2} = \mid x - y \mid \end{align}

Furthermore, if $n = 2$ then the Euclidean distance between the points $\mathbf{x} = (x_1, x_2), \mathbf{y} = (y_1, y_2) \in \mathbb{R}^2$ is:

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

In general, for any positive integer $n$ we see that the Euclidean distance between $\mathbf{x} = (x_1, x_2, ..., x_n)$ and $\mathbf{y} = (y_1, y_2, ..., y_n)$ is given to be:

(4)
\begin{align} \quad \| \mathbf{x} - \mathbf{y} \| = \sqrt{(x_1 - y_1)^2 + (x_2 - y_2)^2 + ... + (x_n - y_n)^2} = \left ( \sum_{i=1}^{n} (x_i - y_i)^2 \right )^{1/2} \end{align}

Let's now look at an example. Consider the points $\mathbf{x} = (0, 3, 0, 2), \mathbf{y} = (1, 1, 3, 4) \in \mathbb{R}^4$. then we have that:

(5)
\begin{align} \quad \| \mathbf{x} - \mathbf{y} \| = \sqrt{(0 - 1)^2 + (3 - 1)^2 + (0 - 3)^2 + (2 - 4)^2} = \sqrt{1 + 4 + 9 + 4} = \sqrt{18} \end{align}

Let's now look at a very simple theorem which gives us a very intuitively important property in that the distance between a point $\mathbf{x}$ and a point $\mathbf{y}$ should equal the distance between $\mathbf{y}$ and $\mathbf{x}$.

 Theorem 1: If $\mathbf{x} = (x_1, x_2, ..., x_n), \mathbf{y} = (y_1, y_2, ..., y_n) \in \mathbb{R}^n$ then $\| \mathbf{x} - \mathbf{y} \| = \| \mathbf{y} - \mathbf{x} \|$.
• Proof: Let $\mathbf{x}, \mathbf{y} \in \mathbb{R}^n$.
(6)
\begin{align} \quad \| \mathbf{x} - \mathbf{y} \| = \left ( \sum_{i=1}^{n} (x_i - y_i)^2 \right )^{1/2} \end{align}
• Note that for all $a, b \in \mathbb{R}$ that:
(7)
\begin{align} \quad (a - b)^2 = a^2 - 2ab + b^2 = b^2 - 2ba + a^2 = (b - a)^2 \end{align}
• Hence we have that:
(8)
\begin{align} \quad \left ( \sum_{i=1}^{n} (x_i - y_i)^2 \right )^{1/2} = \left ( \sum_{i=1}^{n} (y_i - x_i)^2 \right )^{1/2} = \| \mathbf{y} - \mathbf{x} \| \quad \blacksquare \end{align}