# Gaussian integral

File:E^(-x^2).jpg
A graph of $f(x)\ = e^{-x^2}\$ generated by GraphCalc and the area of the f(x) with the x-axis, which equals to $\sqrt{\pi}$.

The Gaussian integral, or probability integral, is the improper integral of the Gaussian function $e^{{-x}^2}$ over the entire real line. It is named after the German mathematician and physicist Carl Friedrich Gauss, and the equation is:

$\int_{-\infty}^\infty e^{-x^2}\,dx = \sqrt{\pi}$

This integral has wide applications including normalization in probability theory and continuous Fourier transform. It also appears in the definition of the error function.

Although no elementary function exists for the error function, as can be proven by the Risch algorithm, the Gaussian integral can be solved analytically through the tools of calculus. That is, there is no elementary indefinite integral for $\int e^{-x^2}\,dx$, but the definite integral $\int_{-\infty}^\infty e^{-x^2}\,dx$ can be evaluated.

## Computation

A standard way to compute the Gaussian integral is

• consider the function $e^{-(x^2+y^2)}=e^{-r^2}$ on the plane $\mathbf{R}^2$, and compute its integral two ways:
• on the one hand, by double integration in the Cartesian coordinate system, its integral is a square: $\left(\int e^{-x^2}\,dx\right)^2$;
• on the other hand, by shell integration (a case of double integration in polar coordinates), its integral is computed to be $\pi$.

Comparing these two computations yields the integral, though one should take care about the improper integrals involved.

### Brief proof

Briefly, one computes that on the one hand,

\begin{align} \int_{\mathbf{R}^2} e^{-(x^2+y^2)}\,dx\,dy &= \int_{-\infty}^\infty \int_{-\infty}^\infty e^{-(x^2+y^2)}\,dx\,dy\\ &= \left ( \int_{-\infty}^\infty e^{-x^2}\,dx \right ) \cdot \left ( \int_{-\infty}^\infty e^{-y^2}\,dy \right )\\ &= \left ( \int_{-\infty}^\infty e^{-x^2}\,dx \right )^2.  \end{align}

On the other hand,

\begin{align} \int_{\mathbf{R}^2} e^{-(x^2+y^2)}\,dx\,dy &= \int_0^{2\pi} \int_0^{\infin} re^{-r^2}\,dr\,d\theta\\ &= 2\pi \int_0^\infty re^{-r^2}\,dr\\ &= 2\pi \int_{-\infty}^0 \frac{1}{2} e^s\,ds = \pi \int_{-\infty}^0 e^s\,ds = \pi (e^0 - e^{-\infty}) = \pi (1 - 0) = \pi, \end{align} where the factor of $r$ comes from the transform to polar coordinates ($r\,dr\,d\theta$ is the standard measure on the plane, expressed in polar coordinates), and the substitution involves taking $s=-r^2$, so $ds=-2r\,dr$.

Combining these yields $\left ( \int_{-\infty}^\infty e^{-x^2}\,dx \right )^2=\pi$, so $\int_{-\infty}^\infty e^{-x^2}\,dx=\sqrt{\pi}$.

### Careful proof

To justify the improper double integrals and equating the two expressions, we begin with an approximating function:

$I(a)=\int_{-a}^a e^{-x^2}dx.$

so that the integral may be found by

$\lim_{a\to\infty} I(a) = \int_{-\infty}^{\infty} e^{-x^2}\, dx.$

Taking the square of I yields

$I^2(a)= \left ( \int_{-a}^a e^{-x^2}\, dx \right )\cdot \left ( \int_{-a}^a e^{-y^2}\, dy \right )= \int_{-a}^a \left ( \int_{-a}^a e^{-y^2}\, dy \right )\,e^{-x^2}\, dx = \int_{-a}^a \int_{-a}^a e^{-(x^2+y^2)}\,dx\,dy.$

Using Fubini's theorem, the above double integral can be seen as an area integral $\int e^{-(x^2+y^2)}\,d(x,y)$, taken over a square with vertices {(−a, a), (a, a), (a, −a), (−a, −a)} on the xy-plane.

Since the exponential function is greater than 0 for all real numbers, it then follows that the integral taken over the square's incircle must be less than $I(a)^2$, and similarly the integral taken over the square's circumcircle must be greater than $I(a)^2$. The integrals over the two disks can easily be computed by switching from cartesian coordinates to polar coordinates: $x=r\,\cos \theta$, $y= r\,\sin\theta$, $d(x,y) = r\, d(r,\theta)$:

$\int_0^{2\pi}\int_0^a re^{-r^2}\,dr\,d\theta < I^2(a) < \int_0^{2\pi}\int_0^{a\sqrt{2}} re^{-r^2}\,dr\,d\theta.$

(See to polar coordinates from cartesian coordinates for help with polar transformation.)

Integrating,

$\pi (1-e^{-a^2}) < I^2(a) < \pi (1 - e^{-2a^2}).$

By the squeeze theorem, this gives the Gaussian integral

$\int_{-\infty}^\infty e^{-x^2}\, dx = \sqrt{\pi}.$

## Relation to the gamma function

