Week 7: Random functions in full: covariance operators, stochastic processes, and KL expansions
Choose a function by choosing its coefficients. Week 5 made this a deterministic construction; now let the coefficients vary randomly. How fast must their amplitudes decay for a draw to be an actual vector in the desired space?
This question links three views of the same uncertainty: random coefficients, a covariance operator and a covariance kernel. Parseval will turn function-space variance into a sum of scalar variances. The sum is the key difference between a finite random vector and an infinite random function.
Route through this chapter
Probability on function spaces
Mean elements, covariance and cross-covariance operators
Basis expansions with random coefficients
Generalised polynomial chaos (gPC) expansions
Handout: Gaussian and other stochastic processes
Random elements of Hilbert spaces
Throughout the Hilbert-valued discussion, take H separable and random elements strongly measurable. Gaussian process and gPC examples below are real unless explicitly labelled complex. Given a Hilbert space H (e.g. a Hilbert space of real-valued functions on a set X), an H-valued random variable is just a (measurable) function u:Ω→H defined on a probability space (Ω,F,P).
Some obvious questions:
What are the right notions of mean and variance for u?
How do we build/sample such H-valued random variables?
Mean elements
Observe that, for an Rn-valued random variable u:Ω→Rn, the mean element mu∈Rn can be defined as the vector of means of the n components, and also equivalently
E[u]=mu⟺E[u−mu]=0⟺for all ℓ∈Rn,E[⟨ℓ,u−mu⟩]=0,
where ⟨ℓ,u−mu⟩ is a real r.v.
Inspired by this, we say that mu∈H is the (weak) expected value / mean of u:Ω→H, and write E[u]=mu, if
for all ℓ∈H,E[⟨ℓ,u−mu⟩H]=0.
(Note) cf. the strong/Bochner integral, in which we really do perform vector-valued integration.
Covariance operators
The mean is well-defined if E[∣u∣H]<∞.
If E[∣u∣H2]<∞, then we can go further and define the covariance operator Cov[u], or Cu, of u:Ω→H as the linear operator from H to itself given by
⟨h,Cuk⟩H:=E[⟨h,u−mu⟩H⟨u−mu,k⟩H],for each h,k∈H.
Note, though, that
⟨h,u−mu⟩H⟨u−mu,k⟩H=⟨h,⟨u−mu,k⟩H(u−mu)⟩H,
and so (weakly)
Cu=E[(u−mu)⊗(u−mu)].
Similarly, we can define the cross-covariance operator of two random variables. Let u:Ω→H1, v:Ω→H2 be random variables, i.e. (u,v) takes values in H1⊕H2. The cross-covariance operator of u and v, denoted Cov[u,v] or Cuv, is an operator from H2 into H1 given by
⟨h,Cuvk⟩H1:=E[⟨h,u−mu⟩H1⟨v−mv,k⟩H2],
for k∈H2, h∈H1.
Note that Cu above is just Cuu. Just as before,
Cuv=E[(v−mv)⊗(u−mu)].
Sazonov's theorem (structure of covariance operators)
Theorem (Sazonov). Let u:Ω→H take values in a separable Hilbert space (one admitting a finite or countable complete orthonormal basis), have finite second moment E[∣u∣H2], mean mu∈H and covariance operator Cu:H→H. Then Cu is SPSD and trace class, and
trCu=E[∣u−mu∣H2]<∞.
Proof (sketch pieces). To see that Cu is self-adjoint, consider any h,k∈H:
(Exercise) Cu is strictly positive iff no nonzero h has ⟨h,u−mu⟩=0 almost surely; equivalently the centred law is not supported on a proper closed linear subspace, or the original law on a proper closed affine hyperplane. Centring matters: a constant nonzero random vector has zero covariance. Strict positivity still does not imply a bounded inverse.
To see that Cu has finite trace, let (ψn)n∈N be any CONB of H. Then
An important consequence of Sazonov's theorem is that a finite-variance random vector u with values in an infinite-dimensional H can never have identity covariance.
Randomised basis expansions
Fix a CONB (ψn)n∈N of a (real) Hilbert space H, e.g. a space of functions on some set X. We propose to define a random element u of H via
u:=n∈N∑ξnψn,
where the ξn, n∈N, are R-valued random variables.
Question: What conditions need to be imposed on the ξn to ensure that u∈H a.s.?
The key tool here is Kolmogorov's two-series theorem from last week's handout.
Theorem. Let (ψn)n be a CONB of H. Fix a deterministic sequence (σn)n with σn∈R, and set
u:=n∈N∑σnξnψn,withξn∼N(0,1)i.i.d.
If ∑nσn2<∞, then u∈H a.s. Moreover E[u]=mu=0, and Cov[u]=Cu=Σ2, where Σ2 is the diagonal operator ψn↦∣σn∣2ψn.
Proof. Observe that
u∈H⟺∣u∣H2<∞⟺n∈N∑∣σnξn∣2<∞
(by Parseval).
In fact no two-series theorem is needed for this sufficient condition. Tonelli gives
E[n∑∣σnξn∣2]=n∑σn2<∞.
A nonnegative random variable with finite expectation is finite almost surely, so the coefficient sequence is square-summable almost surely. Its tails also tend to zero in L2(Ω;H). The source's fourth-moment/two-series argument below is an alternative route, not a necessary extra assumption.
Now observe that
n∑E[∣σnξn∣2]=n∑∣σn∣2E[∣ξn∣2]=n∑∣σn∣2<∞,
and
n∑E[∣σnξn∣4]=n∑∣σn∣4E[∣ξn∣4]=3n∑∣σn∣4<∞.
So Kolmogorov's two-series theorem ensures that P[∑n∣σnξn∣2<∞]=1, i.e. P[u∈H]=1.
(Exercises) Check that E[u]=0 (easy!). Check that Cov[u]=Σ2.
□
Example. On H:=Lper2([0,2π];C) with Fourier CONB ψn(t)=exp(int)/2π for n∈Z, we can build a random element u of H by setting e.g.
u=n∈Z∑σnξnψn,σ0:=0,σ±n:=n1for n=0.
This example is complex-valued with real Gaussian coefficients; it is not a real-valued process unless conjugate Fourier coefficients are coupled. A real sine/cosine basis with independent real coefficients gives the corresponding real model. The zero Fourier mode is excluded when identifying covariance with (−Δ)−1.
Then
n∈Z∑σn2=2n∈N∑n21=3π2<∞,
and so u∈L2 a.s.
Indeed, one can similarly check that u∈Hs for all s<21. The mean is the zero function, and the covariance operator is ψn↦n−2ψn, i.e. Cov[u]=(−Δ)−1, i.e. is the integral operator whose kernel is the Green's function (fundamental solution) of Laplace's equation.
Random coefficients must share a finite variance budget. Compare decaying mode variances with constant mode variance.
Each panel shows cumulative expected squared norm for an orthonormal expansion. Vertical scales differ: the left stays below π²/6; the right grows as N. ↗
Every finite white-noise truncation exists, yet their expected squared norms have no finite limit. For Gaussian white noise the strong law gives the stronger almost-sure divergence stated below.
Reveal one fixed random draw through its coefficients. Replaying uses the same random numbers, so the new detail comes only from adding modes. The displayed variance budget is an expectation over draws, not the realised energy of this one curve.
Random coefficients become a random function
Random coefficients
One assembled random function
Expected partial energy = 1.000 < π²/6
The same seeded coefficients are reused on replay. Increasing the truncation reveals finer structure; the variance budget is an expectation, not the energy of this particular draw.
Play once, pause, or scrub to inspect an intermediate state.
Ready to explore.Fixed seeded independent Gaussian coefficients ξₙ and orthonormal sine modes √2 sin(nπx) on [0,1], scaled by 1/n. Completed modes have total expected squared norm Σ1/n²; the last mode fades in continuously. This is one reproducible realisation, not an empirical covariance estimate. ↗
Gaussian white noise
A naive definition of Gaussian white noise on H is
w:=n∈N∑ξnψn,ξn∼N(0,1)i.i.d.
Unfortunately, it is easy to show that P[∣w∣H=∞]=1, so w is almost surely too rough to land in H. These are formal or cylindrical mean/covariance statements; w is not an H-valued random element. Indeed the strong law gives N−1∑n=1Nξn2→1 almost surely. In the one-dimensional Fourier Sobolev scale, ∑n(1+n2)s<∞ for s<−1/2, so the same expectation argument places white noise in these negative spaces almost surely. This threshold refers to that scale; it is not universal for an arbitrary Hilbert scale.
Generalised polynomial chaos (gPC) expansions
The idea here is to express a "complicated" r.v. u as a sum of "simple" deterministic functions of a "simple" r.v. ξ, called the stochastic germ. To keep things concrete, fix a r.v. ξ:Ω→X=R with law μξ. Under mild assumptions (need that E[ea∣ξ∣]<∞ for some a>0) there is a system {qk}k∈N0 of orthogonal polynomials for ξ/μξ:
each qk:R→R is a polynomial of degree k;
they satisfy the orthogonality relation
E[qj(ξ)qk(ξ)]=γkδjk
for some normalisation constants γk>0;
the normalised functions qk/γk form a CONB for L2(X,μξ;R).
E.g.:
For ξ∼N(0,1), we obtain the Hermite polynomials
He0(z)=1,He1(z)=z,He2(z)=z2−1,…
The normalisation constant is γk=k!.
For ξ∼U([−1,1]), we obtain the Legendre polynomials.
Assume u=F(ξ)∈L2(Ω) is measurable with respect to the germ. Otherwise a basis of functions of ξ reconstructs only E[u∣ξ], not independent randomness hidden in u. For finite-support germ laws the polynomial system terminates at the dimension of L2(μξ); an infinite sequence of positive normalisations requires infinite support.
The idea now is simply to expand u (thought of as a function on X) in the orthogonal basis {qk}k:
u=k∈N0∑ukqk(ξ),
with
uk=γk−1E[uqk(ξ)]∈R.
In practice, the expected value on the RHS will have to be approximated somehow, e.g. via Monte Carlo sampling:
Think of this as a cheap surrogate model for the potentially expensive/slow/complicated r.v. u.
The same procedure can be followed for any system of functions qk that are orthogonal w.r.t. μξ, not just polynomials, e.g. wavelets, Fourier basis functions, …
We can do the same thing for gPC expansion of a random vector u:Ω→Rd. Again we expand as
u=k∑ukqk(ξ),uk=γk−1E[uqk(ξ)]∈Rd.
We can do the same thing for gPC expansion of a random function u:Ω→{functions on T}, i.e. stochastic processes/functions:
u(t,ξ)=k∑uk(t)qk(ξ),
with uk:T→R given by
uk(t)=γk−1E[u(t,ξ)qk(ξ)].
(the "stochastic modes" or gPC modes of u)
We also often expand using multiple stochastic germs ξ1,…,ξM. We then need a system of functions RM→R that form a CONB with respect to the joint law μξ of ξ=(ξ1,…,ξM). If the components of ξ are independent, then joint basis functions are just products of univariate ones, but beware the curse of dimension: learning KM coefficients can rapidly exhaust your computational resources!
Now keep the random numbers fixed and change a covariance eigenvalue. The coefficient ellipse and the function curves must change together, because they are two representations of the same two-mode random element.
Mode variance controls shape and uncertainty
Coefficient covariance ellipse
Same draws, changed second variance
λ₁=1, λ₂=0.050, trace(C)=1.050
More second-mode variance spreads the coefficient ellipse vertically and strengthens the second sine pattern in every coupled draw.
Play once, pause, or scrub to inspect an intermediate state.
Ready to explore.On [0,1], ψ₁=√2 sin(πx), ψ₂=√2 sin(2πx), eigenvalues 1 and λ₂. The coefficient ellipse and three fixed seeded draws use the same λ₂. Covariance kernel is ψ₁(x)ψ₁(y)+λ₂ψ₂(x)ψ₂(y); rank is two when λ₂>0. ↗
Stochastic processes
A stochastic process on a set X is just a (measurable) function
u:X×Ω→R,
where (Ω,F,P) is some probability space, i.e. it is just a family of R-valued random variables u(x), one for each x∈X.
Mean and covariance functions
The mean functionmu:X→R of u is given by
mu(x):=E[u(x)]=∫Ωu(x,ω)P(dω),
defined as long as E[∣u(x)∣] is finite for all x∈X.
The covariance function / cov. kernelku:X×X→R is given by
ku(x,y):=E[(u(x)−mu(x))(u(y)−mu(y))],
and is defined as long as E[∣u(x)∣2]<∞ for all x∈X.
Gaussian processes
A stochastic process u:X×Ω→R is called a Gaussian process (GP) with mean func. m:X→R and cov. func. k:X×X→R, denoted u∼GP(m,k), if, for all x1,…,xn∈X, n∈N,
There is a close relationship between "nice" stochastic processes and random basis expansions in the eigenbasis of a suitable integral operator.
Karhunen–Loève Theorem. Let X⊆Rd and let u:X×Ω→R be centred (i.e. mu=0) and square-integrable (i.e.
E[∫X∣u(x)∣2dx]=∫XE[∣u(x)∣2]dx<∞
), with continuous and square-integrable cov. func. k.
Then the induced integral op.
Ik:L2(X)→L2(X),(Ikf)(x):=∫Xk(x,y)f(y)dy
is the cov. op. Cov[u] of u. Let λn≥0 and ψn be the eigenvalues and orthonormal eigenfunctions of Ik. Then
u=n∈N∑znψn,
with
zn=∫Xu(x)ψn(x)dx=⟨u,ψn⟩L2(X),
and the r.v.s zn are centred (i.e. E[zn]=0) and uncorrelated with variance λn (i.e. E[znzm]=λnδnm).
Furthermore, if u∼GP(0,k), then
zn∼N(0,λn).
The KL expansion converges in L2(Ω;L2(X)), and its mean-square truncation error is ∑n>Nλn. In the Gaussian case the coefficients are jointly Gaussian and uncorrelated, hence independent. For a non-Gaussian process they need only be uncorrelated. This is the random analogue of the projection error in Week 6.
Smoothness of sample draws
Mean-square differentiability and almost-sure differentiability of paths are different claims. Suitable continuous mixed derivatives of the covariance give derivatives in mean square. Almost-sure path regularity needs additional increment bounds and a continuity/modification theorem; covariance differentiability alone is not used here as a pathwise theorem. See Rasmussen and Williams, Chapter 4.
A directly checkable alternative uses the spectral scale. If
n∑(1+n2)sσn2<∞,
then the Fourier random series lies in Hpers almost surely by Tonelli. For σn=1/∣n∣, this holds for every fixed s<1/2. Sobolev embedding then yields any pathwise regularity that this bound actually supports; it does not assert continuity at the endpoint.
For an infinite-rank Gaussian with covariance eigenvalues λn>0, its RKHS norm would be ∑n∣zn∣2/λn=∑nξn2=∞ almost surely. Typical draws are therefore outside the covariance RKHS. There is no universal exact “loss of d/2 derivatives” without specifying a spectral model and domain.
Proof that Cov[u]=Ik
For f,g∈L2(X), by definition of the covariance operator,
At many points now, we have a necessary step in implementing our mathematical ideas: we need to learn/fit coefficients in a model to best explain some data, or to best approximate some underlying function. This naturally leads us to our next topic: inverse problems.