Metric
AI-Generated
This file was generated by AI and may require review.
Definition
A metric on a set $X$ is a function $d: X \times X \to \mathbb{R}$ satisfying:
- Positive definiteness: $d(x, y) \geq 0$, with equality iff $x = y$
- Symmetry: $d(x, y) = d(y, x)$
- Triangle inequality: $d(x, z) \leq d(x, y) + d(y, z)$
A set equipped with a metric is called a metric space.
From Norms
Every norm induces a metric:
$$ d(x, y) = \|x - y\| $$Common Metrics
| Metric | Formula | Name |
|---|---|---|
| $d(x,y) = \sqrt{\sum (x_i - y_i)^2}$ | Euclidean distance | $L^2$ metric |
| $d(x,y) = \sum \|x_i - y_i\|$ | Manhattan distance | $L^1$ metric |
| $d(x,y) = \max \|x_i - y_i\|$ | Chebyshev distance | $L^\infty$ metric |
| $d(x,y) = \begin{cases} 0 & x = y \\ 1 & x \neq y \end{cases}$ | Discrete metric |
Intuition
A metric generalizes the concept of “distance” to abstract spaces. It tells you how far apart two points are, satisfying our intuitive expectations:
- Distance is non-negative
- Distance from $x$ to $y$ equals distance from $y$ to $x$
- Going through an intermediate point can’t be shorter than going directly
Related Concepts
- Norm — induces a metric via $d(x,y) = \|x - y\|$
- metric_space — a set with a metric
- continuity — defined using metrics