Since the integrand is an even function,

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

which, after a change of variable, turns into the Euler integral

$\int_0^\infty e^{-t} \ t^{-1/2} dt \, = \, \Gamma\left(\frac{1}{2}\right)$

where Γ is the gamma function. This shows why the factorial of a half-integer is a rational multiple of $\sqrt \pi$. More generally,

$\int_0^\infty e^{-ax^b} dx = a^{-1/b} \, \Gamma\left(1+\frac{1}{b}\right).$

## Generalizations

### The integral of a Gaussian function

The integral of any Gaussian function is reducible in terms of the Gaussian integral

$\int_{-\infty}^{\infty} ae^{-(x+b)^2/c^2}\,dx.$

The constant a can be factored out of the integral. Replacing x with y - b yields

$a\int_{-\infty}^\infty e^{-y^2/c^2}\,dy.$

Substituting y with cz gives

$a |c| \int_{-\infty}^\infty e^{-z^2}\,dz$
$=a |c| \sqrt{\pi}.$

### n-dimensional and functional generalization

Suppose A is a symmetric positive-definite invertible covariant tensor of rank two. Then,

$\int \exp\left( - \frac 1 2 A_{ij} x^i x^j \right) d^nx = \sqrt{\frac{(2\pi)^n}{\det A}}$

where the integral is understood to be over Rn. This fact is applied in the study of the multivariate normal distribution.

Also,

$\int x^{k_1}\cdots x^{k_{2N}} \, \exp\left( - \frac 1 2 A_{ij} x^i x^j \right) d^nx = \sqrt{\frac{(2\pi)^n}{\det A}} \, \frac{1}{2^N N!} \, \sum_{\sigma \in S_{2N}}(A^{-1})^{k_{\sigma(1)}k_{\sigma(2)}} \cdots (A^{-1})^{k_{\sigma(2N-1)}k_{\sigma(2N)}}$

where σ is a permutation of {1, ..., 2N} and the extra factor on the right-hand side is the sum over all combinatorial pairings of {1, ..., 2N} of N copies of A−1.

Alternatively,

$\int f(\vec x) \, \exp\left( - \frac 1 2 A_{ij} x^i x^j \right) d^nx = \sqrt{(2\pi)^n\over \det{A}} \, \left. \exp\left({1\over 2}(A^{-1})^{ij}{\partial \over \partial x^i}{\partial \over \partial x^j}\right)f(\vec{x})\right|_{\vec{x}=0} $


for some analytic function f, provided it satisfies some appropriate bounds on its growth and some other technical criteria. (It works for some functions and fails for others. Polynomials are fine.) The exponential over a differential operator is understood as a power series.

While functional integrals have no rigorous definition (or even a nonrigorous computational one in most cases), we can define a Gaussian functional integral in analogy to the finite-dimensional case. There is still the problem, though, that $(2\pi)^\infty$ is infinite and also, the functional determinant would also be infinite in general. This can be taken care of if we only consider ratios:

$\frac{\int f(x_1)\cdots f(x_{2N}) e^{-\iint \frac{A(x_{2N+1},x_{2N+2}) f(x_{2N+1}) f(x_{2N+2})}{2} d^dx_{2N+1} d^dx_{2N+2}} \mathcal{D}f}{\int e^{-\iint \frac{A(x_{2N+1},x_{2N+2}) f(x_{2N+1}) f(x_{2N+2})}{2} d^dx_{2N+1} d^dx_{2N+2}} \mathcal{D}f},$
$=\frac{1}{2^N N!}\sum_{\sigma \in S_{2N}}A^{-1}(x_{\sigma(1)},x_{\sigma(2)})\cdots A^{-1}(x_{\sigma(2N-1)},x_{\sigma(2N)}).$

In the deWitt notation, the equation looks identical to the finite-dimensional case.

### n-dimensional with linear term

Once again A is a symmetric matrix, then

$\int e^{-A_{ij} x^i x^j+B_i x_i} d^nx=\sqrt{ \frac{\pi^n}{\det{A}} }e^{\frac{1}{4}B^TA^{-1}B}.$

### Integrals of similar form

\begin{align} &\int_0^\infty x^{2n} e^{-x^2/a^2}\,dx  &&= \sqrt{\pi} \frac{(2n)!}{n!} \left(\frac{a}{2}\right)^{2n+1} \\  &\int_0^\infty x^{2n+1}e^{-x^2/a^2}\,dx  &&= \frac{n!}{2} a^{2n+2}  \end{align}

## Beyond Gaussian Integrals

Exponentials of other even polynomials can easily be solved using series. For example the solution to the integral of the exponential of a quartic polynomial is:

$\int_{-\infty}^{\infty}{\exp({a x^4+b x^3+c x^2+d x+f})dx} = e^f\sum_{n,m,p=0}^{\infty}{ \frac{ b^{4n}}{(4n)!}\frac{c^{2m}}{(2m)!}\frac{d^{4p}}{(4p)!} \frac{ \Gamma(3n+m+p+\frac14) }{a^{3n+m+p+\frac14} } }$

These integrals turn up in subjects such as quantum field theory.