# Cholesky decomposition and confidence ellipsoid

I'm trying to construct an error ellipsoid from a covariance matrix (which exists for a 3D point) and then sample consistent xyz points in this region. (This question succeeds this one.)

What I'm currently doing is:

1) Calculate the Cholesky decomposition of the covariance matrix.
2) Sample each initial vertex point as a Gaussian with width 1 to generate (x', y', z')
3) Multiply (x',y',z') by the Cholesky decomposition matrix for the newly generated point.
4) Add this result to a matrix of the mean values.

To add some more concrete details, the covariance matrix of the initial point is:

$\begin{pmatrix} 10.0115 & -10.6835 & 5.18024 \\ -10.6835 & 11.4009 & -5.52798 \\ 5.18024 & -5.52798 & 2.77646 \\ \end{pmatrix}$

I then calculate the Cholesky decomposition, which is:

$\begin{pmatrix} 3.164095& 0& 0\\ -3.376478& 0.017131& 0\\ 1.637195& -0.001619& 0.309921\\ \end{pmatrix}$

And the initial xyz point is at (35.5361, -37.2661, 22.521).

Generating three random numbers from a Gaussian of mean 0 and width 1 yielded: -0.377495, -0.933623, 0.241011, and at this point I'm not completely clear on the correct procedure.

My assumption is that it is correct to multiply the Cholesky decomposition matrix by a matrix containing the randomly generated Gaussian points, and then add this to a matrix containing the initial values. This would look like this:

$\begin{pmatrix} 35.5361& 0& 0\\ 0& -37.2661& 0\\ 0& 0& 22.521\\ \end{pmatrix}+ \begin{pmatrix} 3.164095& 0& 0\\ -3.376478& 0.017131& 0\\ 1.637195& -0.001619& 0.309921\\ \end{pmatrix} \begin{pmatrix} -0.377495& 0& 0\\ 0 & -0.933623 & 0 \\ 0 & 0 & 0.241011\\ \end{pmatrix}$

For which the result is:

$\begin{pmatrix} 34.3417�& 0& 0\\ 0 & -37.281 & 0 \\ 0 & 0 & 22.5957\\ \end{pmatrix}$

And I could definitely believe that a new xyz point at (34.3417,-37.281,22.5957) could be consistent with what I want to generate, but I'm still not completely confident I have followed a valid procedure to generate this.

Any comments would be much appreciated!

• I can't understand how what you are doing crosses with your question title. Multiplying orthonormal data by Cholesky root of a covariance matrix makes the data covariate right according that cov matrix. And if the data is a random sample from orthonormal population, then the same trick yields data which is a random sample from population with the cov matrix. But sorry, I can't trace, how it connects to drawing an ellips. – ttnphns Jun 12 '14 at 7:09
• I was trying to follow something similar to the procedure described here, where you use the Cholesky decomposition to calculate points on an ellipse corresponding to a covariance matrix. Have I got this horribly wrong? – anthr Jun 12 '14 at 15:22
• Maybe it is useful to add that my concern is the off-diagonals of the Cholesky matrix don't have an effect on the final result. I can't see whether or not this is important. – anthr Jun 12 '14 at 17:06

The initial point and the sample should be vectors, not matrices. So you should get: $$\begin{bmatrix} 35.5361\\ -37.2661\\ 22.521\\ \end{bmatrix} + \begin{bmatrix} 3.164095& 0& 0\\ -3.376478& 0.017131& 0\\ 1.637195& -0.001619& 0.309921\\ \end{bmatrix} \begin{bmatrix} -0.377495\\ -0.933623 \\ 0.241011\\ \end{bmatrix} = \begin{bmatrix} 34.3417\\ -37.281 \\ 22.5957\\ \end{bmatrix}$$ But other than that, yes, your procedure is correct.