# Whitening transformation

A whitening transformation is a decorrelation transformation that transforms a set of random variables having a known covariance matrix $M$ into a set of new random variables whose covariance is the identity matrix (meaning that they are uncorrelated and all have variance 1).

The transformation is called "whitening" because it changes the input vector into a white noise vector. It differs from a general decorrelation transformation in that the latter only makes the covariances equal to zero, so that the correlation matrix may be any diagonal matrix.

The inverse coloring transformation transforms a vector $Y$ of uncorrelated variables (a white random vector) into a vector $X$ with a specified covariance matrix.

## Definition

Suppose $X$ is a random (column) vector with covariance matrix $M$ and mean $0$. The matrix $M$ can be written as the expected value of the outer product of $X$ with itself, namely:

$M = \operatorname{E}[X X^\top]$

Since $M$ is symmetric and positive semidefinite, it has a square root $M^{1/2}$, such that $M^{1/2}( M^{1/2})^\top = M$. If $M$ is positive definite, $M^{1/2}$ is invertible. Then the vector $Y = M^{-1/2}X$ has covariance matrix:

$\operatorname{Cov}(Y) = \operatorname{E}[Y Y^\top] = M^{-1/2} \operatorname{E}[X X^\top] (M^{-1/2})^\top$

$\operatorname{Cov}(Y)= M^{-1/2} M (M^{-1/2})^\top = (M^{-1/2} M^{1/2}) ((M^{1/2})^\top (M^{-1/2})^\top ) = I$

and is therefore a white random vector.

Since the square root of a matrix is not unique, the whitening transformation is not unique either.

If $M$ is not positive definite, then $M^{1/2}$ is not invertible, and it is impossible to map $X$ to a white vector of the same length. In that case the vector $X$ can still be mapped to a smaller white vector $Y$ with $m$ elements, where $m$ is the number of non-zero eigenvalues of $M$.