# Gaussian integral

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

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

${\displaystyle \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 ${\displaystyle \int e^{-x^{2}}\,dx}$, but the definite integral ${\displaystyle \int _{-\infty }^{\infty }e^{-x^{2}}\,dx}$ can be evaluated.

## Computation

A standard way to compute the Gaussian integral is

• consider the function ${\displaystyle e^{-(x^{2}+y^{2})}=e^{-r^{2}}}$ on the plane ${\displaystyle \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: ${\displaystyle \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 ${\displaystyle \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,

{\displaystyle {\begin{aligned}\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{aligned}}}

On the other hand,

{\displaystyle {\begin{aligned}\int _{\mathbf {R} ^{2}}e^{-(x^{2}+y^{2})}\,dx\,dy&=\int _{0}^{2\pi }\int _{0}^{\infty }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{aligned}}}

where the factor of ${\displaystyle r}$ comes from the transform to polar coordinates (${\displaystyle r\,dr\,d\theta }$ is the standard measure on the plane, expressed in polar coordinates), and the substitution involves taking ${\displaystyle s=-r^{2}}$, so ${\displaystyle ds=-2r\,dr}$.

Combining these yields ${\displaystyle \left(\int _{-\infty }^{\infty }e^{-x^{2}}\,dx\right)^{2}=\pi }$, so ${\displaystyle \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:

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

so that the integral may be found by

${\displaystyle \lim _{a\to \infty }I(a)=\int _{-\infty }^{\infty }e^{-x^{2}}\,dx.}$

Taking the square of I yields

${\displaystyle 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 ${\displaystyle \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 ${\displaystyle I(a)^{2}}$, and similarly the integral taken over the square's circumcircle must be greater than ${\displaystyle I(a)^{2}}$. The integrals over the two disks can easily be computed by switching from cartesian coordinates to polar coordinates: ${\displaystyle x=r\,\cos \theta }$, ${\displaystyle y=r\,\sin \theta }$, ${\displaystyle d(x,y)=r\,d(r,\theta )}$:

${\displaystyle \int _{0}^{2\pi }\int _{0}^{a}re^{-r^{2}}\,dr\,d\theta

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

Integrating,

${\displaystyle \pi (1-e^{-a^{2}})

By the squeeze theorem, this gives the Gaussian integral

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

## Relation to the gamma function

Since the integrand is an even function,

${\displaystyle \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

${\displaystyle \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 ${\displaystyle {\sqrt {\pi }}}$. More generally,

${\displaystyle \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

${\displaystyle \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

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

Substituting y with cz gives

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

### n-dimensional and functional generalization

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

${\displaystyle \int \exp \left(-{\frac {1}{2}}A_{ij}x^{i}x^{j}\right)d^{n}x={\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,

${\displaystyle \int x^{k_{1}}\cdots x^{k_{2N}}\,\exp \left(-{\frac {1}{2}}A_{ij}x^{i}x^{j}\right)d^{n}x={\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,

${\displaystyle \int f({\vec {x}})\,\exp \left(-{\frac {1}{2}}A_{ij}x^{i}x^{j}\right)d^{n}x={\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 ${\displaystyle (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:

${\displaystyle {\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^{d}x_{2N+1}d^{d}x_{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^{d}x_{2N+1}d^{d}x_{2N+2}}{\mathcal {D}}f}},}$
${\displaystyle ={\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

${\displaystyle \int e^{-A_{ij}x^{i}x^{j}+B_{i}x_{i}}d^{n}x={\sqrt {\frac {\pi ^{n}}{\det {A}}}}e^{{\frac {1}{4}}B^{T}A^{-1}B}.}$

### Integrals of similar form

{\displaystyle {\begin{aligned}&\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{aligned}}}

## 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:

${\displaystyle \int _{-\infty }^{\infty }{\exp({ax^{4}+bx^{3}+cx^{2}+dx+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+{\frac {1}{4}})}{a^{3n+m+p+{\frac {1}{4}}}}}}}$

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