Links

Metrics

Example 1. Let
XR\mathcal{X}\subseteq\mathbb{R}
be a nonempty set and define
d:X×XRd:\mathcal{X}\times\mathcal{X}\rightarrow\mathbb{R}
by
d(x,y){1if x=y0otherwise.d(x,y)\triangleq\begin{cases}\begin{array}{cl}1 & \text{if $x=y$} \\0 & \text{otherwise.}\end{array}\end{cases}
Prove
dd
forms a metric.
Ex 1: Comment
Hint
Visual
Formal Write-Up
Follow-Up
This interesting metric might not be useful for finding our usual notion of "distance'' between to points on a map, but it is useful for illustrations and identifying general properties of metrics (since it is so simple to analyze).
It suffices to verify each of the three properties of a metric hold.
Illustration of discrete metric for 3 points in the 2D plane. An arrow from a point to a point with label denotes . The distance between any pair of points is 1 while the distance between a point and itself is zero. Symmetry is also apparent since the "distance'' between points does not depend on direction.
To verify
dd
is a metric we verify three properties hold: symmetry, positivity, and the triangle inequality. By definition,
d(x,y)=1>0d(x,y) = 1 > 0
if
xyx\neq y
and
d(x,x)=0d(x,x) = 0
. Thus, positivity holds for
dd
. Additionally,
xyx\ne y
implies
d(x,y)=1=d(y,x)d(x,y) = 1 = d(y,x)
, and so symmetry holds also. Let three points
x,y,zXx,y,z\in\mathcal{X}
be given. If
x=zx=z
, then
d(x,z)=0d(x,y)+d(y,z),d(x,z)=0\leq d(x,y)+d(y,z),
where the inequality holds by positivity of
dd
(i.e.
d(x,y)0d(x,y)\geq 0
and
d(y,z)0d(y,z)\geq 0
). Next, suppose
xzx\neq z
. This implies either
xyx\ne y
or
yzy\neq z
, making either
d(x,y)=1d(x,y) = 1
or
d(y,z)=1d(y,z) = 1
, and so
d(x,z)=1d(x,y)+d(y,z)d(x,z) = 1 \leq d(x,y)+d(y,z)
In either case,
d(x,z)d(x,y)+d(y,z).d(x,z) \leq d(x,y) + d(y,z).
Since
x,y,zXx,y,z\in\mathcal{X}
were arbitrarily chosen, the triangle inequality holds. Thus, all three properties hold, i.e.
dd
forms a metric.
\blacksquare
Note we start by identifying the definition of what must be shown to complete a satisfactory proof. This is a good practice in general. It makes clear what must be done and where we are headed.
To prove something holds "for all elements...'' it is typically easiest to assume arbitrary elements are given. Then we prove whatever statement with this arbitrary elements and then state that, because these were chosen arbitrarily, the result holds for all such elements (see second to last sentence of proof).
Sometimes a particular relation can be hard to verify directly. However, we can, at times, break the relationship up into a handful of cases that are each easier to verify.
Example 2. Let
X1,2,3,4\mathcal{X} \triangleq {1,2,3,4}
and define
d ⁣:X×XRd\colon\mathcal{X}\times\mathcal{X}\rightarrow\mathbb{R}
by
d(x,y){0if x=y13if x>y,23if x<y.d(x,y)\triangleq \begin{cases} \begin{array}{cl} 0 & \text{if $x=y$, }\\[5pt] \frac{1}{3} & \text{if $x > y$}, \\[5pt] \frac{2}{3} & \text{if $x < y$.} \\\end{array}\end{cases}
Is
(X,d)(\mathcal{X},d)
a metric space? Prove your answer.
Hint
Visual
Formal Write-Up
Follow-Up
For
(X,d)(\mathcal{X},d)
to be a metric space, each of the four axioms must hold.
Illustration of function for 3 points on the 1D number line. An arrow from a point to a point with label denotes . Notice is not a metric since it does not possess symmetry.
No,
(X,d)(\mathcal{X},d)
is not a metric space since the symmetry axiom fails, e.g. note
d(1,2)=23>13=d(2,1).d(1,2) = \dfrac{2}{3} > \dfrac{1}{3} = d(2,1).
\blacksquare
To prove
(X,d)(\mathcal{X},d)
is a metric space, one must verify each of the four axioms hold. However, to prove something is not a metric space, it suffices to find a single counterexample that shows a violation of one of the axioms.