# How to find the maximum axis of ellipsoid given the covariance matrix?

In this link, the ellipse of a covariance matrix is discussed in more details. Basically, the major axis can be determined by finding the largest eigenvalue of the covariance matrix and the the chi square value with given confidence level, thus

$$\text{L} = \sqrt{(\chi^{2}_{n,\alpha}) \lambda_{max}}$$ where L is half of the major axis length. For 2D case, given the confidence level ( $95 \%$ or $\alpha = 0.05$), $\chi^{2}_{n=2,\alpha} = 5.9915$. (i.e. using chi2inv(0.95,2)in Matlab), the result is

covariance =
5.6681    4.6314
4.6314    5.5951
mean =
-0.0208    0.0048
eigenMax =
19.1943


My question is that how can I expand the aforementioned approach for ellipsoid? How can I determine the maximum axis? Should I merely determine the maximum eigenvalue and multiple it with the chi square value? Thank you.

For a multivariate normal distribtion with mean-vector $\mu$ and var-covar matrix $\Sigma$ the contours of constant density are ellipsoids defined by all x-vectors where $(x-\mu)'\Sigma^{-1}(x-\mu)=c^2$.
These are ellipsoids centered at $\mu$ and axis in the directions of the eigenvectors of $\Sigma$ and axis lenghts $2c\sqrt{\lambda_i}$, where $\lambda_i$ are the eigenvalues of $\Sigma$.
This result is valid in two dimensions but also in n dimensions. So to define confidence regions (if multivariate normal) you can replace $c^2$ by the quantiles of the $\chi^2$-distribution.
• Thanks for the answer. I've updated my post to reflect the fact that $c$ in your case should be inside the square root. It seems there is an error in the link that I've posted (in the code not the post). – CroCo Aug 5 '15 at 6:22
• You are right, I changed the text to "replace $c^2$ by the quantilies of $\chi^2$. (before chaning it was $c$ in stead of $c^2$). Thanks (+1) – user83346 Aug 5 '15 at 15:31