Canonical: https://knowlpedia.com/topology/metric/

# Metric

A distance function on a set satisfying positivity, symmetry, and the triangle inequality.

A **metric** on a [set](https://knowlpedia.com/shared-foundations/set/) \(X\) is a [function](https://knowlpedia.com/shared-foundations/function/) \(d\colon X\times X\to[0,\infty)\) such that for all \(x,y,z\in X\):

1. (Identity of indiscernibles) \(d(x,y)=0\) if and only if \(x=y\).
2. (Symmetry) \(d(x,y)=d(y,x)\).
3. (Triangle inequality) \(d(x,z)\le d(x,y)+d(y,z)\).

## Induced structure

A metric is the basic structure underlying a [metric space](https://knowlpedia.com/topology/metric-space/); it determines [open balls](https://knowlpedia.com/topology/open-ball/) and hence the [metric-induced topology](https://knowlpedia.com/topology/metric-induced-topology/).

## Examples

- On \(\mathbb{R}^n\), the Euclidean metric \(d(x,y)=\|x-y\|_2\).
- On any set \(X\), the discrete metric \(d(x,y)=0\) if \(x=y\) and \(d(x,y)=1\) otherwise.
