In the theory of stochastic processes, the Karhunen–Loève theorem (named after Kari Karhunen and Michel Loève), also known as the Kosambi–Karhunen–Loève theorem states that a stochastic process can be represented as an infinite linear combination of orthogonal functions, analogous to a Fourier series representation of a function on a bounded interval. The transformation is also known as Hotelling transform and eigenvector transform, and is closely related to principal component analysis (PCA) technique widely used in image processing and in data analysis in many fields. There exist many such expansions of a stochastic process: if the process is indexed over [a, b], any orthonormal basis of L2([a, b]) yields an expansion thereof in that form. The importance of the Karhunen–Loève theorem is that it yields the best such basis in the sense that it minimizes the total mean squared error. In contrast to a Fourier series where the coefficients are fixed numbers and the expansion basis consists of sinusoidal functions (that is, sine and cosine functions), the coefficients in the Karhunen–Loève theorem are random variables and the expansion basis depends on the process. In fact, the orthogonal basis functions used in this representation are determined by the covariance function of the process. One can think that the Karhunen–Loève transform adapts to the process in order to produce the best possible basis for its expansion. In the case of a centered stochastic process {Xt}t ∈ [a, b] (centered means E[Xt] = 0 for all t ∈ [a, b]) satisfying a technical continuity condition, X admits a decomposition
X t = ∑ k = 1 ∞ Z k e k ( t ) {\displaystyle X_{t}=\sum _{k=1}^{\infty }Z_{k}e_{k}(t)}
where Zk are pairwise uncorrelated random variables and the functions ek are continuous real-valued functions on [a, b] that are pairwise orthogonal in L2([a, b]). It is therefore sometimes said that the expansion is bi-orthogonal since the random coefficients Zk are orthogonal in the probability space while the deterministic functions ek are orthogonal in the time domain. The general case of a process Xt that is not centered can be brought back to the case of a centered process by considering Xt − E[Xt] which is a centered process. Moreover, if the process is Gaussian, then the random variables Zk are Gaussian and stochastically independent. This result generalizes the Karhunen–Loève transform. An important example of a centered real stochastic process on [0, 1] is the Wiener process; the Karhunen–Loève theorem can be used to provide a canonical orthogonal representation for it. In this case the expansion consists of sinusoidal functions. The above expansion into uncorrelated random variables is also known as the Karhunen–Loève expansion or Karhunen–Loève decomposition. The empirical version (i.e., with the coefficients computed from a sample) is known as the Karhunen–Loève transform (KLT), principal component analysis, proper orthogonal decomposition (POD), empirical orthogonal functions (a term used in meteorology and geophysics), or the Hotelling transform.
Formulation Throughout this article, we will consider a random process Xt defined over a probability space (Ω, F, P) and indexed over a closed interval [a, b], which is square-integrable, has zero-mean, and with covariance function KX(s, t). In other words, we have:
∀ t ∈ [ a , b ] X t ∈ L 2 ( Ω , F , P ) , i.e. E [ X t 2 ] < ∞ , {\displaystyle \forall t\in [a,b]\qquad X_{t}\in L^{2}(\Omega ,F,\mathbf {P} ),\quad {\text{i.e. }}\mathbf {E} [X_{t}^{2}]<\infty ,}
∀ t ∈ [ a , b ] E [ X t ] = 0 , {\displaystyle \forall t\in [a,b]\qquad \mathbf {E} [X_{t}]=0,}
∀ t , s ∈ [ a , b ] K X ( s , t ) = E [ X s X t ] . {\displaystyle \forall t,s\in [a,b]\qquad K_{X}(s,t)=\mathbf {E} [X_{s}X_{t}].}
The square-integrable condition E [ X t 2 ] < ∞ {\displaystyle \mathbf {E} [X_{t}^{2}]<\infty } is logically equivalent to K X ( s , t ) {\displaystyle K_{X}(s,t)} being finite for all s , t ∈ [ a , b ] {\displaystyle s,t\in [a,b]} .
We associate to KX a linear operator (more specifically a Hilbert–Schmidt integral operator) TKX defined in the following way:
T K X : { L 2 ( [ a , b ] ) → L 2 ( [ a , b ] ) f ↦ T K X f = ∫ a b K X ( s , ⋅ ) f ( s ) d s {\displaystyle T_{K_{X}}\colon \left\{{\begin{aligned}L^{2}([a,b])&\to L^{2}([a,b])\\f&\mapsto T_{K_{X}}f=\int _{a}^{b}K_{X}(s,\cdot )f(s)\,ds\end{aligned}}\right.}
Since TKX is a linear endomorphism, it makes sense to talk about its eigenvalues λk and eigenfunctions ek, which are found by solving the homogeneous Fredholm integral equation of the second kind
∫ a b K X ( s , t ) e k ( s ) d s = λ k e k ( t ) {\displaystyle \int _{a}^{b}K_{X}(s,t)e_{k}(s)\,ds=\lambda _{k}e_{k}(t)} .
Statement of the theorem Theorem. Let Xt be a zero-mean square-integrable stochastic process defined over a probability space (Ω, F, P) and indexed over a closed and bounded interval [a, b], with continuous covariance function KX(s, t). Then KX(s,t) is a Mercer kernel and letting ek be an orthonormal basis on L2([a, b]) formed by the eigenfunctions of TKX with respective eigenvalues λk, Xt admits the following representation
X t = ∑ k = 1 ∞ Z k e k ( t ) {\displaystyle X_{t}=\sum _{k=1}^{\infty }Z_{k}e_{k}(t)}
where the convergence is in L2, uniform in t and
Z k = ∫ a b X t e k ( t ) d t {\displaystyle Z_{k}=\int _{a}^{b}X_{t}e_{k}(t)\,dt}
Furthermore, the random variables Zk have zero-mean, are uncorrelated and have variance λk
E [ Z k ] = 0 , ∀ k ∈ N and E [ Z i Z j ] = δ i j λ j , ∀ i , j ∈ N {\displaystyle \mathbf {E} [Z_{k}]=0,~\forall k\in \mathbb {N} \qquad {\mbox{and}}\qquad \mathbf {E} [Z_{i}Z_{j}]=\delta _{ij}\lambda _{j},~\forall i,j\in \mathbb {N} }
Note that by generalizations of Mercer's theorem we can replace the interval [a, b] with other compact spaces C and the Lebesgue measure on [a, b] with a Borel measure whose support is C.
Proof The covariance function KX satisfies the definition of a Mercer kernel. By Mercer's theorem, there consequently exists a set λk, ek(t) of eigenvalues and eigenfunctions of TKX forming an orthonormal basis of L2([a,b]), and KX can be expressed as
K X ( s , t ) = ∑ k = 1 ∞ λ k e k ( s ) e k ( t ) {\displaystyle K_{X}(s,t)=\sum _{k=1}^{\infty }\lambda _{k}e_{k}(s)e_{k}(t)}
The process Xt can be expanded in terms of the eigenfunctions ek as:
X t = ∑ k = 1 ∞ Z k e k ( t ) {\displaystyle X_{t}=\sum _{k=1}^{\infty }Z_{k}e_{k}(t)}
where the coefficients (random variables) Zk are given by the projection of Xt on the respective eigenfunctions
Z k = ∫ a b X t e k ( t ) d t {\displaystyle Z_{k}=\int _{a}^{b}X_{t}e_{k}(t)\,dt}
We may then derive
E [ Z k ] = E [ ∫ a b X t e k ( t ) d t ] = ∫ a b E [ X t ] e k ( t ) d t = 0 E [ Z i Z j ] = E [ ∫ a b ∫ a b X t X s e j ( t ) e i ( s ) d t d s ] = ∫ a b ∫ a b E [ X t X s ] e j ( t ) e i ( s ) d t d s = ∫ a b ∫ a b K X ( s , t ) e j ( t ) e i ( s ) d t d s = ∫ a b e i ( s ) ( ∫ a b K X ( s , t ) e j ( t ) d t ) d s = λ j ∫ a b e i ( s ) e j ( s ) d s = δ i j λ j {\displaystyle {\begin{aligned}\mathbf {E} [Z_{k}]&=\mathbf {E} \left[\int _{a}^{b}X_{t}e_{k}(t)\,dt\right]=\int _{a}^{b}\mathbf {E} [X_{t}]e_{k}(t)dt=0\\[8pt]\mathbf {E} [Z_{i}Z_{j}]&=\mathbf {E} \left[\int _{a}^{b}\int _{a}^{b}X_{t}X_{s}e_{j}(t)e_{i}(s)\,dt\,ds\right]\\&=\int _{a}^{b}\int _{a}^{b}\mathbf {E} \left[X_{t}X_{s}\right]e_{j}(t)e_{i}(s)\,dt\,ds\\&=\int _{a}^{b}\int _{a}^{b}K_{X}(s,t)e_{j}(t)e_{i}(s)\,dt\,ds\\&=\int _{a}^{b}e_{i}(s)\left(\int _{a}^{b}K_{X}(s,t)e_{j}(t)\,dt\right)\,ds\\&=\lambda _{j}\int _{a}^{b}e_{i}(s)e_{j}(s)\,ds\\&=\delta _{ij}\lambda _{j}\end{aligned}}}
where we have used the fact that the ek are eigenfunctions of TKX and are orthonormal. Let us now show that the convergence is in L2. Let
S N = ∑ k = 1 N Z k e k ( t ) . {\displaystyle S_{N}=\sum _{k=1}^{N}Z_{k}e_{k}(t).}
Then:
E [ | X t − S N | 2 ] = E [ X t 2 ] + E [ S N 2 ] − 2 E [ X t S N ] = K X ( t , t ) + E [ ∑ k = 1 N ∑ l = 1 N Z k Z ℓ e k ( t ) e ℓ ( t ) ] − 2 E [ X t ∑ k = 1 N Z k e k ( t ) ] = K X ( t , t ) + ∑ k = 1 N λ k e k ( t ) 2 − 2 E [ ∑ k = 1 N ∫ a b X t X s e k ( s ) e k ( t ) d s ] = K X ( t , t ) − ∑ k = 1 N λ k e k ( t ) 2 {\displaystyle {\begin{aligned}\mathbf {E} \left[\left|X_{t}-S_{N}\right|^{2}\right]&=\mathbf {E} \left[X_{t}^{2}\right]+\mathbf {E} \left[S_{N}^{2}\right]-2\mathbf {E} \left[X_{t}S_{N}\right]\\&=K_{X}(t,t)+\mathbf {E} \left[\sum _{k=1}^{N}\sum _{l=1}^{N}Z_{k}Z_{\ell }e_{k}(t)e_{\ell }(t)\right]-2\mathbf {E} \left[X_{t}\sum _{k=1}^{N}Z_{k}e_{k}(t)\right]\\&=K_{X}(t,t)+\sum _{k=1}^{N}\lambda _{k}e_{k}(t)^{2}-2\mathbf {E} \left[\sum _{k=1}^{N}\int _{a}^{b}X_{t}X_{s}e_{k}(s)e_{k}(t)\,ds\right]\\&=K_{X}(t,t)-\sum _{k=1}^{N}\lambda _{k}e_{k}(t)^{2}\end{aligned}}}
which goes to 0 by Mercer's theorem.
Properties of the Karhunen–Loève transform
Special case: Gaussian distribution Since the limit in the mean of jointly Gaussian random variables is jointly Gaussian, and jointly Gaussian random (centered) variables are independent if and only if they are orthogonal, we can also conclude: Theorem. The variables Zi have a joint Gaussian distribution and are stochastically independent if the original process {Xt}t is Gaussian. In the Gaussian case, since the variables Zi are independent, we can say more:
lim N → ∞ ∑ i = 1 N e i ( t ) Z i ( ω ) = X t ( ω ) {\displaystyle \lim _{N\to \infty }\sum _{i=1}^{N}e_{i}(t)Z_{i}(\omega )=X_{t}(\omega )}
almost surely.
The Karhunen–Loève transform decorrelates the process This is a consequence of the independence of the Zk.
The Karhunen–Loève expansion minimizes the total mean square error In the introduction, we mentioned that the truncated Karhunen–Loeve expansion was the best approximation of the original process in the sense that it reduces the total mean-square error resulting of its truncation. Because of this property, it is often said that the KL transform optimally compacts the energy. More specifically, given any orthonormal basis {fk} of L2([a, b]), we may decompose the process Xt as:
X t ( ω ) = ∑ k = 1 ∞ A k ( ω ) f k ( t ) {\displaystyle X_{t}(\omega )=\sum _{k=1}^{\infty }A_{k}(\omega )f_{k}(t)}
where
A k ( ω ) = ∫ a b X t ( ω ) f k ( t ) d t {\displaystyle A_{k}(\omega )=\int _{a}^{b}X_{t}(\omega )f_{k}(t)\,dt}
and we may approximate Xt by the finite sum
X ^ t ( ω ) = ∑ k = 1 N A k ( ω ) f k ( t ) {\displaystyle {\hat {X}}_{t}(\omega )=\sum _{k=1}^{N}A_{k}(\omega )f_{k}(t)}
for some integer N. Claim. Of all such approximations, the KL approximation is the one that minimizes the total mean square error (provided we have arranged the eigenvalues in decreasing order).
The optimality of the Karhunen–Loève basis can be stated as three distinct properties, each of which characterizes the KL expansion uniquely when it is used as a transform (up to ordering of equal-variance components) among all linear orthogonal transforms:
Decorrelation: The KL components are mutually uncorrelated (orthogonal in the probability-theoretic sense), meaning the covariance matrix of the expansion coefficients is diagonal. Variance concentration: Among all orthogonal decompositions, the first K KL components capture more variance than the first K components of any other orthogonal basis, for every K. Minimum reconstruction error: Truncating the expansion to K terms yields the lowest mean squared error among all linear K-term approximations. These properties make the KL transform the theoretical benchmark against which other linear transforms—such as the discrete Fourier transform and discrete cosine transform—are compared. The DFT and DCT are optimal only when the covariance structure has the specific symmetry (circulant or centrosymmetric, respectively) that matches their basis functions; the KL transform is optimal for any covariance structure.
Explained variance An important observation is that since the random coefficients Zk of the KL expansion are uncorrelated, the Bienaymé formula asserts that the variance of Xt is simply the sum of the variances of the individual components of the sum:
var [ X t ] = ∑ k = 0 ∞ e k ( t ) 2 var [ Z k ] = ∑ k = 1 ∞ λ k e k ( t ) 2 {\displaystyle \operatorname {var} [X_{t}]=\sum _{k=0}^{\infty }e_{k}(t)^{2}\operatorname {var} [Z_{k}]=\sum _{k=1}^{\infty }\lambda _{k}e_{k}(t)^{2}}
Integrating over [a, b] and using the orthonormality of the ek, we obtain that the total variance of the process is:
∫ a b var [ X t ] d t = ∑ k = 1 ∞ λ k {\displaystyle \int _{a}^{b}\operatorname {var} [X_{t}]\,dt=\sum _{k=1}^{\infty }\lambda _{k}}
In particular, the total variance of the N-truncated approximation is
∑ k = 1 N λ k . {\displaystyle \sum _{k=1}^{N}\lambda _{k}.}
As a result, the N-truncated expansion explains
∑ k = 1 N λ k ∑ k = 1 ∞ λ k
