**Metric** (度量) or **distance function** $d: X^2 \to \mathbb{R}_{\ge 0}$ on a set $X$
is a non-negative bivariate function that satisfies:
(1) non-degeneracy: distance is positive between different elements, $d(x, y) = 0 \iff x = y$;
(2) symmetry: distance is independent of order, $d(x, y) = d(y, x)$;
(3) triangular inequality: distance minimizes path length, $d(x, y) + d(y, z) \ge d(x, z)$.
Metric specifies the distance among the elements of a set.
**Psudo-metric** is almost a metric except non-degeneracy, i.e.
a non-negative symmetric bivariate function that satisfies the triangular inequality.
For example, for the space $C(\mathbb{R})$ of continuous real functions,
$\rho_n(f, g) = \sup_{x \in [-n,n]} |f(x) - g(x)|$, $n \in \mathbb{N}$, are psudo-metrics.
But they can be transformed into a metric, e.g.
$\sigma(f, g) = \sum_{n=1}^{\infty} 2^{-n} \min \{1,\rho_n(f, g) \}$.
**Strongly equivalent metrics** on a set are ones whose ratio is positively bounded:
$\exists c, C > 0$: $\forall x, y \in X$, $c d_1(x, y) \le d_2(x,y) \le C d_1(x,y)$.
All metrics induced by p-norms on a Cartesian product of real numbers are strongly equivalent.
A metric strongly equivalent to a complete metric is also complete.
Strong equivalence of metrics preserves uniform continuity.

**Metric space** (度量空间) $(X, d)$ is a set $X$ endowed with a metric $d(\cdot, \cdot)$.
**Distance** $d(x, A)$ between a point and a subset of a metric space
is the infimum of distances between the point and any point in the subset:
$d(x, A) = \inf_{y \in A} d(x, y)$.
**Distance** $d(A, B)$ between subsets of a metric space
is the infimum of distances between any point in one subset and any point in the other:
$d(A, B) = \inf_{x \in A, y \in B} d(x, y)$.
**Hausdorff distance** $\text{Haus}(A, B)$ between subsets of a metric space
is the supremum of distances from any point in one subset to the other:
$\text{Haus}(A, B) = \max\{\sup_{x \in A} d(x, B), \sup_{x \in B} d(x, A)\}$,
i.e. $\text{Haus}(A, B) = \max_{S(2)} \sup_x \inf_y d(x, y)$.
**Diameter** $\mathrm{diam}(A)$ of a subset of a metric space
is the supremum of distances between points in the subset:
$\mathrm{diam}(A) = \sup_{x, y \in A} d(x, y)$.
**Bounded metric space** is a metric space whose diameter is finite.

**Isometry** (等距同构) or **congruent transformation**
is a distance-preserving bijective map between two metric spaces:
given metric spaces $(X, d_x)$ and $(Y, d_y)$, bijection $f: X \to Y$ is an isometry iff
$d_x(x_1, x_2) = d_y(f(x_1), f(x_2)), \forall x_1, x_2 \in X$.
For example, bending a plane is an isometry.
Two metric spaces are **isometric** if and only if there exists an isometry between them.

**Subspace** $(A, d)$ of a metric space is the metric space consisting of
a subset and the metric restricted to the Cartesian square of the subset:
$A \subset X$, $d = d|_{A^2}$.
**Totally-bounded metric space** is a metric space
that can be represented as a finite union of arbitrarily bounded subspaces:
$\forall \varepsilon > 0$, $\exists \{x_i\}_{i=1}^{n} \subset X$:
$X \subset \cup_{i=1}^n B_\varepsilon(X_i)$.

**Product space** $(X_1 \times X_2, d_1 \times d_2)$ of two metric spaces
is the metric space consisting of the Cartesian product of the spaces and the sum of their metrics:
$(d_1 \times d_2) ((x_1, x_2), (x'_1, x'_2)) = d_1(x_1, x'_1) + d_2(x_2, x'_2)$.

**Cauchy sequence** in a metric space is a sequence with a tail of arbitrarily small diameter:
$\forall \varepsilon > 0$, $\exists N \in \mathbb{N}$: $\text{diam}(x_i)_{i \ge N} < \varepsilon$.
Every convergent sequence in a metric space is a Cauchy sequence.
Every Cauchy sequence in a metric space is a bounded subspace.
**Complete metric space** is a metric space where every Cauchy sequence converges.
The real line and the complex plane are complete metric spaces, but the rational numbers is not.
Completeness of the real line is the main reason
why it is used in calculus instead of smaller sets e.g. the rational line.
A subspace of a complete metric space is complete if and only if it is a closed subset.
Every $l^p$ space, $p \in [1, \infty)$, and the $l^\infty$ space are complete metric spaces.
The real function space $C[a, b]$ on any interval is a complete metric space
when endowed with the uniform norm, but not when endowed with the $L^1$ norm.

