# Difference between revisions of "Metric (analysis)"

A metric $d$ on a set $S$ is a function $d: S \times S \to \mathbb{R}$ which obeys the following three properties:

• Symmetry: $d(x, y) = d(y, x)$ for all points $x, y \in S$.
• Positivity: $d(x, y) \geq 0$ for all $x, y \in S$ and $d(x, y) = 0$ if and only if $x = y$.
• The triangle inequality: $d(x, y) + d(y, z) \geq d(x, z)$ for all $x, y, z \in S$.

Together, the set $S$ and the metric $d$ form a metric space.

## Common metrics

• For $S = \mathbb{R}^n$, the Euclidean metric $d((x_1, x_2, \ldots, x_n), (y_1, y_2, \ldots y_n)) = \sqrt{(x_1-y_1)^2 + \ldots + (x_n - y_n)^2}$ is the conventional distance function.
• For any set $S$, the discrete metric $d(x, y) = 0 \Longleftrightarrow x = y$ and $d(x, y) = 1$ otherwise.