# How to sample from a multivariate normal given the $P^T LDL^T P$ decomposition of $\Sigma$?

How to sample from a multivariate normal given the $P^TLDL^TP$ decomposition of $\Sigma$, and $\mu$?

Here, $P$ is a permutation matrix, $L$ is lower-triangular, and $D$ is diagonal

Given the Cholesky decomposition $LL^T$ of $\Sigma$, and $\mu$, we can sample by doing:

$sample = \mu + L * z$

... where $z$ is a vector of univariate standard normals.

I imagine that there must be some way of tweaking this formula to work with the $P^TLDL^TP$ decomposition, but my maths isn't quite good enough to see how to do that?

• Perhaps your notation is confusing you, so let's write the decomposition as $P'\Lambda D\Lambda'P = LL'$. Now isn't it obvious that $L = P'\Lambda \sqrt{D}$ where the square root is applied to the diagonal elements of $D$? – whuber Jan 29 '13 at 4:00
• I thought that too, until I tried it. Unfortunately, it is not true that $L = P^T\Lambda \sqrt(D)$, because $L$ is lower-triangular, and $P^T\Lambda \sqrt(D)$ is not, because it's been permutated. – Hugh Perkins Jan 29 '13 at 4:11
• But it's not necessary for $L$ to be lower triangular for this method to work! All that is required is that $LL'=\Sigma$. – whuber Jan 29 '13 at 4:13
• So you knew the answer all along :-). – whuber Jan 29 '13 at 4:18
• Well, I guessed at two plausible answers, but I lacked a way of proving/disproving either of them. – Hugh Perkins Jan 29 '13 at 4:21

We can write $$P^\prime \Lambda D \Lambda^\prime P=LL^\prime$$
and $L=P^\prime\Lambda\sqrt{D}$ where we understand $\sqrt{D}$ to be the square root of the diagonal of $D$. The only requirement for this to work is that $LL^\prime=\Sigma,$ so it's not important in this instance that $L=P^\prime\Lambda\sqrt{D}$ may be permuted.