A Mathematical Analysis
This appendix collects the core results from real analysis and topology that underpin the mathematics of generative modelling. Rather than simply listing definitions, we develop the material from the ground up, with complete proofs and worked examples, so that the reader can appreciate why each concept matters. The journey begins with the real number line and ends, several sections later, with the function-space machinery needed for variational inference and optimal transport.
The Real Number Line
The real numbers are so familiar that one might wonder why we bother axiomatising them at all. The answer is that one particular property of , completeness, is responsible for virtually every convergence guarantee we rely on when training generative models. Without it, gradient descent could converge to a “hole” in the number line, and probability distributions could fail to have well-defined means.
We begin with two companion definitions that capture the idea of “tightest possible bound.”
Definition 1 (Supremum).
Let be a nonempty set. A number is the supremum (or least upper bound) of , written , if
for every (i.e. is an upper bound), and
whenever is an upper bound of we have (i.e. is the smallest such bound).
The supremum need not belong to itself.
Definition 2 (Infimum).
Let be nonempty. The infimum (or greatest lower bound) of , written , is the largest real number satisfying for every . Equivalently, where .
Example 1 (Open Interval).
Consider the open interval . Every element of is strictly less than , and for any proposed upper bound the midpoint lies in yet exceeds . Hence , even though . By a symmetric argument, .
Example 2 (Rationals in an Interval).
Let . Every element of is rational, yet , which is irrational. This example is historically significant: it shows that the rationals alone cannot supply the supremum of a bounded set of rationals.
Example 3 (Negative Powers of Two).
Let . Then and , since the terms decrease toward zero but never reach it.
The following axiom is what distinguishes from .
Theorem 1 (Completeness Axiom).
Every nonempty subset of that is bounded above has a supremum in .
The Completeness Axiom is not something we prove; it is taken as an axiom in the construction of . One way to appreciate its content is to observe that the analogous statement fails for : the set is bounded above in yet has no rational least upper bound.
Key Idea.
Completeness is what distinguishes from : it guarantees that limits of convergent sequences always exist within , which is essential for the convergence guarantees we need in optimisation and sampling.
An immediate and useful consequence is the Archimedean property, which says that there are no “infinitely large” or “infinitesimally small” positive reals.
Theorem 2 (Archimedean Property).
For every with and every , there exists such that .
Proof.
Suppose for contradiction that no such exists. Then for every , which means the set is bounded above by . By the Completeness Axiom (Theorem 1), exists in . Because , we have , so is not an upper bound of . Therefore there exists with , giving . But , contradicting the assumption that is an upper bound.
The next result uses completeness in a geometric way. It says that a sequence of closed intervals, each contained in the previous one and shrinking in length, must “trap” a single point.
Theorem 3 (Nested Intervals).
Let be a nested sequence of nonempty closed intervals with . Then there exists a unique point with
Proof.
The sequence is non-decreasing and bounded above by , so by the Completeness Axiom it converges to . Similarly, is non-increasing and bounded below by , so it converges to some limit . For every we have , hence , giving . Any point in the intersection must lie in every and hence equal .
Historical Note.
Richard Dedekind (1872) and Georg Cantor independently constructed from , each motivated by the need for a number system where every Cauchy sequence converges. Dedekind used “cuts” that partition into two halves, while Cantor identified each real with an equivalence class of Cauchy sequences of rationals. Both constructions yield the same ordered field, and the Completeness Axiom holds in each.
Metric Spaces
A great deal of generative modelling takes place not on the real line but in high-dimensional spaces: image pixel spaces, latent spaces, and spaces of probability distributions. To discuss convergence, continuity, and compactness in all these settings at once, we need the abstraction of a metric space. The idea is simple: distill the essence of “distance” into a small set of axioms, and then develop the theory once and for all.
Definition and Examples
Definition 3 (Metric Space).
A metric space is a pair where is a nonempty set and is a function (called a metric or distance function) satisfying, for all :
Non-negativity: .
Identity of indiscernibles: if and only if .
Symmetry: .
Triangle inequality: .
These four axioms capture the intuitive properties we expect of distance: distances are non-negative, zero only for identical points, symmetric, and satisfy the “shortcut cannot be longer than the detour” principle. Let us see several concrete instances.
Example 4 (Euclidean Metric).
On , the Euclidean metric is This is the distance “as the crow flies” and the default metric in most machine learning applications.
Example 5 (Discrete Metric).
On any set , define Verification of the axioms is immediate. The discrete metric may seem artificial, but it appears naturally when is a finite label set (e.g. class labels in a classifier).
Example 6 (Taxicab Metric).
On , the taxicab (or Manhattan) metric is In two dimensions, this measures distance by travelling along axis-aligned streets, like a taxi in Manhattan.
Example 7 ( Metric).
For any , the distance on is The Euclidean metric corresponds to and the taxicab metric to . The limiting case gives the supremum metric . That the triangle inequality holds for all is the content of the Minkowski inequality.
The shape of the unit ball varies dramatically with the choice of metric.
Open and Closed Sets
With a metric in hand, we can formalise what it means for a set to “have no boundary points” (open) or “contain all its boundary points” (closed). These notions are essential for stating convergence theorems precisely.
Definition 4 (Open Ball).
Let be a metric space, , and . The open ball of radius centred at is
Definition 5 (Open Set).
A subset is open if for every there exists such that . Informally, every point of can be “wiggled” a little without leaving .
Definition 6 (Closed Set).
A subset is closed if its complement is open.
A common misconception is that “closed” is the opposite of “open.” In fact, a set can be both open and closed (the empty set and itself), or neither (the half-open interval in ).
Definition 7 (Limit Point).
A point is a limit point (or accumulation point) of a set if every open ball centred at contains a point of other than itself: Note that need not belong to .
Definition 8 (Isolated Point).
A point is an isolated point of if there exists with . Equivalently, but is not a limit point of .
Interior, Closure, and Boundary
Every set in a metric space has three closely related derived sets that describe its “inner core,” its “completed version,” and the “edge” between inside and outside.
Definition 9 (Interior).
The interior of , denoted , is the set of all points for which there exists with . Equivalently, is the largest open set contained in (i.e. the union of all open subsets of ).
Definition 10 (Closure).
The closure of , denoted or , is the smallest closed set containing . Equivalently, , where is the set of all limit points of .
Definition 11 (Boundary).
The boundary of is . A point belongs to if and only if every open ball centred at intersects both and .
With these definitions in place, we can prove two fundamental characterisations of closed sets.
Theorem 4 (Closed Set Characterisation).
A set in a metric space is closed if and only if contains all its limit points.
Proof.
() Suppose is closed and let be a limit point of . We must show . If , then , which is open. So there exists with , meaning . But this contradicts being a limit point, since every ball around a limit point must intersect .
() Suppose contains all its limit points. We show is open. Take any . Since and is not a limit point of (because contains all its limit points), there exists with . Since , this gives , i.e. . As was arbitrary, is open, so is closed.
Theorem 5 (Closure via Limit Points).
For any subset of a metric space , where denotes the set of all limit points of .
Proof.
We show both inclusions.
() We must show . Since is closed and contains , it suffices to show it contains every limit point of . Let and suppose . Then , which is open. So there exists with , contradicting the fact that is a limit point of .
() We show by proving that is closed. Let be a limit point of . For every , contains a point with . If , then . If , then pick small enough that ; since is a limit point of , contains a point of distinct from , and hence . Either way, is a limit point of , so . Therefore contains all its limit points and is closed by Theorem 4. Since is the smallest closed set containing , we conclude .
Sequences and Convergence
Sequences are the primary vehicle through which we discuss convergence in analysis. A training loop in deep learning is, at bottom, a sequence of parameter vectors , and the central question is whether this sequence converges to a useful model. The concepts in this section make that question precise.
Definition 12 (Convergent Sequence).
A sequence in a metric space converges to a point if for every there exists such that for all . We write or .
Convergence is the demand that, no matter how tight a tolerance we specify, the sequence eventually enters and stays within the open ball .
Example 8 (Convergent and Divergent Sequences).
The sequence in converges to : given , choose (possible by the Archimedean property, Theorem 2), and then for all .
The sequence does not converge. Its terms alternate between and and never settle within any ball of radius less than around a single point.
A subtler notion asks whether the terms of a sequence get close to each other, without reference to any particular limit.
Definition 13 (Cauchy Sequence).
A sequence in a metric space is a Cauchy sequence if for every there exists such that for all .
Every convergent sequence is Cauchy, but the converse can fail: the space may have “gaps” that prevent a Cauchy sequence from finding its limit.
Theorem 6 (Convergent Implies Cauchy).
Every convergent sequence in a metric space is a Cauchy sequence.
Proof.
Suppose . Given , choose such that for all . Then for , where we used the triangle inequality.
Remark 1 (The Converse Fails in ).
The sequence of decimal approximations to is a Cauchy sequence of rationals. Yet it does not converge in , because its limit is irrational. This is precisely the kind of gap that the completeness of eliminates.
Definition 14 (Complete Metric Space).
A metric space is complete if every Cauchy sequence in converges to a limit in .
Completeness is a property of the space, not of individual sequences. The rationals are incomplete; the reals are complete. In the infinite-dimensional world, Banach and Hilbert spaces are complete by definition, and this is exactly what makes them suitable homes for the function spaces used in variational inference.
Theorem 7 (Completeness of ).
with the Euclidean metric is a complete metric space.
Proof sketch.
Let be a Cauchy sequence in . For each coordinate , the scalar sequence is Cauchy in (since ). By the completeness of (which follows from the Completeness Axiom, Theorem 1), each coordinate sequence converges: . Setting , one verifies .
The next result is one of the jewels of real analysis. It guarantees the existence of convergent subsequences in bounded regions.
Theorem 8 (Bolzano–Weierstrass).
Every bounded sequence in has a convergent subsequence.
Proof.
We prove the result for ; the general case follows by applying the one-dimensional argument to each coordinate in turn (using a diagonal subsequence extraction).
Let be a bounded sequence in , so for all . We construct a convergent subsequence by interval bisection. Divide into two equal halves: and . At least one half contains infinitely many terms of the sequence; call it and choose . Repeat: bisect , pick the half with infinitely many terms, call it , and choose with .
Continuing, we obtain a subsequence and nested intervals with and for every . By the Nested Intervals Theorem (Theorem 3), the intervals shrink to a single point . Since , we have .
For : given a bounded sequence in , first extract a subsequence along which the first coordinate converges (by the one-dimensional result). From that subsequence, extract a further subsequence along which the second coordinate also converges. After such extractions, we have a subsequence that converges in every coordinate, and hence in .
Historical Note.
Bernhard Bolzano proved the one-dimensional result in 1817, making it one of the earliest rigorous statements about the structure of . Karl Weierstrass rediscovered and popularised it in the 1860s as part of his programme to place analysis on a firm logical foundation. The theorem was among the first results to show that has fundamentally different properties from : a bounded sequence of rationals need not have a rational limit point.
Compactness
Compactness is arguably the single most important topological property in analysis. Compact sets are “the next best thing to finite sets”: they are small enough to be controlled, yet rich enough to be useful. In optimisation, compactness guarantees that continuous functions attain their optima. In measure theory, compactness ensures that sequences of probability measures have convergent subsequences.
We begin with the covering definition, which is the most general.
Definition 15 (Open Cover).
Let be a metric space and . A collection of open sets is an open cover of if . A subcover is a subcollection that still covers .
Definition 16 (Compact Set).
A subset of a metric space is compact if every open cover of has a finite subcover: whenever with each open, there exist finitely many indices with .
The power of this definition lies in the word “every”: no matter how wastefully we cover with open sets, we can always trim the cover down to a finite one.
The most useful characterisation of compact subsets of is the classical Heine–Borel theorem.
Theorem 9 (Heine–Borel).
A subset is compact if and only if it is closed and bounded.
Proof.
(: compact implies closed and bounded.)
Bounded. Consider the open cover of . By compactness, finitely many balls suffice: where . Hence is bounded.
Closed. We show is open. Fix any . For each , let and consider the open balls . These cover , so by compactness there exist with . Let . We claim . Indeed, if , then for some , giving , a contradiction.
(: closed and bounded implies compact.)
Since is bounded, it is contained in some closed box . Suppose for contradiction that has an open cover with no finite subcover. Bisect the box into congruent sub-boxes. At least one sub-box intersects in a subset that has no finite subcover from ; call this sub-box and the corresponding subset . Repeat to obtain nested boxes with diameters shrinking to zero and having no finite subcover.
By the Nested Intervals Theorem applied coordinate-wise, the boxes shrink to a single point . Since each is nonempty and (as is closed), we have . So for some , and since is open, for some . For sufficiently large , , so , so a single open set covers , contradicting our assumption.
There is a sequential characterisation of compactness that is often more convenient in practice.
Definition 17 (Sequential Compactness).
A metric space (or a subset thereof) is sequentially compact if every sequence in has a subsequence that converges to a point in .
Theorem 10 (Compactness Equivalence in Metric Spaces).
In a metric space, a set is compact if and only if it is sequentially compact.
Proof sketch.
(Compact sequentially compact.) Let be a sequence in a compact set . If only finitely many distinct values appear, some value repeats infinitely often and yields a (trivially) convergent subsequence. Otherwise, the set of distinct values is infinite. Suppose no subsequence converges in . Then every point of has a neighbourhood containing at most finitely many terms. These neighbourhoods form an open cover of ; extracting a finite subcover shows that has only finitely many terms, a contradiction.
(Sequentially compact compact.) This direction uses a technical tool called a Lebesgue number. Given an open cover of a sequentially compact set , one first shows that there exists (the Lebesgue number) such that every subset of with diameter less than is contained in some single . Then, using sequential compactness, one shows that can be covered by finitely many balls of radius , each of which fits inside some . This produces the desired finite subcover.
The compact-implies-closed-and-bounded direction holds in any metric space. Let us record this cleanly.
Theorem 11 (Compact Sets are Closed and Bounded).
In any metric space , every compact set is closed and bounded.
Proof.
Closed. Let be a limit point of . For each , the ball intersects , so we can pick with . By sequential compactness (Theorem 10), has a subsequence converging to some . But already, so , hence . By Theorem 4, is closed.
Bounded. Fix any and consider the open cover of . A finite subcover yields for some , so is bounded.
Key Idea.
In generative modelling, we often work with probability distributions on compact metric spaces. The Kantorovich–Rubinstein theorem (Proof of KR Duality in the Wasserstein GAN chapter) requires compactness to guarantee that the Wasserstein distance metrises weak convergence of probability measures. Compactness also underpins the Arzelà–Ascoli theorem, which controls the complexity of function classes used in discriminator and critic networks.
Remark 2 (Why Compactness Matters for Optimisation).
The extreme value theorem (which we prove in Extreme Value Theorem below) guarantees that a continuous function on a compact set attains its maximum and minimum. This is why many optimisation problems in machine learning implicitly assume compact parameter domains or add regularisation to effectively compactify the search space. Without compactness, a continuous objective can approach but never reach its infimum, and the “optimal” parameters may not exist.
Continuity
Continuity is the mathematical formalisation of the intuitive idea that “small changes in input produce small changes in output.” For generative modelling this concept is indispensable: the decoder of a variational autoencoder must map nearby latent codes to perceptually similar images, and the loss landscape that a GAN critic traverses must be sufficiently regular for gradient-based optimisation to succeed. In this section we develop the theory of continuity from the basic - definition through to the Lipschitz condition that underpins Wasserstein GANs.
Definitions of Continuity
Definition 18 (- Continuity).
Let and be metric spaces. A function is continuous at a point if for every there exists such that (EPS Delta) The function is continuous on if it is continuous at every point of .
The definition says nothing about how large or small must be in absolute terms; it only requires that a suitable exists. Crucially, may depend on both and the point . When it depends only on , we obtain the stronger notion of uniform continuity discussed in Uniform Continuity.
An equivalent and often more convenient characterisation uses sequences.
Theorem 12 (Sequential Characterisation).
Let and be metric spaces and let . Then is continuous at if and only if for every sequence in with , we have .
Proof.
; Suppose is continuous at and let be a sequence with . Given , choose as in Definition 18. Since , there exists such that for all . Then for all , so .
; We prove the contrapositive. Suppose is not continuous at . Then there exists such that for every there is a point with yet . Taking for produces a sequence with but for all , so does not converge to .
Extreme Value Theorem
One of the most important consequences of continuity is that continuous functions on compact sets are guaranteed to attain their extreme values. Before stating the main result, we establish that continuous maps preserve compactness.
Theorem 13 (Continuous Image of a Compact Set).
Let be a continuous map between metric spaces. If is compact, then is compact.
Proof.
Let be an open cover of in . For each , the preimage is open in because is continuous. Since every lies in some , every lies in the corresponding , so is an open cover of . By compactness of , there exists a finite subcover . Then covers : for any with , we have for some , hence .
Theorem 14 (Extreme Value Theorem).
If is continuous and is compact, then attains its maximum and minimum on . That is, there exist points such that
Proof.
By Theorem 13, is a compact subset of . The Heine–Borel theorem tells us that compact subsets of are precisely the closed and bounded sets. Since is bounded, and are finite. Since is closed, both and belong to . Therefore there exist with and with .
Uniform Continuity
Definition 19 (Uniform Continuity).
A function between metric spaces is uniformly continuous if for every there exists such that
Remark 3 (Pointwise vs Uniform).
Ordinary continuity and uniform continuity differ in a subtle but important way. In the pointwise definition (Definition 18), may depend on both and the particular point . In the uniform definition, a single works simultaneously for every pair of points in the domain. The distinction vanishes on compact domains, as the next theorem shows, but is significant on unbounded or non-closed domains.
On compact domains, the distinction between pointwise and uniform continuity disappears. This classical result is essential in analysis and will be used repeatedly in later chapters.
Theorem 15 (Heine–Cantor).
Every continuous function on a compact metric space is uniformly continuous.
Proof.
Let be continuous on the compact metric space . Fix . For each , continuity gives a such that implies . The open balls cover . By compactness, finitely many suffice: . Set .
Now suppose . Since the finite collection covers , there exists with . Then Therefore and , so by the triangle inequality . Since is independent of the choice of and , is uniformly continuous.
Lipschitz Continuity
Uniform continuity guarantees a single for each , but says nothing about the rate at which the output changes with the input. Lipschitz continuity provides a quantitative bound on this rate, making it the strongest common continuity condition and the one most directly relevant to modern generative models.
Definition 20 (Lipschitz Continuity).
A function between metric spaces is -Lipschitz (or Lipschitz continuous with constant ) if there exists a constant such that (Lipschitz) The smallest such is called the Lipschitz constant of , denoted or .
For differentiable functions, the Lipschitz constant has a clean gradient characterisation.
Definition 21 (Lipschitz Constant via Gradient).
Let be differentiable. Then is -Lipschitz with respect to the Euclidean norm if and only if (Lipschitz GRAD)
The various notions of continuity form a strict hierarchy.
Theorem 16 (Hierarchy of Continuity).
For functions between metric spaces, the following implications hold: None of the converses hold in general.
Proof.
Lipschitz uniformly continuous.; If is -Lipschitz, set (or if ). Then implies . This is independent of the points and , so is uniformly continuous.
Uniformly continuous continuous.; Uniform continuity provides, for each , a single that works for all points. In particular it works at any fixed point , so is continuous at .
Converses fail.; The function on is uniformly continuous (it is continuous on a compact set, so the Heine–Cantor theorem applies) but not Lipschitz: its derivative is unbounded as . The function on is continuous but not uniformly continuous: for , no single works because grows without bound as .
Example 9 (Lipschitz Functions).
Several common functions are Lipschitz continuous:
The linear function is -Lipschitz on , since .
The absolute value is -Lipschitz, by the reverse triangle inequality.
The sine function is -Lipschitz, since by the mean value theorem and the bound .
The ReLU activation is -Lipschitz.
Example 10 (Non-Lipschitz Functions).
Not every continuous function is Lipschitz:
on is not globally Lipschitz because .
on fails to be Lipschitz for the same reason: its derivative grows without bound.
on is not Lipschitz because the derivative blows up at .
Key Idea.
In the Wasserstein GAN framework (10), the critic function is constrained to be -Lipschitz. This ensures that the Kantorovich–Rubinstein dual is finite and provides a meaningful distance between the real and generated distributions. Without the Lipschitz constraint, the supremum would diverge because the critic could become arbitrarily steep, driving the difference to infinity. In practice, the constraint is enforced by weight clipping, gradient penalty, or spectral normalisation.
Connectedness
Compactness captures the idea that a set is “small enough” to extract finite information from infinite data. Connectedness captures a different geometric property: the set is “in one piece.” A connected space cannot be split into two separate open chunks, and this topological rigidity has deep analytic consequences, the most famous being the Intermediate Value Theorem.
Definition 22 (Connected Set).
A metric space is connected if it cannot be written as a union of two nonempty, disjoint open sets and . Equivalently, is connected if and only if every continuous function is constant (where carries the discrete metric).
A stronger property requires that any two points can be joined by a continuous path.
Definition 23 (Path-Connected Set).
A metric space is path-connected if for every pair of points there exists a continuous function with and . The function is called a path from to .
Theorem 17 (Path-Connected Implies Connected).
Every path-connected metric space is connected.
Proof.
Suppose for contradiction that is path-connected but not connected. Then for nonempty disjoint open sets and . Pick and , and let be a path from to . The sets and are open in (since is continuous and , are open), nonempty (since and ), disjoint, and their union is . But this contradicts the fact that the interval is connected.
Remark 4 (The Converse Fails).
Path-connectedness is strictly stronger than connectedness. The classical counterexample is the topologist's sine curve: The set is connected (one cannot separate the oscillating part from the vertical segment without breaking continuity) but not path-connected: no continuous path can traverse the infinitely many oscillations near in finite “time.”
The most celebrated application of connectedness in elementary analysis is the Intermediate Value Theorem, which guarantees that continuous functions on intervals cannot “skip” values.
Theorem 18 (Intermediate Value Theorem).
Let be continuous. If is any real number strictly between and , then there exists such that .
Proof.
The interval is connected (it is path-connected, since the identity map provides a path between any two points). By Theorem 13 (with compactness replaced by the analogous result for connectedness: the continuous image of a connected set is connected), is a connected subset of . The connected subsets of are precisely the intervals. Since and both lie in , and lies between them, we have . Therefore there exists with . Since is strictly between and , we have and , so .
Normed and Inner Product Spaces
Metric spaces provide a general notion of distance, but in the vector spaces that arise throughout machine learning we have additional algebraic structure: vectors can be added and scaled. A norm measures the “size” of a vector in a way that respects this algebraic structure, while an inner product adds a notion of angle and orthogonality. The hierarchy reflects increasing levels of geometric structure. Completeness then distinguishes Banach and Hilbert spaces as the settings where limits always exist, making calculus possible.
Normed Vector Spaces
Definition 24 (Norm).
Let be a vector space over . A norm on is a function satisfying, for all and all :
Positive definiteness:; if and only if .
Absolute homogeneity:; .
Triangle inequality:; .
Definition 25 (Normed Space).
A normed vector space (or simply a normed space) is a pair consisting of a vector space and a norm on . Every normed space is automatically a metric space under the induced metric (Induced Metric)
Example 11 ( Norms on ).
For , the norm on is and the norm is . The most commonly used cases are (Manhattan norm), (Euclidean norm), and (maximum norm). The Euclidean norm is special because it arises from an inner product.
Function Spaces
The norms on have infinite-dimensional counterparts that measure the “size” of functions rather than finite-dimensional vectors.
Definition 26 ( Space).
Let be a measure space and let . The space consists of all (equivalence classes of) measurable functions for which For , the space consists of essentially bounded functions with norm . Two functions that agree -almost everywhere are identified.
Remark 5 (The Importance of ).
The space occupies a privileged position in the family: it is the only space that is a Hilbert space (every other, for , is merely a Banach space). The inner product structure of gives access to the powerful geometry of orthogonal projections, Fourier analysis, and least-squares methods. In machine learning, the mean squared error loss is an quantity, and the reproducing kernel Hilbert spaces used in kernel methods are subspaces of .
Inner Product Spaces
Definition 27 (Inner Product Space).
Let be a vector space over . An inner product on is a function satisfying, for all and all :
Linearity in the first argument:; .
Symmetry:; .
Positive definiteness:; , with equality if and only if .
Every inner product induces a norm via , and hence a metric via .
The fundamental inequality of inner product spaces relates the inner product to the induced norm.
Theorem 19 (Cauchy–Schwarz Inequality).
For any in an inner product space , (Cauchy Schwarz) Equality holds if and only if and are linearly dependent.
Proof.
If , both sides are zero and the inequality holds trivially. Assume and consider the function By positive definiteness of the inner product, for all . This is a non-negative quadratic polynomial in , so its discriminant must satisfy which simplifies to . Taking square roots gives the result. Equality holds precisely when for some , which means , so and are linearly dependent.
Banach and Hilbert Spaces
The spaces are “well-behaved” because every Cauchy sequence converges. In infinite-dimensional settings this completeness property must be imposed as an axiom, leading to the central objects of functional analysis.
Definition 28 (Banach Space).
A normed vector space is a Banach space if it is complete: every Cauchy sequence in converges to a limit in .
Definition 29 (Hilbert Space).
An inner product space is a Hilbert space if it is complete with respect to the norm induced by the inner product.
Every Hilbert space is a Banach space (the inner product induces a norm, and completeness is assumed), but a Banach space need not be a Hilbert space because its norm may not arise from any inner product. A classical test is the parallelogram law: a norm comes from an inner product if and only if for all .
Example 12 ( as a Hilbert Space).
The space with the inner product is a Hilbert space. The induced norm is , and completeness follows from the Riesz–Fischer theorem. Fourier series provide orthonormal bases for , making it the natural home for spectral analysis.
Example 13 ( as a Banach Space (not Hilbert)).
The space with norm is a Banach space (complete) but not a Hilbert space. Its norm fails the parallelogram law, so no inner product can generate it. This means lacks the orthogonal projection machinery that makes so tractable.
A cornerstone result connects continuous linear functionals on a Hilbert space to elements of the space itself.
Theorem 20 (Riesz Representation).
Let be a Hilbert space over . For every continuous linear functional , there exists a unique element such that (Riesz) Moreover, .
The intuition behind the Riesz Representation Theorem is striking: every “measurement” that you can perform on elements of a Hilbert space (that is, every continuous linear functional) amounts to taking an inner product with some fixed element of the space. There are no “exotic” linear functionals lurking beyond the inner product structure. This makes Hilbert spaces exceptionally well-suited for optimisation and approximation theory, since searching over functionals reduces to searching over elements of the space itself.
Topology
Every metric space carries a natural notion of “open set,” and it is this collection of open sets, rather than the metric itself, that determines which functions are continuous, which sets are compact, and which sequences converge. Topology abstracts this observation: it studies the properties of spaces that depend only on the open-set structure. For generative modelling the key payoff is the distinction between strong and weak topologies, which explains why the Wasserstein distance succeeds where the KL divergence fails.
Topological Spaces
Definition 30 (Topological Space).
A topological space is a pair , where is a set and is a collection of subsets of called open sets, satisfying:
The empty set and the whole space belong to .
The intersection of any finite collection of members of belongs to .
The union of any (possibly infinite) collection of members of belongs to .
These three axioms are deliberately minimal: they capture the essential algebraic properties of open sets in metric spaces while discarding the specific notion of distance. A closed set in a topological space is, by definition, the complement of an open set.
Definition 31 (Basis for a Topology).
A collection of open sets is a basis for the topology if every open set in can be written as a (possibly empty) union of members of .
Remark 6 (Metric Topology).
Every metric space has a natural topology: the collection of all sets such that for every there exists with . The open balls form a basis for this topology. This construction provides the bridge between the concrete metric framework of Continuity and the abstract topological viewpoint developed here. Two different metrics on the same set can generate the same topology (they are then called topologically equivalent), which is why topological properties are more fundamental than metric ones.
Strong and Weak Topologies
In finite-dimensional spaces such as , there is essentially only one “reasonable” topology (all norms on are equivalent). In infinite-dimensional spaces the situation is dramatically different: the same underlying set can carry multiple topologies that lead to genuinely different notions of convergence. The two most important are the strong (norm) topology and the weak topology.
The strong topology (also called the norm topology) on a normed space is simply the metric topology induced by the norm. A sequence converges strongly to if . This is the most natural and demanding form of convergence.
Definition 32 (Weak Topology).
Let be a normed space and let denote its dual space (the set of all continuous linear functionals ). The weak topology on is the coarsest topology that makes every continuous. Concretely, a set is open in the weak topology if and only if for every there exist finitely many functionals and such that
Definition 33 (Weak Convergence).
A sequence in a normed space converges weakly to , written , if That is, if and only if in the weak topology.
The weak topology has fewer open sets than the strong topology (it is “coarser”), so it is easier for a sequence to converge weakly than strongly.
Theorem 21 (Strong Implies Weak).
If in norm (strong convergence), then (weak convergence). The converse holds in finite-dimensional spaces but fails in infinite-dimensional ones.
Proof.
Suppose and let be any continuous linear functional. By linearity and continuity, where is the operator norm. Therefore for every , which is exactly weak convergence.
Theorem 22 (Equivalence in Finite Dimensions).
In a finite-dimensional normed space, weak convergence and strong convergence are equivalent.
Proof sketch.
Let with any norm. Every continuous linear functional on has the form for some . Suppose , so for all . Choosing (the -th standard basis vector) shows that each component converges: . Componentwise convergence in implies convergence in norm (since all norms on are equivalent), so strongly.
The following example shows that in infinite dimensions the equivalence breaks down.
Example 14 (Weak But Not Strong Convergence).
In , define Each has unit norm: . By the Riemann–Lebesgue lemma, for any , Therefore weakly. However, for all , so the sequence does not converge strongly to . The oscillations become ever more rapid but never diminish in amplitude.
Key Idea.
In generative modelling, we compare probability distributions, which live in infinite-dimensional function spaces. The KL divergence induces strong-topology-like behaviour: it can be infinite even when distributions are “close” in a perceptually meaningful sense (for instance, when the supports are disjoint but nearby). The Wasserstein distance, by contrast, metrises weak convergence on compact spaces: if and only if converges weakly to (and the -th moments converge). This means the Wasserstein distance captures the intuitive notion that a sequence of distributions approaches when samples from “look like” samples from . It is precisely this property that makes the Wasserstein distance preferable to the KL divergence as a training objective in WGANs: the loss landscape is smooth even when the generator's distribution has not yet “found” the data manifold.
Historical Note.
The distinction between weak and strong convergence was first systematically studied by Stefan Banach and his Lwów school in the 1920s and 1930s. Their insights, recorded in the famous Scottish Book of open problems kept in a Lwów café, laid the foundations of modern functional analysis. Banach's 1932 monograph Théorie des opérations linéaires introduced many of the concepts discussed in this section, including the systematic use of dual spaces and weak convergence.
For generative modelling, weak convergence became directly relevant when Arjovsky, Chintala, and Bottou (2017) showed that the Wasserstein distance provides meaningful gradients where the KL divergence and Jensen–Shannon divergence fail. Their paper demonstrated that sequences of distributions approaching the data distribution may have infinite KL divergence at every step, while the Wasserstein distance decreases smoothly, a phenomenon explained precisely by the difference between strong and weak topologies.
Differentiation and Integration in
The tools of multivariable calculus form the computational backbone of modern generative modelling. Gradients drive optimisation, Jacobians govern how densities transform under invertible maps, and integration by parts is the hidden engine behind score matching. In this section we develop these tools with enough precision to support the theoretical results used throughout the main text, while keeping an eye on the practical consequences for model design and training. Readers comfortable with undergraduate multivariable calculus will find most of this material a review, but the connections to generative modelling should be fresh.
Gradients, Jacobians, and Hessians
We begin with the three fundamental derivative objects of multivariable calculus. The gradient captures first-order information about scalar-valued functions, the Jacobian generalises this to vector-valued maps, and the Hessian captures second-order (curvature) information. Each appears repeatedly in the design and analysis of generative models, and understanding their interplay is essential for the developments in subsequent chapters.
Definition 34 (Gradient).
Let be differentiable at . The gradient of at is the column vector of first partial derivatives: (Gradient) The gradient points in the direction of steepest ascent of at , and its magnitude equals the maximum directional derivative.
The gradient is the workhorse of gradient-based optimisation: every step of stochastic gradient descent moves the parameters in the direction , and the score function that drives diffusion models and score matching is simply the gradient of the log-density with respect to data.
Example 15 (Gradient of a Quadratic).
For the quadratic function where is a symmetric matrix, , and , the gradient is . Setting the gradient to zero gives the critical point (when is invertible). This is the solution to a linear system and appears throughout machine learning in closed-form solutions for linear regression and Gaussian conditioning.
Definition 35 (Jacobian Matrix).
Let be differentiable at . The Jacobian matrix of at is the matrix (Jacobian) so that . The Jacobian provides the best linear approximation to near : When , the Jacobian reduces to the transpose of the gradient: .
Example 16 (Jacobian of an Affine Map).
The affine map , where and , has constant Jacobian . This is the simplest non-trivial example and already illustrates the key principle: the determinant measures how the linear map stretches volume. For a square matrix (), if the map expands volumes, and if it compresses them. Normalizing flow layers often compose such simple maps to build expressive transformations while keeping the Jacobian determinant tractable.
Definition 36 (Hessian Matrix).
Let be twice differentiable at . The Hessian matrix of at is the matrix of second partial derivatives: (Hessian) If (all second partial derivatives exist and are continuous), then is symmetric by Schwarz's theorem (also known as Clairaut's theorem): The Hessian encodes the local curvature of . At a critical point where , the eigenvalues of determine whether the point is a local minimum (all positive), local maximum (all negative), or saddle point (mixed signs).
Example 17 (Hessian of the Log-Gaussian).
For the multivariate Gaussian log-density , the gradient (score) is and the Hessian is , a constant matrix. This is one of the few cases where the Hessian is independent of , reflecting the fact that a Gaussian has uniform curvature. The trace of the Hessian is , where are the eigenvalues of .
Insight.
The chain rule in multiple dimensions states that . Taking determinants gives . For normalizing flows that compose invertible layers , this factorisation means . Each layer contributes an additive term to the log-determinant, which is why composing simple layers with cheap determinants produces an expressive flow with a tractable density.
Definition 37 (Trace).
For a square matrix , the trace is the sum of its diagonal entries: (Trace DEF)
Theorem 23 (Trace Properties).
Let be matrices of compatible dimensions and . Then:
Linearity: .
Transpose invariance: .
Cyclic property: .
Eigenvalue relation: If are the eigenvalues of (counted with algebraic multiplicity), then .
Proof.
Properties (i) and (ii) follow directly from the definition. For the cyclic property, let , , . Then (Cyclic Proof) The second equality follows by applying the same argument to the product . Property (iv) follows from the fact that similar matrices share the same trace, and every matrix is similar (over ) to its Jordan normal form, whose diagonal entries are the eigenvalues.
The cyclic property of the trace is surprisingly powerful. It allows us to convert scalar expressions into matrix forms and vice versa: for instance, the quadratic form can be written as , a rewriting that underlies the next result.
Definition 38 (Hutchinson's Trace Estimator).
For any square matrix , the trace can be expressed as the expectation (Hutchinson) where is a random vector satisfying and . Common choices for the distribution of include Rademacher random vectors (each entry independently with equal probability) and standard Gaussian vectors.
Proof.
Using the cyclic property of the trace and the linearity of expectation: The key step is interchanging and , which is justified by the linearity of both operators.
The variance of the estimator depends on the distribution of and the structure of . For Rademacher vectors, , where is the Frobenius norm. Gaussian probe vectors give higher variance, , but are easier to generate. In practice, a small number of random projections (often just one per training step) provides sufficient gradient signal.
Remark 7 (Hutchinson's Estimator and Score Matching).
Hutchinson's estimator is the computational trick that makes sliced score matching practical. In score matching, one must evaluate , which naively requires backward passes through the network (one per diagonal entry of the Hessian). Hutchinson's estimator replaces this with a single random projection , yielding the unbiased estimate , computable with just one forward-backward pass via the identity . This reduces the cost from to backward passes per sample.
Integration by Parts
Integration by parts transfers a derivative from one factor of an integrand to another. This seemingly modest operation is the single most important analytical tool in the theory of score matching. We first state the familiar one-dimensional version and then extend it to , where it takes on the form of the divergence theorem.
Theorem 24 (Integration by Parts (One Dimension)).
If and are continuously differentiable on , then (IBP 1D)
Proof.
The product rule gives , so . Integrating both sides over and applying the fundamental theorem of calculus to the first term yields
Theorem 25 (Multivariate Integration by Parts).
Let be a continuously differentiable vector field and a continuously differentiable function. If as , then (IBP Multi) where is the divergence of .
Proof.
We apply the one-dimensional integration by parts formula to each coordinate. For the -th component, integrating with respect to while holding all other variables fixed: The boundary term vanishes by the decay assumption as . Summing over and integrating over all remaining variables gives
Key Idea.
Integration by parts is the fundamental tool behind score matching. Hyvärinen's key insight was to apply integration by parts to the Fisher divergence which appears intractable because it involves the unknown data score . By expanding the square and integrating by parts, the cross-term can be rewritten in terms of and alone. The derivative is effectively “transferred” from the unknown onto the known model . The boundary terms vanish precisely because probability densities decay to zero at infinity.
Change of Variables
The change-of-variables formula describes how integrals transform under smooth, invertible coordinate changes. It is the mathematical bedrock upon which normalizing flows are built. The basic intuition is straightforward: when we “stretch” or “compress” a region of space through a smooth map, volumes change by a factor determined by the Jacobian determinant. For probability densities, which must integrate to one, this volume factor appears as a correction term that ensures the transformed density remains properly normalised.
Theorem 26 (Change of Variables (One Dimension)).
If is a diffeomorphism (smooth bijection with smooth inverse), then for any integrable function , (COV 1D) The absolute value accounts for the possibility that reverses orientation (i.e., is decreasing).
Proof.
If is increasing, then and the result follows directly from the substitution , . If is decreasing, then and the substitution reverses the limits of integration. The two sign changes (from and from reversing limits) cancel, yielding the absolute value.
Theorem 27 (Change of Variables (Multivariate)).
Let be a diffeomorphism between open subsets . Then for any integrable function , (COV Multi) where is the Jacobian matrix of .
The factor measures how locally stretches or compresses volume. If doubles all lengths, the determinant is and the volume element is scaled accordingly.
Proof sketch of Theorem 27.
The idea is to approximate locally by its linear part. Partition into small cubes of side length . On each cube, is approximately affine: for some centre point . The image is approximately a parallelepiped whose volume is . Thus Making this approximation rigorous requires showing that the error vanishes as , which uses the differentiability of and standard measure-theoretic arguments. The full proof can be found in any graduate real analysis text.
Example 18 (Polar Coordinates).
Define for , . The Jacobian is The change-of-variables formula gives , recovering the familiar area element in polar coordinates. This conversion is used throughout probability to compute expectations of radially symmetric densities, including the Gaussian integral.
Key Idea.
The change-of-variables formula is the mathematical foundation of normalizing flows. A normalizing flow transforms a simple base density (typically a standard Gaussian) through an invertible map to produce a complex target density. If , the density of is Taking logarithms, . Training requires evaluating , which costs for a dense Jacobian. This motivates flow architectures with structured Jacobians: autoregressive flows and coupling layers have triangular Jacobians, reducing the determinant computation to (since the determinant of a triangular matrix is just the product of its diagonal entries). Continuous normalizing flows (CNFs) take a different approach, using Hutchinson's trace estimator (Definition 38) to estimate stochastically, avoiding the determinant computation entirely.
Dominated Convergence Theorem
When can we exchange a limit and an integral? This question arises constantly in machine learning, for instance when differentiating an expected loss with respect to model parameters, when taking the limit of a sequence of approximate objectives, or when justifying Monte Carlo gradient estimators. The naive answer “whenever it seems reasonable” is dangerously insufficient: there are well-known counterexamples where pointwise convergence of the integrands does not imply convergence of the integrals. The monotone and dominated convergence theorems provide rigorous sufficient conditions that cover the vast majority of cases arising in practice.
Theorem 28 (Monotone Convergence Theorem).
Let be a sequence of measurable functions satisfying pointwise, with pointwise. Then
The monotone convergence theorem requires the sequence to be non-decreasing and non-negative, which limits its direct applicability. However, it is the right tool when dealing with sums (since partial sums of non-negative terms form a monotone sequence) and is the backbone of many measure-theoretic constructions. The dominated convergence theorem relaxes the monotonicity requirement to a mere boundedness condition, making it far more versatile in practice.
Theorem 29 (Dominated Convergence Theorem).
Let be a sequence of measurable functions with pointwise. Suppose there exists an integrable function (i.e., ) such that for all . Then is integrable and (DCT)
The dominating function plays a crucial role: it must be integrable and must bound all the simultaneously. In practice, finding often amounts to bounding the integrand uniformly in the parameter that varies (the index , or a model parameter ).
Proof sketch.
Since pointwise and , we also have , so is integrable. Define . Since , we have . Moreover, pointwise. By Fatou's lemma applied to the non-negative sequence : Rearranging gives . Since integrals of non-negative functions are non-negative, we conclude , and the first claim follows from .
Remark 8 (Interchanging Limits and Integrals).
The dominated convergence theorem is the standard tool for justifying the interchange . In generative modelling, this arises when we differentiate through expectations: requires conditions on to justify moving inside the integral. The Leibniz integral rule, stated next, makes this precise. Without such conditions, the gradient of the expected loss could differ from the expected gradient, leading to biased gradient estimates during training.
Leibniz Integral Rule
A natural extension of the dominated convergence theorem is to the setting where the parameter is continuous rather than discrete. The Leibniz integral rule is the continuous analogue: it justifies differentiating through an integral with respect to a continuous parameter .
Theorem 30 (Leibniz Integral Rule).
Let and be continuous. Suppose there exists an integrable function such that Then the function is differentiable and (Leibniz)
Proof sketch.
Consider the difference quotient By the mean value theorem, the integrand equals for some between and , and hence is bounded in absolute value by . As , the integrand converges pointwise to , and the dominating function is independent of . The dominated convergence theorem (Theorem 29) then justifies interchanging the limit and the integral.
Remark 9 (Applications in Generative Modelling).
The Leibniz integral rule is the rigorous justification for differentiating through the ELBO in VAE training, through the diffusion loss in DDPM training, and through essentially every gradient-based training procedure that involves an expectation. Whenever we write , we are implicitly invoking this theorem. Note that this result applies only when the distribution does not depend on . When it does (as in the reparameterisation trick for VAEs), a change of variables is needed first to move the -dependence out of the measure and into the integrand, after which Leibniz's rule can be applied.
Example 19 (Leibniz Rule Applied to a Gaussian Model).
Consider the parametric family for . Then This is bounded by for in any compact interval , and is integrable. The Leibniz rule then gives . Since for all , the left-hand side is zero, confirming the normalisation constraint is preserved under differentiation.
Historical Note.
Leibniz stated this rule informally in the seventeenth century as part of his development of calculus. The rigorous version, grounded in the dominated convergence theorem, was established by Lebesgue in the early twentieth century. Richard Feynman famously called “differentiating under the integral sign” his secret weapon for solving physics problems, writing in his autobiography that it was “a technique not taught enough in the universities” yet effective on a surprising range of integrals that stymied his colleagues.
Regularity and Function Classes
The theoretical guarantees behind score matching, integration by parts, and density estimation all rely on the functions involved being “sufficiently nice.” This section makes that notion precise by introducing the standard smoothness and decay conditions that appear in the analysis of generative models. We organise the discussion from the most basic regularity (continuity and differentiability classes) through rapid-decay conditions (the Schwartz class) to the Sobolev spaces that provide weak differentiability, and finally state the explicit assumptions used in score matching proofs.
Definition 39 (Smoothness Class ).
A function belongs to the smoothness class if all partial derivatives of up to and including order exist and are continuous. The class consists of continuous functions, and denotes the class of infinitely differentiable (smooth) functions.
Example 20 (Smoothness Hierarchy).
Polynomials and the Gaussian density are .
The function is but not at , since the left and right derivatives disagree.
The function is (with ), but not at .
The ReLU activation is but not , while the softplus activation is and approximates ReLU for large arguments.
Definition 40 (Schwartz Class).
The Schwartz class consists of all smooth functions whose derivatives of every order decay faster than any polynomial. Formally, if and only if for all multi-indices , (Schwartz) where and . Gaussian densities are the prototypical Schwartz functions: the factor kills any polynomial growth. The Schwartz class is closed under multiplication, differentiation, and Fourier transform, making it the ideal setting for analysis involving all three operations simultaneously.
The Schwartz class sits strictly inside every space and inside every Sobolev space, making it the “safest” function class for analytical manipulations. When we establish a result for Schwartz-class densities, it often extends by density arguments (approximating a general function by Schwartz functions) to broader classes.
Remark 10 (Decay Conditions in Score Matching).
Score matching proofs require the boundary terms from integration by parts to vanish. This happens when the data density and the model score decay sufficiently fast as . Specifically, we need which is guaranteed when belongs to the Schwartz class (as Gaussian and Gaussian-mixture densities do). Densities with heavy tails, such as the Cauchy distribution, can violate this condition and require special treatment.
The hierarchy provides increasingly strong regularity. For many purposes in generative modelling, suffices (since we need second derivatives for the Hessian trace in score matching), but the Schwartz class is the “gold standard” where all analytical manipulations are guaranteed to be valid.
We briefly introduce Sobolev spaces, which provide the natural functional-analytic setting for score functions and weak derivatives. While we will not need the full theory of Sobolev spaces, it is worth understanding the basic idea, as it explains why neural networks with non-smooth activations can still be analysed rigorously.
Definition 41 (Sobolev Space (Informal)).
The Sobolev space consists of functions defined on whose weak derivatives up to order all belong to . The most commonly encountered case in generative modelling is the space of functions with square-integrable first derivatives. A function may not be classically differentiable everywhere, but possesses a well-defined gradient in the sense.
Remark 11 (Why Sobolev Spaces Matter).
Sobolev spaces provide the natural setting for score functions. A score that belongs to an appropriate Sobolev space has enough regularity for integration by parts to hold in the weak (distributional) sense, even when classical derivatives may not exist at isolated points. This allows the theory to cover neural network score models that use non-smooth activations like ReLU, provided their outputs have square-integrable gradients almost everywhere.
Understanding which regularity class a function belongs to is important in generative modelling for several reasons. First, score matching requires the model log-density to be at least so that the Hessian trace exists. Second, the convergence theory of diffusion models relies on the score function satisfying Lipschitz conditions, which places the score in (Lipschitz continuous but not necessarily differentiable). Third, neural networks with smooth activations (such as GELU or softplus) produce outputs, while those using ReLU produce only outputs, with consequences for the regularity of the learned density.
The following assumptions collect the standard regularity conditions used in score matching and related results throughout this text. These are not merely technical requirements: each corresponds to a failure mode that can arise in practice when the assumptions are violated.
Assumption 1 (Score Regularity).
The model score function is continuously differentiable in for each , and satisfies the finite Fisher information condition: (Score REG)
Assumption 2 (Boundary Decay).
The product of the data density and the model score vanishes at infinity: (Boundary) ensuring that the boundary terms arising from integration by parts are zero.
Assumption 3 (Positivity).
The model density is everywhere positive: for all and all in the parameter space. This ensures that the score function is well-defined everywhere.
Assumption 4 (Identifiability).
The model family is identifiable: if for almost every , then . This ensures that the minimiser of the score matching objective, if it exists, uniquely determines the model parameters.
These four assumptions together form the standard regularity package for score matching. Assumptions Assumption 1 and Assumption 2 are needed for the integration-by-parts step, Assumption 3 ensures the score is everywhere defined, and Assumption 4 ensures that the optimisation problem has a unique solution. When any of these assumptions is violated, the score matching estimator may be inconsistent, have infinite variance, or converge to the wrong parameter values.
In practice, neural network score models with smooth activations, trained on data from sub-Gaussian distributions, satisfy these assumptions at least approximately. The theoretical analysis assuming exact satisfaction provides guidance for architecture and distribution choices, even when the assumptions hold only in an approximate sense.
Contraction Mappings and Fixed Points
Many iterative algorithms in machine learning can be understood through the lens of contraction mappings. The central question is simple: given a mapping that we apply repeatedly, does the sequence of iterates converge, and if so, to what? The Banach fixed point theorem provides a clean and complete answer when is a contraction: the iterates always converge to a unique fixed point, regardless of the starting point, and the convergence rate is geometric. This makes it one of the most practical existence theorems in all of mathematics.
Definition 42 (Contraction Mapping).
Let be a metric space. A function is a contraction mapping (or contraction) if there exists a constant such that (Contraction) The constant is called the contraction factor. Every contraction is Lipschitz continuous with Lipschitz constant , and in particular is uniformly continuous.
Example 21 (A Simple Contraction).
The map on is a contraction with factor , since . Its unique fixed point satisfies , giving . Starting from , the iterates are , which converge geometrically to . This example, despite its simplicity, illustrates the key features of the theorem: existence, uniqueness, and a concrete convergence rate.
Theorem 31 (Banach Fixed Point Theorem).
Let be a complete metric space and a contraction with factor . Then:
has a unique fixed point , i.e., .
For any starting point , the iterates converge to .
The rate of convergence is geometric: (Banach RATE)
Proof.
Existence. Fix any and define for . We first show that is a Cauchy sequence. By the contraction property, For any , the triangle inequality gives (Cauchy Bound) Since , the right-hand side tends to zero as , so is Cauchy. By completeness of , there exists with .
is a fixed point. We show using the triangle inequality: Hence , so .
Uniqueness. Suppose and . Then . Since , this forces , so .
Convergence rate. Letting in (Cauchy Bound) gives . This is a geometric (exponential) rate: the error decreases by a factor of at least at each iteration.
The beauty of the Banach fixed point theorem lies in its constructive nature: unlike many existence theorems in analysis (such as those relying on Zorn's lemma or the axiom of choice), it not only asserts that a fixed point exists but provides an explicit algorithm (repeated iteration) to find it and a quantitative bound on how quickly the algorithm converges. This constructive character makes it particularly valuable in computational settings, where an existence result is only useful if accompanied by a practical method to compute the object in question.
The error bound in part (iii) is an a priori estimate: it depends only on the starting point , the first iterate , and the contraction factor , not on the (unknown) fixed point . This makes it directly computable before the algorithm terminates.
Key Idea.
The Sinkhorn algorithm for optimal transport converges because each Sinkhorn iteration is a contraction mapping on the space of scaling vectors (in the Hilbert projective metric). The Banach fixed point theorem guarantees geometric convergence to the unique optimal coupling. Similarly, many iterative algorithms in machine learning can be analysed as contractions or approximate contractions:
Expectation-maximisation (EM): Under regularity conditions, the EM operator is a contraction near the true parameter value, giving local geometric convergence.
Proximal gradient methods: The proximal operator of a strongly convex function is a contraction, ensuring convergence of iterative proximal algorithms.
Belief propagation on trees: Message-passing updates on tree-structured graphical models are contractions, guaranteeing convergence to the exact marginals.
The contraction factor directly controls how many iterations are needed to reach a desired accuracy: to achieve , we need iterations.
Historical Note.
Stefan Banach proved his fixed point theorem in his 1922 doctoral thesis at the University of Lwów (now Lviv, Ukraine), making it one of the earliest results in the then-nascent field of functional analysis. Despite its remarkably simple proof, the theorem has proved to be one of the most widely applied existence and uniqueness results in all of mathematics. Picard's existence theorem for ordinary differential equations (1890), the convergence of Newton's method near a root, the implicit function theorem, and the uniqueness of solutions to certain integral equations are all consequences or close relatives of Banach's theorem. In the words of the mathematician Jean Dieudonné, it is “one of the most fertile ideas of modern analysis.”
Exercises
The following exercises reinforce the material from all sections of this appendix. They range from routine verifications (suitable for building intuition) to more substantial proofs. Exercises marked with a generative-modelling flavour connect abstract results to the applications developed in the main text.
Exercise 1 (Supremum Characterisation).
Let be a nonempty set that is bounded above, and let . Prove that for every , there exists an element such that . State and prove the analogous result for the infimum.
Exercise 2 (Arithmetic of Suprema).
Let and be nonempty bounded subsets of . Define . Prove that
Exercise 3 (Epsilon– Convergence).
Using the – definition of convergence, prove that the sequence converges to as . That is, given , find an explicit such that for all . Hint: first simplify algebraically.
Exercise 4 (Closed Sets and Limit Points).
Let be a metric space and let . Prove that is closed if and only if contains all of its limit points.
Exercise 5 (Cauchy Sequences Are Bounded).
Let be a metric space and let be a Cauchy sequence in . Prove that is bounded, i.e., there exists and such that for all . Hint: use the Cauchy property with to control all but finitely many terms, then handle the finitely many remaining terms separately.
Exercise 6 (Heine–Borel in ).
Prove the Heine–Borel theorem for : a subset is compact if and only if it is closed and bounded. Hint: for the “if” direction, use the Bolzano–Weierstrass theorem to extract a convergent subsequence from any sequence in .
Exercise 7 (Continuity vs. Uniform Continuity).
Prove that is continuous but not uniformly continuous on . Specifically, show that for any , there exist with but . Hint: choose large enough that the slope of near exceeds . What does this tell you about why unbounded domains require care in optimisation?
Exercise 8 (Lipschitz Algebra).
Let be Lipschitz continuous with Lipschitz constants and respectively. Prove:
is Lipschitz with constant at most .
is Lipschitz with constant at most .
Give an example showing that need not be Lipschitz, even when both and are Lipschitz. Hint: try .
Exercise 9 (Gaussian Score Function).
Let be the standard Gaussian density.
Compute the score function .
Compute the Hessian .
Verify that as .
Compute and verify it equals (consistent with the score matching identity).
Exercise 10 (Change of Variables for Affine Transforms).
Let and define for constants and . Use the change-of-variables formula (Theorem 26) to show that has density
Exercise 11 (Integration by Parts Computation).
Apply integration by parts to compute without using the gamma function directly. Then generalise: use repeated integration by parts to show that for all .
Exercise 12 (Failure of Boundary Decay).
Give an example of a probability density that does not satisfy the boundary decay condition (Assumption 2) for some reasonable model score . Explain what goes wrong when one attempts to apply integration by parts in the score matching derivation. Hint: consider a density whose tails oscillate, such as a smooth density with bumps at for whose heights decrease but whose score values do not decay fast enough.
Exercise 13 (Cauchy Distribution and Score Regularity).
Consider the Cauchy density .
Show that has a well-defined score function .
Prove that , violating the score regularity assumption (Assumption 1).
Explain the practical implications: why does this make score matching unreliable for heavy-tailed data?
Exercise 14 (Cosine Contraction).
Let restricted to the interval .
Show that maps into itself.
Show that is a contraction on and find an upper bound on the contraction factor. Hint: use the mean value theorem and . Can you find a tighter bound?
Starting from , compute 10 iterates and report the fixed point to 4 decimal places.
Exercise 15 (Newton's Method as a Contraction).
For a fixed , consider the iteration where (Newton's method for computing ).
Show that maps into itself.
Compute and show that for all , so is a contraction on with factor .
Identify the unique fixed point of and explain why the iterates converge to .
In practice, Newton's method for square roots converges much faster than the geometric rate suggests. Explain why. Hint: consider the error and show that , giving quadratic convergence.
Exercise 16 (Weak but Not Strong Convergence in ).
In the Hilbert space of square-summable sequences, let denote the sequence with in position and elsewhere.
Show that for all , so does not converge strongly to (or to any other element).
Prove that weakly, meaning for every . Hint: for , observe that and use the fact that implies .
Explain why this example shows that the unit ball in an infinite-dimensional Hilbert space is not sequentially compact in the strong topology, but is sequentially compact in the weak topology (by the Banach–Alaoglu theorem). Why does this distinction matter for convergence of probability measures in generative modelling?