Metric Spaces

# Metric Spaces

A set $$X$$ is a metric space if there exists a metric $$d : X \times X \rightarrow \mathbb{R}$$ such that for all $$p, q \in X$$

1. (non-negativity) $$d(p, q) \geq 0$$ ($$= 0$$ iff $$p = q$$),
2. (symmetry) $$d(p, q) = d(q, p)$$, and
3. (triangle inequality) $$d(p, q) \leq d(p, r) + d(r, q)$$ for all $$r \in X$$.

For example,

1. $$\mathbb{R}^n$$ with $$d(\vec{x}, \vec{y}) = \sqrt{(x_1 - y_1)^2 + \dots + (x_n - y_n)^2}$$, also known as the Euclidean metric on $$\mathbb{R}^n$$, which is the implicit metric on $$\mathbb{R}^n$$ if left unspecified.
2. $$\mathbb{R}$$ with $$d(x, y) = |x - y|$$, a specialization of the above example where $$n = 1$$.
3. $$\mathbb{R}^n$$ with $$d(\vec{x}, \vec{y}) = \sum_{i = 1}^n |x_i - y_i|$$, also known as the staircase metric.
4. For a space of trees, $$d_T(x, y) =$$ length of the shortest path between $$x$$ and $$y$$.
5. For a space of genome sequences, $$d_G(x, y) =$$ number of letters that are different.
6. For a space of continuous functions on $$[a, b]$$, denoted $$\mathcal{C}([a, b])$$, $$d_I(f, g) = \int_a^b |f - g| dx$$.
7. For a space of continuous bounded functions on $$\mathbb{R}$$, denoted $$\mathcal{C}_b(\mathbb{R})$$, $$d_{\sup}(f, g) = \sup_{x \in R} |f(x) - g(x)|$$, also known as sup norm. The supremum exists because the functions are bounded in their values.
8. For any set $$X$$, a discrete metric is defined as \begin{align} d_{discrete} = \begin{cases} 0 & \text{ if } p = q\\ 1 & \text{ otherwise} \end{cases} \end{align}

# Open Balls

A neighborhood, or open ball, of radius $$r$$ is $$N_r(x) = \{y : d(x, y) < r\}$$, alternatively denoted as $$B_r(x)$$ or $$B(x; r)$$. It tells us which points are nearby each other.

# Closed Balls

A closed ball of radius $$r$$ is $$\overline{N_r(x)} = \{y : d(x, y) \leq r\}$$, alternatively denoted as $$B_r[x]$$ or $$B[x; r]$$.