3.1. Introduction#

3.1.1. Distance Functions#

Definition 3.1 (Distance function/Metric)

Let X be a nonempty set. A function d:X×XR is called a distance function or a metric if it satisfies the following properties for any elements x,y,zX:

  1. Non-negativity: d(x,y)0

  2. Identity of indiscernibles: d(x,y)=0x=y

  3. Symmetry: d(x,y)=d(y,x)

  4. Triangle inequality: d(x,y)d(x,z)+d(z,y)

  • It is customary to call the elements of a set X associated with a distance function as points.

  • Distance functions are real valued.

  • Distance functions map an ordered pair of points in X to a real number.

  • Distance between two points in the set X can only be non-negative.

  • Distance of a point with itself is 0. In other words, if the distance between two points is 0, then the points are identical. i.e. the distance function works as a discriminator between the points of the set X.

  • Symmetry means that the distance from a point x to another point y is same as the distance from y to x.

  • Triangle inequality says that the direct distance between two points can never be longer than the distance covered through an intermediate point.

3.1.2. Metric Spaces#

Definition 3.2 (Metric space)

Let d be a distance function on a set X. Then we say that (X,d) is a metric space. The elements of X are called points.

  • In general, a set X can be associated with different metrics (distance functions) say d1 and d2. In that case, the corresponding metric spaces (X,d1) and (X,d2) are different.

  • When a set X is equipped with a metric d to create a metric space (X,d), we say that X has been metrized.

  • If the metric d associated with a set X is obvious from the context, we will denote the corresponding metric space (X,d) by simply X. E.g., |xy| is the standard distance function on the set R.

  • When we say that let Y be a subset of a metric space (X,d), we mean that YX.

  • Similarly, a point in a metric space (X,d) means the point in the underlying set X.

Note

Some authors prefer the notation d:X×XR+. With this notation, the non-negativity property is embedded in the type signature of the function (i.e. the codomain specification) and doesn’t need to be stated explicitly.

3.1.3. Properties of Metrics#

Proposition 3.1 (Triangle inequality alternate form)

Let (X,d) be a metric space. Let x,y,zX.

|d(x,z)d(y,z)|d(x,y).

Proof. From triangle inequality:

d(x,z)d(x,y)+d(y,z)d(x,z)d(y,z)d(x,y).

Interchanging x and y gives:

d(y,z)d(x,z)d(y,x)=d(x,y).

Combining the two, we get:

|d(x,z)d(y,z)|d(x,y).

3.1.4. Metric Subspaces#

Definition 3.3 (Metric subspace)

Let (X,d) be a metric space. Let YX be a nonempty subset of X. Then, Y can be viewed as a metric space in its own right with the distance function d restricted to Y×Y, denoted as d|Y×Y. We then say that (Y,d|Y×Y) or simply Y is a metric subspace of X.

It is customary to drop the subscript Y×Y from the restriction of d and write the subspace simply as (Y,d).

Example 3.1

[0,1] is a metric subspace of R with the standard metric d(x,y)=|xy| restricted to [0,1]. In other words, the distance between any two points x,y[0,1] is calculated by viewing x,y as points in R and using the standard metric for R.

3.1.5. Examples#

Example 3.2 (Rn p-distance)

For some 1p<, the function dp:Rn×RnR:

dp(x,y)(i=1n|xiyi|p)1p

is a metric and (Rn,dp) is a metric space.

Example 3.3 (Rn Euclidean space)

The d2 metric over Rn:

d2(x,y)(i=1n|xiyi|2)12

is known as the Euclidean distance and the metric space (Rn,d2) is known as the n-dimensional Euclidean (metric) space.

The standard metric for Rn is the Euclidean metric.

Example 3.4 (Discrete metric)

Let X be a nonempty set:

Define:

d(x,y)={0x=y1xy.

(X,d) is a metric space. This distance is called discrete distance and the metric space is called a discrete metric space.

Discrete metric spaces are discussed in depth in Discrete Metric Space. They help clarify many subtle issues in the theory of metric spaces.

Example 3.5 (R A metric space for the extended real line)

Consider the mapping φ:R[1,1] given by:

φ(x)={t1+|t|xR1x=1x=.

φ is a bijection from R onto [1,1].

[1,1] is a metric space with the standard metric for the real line dR(x,y)=|xy| restricted to [1,1].

Consider a function d:R×RR defined as

d(s,t)=|φ(s)φ(t)|.

The function d satisfies all the requirements of a metric. It is the standard metric on R.

Example 3.6 (p Real sequences)

For any 1p<, we define:

p={{an}RN|i=1|ai|p}

as the set of real sequences {an} such that the series anp is absolutely summable.

It can be shown that the set p is closed under sequence addition.

Define a map dp:p×pR as

dp({an},{bn})=i=1|aibi|p.

dp is a valid distance function over p. We metrize p with dp as the standard metric.

3.1.6. Products of Metric Spaces#

Definition 3.4 (Finite products of metric spaces)

Let (X1,d1),(X2,d2),,(Xn,dn) be n metric spaces.

Let X=X1×X2××Xn. Define a map ρ:X×XR as:

ρ((a1,a2,,an),(b1,b2,,bn))=i=1ndi(ai,bi).

ρ is a distance function on X. The metric space (X,ρ) is called the product of metric spaces (Xi,di).

3.1.7. Distance between Sets and Points#

Definition 3.5 (Distance between a point and a set)

The distance between a nonempty set AX and a point xX is defined as:

d(x,A)inf{d(x,a)aA}.
  • Since A is nonempty, hence the set D={d(x,a)aA} is not empty.

  • D is bounded from below since d(x,a)0.

  • Since D is bounded from below, hence it does have an infimum.

  • Thus, d(x,A) is well-defined and finite.

  • Since A is non-empty, hence there exists aA.

  • d(x,a)D.

  • Thus, D is bounded from above too.

  • Thus, 0d(x,A)d(x,a).

  • If xA, then d(x,A)=0.

Theorem 3.1

If xA, then d(x,A)=0.

Example 3.7

  1. Let X=R and A=(0,1).

  2. Let x=0.

  3. Then d(x,A)=0.

  4. However, xA.

  5. Thus, d(x,A)=0 doesn’t imply that xA.

Distance of a set with its accumulation points is 0. See Theorem 3.21.

3.1.8. Distance between Sets#

Definition 3.6 (Distance between sets)

The distance between two nonempty sets A,BX is defined as:

d(A,B)inf{d(a,b)|aA,bB}.