Introduction
Up to this point, we have relied on calculus and linear algebra to solve optimization problems. For many practical
machine learning applications, these tools are sufficient. However, as we move toward advanced topics like manifold
learning or information geometry, intuition alone is no longer enough.
Consider a fundamental question. When we run gradient descent, we
assume that each step brings us closer to a solution and that iterating long enough will reach (or approach) a minimum.
But what guarantees this? The sequence of iterates \(\mathbf{x}_0, \mathbf{x}_1, \mathbf{x}_2, \ldots\) may get
arbitrarily close together without ever settling on an actual point unless the underlying space has the right structure.
Similarly, when we work with function spaces in kernel methods or neural networks, we treat entire functions
as single "points." But what does "distance" mean between two functions? What does it mean for a sequence of
functions to converge? The familiar Euclidean intuition breaks down, and we need a more general framework.
This page introduces that framework: metric spaces and the notion of completeness.
These concepts formalize exactly when iterative algorithms converge to valid solutions. Rather than learning new
computational techniques, we are gaining the language to state precisely what we have been assuming all along and to
understand when those assumptions hold.
Metric Space
The framework begins with a minimal abstraction: a set equipped with a notion of distance. We do not require
coordinates, inner products, or linear structure. All we need is a function that assigns a nonnegative real number to
each pair of points and obeys three natural axioms.
Definition: Metric Space \((M, d)\)
A metric space is an ordered pair \((M, d)\) consisting of a nonempty set
\(M\) and a metric \(d\) on \(M\). The metric \(d\) is a function
\(d: M \times M \to \mathbb{R}\) that defines the distance between any two elements of \(M\).
For all \(a, b, c \in M\), the following axioms must hold:
- Positive definiteness. \(d(a,b) \geq 0\), with equality if and only if \(a = b\).
(The inequality \(d(a,b) \geq 0\) is the nonnegativity condition. The "if and only if"
clause is the identity of indiscernibles.)
- Symmetry. \(d(a,b) = d(b,a)\).
- Triangle inequality. \(d(a,b) \leq d(a,c) + d(c, b)\).
Definition: Metric Subspace and Superspace
Suppose \((X, d)\) and \((Y, e)\) are metric spaces. We say that \((X, d)\) is a metric subspace of
\((Y, e)\), and that \((Y, e)\) is a metric superspace of \((X, d)\), if and only if
\(X \subseteq Y\) and \(d\) is the restriction of \(e\) to \(X \times X\). That is, \(d(a, b) = e(a, b)\) for all
\(a, b \in X\).
Insight: Why the Axioms Matter in Practice
We have already used non-Euclidean distances throughout this curriculum. In k-nearest neighbors, the choice between
Euclidean distance, Manhattan distance, or cosine similarity fundamentally changes which points are considered
"close." In kernel methods, the kernel function implicitly defines a distance in a high-dimensional feature space.
These are all metrics on different spaces.
The axioms are not arbitrary mathematical restrictions. They encode the minimal properties required for algorithms
to behave sensibly. For instance, if the triangle inequality fails, then a nearest-neighbor search might return a
point \(y\) as "closest" to \(x\), even when a third point \(z\) satisfies \(d(x, z) \lt d(x, y)\) via an indirect
path. Efficient search structures like KD-trees and ball trees rely on the triangle inequality for their pruning
guarantees.
Distance
With a metric defined, we can extend the notion of distance from pairs of points to more general situations. In
optimization, we rarely care about the distance between two specific points. Instead, we ask questions like "How far is
this point from the feasible region?" or "How close is our current iterate to the set of optimal solutions?" These
questions require measuring distance from a point to a set.
Before formalizing this, we need to make precise what it means to take the "smallest possible distance" over a
potentially infinite set. Consider the interval \((0, 1) \subseteq \mathbb{R}\) and the point \(0\). The distances
\(d(0, y) = y\) for \(y \in (0, 1)\) form a set with no smallest element, yet they approach \(0\) arbitrarily closely.
To capture this "smallest attainable or approachable value," we use the infimum rather than the minimum.
Definition: Supremum and Infimum
Let \(S \subseteq \mathbb{R}\). An upper bound of \(S\) is any \(u \in \mathbb{R}\) satisfying
\(s \leq u\) for every \(s \in S\). A lower bound is defined dually (\(\ell \leq s\) for every
\(s \in S\)). We say \(S\) is bounded above if it has at least one upper bound, and bounded
below if it has at least one lower bound.
When \(S\) is nonempty and bounded above, its supremum \(\sup S\) is the least upper bound, the
smallest real number that is an upper bound of \(S\). Dually, when \(S\) is nonempty and bounded below, its
infimum \(\inf S\) is the greatest lower bound. The existence of these quantities is a nontrivial
property of \(\mathbb{R}\). We return to this in the discussion below.
We extend these to extended-real values by convention: \(\sup S = +\infty\) when \(S\) is unbounded above,
\(\inf S = -\infty\) when unbounded below, and for the empty set \(\sup \emptyset = -\infty\),
\(\inf \emptyset = +\infty\). When the supremum belongs to \(S\) itself, we call it the maximum,
written \(\max S\). When the infimum belongs to \(S\), we call it the minimum, written \(\min S\).
The point of using \(\sup\) and \(\inf\) rather than \(\max\) and \(\min\) is precisely to handle sets without a
largest or smallest element. The interval \((0, 1)\) illustrates the point, since \(\inf (0,1) = 0\) while
\(\min (0,1)\) does not exist.
Insight: The Completeness of \(\mathbb{R}\)
Every nonempty bounded-above \(S \subseteq \mathbb{R}\) has a supremum, so the least upper bound exists as
a real number. This is the completeness property of the real numbers, the foundational axiom
distinguishing \(\mathbb{R}\) from \(\mathbb{Q}\). The set \(S = \{q \in \mathbb{Q} : q^2 \lt 2\}\) is bounded above
in \(\mathbb{Q}\) (by \(3/2\), say) but has no rational least upper bound. Only when we pass to \(\mathbb{R}\) does
\(\sup S = \sqrt{2}\) exist. Without this property, the infimum in our distance definition could fail to exist even
when intuitively it should be well-defined.
This order-theoretic completeness of \(\mathbb{R}\) is deeply connected to the metric-space
completeness we will study later. There the analogous question becomes whether every Cauchy sequence
converges. In \(\mathbb{R}\), the two notions are equivalent. In general metric spaces, which may lack an order
structure, only the Cauchy formulation survives. Both express the same intuition: no holes.
In optimization and machine learning, \(\inf\) and \(\sup\) appear throughout. The optimal value of a minimization
problem is \(\inf_x f(x)\), generalization bounds are stated as suprema over hypothesis classes, and the \(\limsup\)
/ \(\liminf\) of an error sequence capture worst-case and best-case asymptotic behavior. We will rely on these
operations without further ceremony.
Definition: Distances
Suppose \((X, d)\) is a metric space and \(A\) and \(B\) are subsets of \(X\).
We define the distance from \(x \in X\) to \(A\) to be
\[
\operatorname{dist}(x, A) = \inf \{d(x, a) \mid a \in A\} \quad (\text{Points to Sets})
\]
and the distance from \(A\) to \(B\) to be
\[
\operatorname{dist}(A, B) = \inf \{d(a, b) \mid a \in A, b \in B\}. \quad (\text{Sets to Sets})
\]
Both distances depend on the choice of the metric \(d\). By convention, when the set is empty we extend these
definitions via \(\inf \emptyset = +\infty\) (as established above), so that
\(\operatorname{dist}(x, \emptyset) = +\infty\) and \(\operatorname{dist}(A, \emptyset) = +\infty\).
This ensures that the derived notions below (isolated points, boundary, etc.) remain well-defined
in degenerate cases.
Definition: Isolated Points
Suppose \(X\) is a metric space, \(S\) is a subset of \(X\), and \(z \in S\). Then \(z\) is said to be
an isolated point of \(S\) if and only if
\[
\operatorname{dist}(z, S \setminus \{z\}) \neq 0.
\]
The collection of isolated points of \(S\) is denoted by \(\operatorname{iso}(S)\).
The complement of isolated points leads to a more important concept for our purposes: accumulation points.
While isolated points stand alone with "room around them," accumulation points are surrounded by infinitely
many other points from the set no matter how small a neighborhood we consider.
Definition: Accumulation Points
Suppose \(X\) is a metric space, \(S\) is a subset of \(X\), and \(z \in X\). Then \(z\) is said to be
an accumulation point or a limit point of \(S\) in \(X\) if and only if
\[
\operatorname{dist}(z, S \setminus \{z\}) = 0.
\]
The collection of accumulation points of \(S\) in \(X\) is denoted by \(\operatorname{acc}(S)\).
Definition: Nearest Points
Suppose \((X, d)\) is a metric space, \(S\) is a subset of \(X\), and \(z \in X\). A member \(s \in S\), if one exists,
is called a nearest point of \(S\) to \(z\) in \(X\) if and only if
\[
d(z, s) = \operatorname{dist}(z, S).
\]
A nearest point need not exist in general. Take \(X = \mathbb{R}\), \(S = (0, 1)\), and \(z = 0\). Then
\(\operatorname{dist}(z, S) = 0\), yet no member of \(S\) is at distance zero from \(z\), because \(S\) is open and
excludes its boundary. Existence is guaranteed, however, when \(S\) has sufficient structure. The most notable case is
that \(S\) is compact, a notion we formalize on a later page. In \(\mathbb{R}^n\), compactness reduces
to \(S\) being closed and bounded (Heine-Borel). More generally, closedness alone suffices in "nice" spaces such as
Hilbert spaces, where the projection
onto a closed convex set is uniquely determined.
Insight: When Can We Trust That "The Nearest Point Exists"?
Machine learning practitioners routinely take the existence of a nearest point for granted: "find the closest
training example," "project onto the feasible set," "snap the embedding to the nearest codeword." These operations
are so ubiquitous that it is easy to forget they rest on a nontrivial mathematical guarantee.
Here is the cheat sheet for when existence is safe:
-
k-Nearest Neighbors / SVM support vectors. The set \(S\) is a finite collection of training points.
Finite sets are automatically compact, so a minimizer always exists (in fact, it is attained by brute-force search).
-
Projection in convex optimization (proximal methods, projected gradient descent). The feasible set is typically
closed and convex in \(\mathbb{R}^n\) or a Hilbert space. The Hilbert projection theorem guarantees not only
existence but also uniqueness of the nearest point.
-
Vector quantization / codebook lookup. The codebook is finite, exactly as in k-NN, so existence
is automatic.
-
Open constraint sets (for example, strict inequalities \(g(x) \lt 0\)). This is where existence
can fail. The nearest feasible point may not exist. The typical fix is to replace the constraint with
its closure \(g(x) \leq 0\), or to use a barrier/penalty method rather than direct projection.
-
Non-compact feasible sets (even convex ones). There is no guarantee in general. The fundamental
obstruction is not non-convexity but non-compactness. A closed but unbounded set in \(\mathbb{R}^n\),
or any closed bounded set in an infinite-dimensional
Banach space (which is never
compact), can fail to contain a nearest point. Iterative algorithms operating in such settings may oscillate or
approach a limit outside \(S\).
The takeaway is simple. Whenever we write project(x, S) or call a nearest-neighbor routine, the code
silently assumes existence. That assumption is usually, but not always, justified by the structure of \(S\).
The concept of distance to a set is fundamental to margin-based classifiers
(like SVMs),
where the goal is to maximize the distance between a decision boundary and the nearest data points.
Furthermore, the nearest point definition is the mathematical foundation of projection.
In constrained optimization, projecting a gradient update back onto the feasible set \(S\) is exactly the
act of finding a nearest point \(s \in S\) to the updated vector \(z\).
Open, Closed & Dense
The concepts of interior and boundary lead naturally to a classification of sets themselves. A set is open if
it consists entirely of interior points. Intuitively, every point has "breathing room" and we can move slightly in any
direction without leaving the set. A set is closed if it contains all its boundary points, so it includes its
own "edge."
Definition: Open and Closed Subsets
Suppose \(X\) is a metric space and \(S\) is a subset of \(X\). Then \(S\) is said to be
- an open subset of \(X\), or open in \(X\), if and only if \[S \cap \partial S = \emptyset\]
- a closed subset of \(X\), or closed in \(X\), if and only if \[\partial S \subseteq S\]
Note that most subsets of metric spaces are neither open nor closed. A set can contain some but not all of its boundary
points. However, the sets that are open form a structure worth naming.
Open and closed are two ways of asking which boundary points belong to a set. A different and complementary
question is: how thoroughly does a subset reach into the rest of the space? Even a set that is far from being
all of \(X\) can still "approach every point" of \(X\). Every point of \(X\) is then the limit of some sequence drawn
from the subset, or equivalently, every open region of \(X\), no matter how small, meets the subset.
Sets with this reaching property are called dense, and they behave in many contexts as good "test sets." A continuous
function, an isometry, and a bounded linear operator are each determined by their values on a dense subset. The formal
definition uses the closure introduced above.
Definition: Dense Subset
Suppose \(X\) is a metric space and \(S \subseteq X\). Then \(S\) is said to be dense in \(X\) if
and only if its closure equals the whole space:
\[
\overline{S} = X.
\]
Equivalently, every nonempty open subset of \(X\) contains at least one point of \(S\). Equivalently again, every
point of \(X\) is the limit of a sequence drawn from \(S\).
The standard example is \(\mathbb{Q}\) inside \(\mathbb{R}\). Every real number is a limit of rationals, so
\(\overline{\mathbb{Q}} = \mathbb{R}\) and \(\mathbb{Q}\) is dense in \(\mathbb{R}\). The same holds componentwise for
\(\mathbb{Q}^n\) inside \(\mathbb{R}^n\). The irrationals \(\mathbb{R} \setminus \mathbb{Q}\) are also dense in
\(\mathbb{R}\). Density is symmetric in a strong sense. A set and its complement can both be dense, which is exactly
what happens here.
In function spaces, dense subsets play an even more decisive role. Trigonometric polynomials are dense in continuous
periodic functions, and continuous compactly supported functions are dense in \(L^p\). These density results are the
engines behind the entire theory of Fourier analysis and \(L^p\) approximation, where we prove an identity for a "nice"
dense subclass and then extend it to the whole space by continuity.
Definition: Topology
Suppose \((X, d)\) is a metric space. The collection of open subsets of \(X\) is called the
topology determined by the metric \(d\), denoted \(\tau_d\).
While we will not develop general topology here, this connection is valuable. Many properties of metric spaces
(continuity, convergence, compactness) depend only on which sets are open, not on the specific numerical values of the
metric.
Why do these classifications matter for optimization? If our search space is strictly open (for
example, \(0 \lt x \lt 1\)), an algorithm might iterate forever, approaching a boundary value without ever reaching it.
The limit point is excluded from the feasible set. A closed set contains its boundary, ensuring that
edge solutions are valid. More fundamentally, the Extreme Value Theorem guarantees that a continuous
function attains its maximum and minimum only when the domain is compact, which in \(\mathbb{R}^n\)
means both closed and bounded.
Now we arrive at one of the most important concepts for algorithmic convergence: completeness.
Definition: Complete Metric Space
A metric space \(X\) is said to be complete if and only if
\(X\) is closed in every metric superspace of \(X\).
Here "closed" is meant in the topological sense relative to the superspace \(Y\). For every metric superspace
\((Y, e)\) with \(X \subseteq Y\), the boundary \(\partial X\) computed inside \(Y\) satisfies
\(\partial X \subseteq X\).
Intuitively, completeness means the space has "no holes." The real numbers \(\mathbb{R}\) with the standard metric are
complete, which is why calculus works. The rational numbers \(\mathbb{Q}\) are not complete. Consider
the sequence defined by \(x_1 = 1\) and \(x_{n+1} = \frac{1}{2}\left(x_n + \frac{2}{x_n}\right)\). Each term is
rational, but the sequence converges to \(\sqrt{2}\), which is irrational. The limit exists in \(\mathbb{R}\) but not in
\(\mathbb{Q}\). There is a "hole" where \(\sqrt{2}\) should be.
For optimization, completeness ensures that limit points of iterative algorithms actually belong to the space we are
working in. The definition above (closedness in every superspace) is the primary one we adopt here. It is convenient
because it refers only to already-established topological notions. On the page devoted to completeness, we will develop
the theory of Cauchy sequences and establish the standard equivalent characterization: a metric space is
complete if and only if every Cauchy sequence converges to a limit within the space. This equivalence is the
reason both formulations are used interchangeably in the literature.
Balls
Open and closed sets can be complicated objects, but we can build them from simpler pieces. The open
ball centered at a point \(x\) with radius \(r\) is the set of all points within distance \(r\) of \(x\). These
balls are the "building blocks" of the topology. Every open set \(U\) can be expressed as a union of open balls, as we
prove below once the balls themselves have been defined. That property is exactly what it means to say the open balls
form a basis for the metric topology, a perspective we develop in full generality on the page on topological
spaces.
More importantly for algorithms, balls give us a coordinate-free way to talk about
neighborhoods. When we say "there exists a step size \(\alpha\) such that gradient descent stays in the
feasible region," we are implicitly saying the current point lies in an open ball contained within
that region.
Definition: Open Balls & Closed Balls
Suppose \((X, d)\) is a metric space and \(x \in X\). For each \(r \in \mathbb{R}^+\), we define:
- The open ball in \(X\) centered at the point \(x\) and with radius \(r\) to be the set
\[
\mathcal{B}[x; r) = \{y \in X \mid d(x, y) \lt r\}.
\]
- The closed ball in \(X\) centered at the point \(x\) and with radius \(r\) to be the set
\[
\mathcal{B}[x; r] = \{y \in X \mid d(x, y) \leq r\}.
\]
Intuitively, the open ball in \(X\) should be an open subset of \(X\), and the closed ball in \(X\) a closed subset of
\(X\). Both statements are true. We prove only the open ball case here.
Theorem: Open Balls Are Open
Suppose \((X, d)\) is a metric space, \(x \in X\), and \(r \in \mathbb{R}^+\). Then the open ball
\(\mathcal{B}[x; r)\) is an open subset of \(X\).
Proof: The Open Ball is Open
Suppose \((X, d)\) is a metric space, \(x \in X\), and \(r \in \mathbb{R}^+\). Consider the open ball
\[
\mathcal{B}[x; r) = \{y \in X \mid d(x, y) \lt r\} \subseteq X.
\]
Let \(z \in \mathcal{B}\). Since \(d(x, z) \lt r\), we may choose
\[
s := \tfrac{1}{2}\bigl(r - d(x, z)\bigr) \in (0, r),
\]
so that \(d(x, z) \lt r - s\).
Now consider any point \(w\) outside the ball, that is, \(w \in X \setminus \mathcal{B}\).
By definition, \(d(w, x) \geq r\). The triangle inequality gives
\(d(w, x) \leq d(w, z) + d(z, x)\), and rearranging (using symmetry) yields the
reverse triangle inequality:
\[
d(z, w) \geq d(w, x) - d(x, z) \gt r - (r - s) = s.
\]
Since \(w\) is an arbitrary point in the complement \(X \setminus \mathcal{B}\),
this inequality holds for all points outside the ball. This implies that the
"shortest distance" (infimum) from \(z\) to the outside of the ball is at least \(s\):
\[
\operatorname{dist}(z, X \setminus \mathcal{B}) = \inf \{d(z, w) \mid w \notin \mathcal{B}\} \geq s \gt 0.
\]
Recall the definition of a boundary point requires the distance to the complement to be zero.
Since the distance here is strictly positive, \(z \notin \partial \mathcal{B}\).
Since \(z\) was chosen arbitrarily, we have \(\mathcal{B} \cap \partial \mathcal{B} = \emptyset\),
which is precisely the definition of \(\mathcal{B}\) being open. Equivalently, every point of
\(\mathcal{B}\) is an interior point, so
\[
\mathcal{B} = \mathcal{B}^{\circ}.
\]
Therefore, \(\mathcal{B}\) is open.
Theorem: Open Balls Form a Basis
Suppose \((X, d)\) is a metric space and \(U\) is a subset of \(X\). Then \(U\) is open in \(X\) if
and only if for each \(x \in U\) there exists \(r \in \mathbb{R}^+\) with
\(\mathcal{B}[x; r) \subseteq U\). In that case, for any such choice of radii \(r_x\),
\[
U = \bigcup_{x \in U} \mathcal{B}[x; r_x).
\]
Proof: Open Balls Form a Basis
Suppose first that \(U\) is open in \(X\), and let \(x \in U\). Since \(d(x, x) = 0\), we have
\(\operatorname{dist}(x, U) = 0\), so \(x\) is a boundary point of \(U\) precisely when
\(\operatorname{dist}(x, U^c) = 0\). Openness means \(U \cap \partial U = \emptyset\), and therefore
\(\operatorname{dist}(x, U^c) \neq 0\). Distances are infima of nonnegative numbers, so
\(\operatorname{dist}(x, U^c) \gt 0\).
If \(U^c = \emptyset\), then \(U = X\) and \(\mathcal{B}[x; r) \subseteq U\) for every
\(r \in \mathbb{R}^+\). Otherwise \(\operatorname{dist}(x, U^c)\) is a positive real number, and we
may set
\[
r := \tfrac{1}{2}\operatorname{dist}(x, U^c) \in \mathbb{R}^+.
\]
For \(y \in \mathcal{B}[x; r)\), membership \(y \in U^c\) would force
\(d(x, y) \geq \operatorname{dist}(x, U^c) = 2r\), contradicting \(d(x, y) \lt r\). Hence
\(\mathcal{B}[x; r) \subseteq U\).
Conversely, suppose each \(x \in U\) admits \(r_x \in \mathbb{R}^+\) with
\(\mathcal{B}[x; r_x) \subseteq U\), and fix such an \(x\). Every \(w \in U^c\) lies outside
\(\mathcal{B}[x; r_x)\), so \(d(x, w) \geq r_x\), and consequently
\(\operatorname{dist}(x, U^c) \geq r_x \gt 0\). The same conclusion holds when \(U^c = \emptyset\),
where the distance is \(+\infty\) by convention. Thus \(x \notin \partial U\). Since \(x\) was an
arbitrary member of \(U\), we obtain \(U \cap \partial U = \emptyset\), which is what it means for
\(U\) to be open.
Finally, \(d(x, x) = 0 \lt r_x\) places each \(x \in U\) inside \(\mathcal{B}[x; r_x)\), so \(U\) is
contained in \(\bigcup_{x \in U} \mathcal{B}[x; r_x)\). The reverse inclusion holds because each
\(\mathcal{B}[x; r_x)\) is contained in \(U\).
Theorem: Balls in Subspaces
Suppose \((X, d)\) is a metric space, \((Z, d_Z)\) is a
metric subspace of \((X, d)\),
\(x \in Z\), and \(r \in \mathbb{R}^+\). Writing \(\mathcal{B}_X\) and \(\mathcal{B}_Z\) for
balls formed in \(X\) and in
\(Z\) respectively, we have:
- The open ball of \(Z\) centered at \(x\) with radius \(r\) is the trace on \(Z\)
of the corresponding open ball of \(X\),
\[
\mathcal{B}_Z[x; r) = Z \cap \mathcal{B}_X[x; r).
\]
- The closed ball of \(Z\) centered at \(x\) with radius \(r\) is the trace on \(Z\)
of the corresponding closed ball of \(X\),
\[
\mathcal{B}_Z[x; r] = Z \cap \mathcal{B}_X[x; r].
\]
Moreover, every open ball and every closed ball of \(Z\) arises in this way.
Proof: Balls in Subspaces
Since \(d_Z\) is the restriction of \(d\) and \(x \in Z\), we have \(d_Z(x, y) = d(x, y)\) for every
\(y \in Z\). Hence
\[
\mathcal{B}_Z[x; r) = \{y \in Z \mid d_Z(x, y) \lt r\} = \{y \in Z \mid d(x, y) \lt r\}
= Z \cap \{y \in X \mid d(x, y) \lt r\} = Z \cap \mathcal{B}_X[x; r),
\]
and the same chain with \(\lt\) replaced by \(\leq\) throughout gives the closed ball. For the final
assertion, the point \(x \in Z\) and the radius \(r \in \mathbb{R}^+\) were arbitrary, while every ball of
\(Z\) is by definition centered at a point of \(Z\) and carries a radius in \(\mathbb{R}^+\). The two
identities therefore cover every ball of \(Z\).
Theorem: The Topology of a Metric Subspace
Suppose \((X, d)\) is a metric space and \((Z, d_Z)\) is a
metric subspace of \((X, d)\). A subset
\(W\) of \(Z\) is open in \(Z\) if and only if \(W = Z \cap U\) for some open subset \(U\) of \(X\).
Equivalently, the
topology determined
by \(d_Z\) is
\[
\tau_{d_Z} = \{\, Z \cap U \mid U \in \tau_d \,\}.
\]
Proof: The Topology of a Metric Subspace
Suppose first that \(W = Z \cap U\) for some open subset \(U\) of \(X\), and let \(x \in W\). Since
\(x \in U\), the criterion that
open balls form a basis, applied in
\(X\), supplies \(r \in \mathbb{R}^+\) with \(\mathcal{B}_X[x; r) \subseteq U\). Because \(x\) lies in
\(Z\), the description of
balls in subspaces gives
\[
\mathcal{B}_Z[x; r) = Z \cap \mathcal{B}_X[x; r) \subseteq Z \cap U = W.
\]
Since \(x\) was an arbitrary member of \(W\), the same criterion applied in \(Z\) shows that \(W\) is
open in \(Z\).
Conversely, suppose \(W\) is open in \(Z\). The criterion applied in \(Z\) supplies, for each
\(p \in W\), a radius \(r_p \in \mathbb{R}^+\) with \(\mathcal{B}_Z[p; r_p) \subseteq W\). Fix such a
family of radii and set
\[
U := \bigcup_{p \in W} \mathcal{B}_X[p; r_p) \subseteq X.
\]
To see that \(U\) is open in \(X\), let \(y \in U\) and choose \(q \in W\) with
\(y \in \mathcal{B}_X[q; r_q)\). That ball is
an open subset of \(X\), so the
criterion supplies \(\rho \in \mathbb{R}^+\) with
\(\mathcal{B}_X[y; \rho) \subseteq \mathcal{B}_X[q; r_q) \subseteq U\). As \(y\) was arbitrary, \(U\) is
open in \(X\). When \(W = \emptyset\) the union is empty, and \(U = \emptyset\) satisfies the criterion
vacuously.
Intersecting the defining union with \(Z\) and applying the description of balls in subspaces to each
term, we obtain
\[
Z \cap U = \bigcup_{p \in W} \bigl( Z \cap \mathcal{B}_X[p; r_p) \bigr)
= \bigcup_{p \in W} \mathcal{B}_Z[p; r_p) = W,
\]
the last equality holding because each \(\mathcal{B}_Z[p; r_p)\) is contained in \(W\), while
\(d_Z(p, p) = 0 \lt r_p\) places each \(p \in W\) inside its own ball.
For the second formulation, \(\tau_{d_Z}\) is the collection of open subsets of \(Z\). Every member of
\(\tau_{d_Z}\) is an open subset of \(Z\) and therefore has the form \(Z \cap U\) with \(U \in \tau_d\).
In the other direction, for \(U \in \tau_d\) the set \(Z \cap U\) is a subset of \(Z\) that is open in
\(Z\). The two collections therefore coincide.
The passage from \(X\) to \(Z\) traces open sets rather than selecting them, so the topology of \(Z\) is
not in general a subcollection of the topology of \(X\). Taking \(Z = [0, 1]\) inside
\(X = \mathbb{R}\), the set \([0, 1/2) = Z \cap \mathcal{B}_X[0; 1/2)\) is an open ball of \(Z\) and so
open in \(Z\), yet it is not open in \(\mathbb{R}\), because \(0\) is one of its boundary points there.
The discrepancy persists for closed sets even when \(Z\) is itself open in \(X\). With
\(Z = \mathcal{B}_X[1/2; 1/2) = (0, 1)\), the set \((0, 1/2]\) has boundary \(\{1/2\}\) in \(Z\) and
boundary \(\{0, 1/2\}\) in \(\mathbb{R}\), so it is closed in \(Z\) and not closed in \(\mathbb{R}\).
The open ball also provides the foundation for discussing
convexity in a coordinate-free manner. In a
normed linear space, all open balls
of the same radius have identical shape, since each is simply a translation of the others. Moreover, these balls are
themselves convex sets (a short consequence of the triangle inequality and positive homogeneity of the norm). We can now
state the definition of convexity that applies to general normed spaces, not just \(\mathbb{R}^n\):
Definition: Convex
Suppose \(V\) is a
normed linear space and \(C \subseteq V\). Then \(C\) is said to be
convex if and only if
for each \(a, b \in C\), the line segment \(\{ (1 - t)a + tb \mid t \in [0, 1] \}\) joining \(a\) and \(b\) is included in
\(C\).