Metric Space
What is a metric space?
A metric space is a pair \( (X, d) \), where \( X \) is a set and \( d \) is a function (called a metric) that assigns a non-negative real number to every pair of points \( x, y \in X \), denoted \( d(x, y) \), which represents the distance between \( x \) and \( y \). This is usually written as \( (X, d) \). $$ (X,d) $$
The metric must satisfy the following properties:
- Non-negativity: \( d(x, y) \geq 0 \) for all \( x, y \in X \), and \( d(x, y) = 0 \) if and only if \( x = y \) (the distance from a point to itself is zero, and the distance between two distinct points is strictly positive).
- Symmetry: \( d(x, y) = d(y, x) \) for all \( x, y \in X \) (the distance from \( x \) to \( y \) is the same as from \( y \) to \( x \)).
- Triangle inequality: \( d(x, y) + d(y, z) \geq d(x, z) \) for all \( x, y, z \in X \) (the direct distance between two points is always less than or equal to the sum of the distances through a third point).
In short, a metric space provides a mathematical structure that allows us to measure the distances between points in a set, enabling us to rigorously explore geometric concepts such as continuity, convergence, and compactness.
Put simply, a metric space is a set X with a distance function d.
This set can be anything from a basic collection of points to a full vector space.
A practical example
A classic example of a metric space is Euclidean space in \( \mathbb{R}^n \), which refers to the set of points in the plane (when \( n = 2 \)) or in three-dimensional space (when \( n = 3 \)).
Consider \( \mathbb{R}^2 \), the Cartesian plane.
The Euclidean metric \( d \) is defined for two points \( p = (p_1, p_2) \) and \( q = (q_1, q_2) \) as:
$$ d(p, q) = \sqrt{(p_1 - q_1)^2 + (p_2 - q_2)^2} $$
This formula gives the Euclidean distance, which is the straight-line distance between two points \( p \) and \( q \) in the plane.
This definition satisfies the properties of a metric:
- Non-negativity: The square root is always non-negative, and \( d(p, q) = 0 \) if and only if \( p_1 = q_1 \) and \( p_2 = q_2 \), meaning \( p = q \).
- Symmetry: We have \( d(p, q) = d(q, p) \) because \( (p_1 - q_1)^2 \) is equal to \( (q_1 - p_1)^2 \), meaning the distance is the same no matter the order of the points.
- Triangle inequality: The direct distance between two points is always less than or equal to the sum of the distances through a third point, as can be verified using the Pythagorean theorem and other properties of Euclidean geometry.
In conclusion, the space \( (\mathbb{R}^2, d) \), where \( d \) is the Euclidean metric, is an example of a metric space.
The distance function or metric
What is the distance function?
The distance (or metric) is a function \( d(x_1, x_2) \) such that:
\( d(x_1, x_2) \geq 0 \)
\( d(x_1, x_2) = 0 \) if and only if \( x_1 = x_2 \)
\( d(x_1, x_2) = d(x_2, x_1) \)
\( d(x_1, x_2) \leq d(x_1, x_3) + d(x_3, x_2) \)
for all \( x_1, x_2, x_3 \in X \).
Types of distances
There are several different distance functions, not just one.
Euclidean distance
$$ d_2(x, y) := \sqrt{ \sum{(x_i - y_i)^2 } } $$
This is the most common distance because it's the foundation of Euclidean geometry.
Manhattan distance
This distance is fundamental in taxi geometry. It’s called "Manhattan distance" because, just like navigating a city grid, you can't move diagonally between buildings.
$$ d_1(x_1, x_2) := \sum{ |x_i - y_i| } $$
Discrete distance
In this case, the distance is always 1 unless the two points \( x \) and \( y \) are the same, in which case the distance is 0.
$$ d(x, y) := \begin{cases} 0 \:\:\: if \: x = y \\ 1 \:\:\: if \: x \ne y \end{cases} $$
Distance induced by a norm
The norm always induces a distance function.
In such cases, the distance is known as the induced distance.
$$ ||v|| := d(v, 0_V) $$
The length of a vector is simply the distance from the origin.
Thus, if a vector space has a norm, it is also a metric space.
Note. However, the reverse is not always true. A distance function may not necessarily be associated with a norm.
Properties of the induced distance
A distance is said to be induced if it satisfies the following conditions:
\( d(v_1 + v_3, v_2 + v_3) = d(v_1, v_2) \)
\( d(k \cdot v_1, k \cdot v_2 ) = |k| \cdot d(v_1, v_2) \)
Where \( v_1, v_2, v_3 \) are vectors in vector space \( V \) and \( k \) is a scalar \( k \in K \).
Example
Using this definition, it's easy to demonstrate that the Euclidean norm induces the Euclidean distance because it meets the conditions above.
Let's take three vectors \( v_1, v_2, v_3 \) in Euclidean space
$$ v_1 = (6,8) \\ v_2 = (3,4) \\ v_3 = (3,0) $$
The vectors have the following norms:
$$ ||v_1||_2 = \sqrt{6^2 + 8^2} = \sqrt{100} = 10 $$ $$ ||v_2||_2 = \sqrt{3^2 + 4^2} = \sqrt{25} = 5 $$ $$ ||v_3||_2 = \sqrt{3^2 + 0^2} = \sqrt{9} = 3 $$
Therefore, they have the following induced distances:
$$ ||v_1||_2 = d(v_1, 0_v) = 10 $$ $$ ||v_2||_2 = d(v_2, 0_v) = 5 $$ $$ ||v_3||_2 = d(v_3, 0_v) = 3 $$
According to the definition, $$ ||v|| = d(v, 0_v) $$ holds if the following conditions are satisfied:
1] \( d(v_1 + v_3, v_2 + v_3) = d(v_1, v_2) \)
2] \( d(k \cdot v_1, k \cdot v_2) = |k| d(v_1, v_2) \)
Let’s verify these two conditions.
First condition
$$ d(v_1 + v_3, v_2 + v_3) = d(v_1, v_2) $$ $$ d(10 + 3, 5 + 3) = d(10, 5) $$ $$ d(13, 8) = d(10, 5) $$
The distance on the left-hand side is
$$ d(13, 8) = \sqrt{(13 - 8)^2} = \sqrt{5^2} = \sqrt{25} = 5 $$
The distance on the right-hand side is
$$ d(10, 5) = \sqrt{(10 - 5)^2} = \sqrt{5^2} = \sqrt{25} = 5 $$
Therefore
$$ d(13, 8) = d(10, 5) = 5 $$
The first condition is satisfied.
Second condition
$$ d(k \cdot v_1, k \cdot v_2) = |k| \cdot d(v_1, v_2) $$ $$ d(k \cdot 10, k \cdot 5) = |k| \cdot d(10, 5) $$
Let's take \( k = 2 \).
$$ d(2 \cdot 10, 2 \cdot 5) = |2| \cdot d(10, 5) $$ $$ d(20, 10) = |2| \cdot d(10, 5) $$
Where
$$ d(20, 10) = \sqrt{(20 - 10)^2} = \sqrt{10^2} = 10 $$
and
$$ |2| \cdot d(10, 5) = 2 \cdot \sqrt{(10 - 5)^2} = 2 \cdot 5 = 10 $$
Thus
$$ d(k \cdot 10, k \cdot 5) = |k| \cdot d(10, 5) = 10 \:\:\: with \:\: k = 2 $$
The second condition is also satisfied.
We’ve now shown that in Euclidean space, the distance is induced by the norm.
Additional Notes
Some additional observations and remarks on metric spaces:
- Bounded Set in a Metric Space
Let \((X, d)\) be a metric space, where \(d\) is the metric defined on \(X\). A subset \(A \subseteq X\) is said to be bounded if there exists a positive real number \(\mu > 0\) and a fixed point \(x_0 \in X\) such that: $$ d(x, x_0) \leq \mu \quad \text{for all } x \in A $$ In simple terms, all points in \(A\) lie within an open or closed ball of radius \(\mu\), centered at \(x_0\). In this context, a set is considered "bounded" if it can be fully enclosed within a ball (a region of space determined by the metric) with a finite radius.In the topology induced by the metric \(d\), the concept of a bounded set is not inherently linked to whether the set is open or closed. It solely concerns the distances between points in the set.
- Bounded Metric
In a metric space \((X, d)\), if the entire set \(X\) is bounded, then the metric \(d\) is referred to as a bounded metric. - The basis theorem for the topology induced by a metric
In a metric space \((X, d)\), the collection of open balls $ \mathcal{B} $ serves as a basis for a topology on \(X\). $$ \mathcal{B} = \{B_d(x, \varepsilon) \mid x \in X, \varepsilon > 0\} $$ - Continuity Theorem in Metric Spaces
A function \(f : X \to Y\) between two metric spaces \((X, d_X)\) and \((Y, d_Y)\) is continuous if, for every point \(x \in X\) and any \(\varepsilon > 0\), there exists a \(\delta > 0\) such that whenever two points \(x, x' \in X\) are less than \(\delta\) apart $$ d_X(x, x') < \delta $$ their images \(f(x)\) and \(f(x')\) in \(Y\) will be less than \(\varepsilon\) apart $$ d_Y(f(x), f(x')) < \varepsilon $$ - Metric Spaces are Hausdorff Spaces
Every metric space is Hausdorff. Conversely, if a topological space is not Hausdorff, it cannot arise from a metric.Note: A topological space is considered Hausdorff if any two distinct points can be separated by disjoint open neighborhoods.
And so forth.