gives the KarhunenLoeve transform {{b1,b2,},m} of the numerical arrays {a1,a2,}, where m.aibi.


uses the inverse of the matrix m for transforming bi to ai.

Details and Options

  • KarhunenLoeve decomposition is typically used to reduce the dimensionality of data and capture the most important variation in the first few components.
  • The ai can be arbitrary rank arrays or images of the same dimensions.
  • The inner product of m and {a1,a2,} gives {b1,b2,}.
  • In KarhunenLoeveDecomposition[{a1,}], rows of the transformation matrix m are the eigenvectors of the covariance matrix formed from the arrays ai.
  • The matrix m is a linear transformation of ai. The transformed arrays bi are uncorrelated, are given in order of decreasing variance, and have the same total variance as ai.
  • KarhunenLoeveDecomposition[{b1,b2,},m] effectively computes the inverse KarhunenLoeve transformation. If the length of {b1,b2,} is less than the size of m, missing components are assumed to be zero.
  • With an option setting StandardizedTrue, datasets ai are shifted so that their means are zero.


open allclose all

Basic Examples  (2)

KarhunenLoeve decomposition of two datasets:

Principal component decomposition of RGB color channels:

Scope  (5)

Principal components of two grayscale images:

KarhunenLoeve decomposition of three matrix-valued datasets:

Principal components of a list of color images:

Specify the transformation matrix:

Use a transformation matrix and lesser datasets:

Options  (1)

Standardized  (1)

KarhunenLoeve decomposition with datasets shifted to mean zero:

Applications  (3)

Enhance the color contrast of an RGB image:

Reconstruct a multichannel image from 1, 2, or 3 components:

Transform a list of pictorial faces:

Show the residual images when using only the first three components:

Properties & Relations  (7)

The KarhunenLoeve decomposition preserves the total variance:

The KarhunenLoeve decomposition yields uncorrelated sets:

The KarhunenLoeve decomposition yields an orthogonal transformation matrix:

Relation to PrincipalComponents:

A setting Standardized->True is equivalent to subtracting the mean from the input data:

Normalizing by the square root of the number of datasets better preserves the input dynamics:

KarhunenLoeveDecomposition normally returns images of a real type:

Wolfram Research (2010), KarhunenLoeveDecomposition, Wolfram Language function, https://reference.wolfram.com/language/ref/KarhunenLoeveDecomposition.html (updated 2015).


Wolfram Research (2010), KarhunenLoeveDecomposition, Wolfram Language function, https://reference.wolfram.com/language/ref/KarhunenLoeveDecomposition.html (updated 2015).


Wolfram Language. 2010. "KarhunenLoeveDecomposition." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015. https://reference.wolfram.com/language/ref/KarhunenLoeveDecomposition.html.


Wolfram Language. (2010). KarhunenLoeveDecomposition. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/KarhunenLoeveDecomposition.html


@misc{reference.wolfram_2024_karhunenloevedecomposition, author="Wolfram Research", title="{KarhunenLoeveDecomposition}", year="2015", howpublished="\url{https://reference.wolfram.com/language/ref/KarhunenLoeveDecomposition.html}", note=[Accessed: 13-July-2024 ]}


@online{reference.wolfram_2024_karhunenloevedecomposition, organization={Wolfram Research}, title={KarhunenLoeveDecomposition}, year={2015}, url={https://reference.wolfram.com/language/ref/KarhunenLoeveDecomposition.html}, note=[Accessed: 13-July-2024 ]}