Quant Memo
Advanced

Hilbert Spaces and L2

A Hilbert space is what you get when you take ordinary geometry — lengths, angles, right angles — and let it work for functions and infinite-dimensional objects instead of just arrows in 3D space.

Prerequisites: Metric Spaces and Completeness, Inner Products and Orthogonality

Ordinary vectors have length, and two vectors have an angle between them — in particular, you can ask if they're perpendicular. That geometric machinery is enormously useful: projecting one vector onto another is the basis of least-squares regression, and "closest point" problems are everywhere in quant work. A Hilbert space takes that exact machinery — length, angle, projection, perpendicularity — and extends it to work for objects that aren't little arrows in 3D space at all: entire functions, infinite sequences, random variables. L2L^2 is the specific, most important Hilbert space in finance: the space of functions (or random variables) with finite "energy," where the inner product is built from an integral instead of a finite sum.

The analogy: treating whole functions like arrows

In ordinary 3D geometry, you can decompose any vector into components along perpendicular axes, and the length of the whole vector is recovered by Pythagoras from those components. A Hilbert space says: you can do exactly this with functions. Treat an entire function as if it were a single "point" or "arrow" in a space with infinitely many axes, one axis per possible "basis function" (like a sine wave of a particular frequency). Two functions can be "perpendicular" (orthogonal) in a precise sense, and any function can be decomposed into components along a chosen set of perpendicular basis functions — this is exactly what a Fourier series does to a periodic signal.

The mechanics, one symbol at a time

L2L^2 is the set of functions ff (or random variables) with finite "size" in the sense that

f2=f(x)2dx<(or E[X2]< for random variables).\|f\|^2 = \int |f(x)|^2\,dx < \infty \quad \text{(or } \mathbb{E}[X^2]<\infty \text{ for random variables)}.

In words: ff belongs to L2L^2 if its squared values, added up (integrated) over the whole domain, sum to a finite number — a "finite total energy" condition. The inner product between two members f,gf,g of L2L^2 generalizes the ordinary dot product:

f,g=f(x)g(x)dx,\langle f, g \rangle = \int f(x)\,g(x)\,dx,

and two functions are orthogonal exactly when f,g=0\langle f,g \rangle = 0 — the functional analogue of perpendicular vectors. L2L^2 is a Hilbert space because it is (a) an inner-product space with this geometric structure, and (b) complete: every Cauchy sequence of functions in L2L^2 converges to another function that is itself in L2L^2 — no "potholes." That completeness is what makes limiting constructions (like building the Itô integral as a limit of simple approximating functions) actually land on a well-defined object.

Worked example 1: orthogonality of two simple return-decomposition signals

Let f(t)=sin(t)f(t) = \sin(t) and g(t)=sin(2t)g(t) = \sin(2t) on [0,2π][0, 2\pi] — two frequency components you might use to decompose a periodic seasonal pattern in returns. Their inner product is

f,g=02πsin(t)sin(2t)dt=0,\langle f,g \rangle = \int_0^{2\pi} \sin(t)\sin(2t)\,dt = 0,

a standard trigonometric-integral result. These two frequency components are exactly orthogonal — meaning a regression of a signal onto both simultaneously assigns each frequency's contribution independently, with no overlap to worry about, exactly the property that makes Fourier decomposition of periodic financial time series well-posed.

Worked example 2: computing an L2L^2 norm (finite variance as "length")

Let XX be a random variable representing a strategy's daily P&L, with E[X]=0\mathbb{E}[X]=0 and E[X2]=Var(X)=4\mathbb{E}[X^2] = \text{Var}(X) = 4 (dollars squared, in thousands). Then XX's L2L^2 norm is

X=E[X2]=4=2  (thousand dollars).\|X\| = \sqrt{\mathbb{E}[X^2]} = \sqrt{4} = 2 \; (\text{thousand dollars}).

This is exactly the standard deviation — in L2L^2 language, the "length" of a mean-zero random variable is its standard deviation. Two P&L streams X,YX,Y are "orthogonal" in this space exactly when E[XY]=0\mathbb{E}[XY]=0, which (for mean-zero variables) means uncorrelated: correlation is literally the cosine of the angle between two random variables viewed as vectors in L2L^2.

Function explorer
-221.1
x = 1.00f(x) = 0.731

Think of each curve on screen as one "point" living in the L2L^2 space of functions — the whole curve, not any single value, is the object whose length and angle-to-other-curves the Hilbert space structure measures.

sin(t) sin(2t) ⟨f,g⟩ = 0: orthogonal
Different frequency components behave like perpendicular axes in L², each capturing an independent piece of a signal with zero overlap between them.

What this means in practice

L2L^2 and Hilbert-space geometry are the rigorous foundation under several everyday quant tools: least-squares regression is literally projecting a target vector onto the subspace spanned by predictors in L2L^2; principal component analysis finds an orthogonal basis that captures the most "energy" (variance) with the fewest components; the Itô integral is constructed as an L2L^2 limit of simple step-function approximations, which is precisely why completeness matters for stochastic calculus to be well-defined at all.

A Hilbert space extends ordinary geometric ideas — length, angle, orthogonality, projection — to functions and random variables via an inner product built from an integral (or expectation); L2L^2, the space of finite-variance objects, is the specific Hilbert space underlying regression, PCA, Fourier analysis, and the Itô integral.

A common mistake is assuming "orthogonal" always means "unrelated" in some vague statistical sense. In L2L^2, orthogonality is the precise algebraic statement f,g=0\langle f,g\rangle = 0 (zero covariance for mean-zero variables) — it says nothing about independence in general (uncorrelated does not imply independent) and depends entirely on the inner product chosen. Two variables can be L2L^2-orthogonal under one weighting or measure and not under another, so "orthogonal" is always relative to a specific inner product, not an absolute property of the variables themselves.

Related concepts

Practice in interviews

Further reading

  • Reed & Simon, Functional Analysis, ch. II
  • Shreve, Stochastic Calculus for Finance II, ch. 4
ShareTwitterLinkedIn