Multivariate gaussian vs univariate gaussian What is the intuition behind the change in formula from the univariate gaussian to the multivariate gaussian? Why are the determinant and $(2\pi)^{n/2}$ added into the equation?
Thanks


 A: You are attempting to generalize; instead, particularize from the multivariate case to the univariate case.  
The $n$-variate normal density is, as you say,
$$f(\mathbf x; \mathbf \mu, \Sigma) = \frac{1}{(2\pi)^{n/2}|\det \Sigma|^{1/2}}\exp\big(-\frac 12 (\mathbf x-\mathbf \mu)^T\Sigma^{-1}(\mathbf x-\mathbf \mu)\big) \tag{1}$$ where $\mathbf x$ is a column vector of length $n$, and $\Sigma$ is the $n\times n$ covariance matrix with variances down the main diagonal. Note that $\frac{1}{(2\pi)^{n/2}|\det \Sigma|^{1/2}}$ is a constant that makes the $n$-dimensional integral of the density $(1)$ have value $1$. Now, for the case $n=1$, the $1\times 1$ covariance matrix is just $[\sigma^2]$ with determinant $\sigma^2$ and inverse matrix $[\sigma^{-2}]$. So, getting rid of the distinction between $1\times 1$ matrices and ordinary scalars, the
univariate normal distribution is obtained as
\begin{align}
f(x; \mu, \sigma^2) &= \frac{1}{(2\pi)^{1/2}(\sigma^2)^{1/2}}\exp\big(-\frac 12 (x-\mu)\sigma^{-2}(x-\mu)\big)\\
&= \frac{1}{\sigma(2\pi)^{1/2}}\exp\Bigr(-\frac 12 \left(\frac{x-\mu}{\sigma}\right)^2\Bigr)\tag{2}
\end{align}
exactly as you have it.
A: In both cases, everything before the exponential is simply a normalizing constant that makes the expression integrate to one. This is needed to have a proper probability distribution.
For example, in the univariate case:
$$\int_{-\infty}^\infty \exp \left (-\frac{(x-\mu)^2}{2 \sigma^2} \right )
= \sigma \sqrt{2 \pi}$$
So, multiplying by $\frac{1}{\sigma \sqrt{2 \pi}}$ makes $p(x; \mu, \sigma^2)$ integrate to one.
A: I like to think about how the gaussian distribution is constructed from the "inside". The middle of the equation, or the $(x-\mu)^2$, is a unit deviance, a function that satisfies:
$$ d(y; y) = 0$$
and
$$d(y; \mu) > 0$$
There is actually a big group of distributions constructed from unit deviances (see The Theory of Dispersion Models). Anyway, if we plot $(x-\mu)^2$, with $\mu = 0$ for example, varying $x$, we have this:

But this doesn't look like a distribution, right? What is the first step to change this plot? Put a $-$ before the equation, or $-(x-\mu)^2$, which turns the plot upside down: 
Ok, but we want the distribution to give us plausible values. We can smooth the tails of the equation with $\exp(-(1/2\sigma^2)(x-\mu)^2)$. The plot for this, considering $\sigma^2 = 1$ is: 
And now we "just" need to scale the equation in a way that it produces values between 0 and 1 and integrates 1 (I used quotes there because finding a good normalizing constant is not always an easy task). Then, we end up with:
$$ f(x)  = \frac{\exp(-(1/2\sigma^2)(x-\mu)^2)}{\sqrt{2 \pi \sigma^2}}$$
Plotting this, we have:

This is not a very formal explanation (the way I did it in here), but a good one for understanding the Gaussian distribution. The multivariate case is then a generalization of what I explained above.
A: Start from a multivariate gaussian of independent variables
Multivariate Gaussian distribution $p(Y)$ of D dimensional $Y = (y_1, ... , y_D)$ is a product of D univariate Gaussians $p(y_i)$ when the random variables $y_i$ are independent. Note that $p(y_i)$ has mean zero.
$$
\begin {align}
p(Y) 
&= \prod\limits_{i=1}^D p(y_i) \\
&= \prod\limits_{i=1}^D \frac{1}{\sqrt{2\pi}\sigma_i}
    \exp
    \left(
        -\frac{1}{2}\frac{{y_i}^2}{\sigma_i^2})
    \right) \\
&=  \frac {1}{\sqrt{2\pi}^D}
    \prod\limits_{i=1}^D \frac{1}{\sigma_i}
    \exp
    \left(
        -\frac{1}{2}\frac{{y_i}^2}{\sigma_i^2})
    \right)
\end {align}
$$
$(2\pi)^{D/2}$ comes from this product of D univariate gaussians, and play a role to normalise the integral of a gaussian distribution.
Correlated multivariate gaussian to de-correlated gaussian
In the previous step, the multivariate gaussian is de-correlated where the random variable $y_i$ are independent. Correlated multivariate gaussian $p(X)$ can be converted into de-correlated gaussian $p(Y)$ via affine transformation using the eigenvector $U$ of $X$.
The covariance of X is decomposed as $Cov(X) = \Sigma = U\Lambda U^T$ baed on the eigenvector decomposition. Then the correlated multivariate gaussian in X space can be projected into de-correlated Y using $U^T$. Please refer to eigenvector decomposition for details.
In Y space, the probability distribution is the product of independent univariate gaussian distributions.
$$p(y) \propto \prod\limits_{i=1}^D \exp \left( - \frac {1}{2} \sum_{i=1}^D \frac{y_i^2}{\lambda_i} \right)$$

Need to be aware that $U$ is column order matrix. Order does matter.
Derive Gaussian via Integral
From a standard gaussian distribution, a gaussian distribution $p(Z)$ is derived by scaling dispersion and shifting mean.
$$z = f(x) = \frac {(x-u)}{\sigma} $$
Using Change of variables formula in calculus, we can get the derivative when variable is changed from z to x.
$$dz = \frac {1}{\sigma} dx$$
The integral of gaussian distribution is 1. Hence, the integral of the gaussian distributions in X space and Z space are both 1, and they are defined interchangeably using $dz = \frac {1}{\sigma} dx$ as in the snapshot.

Note that $N$ is not a number but a normalisation constant in which  $(2\pi)^{D/2}$ comes into play for multivariate gaussian. $\lambda_i = \sigma_i^2$ is the eigenvalues of $X$.
