Definition
metric
The function
d
:
S
×
S
→
ℝ
+
d: S \times S \to \mathbb{R}_{+}
is a metric if
nonnegativity
: for all
x
,
y
∈
S
x, y \in S
have
d
(
x
,
y
)
≥
0
d(x,y) \geq 0
,
zero-equality
: for all
x
,
y
∈
S
x, y \in S
have
d
(
x
,
y
)
=
0
d(x,y) = 0
if and only if
x
=
y
x = y
,
symmetry
: for all
x
,
y
∈
S
x, y \in S
have
d
(
x
,
y
)
=
d
(
y
,
x
)
d(x,y) = d(y,x)
,
triangle inequality
: for all
x
,
y
,
z
∈
S
x, y, z \in S
have
d
(
x
,
z
)
≤
d
(
x
,
y
)
+
d
(
y
,
z
)
d(x,z) \leq d(x,y) + d(y,z)
.