# Metric

A met­ric, some­times referred to as a dis­tance func­tion, is a func­tion that defines a real non­nega­tive dis­tance be­tween ev­ery two el­e­ments of a set. It is com­monly de­noted by the vari­able $$d$$. In colon-to no­ta­tion, a met­ric $$d$$ that defines dis­tances be­tween el­e­ments of the set $$S$$ is writ­ten:

$$d: S \times S \to [0, \infty)$$

In this case we say $$d$$ is a met­ric on $$S$$.

That is, a met­ric $$d$$ on a set $$S$$ takes as in­put any two el­e­ments $$a$$ and $$b$$ from $$S$$ and out­puts a num­ber that is taken to define their dis­tance in $$S$$ un­der $$d$$. Apart from be­ing non­nega­tive real num­bers, the dis­tances a met­ric out­puts must fol­low three other rules in or­der for the func­tion to meet the defi­ni­tion of a met­ric. A func­tion that matches the above colon-to no­ta­tion is called a met­ric if and only if it satis­fies these re­quire­ments. The fol­low­ing must hold for any choice of $$a$$, $$b$$, and $$c$$ in $$S$$:

1. $$d(a, b) = 0 \iff a = b$$

2. $$d(a, b) = d(b, a)$$

3. $$d(a, b) + d(b, c) \geq d(a, c)$$

(1) effec­tively states both that the dis­tance from an el­e­ment to it­self is 0, and that the dis­tance be­tween non-iden­ti­cal el­e­ments must be greater than 0. (2) as­serts that a met­ric must be com­mu­ta­tive; in­for­mally the dis­tance from $$a$$ to $$b$$ must be the same as the dis­tance from $$b$$ to $$a$$. Fi­nally, (3) is known as the tri­an­gle in­equal­ity and as­serts that the dis­tance from $$a$$ to $$c$$ is at most as large as the sum of the dis­tances from $$a$$ to $$b$$ and from $$b$$ to $$c$$. It is named as such be­cause in eu­clidean space, the points $$a$$, $$b$$, and $$c$$ form a tri­an­gle, and the in­equal­ity re­quires that the length of one side of the tri­an­gle is not longer than the sum of the lengths of the other two sides; vi­o­lat­ing this would mean that the short­est path be­tween two points is no longer the straight line be­tween them.

It is pos­si­ble (and rel­a­tively com­mon!) to deal with mul­ti­ple differ­ent met­rics on the same set. This means we are us­ing the same set el­e­ments as la­bels, but treat­ing the dis­tances be­tween el­e­ments differ­ently; in this case the differ­ent met­ric spaces we are defin­ing may have very differ­ent prop­er­ties. If mul­ti­ple met­rics are be­ing con­sid­ered, we must be care­ful when speak­ing of dis­tances be­tween el­e­ments of the set to spec­ify which met­ric we are us­ing. For ex­am­ple, if $$d$$ and $$e$$ are both met­rics on $$S$$, we can­not just say “the dis­tance be­tween $$a$$ and $$b$$ in $$S$$” be­cause it is am­bigu­ous whether we are refer­ring to $$d(a, b)$$ or to $$e(a, b)$$. We could in­stead say some­thing like “the dis­tance be­tween $$a$$ and $$b$$ un­der $$e$$” to re­move the am­bi­guity.

The most com­monly-used met­ric on Carte­sian space is the Eu­clidean met­ric, defined in two di­men­sions as $$d(a, b) = \sqrt{(a_1-b_1)^2 + (a_2-b_2)^2}$$, and more gen­er­ally in $$n$$ di­men­sions as $$d(a, b) = \sqrt{\sum_{i=1}^n (a_i-b_i)^2}$$.

A less-com­mon met­ric on Carte­sian space is the Man­hat­tan met­ric, defined gen­er­ally as $$d(a, b) = \sum_{i=1}^n |a_i-b_i|$$; the dis­tance is analo­gous to the dis­tance taken be­tween two points on a rec­t­an­gu­lar grid when mo­tion is con­strained to be purely ver­ti­cal or hori­zon­tal, but not di­ag­o­nal.

A met­ric in­duces a topol­ogy add in­tu­itive/​non­alge­braic ex­pla­na­tion lens proof that Eu­clidean and Man­hat­tan dis­tances are metrics

Parents:

• Mathematics

Math­e­mat­ics is the study of num­bers and other ideal ob­jects that can be de­scribed by ax­ioms.

• This is a clear ex­pla­na­tion, but I think some for­mat­ting changes could en­able read­ers to grok it even more quickly.

Sup­pose a reader un­der­stands two of the three re­quire­ments and just needs an ex­pla­na­tion of the third. It would be cool if they could find the sen­tences they’re look­ing for w/​o hav­ing to scan a whole para­graph look­ing for the words, “first”, “sec­ond”, or “third”.

I think we can achieve this by A) mov­ing each ex­pla­na­tion right un­der the equa­tion /​ in­equal­ity it’s talk­ing about, or B) putting the three ex­pla­na­tions in a sec­ond num­bered list, or C) leav­ing the three ex­pla­na­tions in a para­graph, but use the nu­mer­als 1, 2, and 3 within the para­graph. Might re­quire some ex­per­i­men­ta­tion to see what looks best.

• Thanks for the feed­back! I’d pre­fer to have the ex­pla­na­tions un­der­neath the re­quire­ment they re­fer to, but I haven’t been able to get the spac­ing to look good. I added num­bers into the para­graph to make it vi­su­ally easy to find where each re­quire­ment is dis­cussed. If I get the spac­ing to work well, I’ll switch to that.

• Is [0, inf) same as R+?

• I was un­der the im­pres­sion that R+ doesn’t in­clude 0. If that’s the case, then it is not the same.