*Completion of metric space*:
Every metric space is isometric to a dense subspace of a unique complete metric space
up to isometries.
**Completion** $(\widehat X, \tilde d)$ of a metric space $(X, d)$
is the complete metric space with a dense subspace isometric to the metric space,
where $\tilde d$ is the unique extension of the metric induced by an isometry on the range.
The completion of the rational numbers is the real line: $\widehat{\mathbb{Q}} = \mathbb{R}$.

*Baire's Category Theorem*:
A complete metric space is not meager in itself.
Hence every countable cover of a complete metric space
contains at least one subset that includes a nonempty open subset.

**Contraction** on a metric space
is a transformation whose distance scaling ratio has an upper bound less than one:
$f \in C(X, X)$, $\exists L \in [0, 1)$: $\sup_{x, x' \in X} \frac{d(f(x), f(x'))}{d(x, x')} \le L$.
*Contraction Mapping Theorem* or *Banach Fixed Point Theorem*:
Every contraction on a complete metric space has a unique fixed point.

Equivalent sequence.

**Open ball** $B_r(x)$ of radius $r$ centered at a point $x$ in a metric space $(X, d)$
is the set of points whose distances to the point are less than the radius:
$B_r(x) = \{y \in X \mid d(y, x) < r\}$, $r > 0$.
**Closed ball** $\bar B_r(x)$ is the set of points whose distances to the point
are no greater than the radius: $\bar B_r(x) = \{y \in X \mid d(y, x) \le r\}$, $r \ge 0$.
**Sphere** $S_r(x)$ is the set of points whose distances to the point equal the radius:
$S_r(x) = \{y \in X \mid d(y, x) = r\}$, $r \ge 0$.
**Topology generated by a metric** or **metric topology** $\mathcal{T}_d$
is the topology $\mathcal{T(B)}$ generated by the class $\mathcal{B}$ of open balls
in a metric space $(X, d)$:
$\mathcal{T}_d = \mathcal{T(B)}$, $\mathcal{B} = \{B_r(x) \mid x \in X, r > 0\}$.
**Euclidean topology** on a Euclidean space is the topology generated by the Euclidean metric.

**Topologically equivalent metrics** on a set are ones that generate the same topology.
Strong equivalence implies topological equivalence.

A sequence in a metric space converges to a point in the space if and only if any open ball of the point contains a tail of the sequence: $\forall r > 0$, $\exists N \in \mathbb{N}$: $(x_i)_{i \ge N} \subset B_r(x)$. Every convergent sequence in a metric space is a bounded subspace and its limit is unique. A sequence of elements in a set may converge in one metric but not in another.

Every $l^p$ space, $p \in [1, \infty)$, is separable. The $l^\infty$ space is not separable.

For a metric space, compactness is equivalent to limit point compactness and sequential compactness.
Every compact subspace of a metric space is closed and bounded; the converse is not true.
**Covering number** $N(X, r)$ of a compact metric space $X$ with disks at radius $r$
is the minimum number of such disks needed to cover the space.

A map between (open subsets of) metric spaces is continuous at a point (see Topology) if and only if the preimage of every open ball centered at its value at the point includes an open ball centered at the point: (in epsilon-delta formulation) $\lim_{x_i \to x} f(x_i) = f(x)$ iff $\forall \varepsilon > 0$, $\exists \delta > 0$: $f(B_\delta(x)) \subset B_\varepsilon(f(x))$. The metric of a metric space is a continuous function. Continuous map between metric spaces preserves compactness.

**Uniformly continuous map** between metric spaces
is a map such that the preimage of every open ball in its range of an arbitrary radius
includes an open ball of a certain radius: (in epsilon-delta formulation)
$\forall \varepsilon > 0$, $\exists \delta > 0$:
$\forall x \in X$, $f(B_\delta(x)) \subset B_\varepsilon(f(x))$, or equivalently,
$\inf_{x \in X} d(x, Y \setminus f^{-1}(B_\varepsilon(f(x)))) \ge \delta$.
Every uniformly continuous map is continuous.
Every continuous map between metric spaces is uniformly continuous if
its domain is a compact topological space.

**Total variation** $V(f)$ of a continuous map from an interval to a metric space
is the supremum of the sum of distances of the function
at end points of all finite partitions of the interval:
$f \in C([a, b], Y)$, $V(f) = \sup_{(x_i) \in \Pi} \sum_{i=0}^{n-1} d(f(x_i), f(x_{i+1}))$,
where $\Pi = \{(x_i)_{i=1}^n : n \in \mathbb{N}_+, (z_i)_{i=1}^n \subset (0, 1)\}$,
$x_i = a + (b - a) s_i / s_n$, and $s_i = \sum_{j=1}^i z_i$.
**Bounded variation function** is a continuous real function on an interval
with a finite total variation: $f \in C([a, b])$, $V(f) < \infty$.

**Absolutely continuous map** from an interval to a metric space
is a map such that for every finite sub-partition of the interval with a sufficiently small measure,
the sum of distances of the function at end points of the sub-partition can be arbitrarily small:
$f: [a, b] \mapsto Y$, $\forall \varepsilon > 0$, $\exists \delta > 0$:
$\forall (x_i)_{i=0}^n \in \Pi$, $\sum_{j \in J \subset n} (x_{j+1} - x_j) < \delta$,
then $\sum_{j \in J} d(f(x_j), f(x_{j+1})) < \varepsilon$.
Every absolutely continuous map is uniformly continuous.
A real function on an interval is absolutely continuous if and only if
it has an integrable derivative:
$g \in AC([a, b])$ iff $\exists f \in L^1([a, b])$: $g = g(a) + \int_a^x f(\xi) d \xi$.
Every absolutely continuous real function on an interval is of bounded variation,
which equals the integral of the absolute value of its derivative:
$V(g) = \int_a^b |f(x)| d x$.

**Lipschitz condition** [@Lipschitz1864] or **Hölder condition** of order $\alpha$,
$\alpha \in (0, 1]$, for a map between subsets of metric spaces is the condition that:
$\exists L \in [0, \infty)$: $\forall x, x' \in X$, $d(f(x), f(x')) \le L d(x, x')^\alpha$.
When the order equals one, this condition is simply called the Lipschitz condition.
**Lipschitz map**, or more precisely, **L-Lipschitz map** between metric spaces
is a map that satisfies the Lipschitz condition with constant L,
i.e. L is an upper bound for its distance scaling ratio:
$\exists L \in [0, \infty)$: $\sup_{x, x' \in X} \frac{d(f(x), f(x'))}{d(x, x')} \le L$.
We denote the set of L-Lipschitz maps between two given metric spaces as $\text{Lip}_L(X, Y)$.
**Lipschitz constant** $\text{Lip}(f)$ of a map between metric spaces
is the supremum of its distance scaling ratio:
$\text{Lip}(f) = \sup_{x, x' \in X} \frac{d(f(x), f(x'))}{d(x, x')}$.
**Bi-Lipschitz map** between metric spaces is a Lipschitz map with a Lipschitz inverse.
Every Lipschitz map is uniformly continuous.
Every Lipschitz map on an interval is absolutely continuous.
Every continuously differentiable map between metric smooth manifolds is Lipschitz
if the domain is compact: $C^1(K, M) \subset \text{Lip}(K, M)$, where $K$ is compact.
*Rademacher theorem* (see e.g. [@Heinonen2004]):
Every Lipschitz function between (open subsets of) Euclidean spaces
is differentiable almost everywhere (w.r.t. the Lebesgue measure):
$\forall X \in \mathcal{T}(\mathbb{R}^m)$, $\forall f \in \text{Lip}(X, \mathbb{R}^n)$,
$\exists g \in C^1(X, \mathbb{R}^n)$: $f \overset{a.e.}{=} g$.
*Kirszbraun theorem*: Every L-Lipschitz function between (subsets of) Euclidean spaces
can be L-Lipschitz extended to the whole Euclidean space:
$X \subset \mathbb{R}^m$, $\forall f \in \text{Lip}_L(X, \mathbb{R}^n)$,
$\exists \tilde{f} \in \text{Lip}_L(\mathbb{R}^m, \mathbb{R}^n)$: $\tilde{f}|_X = f$.

**Locally L-Lipschitz map** or **locally uniformly Lipschitz map** between metric spaces
is a map such that every point in the domain has a neighborhood where the map is L-Lipschitz.
A locally uniformly Lipschitz map does not need to be Lipschitz,
e.g. shrinking two open intervals separated by a point.
**Locally Lipschitz map** between metric spaces is a map such that
every point in the domain has a neighborhood where the map is Lipschitz.
A map from a locally compact metric space to a metric spaces is locally Lipschitz
if and only if it is Lipschitz on every compact subset of the domain.
Thus, every continuously differentiable function between (subsets of) Euclidean spaces
is locally Lipschitz: $\forall X \subset \mathbb{R}^m$,
$C^1(X, \mathbb{R}^n) \subset \text{Lip}_\text{loc}(X, \mathbb{R}^n)$.
A differentiable map on a compact set need not be locally Lipschitz,
e.g. the continuous extension of $f(x) = x^2 \sin(x^{-2})$ on any compact interval containing zero.
**Pointwise Lipschitz constant** $\text{Lip}~f(x)$ at a point of a map between metric spaces
is the local supremum of its distance scaling ratio:
$\text{Lip}~f(x) = \limsup_{x' \to x, x' \in X} \frac{d(f(x), f(x'))}{d(x, x')}$.
*Stepanov's theorem* (see e.g. [@Heinonen2004]):
Every function between (open subsets of) Euclidean spaces is differentiable
almost everywhere its pointwise Lipschitz constant is finite (w.r.t. the Lebesgue measure):
$\forall X \in \mathcal{T}(\mathbb{R}^m)$, $\forall f: X \mapsto \mathbb{R}^n$,
$\mu(\{x : \text{Lip}~f(x) < \infty\} \setminus \{x : Df(x) \in M_{n,m}(\mathbb{R}) \}) = 0$.

- Juha Heinonen. "Lectures on Lipschitz Analysis". 14th Jyväskylä Summer School, August 2004.