Roughly speaking, a metric space is a set to which we can assign a notion of “distance”. The distance between two points of the set is given by a distance function (called a “metric”) which satisfies some axioms.

The prototypical example of a metric space is \mathbb{R^2} where the distance between two points (x_1,y_1) \text{and} (x_2,y_2) is given by the usual euclidean metric,

\text{Distance} = \sqrt{(x_2-x_1)^2+(y_2-y_1)^2}### Metric Space Formal Definition/Metric Space Axioms:

A metric space is set X along with a function d: X\rightarrow \mathbb{R}_{\geq 0} called the “metric” or the distance function which satisfies the following axioms:

- For any x,y\in X, d(x,y)=0 \text{ if and only if } x=y
- For any x,y\in X, d(x,y)=d(y,x) (Symmetry property)
- For any x,y,z\in X, d(x,z)\leq d(x,y) + d(y,z) (Triangle inequality)

Notice that the above three properties are what we would expect a reasonable definition of “distance” to have. The Euclidean distance function seen above satisfies all the above three properties.

We now give some examples of metric spaces followed by definitions of common notions such as complete metric spaces, compact metric spaces, separable metric spaces, etc.

### Examples of Metric Spaces:

1. The most basic example of a metric space is \mathbb{R^n} endowed with the Euclidean metric.

Let \bf{x}=(x_1,x_2,\ldots,x_n) \text{ and } \bf{y}=(y_1,y_2,\ldots,y_n) be two points in \mathbb{R^n} . Then the distance between two points is given as,

d(\bf{x},\bf{y}) = \sqrt{(y_1-x_1)^2+(y_2-x_2)^2+\ldots+ (y_n-x_n)^2}It is clear that the above metric satisfies the first two axioms of a metric. It also satisfies the triangle inequality which can be proved using the Cauchy Shwartz inequality.

**2. Discrete Metric Space:**

The discrete metric space consists of any set X with the “discrete metric” defined on it. The discrete metric is defined as,

d(x,y) = \begin{cases}0 & \text{ if } x=y \\ 1 & \text{ if } x\neq y \end{cases}We can easily verify that the three metric axioms are satisfied by the discrete metric.

The discrete metric space is useful because it is used as a “counterexample” to show that certain results which hold for \mathbb{R^n} need not be true in the context of a general metric space. For example, if X is an infinite set endowed with the discrete metric, then a closed and bounded set need not be compact.

### Some common kinds of metric spaces:

**1. Complete metric spaces**: A metric space (X,d) is said to be complete if every Cauchy sequence in X converges to a point in X, that is, for every sequence {x_n} there exists an x\in X such that {x_n} converges to x .

*Examples*: 1) The set of real numbers is a complete metric space. The completeness of \mathbb{R} is a consequence of the least upper bound property of the ser of real numbers.

2) The metric space \mathbb{R^n} is a complete metric space.

3) Any closed subspace of \mathbb{R^n} is complete.

The set of rational numbers \mathbb{Q} is not complete, because a Cauchy sequence of rational numbers may converge to an irrational number in the reals.

**2. Separable metric space**: A metric space is said to be separable if it has a countable basis.

*Examples*: 1) The set of real numbers is a separable metric space. Consider the countable collection of open balls with center at every rational number and raduis 1/n for every natural number n.

2) The metric space \mathbb{R^n} is a separable metric space.

**3. Compact metric space**: A metric space is said to be compact if every open cover has a finite subcover. This definition is unwieldy but we can give a characterization for compactness in the sprecial case of \mathbb{R^n} .

The Heine Borel theorem says that a set in \mathbb{R^n} is compact if and only if it is closed and bounded.

Thus the closed intervals [a,b] in \mathbb{R} is compact. Similarly, the closed unit ball in \mathbb{R^n} is compact.

**4. Bounded metric space**: A metric space is said to be bounded if there exists a point x\in X and a natural integer N such that, every point in X lies in the ball with center in x and radius N.

**5. Connected metric space**: A metric space is said to be connected if it cannot be written as a union of two open sets. A metric space that is not connected is said to be disconnected.