# density of 3D Gaussian distribution

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!

EDIT:

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

-

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.
Try QuickMath at quickmath.com (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: 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