# Gaussian formula for $n$ dimensions

I know this is a very simple one. If this is the formula for the two dimensional Gaussian (no covariance matrix considered - I have one mean and variance for each dimension):

$$A\exp{\left[ -\left(\displaystyle \frac{(\mu_{1} - x_{1})^2}{2\sigma_{1}^2} + \frac{(\mu_{2} - x_{2})^2}{2\sigma_{2}^2}\right) \right]}$$

Would this be the one for the three dimensional and so on?

$$A\exp{\left[ -\left(\displaystyle \frac{(\mu_{1} - x_{1})^2}{2\sigma_{1}^2} + \frac{(\mu_{2} - x_{2})^2}{2\sigma_{2}^2} + \frac{(\mu_{3} - x_{3})^2}{2\sigma_{3}^2} + \dots \right) \right]}$$

Thanks.

-
I think you're missing a minus sign in the exponent. – Heike Feb 23 '12 at 12:31
Assuming that "No covariance matrix considered" means that you are interested in independent Gaussian random variables, then the formula you have is nearly right: as Heike pointed out, you are missing a minus sign in the exponent. Be aware also that $A$ depends on $N$, the dimension, as well as the values of the variances $\sigma_i^2$. – Dilip Sarwate Feb 23 '12 at 13:04
yes sorry - I missed the minus sign. edited it. – csetzkorn Feb 23 '12 at 14:08
@Dilip yes I am just interested in independent Gaussian random variables. Is A not used a factor for normalisation? I plug this into a logistic function so it does not really matter in my case. If the formula is ok otherwise - could you please write an answer so that I can accept? Thanks. – csetzkorn Feb 23 '12 at 14:11
Yes, $A$ is a factor that ensures that the density integrates to $1$. Its value happens to be $$A = \frac{1}{(2\pi)^{n/2}\sigma_1\sigma_2\cdots \sigma_n}.$$ This site allows, in fact encourages, people writing the question to post their own answers and also accept their own answers, and I suggest that you do so based on the comments from Heike and myself. – Dilip Sarwate Feb 23 '12 at 14:44
show 1 more comment

This would indeed be correct:

$$A\exp{\left[ -\left(\displaystyle \frac{(\mu_{1} - x_{1})^2}{2\sigma_{1}^2} + \frac{(\mu_{2} - x_{2})^2}{2\sigma_{2}^2} + \frac{(\mu_{3} - x_{3})^2}{2\sigma_{3}^2} + \dots \right) \right]}$$

Please have a look at the comments if you want to ensure that things integrate to one.

-
 ....provided the covariances are all zero. – Michael Hardy Feb 23 '12 at 16:08