# Multivariate Gaussian equivalent for a Gaussian integration identity.

For a one-dimensional x,

$$\int_{-\infty}^{\infty}x^{2}e^{-x^{2}}dx=\frac{1}{2}\int_{-\infty}^{\infty}e^{-x^{2}}dx$$

This can be shown through integration by parts. There is a good derivation of that here.

I'm wondering, does the same exist for a multivariate Gaussian $$\ p(x|\mu,\Sigma)=\left(2\pi\right)^{-\frac{N}{2}}|\Sigma|^{-\frac{1}{2}}\exp\left(-\frac{1}{2}(x-\mu)^{\textrm{T}}\Sigma^{-1}(x-\mu)\right)$$

Where $\Sigma$ (positive-definite) is the variance and $\mu$ is the mean. Here, I'm using $N$ for the dimension of $x$. That is, does

$$\int\left(2\pi\right)^{-\frac{N}{2}}|\Sigma|^{-\frac{1}{2}}\left[-\frac{1}{2}(x-\mu)^{\textrm{T}}\Sigma^{-1}(x-\mu)\right]\exp\left(-\frac{1}{2}(x-\mu)^{\textrm{T}}\Sigma^{-1}(x-\mu)\right)dx$$
$$=\frac{1}{2}\int\left(2\pi\right)^{-\frac{N}{2}}|\Sigma|^{-\frac{1}{2}}\exp\left(-\frac{1}{2}(x-\mu)^{\textrm{T}}\Sigma^{-1}(x-\mu)\right)dx$$

?

My first thought is that the identity should be identical because after carrying out the inner products "upstairs" in the exponential and "downstairs" in the coefficient, it becomes a positive scalar.

This calculation is involved in determining the differential entropy of a multivariate Gaussian. For my answer to agree with the answer given in theorem 9.4.1 here, there should be an additional factor of N on the right hand side.

-

We can compute this directly by a linear change of variables, replacing $\Sigma^{-1/2}(x-\mu)$ by $x$:

\begin{align*} &\int (2\pi)^{-\frac N2}|\Sigma|^{-\frac12}(x-\mu)^T\Sigma^{-1}(x-\mu)\text{exp}\left(-\frac12(x-\mu)^T\Sigma^{-1}(x-\mu)\right)\ dx \\ &= \int (2\pi)^{-\frac N2}x^Tx\exp\left(-\frac12 x^Tx\right)\ dx \\ &= \int (2\pi)^{-\frac N2}(x_1^2+\cdots+x_N^2)\exp\left(-\frac12(x_1^2+\cdots+x_N^2)\right)\ dx \\ \end{align*}

Distributing, we can express this as a sum of $N$ integrals, each of which are equal to

\begin{align*} &\int (2\pi)^{-\frac N2}x_1^2\exp\left(-\frac12(x_1^2+\cdots+x_N^2)\right)\ dx \\ &=\int\cdots\int (2\pi)^{-\frac N2}x_1^2\exp\left(-\frac12x_1^2\right)\cdots\left(-\frac12x_N^2\right)\ dx_1\cdots dx_N \\ &=\left(\int (2\pi)^{-\frac 12}x_1^2\exp\left(-\frac12x_1^2\right)\ dx_1\right) \left(\int (2\pi)^{-\frac 12}\exp\left(-\frac12x_2^2\right)\ dx_2\right) \cdots \left(\int (2\pi)^{-\frac 12}\exp\left(-\frac12x_N^2\right)\ dx_N\right)\\ &= (1)(1)\cdots(1) = 1 \end{align*}

Therefore, $$\int (2\pi)^{-\frac N2}|\Sigma|^{-\frac12}(x-\mu)^T\Sigma^{-1}(x-\mu)\text{exp}\left(-\frac12(x-\mu)^T\Sigma^{-1}(x-\mu)\right)\ dx = N$$ So yes, to be correct, a factor of $N$ must be inserted to your right-hand side (also, the negative sign on the left side in the first occurence of $-\frac12(x-\mu)^T\Sigma^{-1}(x-\mu)$ should be removed).

Alternate proof: Let $X \sim N(\mu,\Sigma)$ be a multivariate Gaussian random vector. Then the components of $Z=\Sigma^{-1/2}(X-\mu)$ are standard Gaussian, and

\begin{align*} &\int (2\pi)^{-\frac N2}|\Sigma|^{-\frac12}(x-\mu)^T\Sigma^{-1}(x-\mu)\text{exp}\left(-\frac12(x-\mu)^T\Sigma^{-1}(x-\mu)\right)\ dx \\ &= E\left((X-\mu)^T\Sigma^{-1}(X-\mu)\right) \\ &= E\left((\Sigma^{-1/2}(x-\mu))^T(\Sigma^{-1/2}(x-\mu))\right) \\ &= E(Z^TZ) \\ &= E(Z_1^2 + Z_2^2 + \cdots + Z_N^2) \\ &= E(Z_1^2)+E(Z_2^2)+\cdots + E(Z_N^2) \\ &= 1+1+\cdots+1 = N \end{align*}

-