# Integral of a Gaussian function

The integral of an arbitrary Gaussian function is

$\int_{-\infty}^{\infty} a\,e^{-(x+b)^2/c^2}\,dx=a |c| \sqrt{\pi}.$

An alternative form is

$\int_{-\infty}^{\infty}k\,e^{-f x^2 + g x + h}\,dx=\int_{-\infty}^{\infty}k\,e^{-f (x-g/(2f))^2 +g^2/(4f) + h}\,dx=k\,\sqrt{\frac{\pi}{f}}\,\exp\left(\frac{g^2}{4f} + h\right),$

where f must be strictly positive for the integral to converge.

## Proof

The integral

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

for some real constants a, b, c > 0 can be calculated by putting it into the form of a Gaussian integral. First, the constant a can simply be factored out of the integral. Next, the variable of integration is changed from x to y = x + b.

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

and then to $z=y/|c|$

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

Then, using the Gaussian integral identity

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

we have

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