# Metric space

A set $S$ is said to be a *metric space* if a real number $d$ may be associated to any two points $p_1$ and $p_2$ in $S$, called the *distance* from $p_1$ to $p_2$.^{[1]} The most obvious example of a metric space is one-dimensional Euclidean space, where the distance function $d(x,y)$ is simply the absolute value of the difference between $x$ and $y$. In other words, $\forall x,y \in \mathbb{R}$, $d(x,y) = | x - y |$. Metric spaces can be equipped with a natural topology whose basic open sets are the balls $B_{\epsilon}(x)$, where $B_{\epsilon}(x) = \{ y \in X \colon d(x,y)<\epsilon\}$.

## Formal Definition

A *metric space* is an ordered pair $(X,d)$ where $X$ is some set and $d$ is a function $d \colon X \times X \rightarrow [0,\infty)$, called a metric, with the following properties:

- For all $x,y \in X$, $d(x,y)=d(y,x)$.
- For all $x,y \in X$, $d(x,y)=0$ if and only if $x=y$.
- For all $x,y,z \in X$, $d(x,y) \leq d(x,z)+d(z,y)$.

It should be noted that every subset of $S$ is also a metric space in its own right, with the same distance function. Intuitively, it follows that every subset of a Euclidean space is a metric space, and the distance between two points is measured in the same way.

## Role in Determining Continuity

The distance metric has implications that go much deeper than may be initially obvious. Using the distance function, the neighborhood of a point may be determined, and subsequently used to find the limit point. With this information, the closure of a set may then be determined.^{[2]} These components are central to determining the continuity of a function, and therefore a topological space.