Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For a 2D Gaussian distribution with
$$ \mu = \begin{pmatrix} \mu_x \\ \mu_y \end{pmatrix}, \quad \Sigma = \begin{pmatrix} \sigma_x^2 & \rho \sigma_x \sigma_y \\ \rho \sigma_x \sigma_y & \sigma_y^2 \end{pmatrix}, $$ its probability density function is $$ f(x,y) = \frac{1}{2 \pi \sigma_x \sigma_y \sqrt{1-\rho^2}} \exp\left( -\frac{1}{2(1-\rho^2)}\left[ \frac{(x-\mu_x)^2}{\sigma_x^2} + \frac{(y-\mu_y)^2}{\sigma_y^2} - \frac{2\rho(x-\mu_x)(y-\mu_y)}{\sigma_x \sigma_y} \right] \right), $$

I was wondering if there is also a similarly clean formula for 3D Gaussian distribution density? What is it?

Thanks and regards!


What I ask is after taking the inverse of the covariance matrix, if the density has a clean form just as in 2D case?

share|cite|improve this question
up vote 4 down vote accepted

There is a standard, general formula for the density of the joint normal (or multivariate normal) distrubution of dimension $n$, provided that the ($n \times n$) covariance matrix $\Sigma$ is non-singular (see, e.g., this or this). In particular, you can apply for $n=3$. When the covariance matrix is singular, the distribution is expressed in terms of the characteristic function.

share|cite|improve this answer
Thanks! What I ask is after taking the inverse of the covariance matrix, if the density has a clean form just as in 2D case? – Tim Nov 21 '10 at 17:08
Try QuickMath at (a free, excellent application). Using it, calculate the inverse of $\Sigma$ and its determinant. I think it may lead to a "reasonable" expression, taking into account that $\Sigma$ is symmetric. – Shai Covo Nov 21 '10 at 17:33
@Tim: Ah, I guess we miscommunicated because for most people working in linear algebra, a formula involving matrix inverses does count as clean. What you are asking for is to find the entries of the inverse explicitly, but beyond $2\times 2$ matrices things start to get ugly. – Rahul Nov 21 '10 at 17:36
@Tim: If you're taking the computational viewpoint, you're probably better off having an explicit expression for the Cholesky decomposition (your covariance matrices are supposed to be positive (semi)definite) instead of an explicit expression for the inverse. Inverses do not behave very nicely in inexact arithmetic. – J. M. Nov 22 '10 at 2:27
@Tim: When something like $A^{-1}b$ appears in a formula, in computational terms you should think of it as "solve $Ax = b$ for $x$" instead. As J.M. said, using a Cholesky decomposition to compute this is much better: having decomposed $A$ as $LL^T$, you just solve $Ly = b$ and then $L^Tx = y$. Solving equations with triangular matrices like $L$ and $L^T$ is very easy, and numerically well-behaved. I would also suggest taking a look at a good textbook on numerical linear algebra. – Rahul Nov 22 '10 at 6:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.