How to Integrate a Gaussian Function

Опубликовал Admin
29-10-2016, 10:33
The Gaussian function is one of the most important functions in mathematics and the sciences. Its characteristic bell-shaped graph comes up everywhere from the normal distribution in statistics to position wavepackets of a particle in quantum mechanics. The Gaussian has the form f(x)=ae−x22σ2{\displaystyle f(x)=ae^{-{\frac {x^{2}}{2\sigma ^{2}}}}} where a{\displaystyle a} is a (normalization) constant that determines the height of the bell curve, and σ{\displaystyle \sigma } is the standard deviation, which determines the curve's width. Integrating this function over all of x{\displaystyle x} is an extremely common task, but it resists the techniques of elementary calculus. No amount of change of variables, integration by parts, trigonometric substitution, etc. will simplify the integral. In fact, the antiderivative of the Gaussian, the error function, cannot be written in terms of elementary functions. Nevertheless, there exists an exact solution for the definite integral, which we find in this article.


  1. Begin with the integral of the Gaussian to be evaluated. We will consider a Gaussian with a height a{\displaystyle a} and a standard deviation σ.{\displaystyle \sigma .}
    • ∫−∞∞ae−x22σ2dx{\displaystyle \int _{-\infty }^{\infty }ae^{-{\frac {x^{2}}{2\sigma ^{2}}}}{\mathrm {d} }x}
  2. Consider the square of the integral. We are expanding this integral into the xy{\displaystyle xy} plane. The idea here is to turn this problem into a double integral for which we can easily solve, and then take the square root.
    • a2∫−∞∞dxe−x22σ2∫−∞∞dye−y22σ2{\displaystyle a^{2}\int _{-\infty }^{\infty }{\mathrm {d} }xe^{-{\frac {x^{2}}{2\sigma ^{2}}}}\int _{-\infty }^{\infty }{\mathrm {d} }ye^{-{\frac {y^{2}}{2\sigma ^{2}}}}}
    • This step comes from the property written below. The mathematical justification for this step is a bit more advanced.
      • (∫−∞∞e−x2dx)2=∫−∞∞∫−∞∞e−(x2+y2)2dxdy{\displaystyle \left(\int _{-\infty }^{\infty }e^{-x^{2}}{\mathrm {d} }x\right)^{2}=\int _{-\infty }^{\infty }\int _{-\infty }^{\infty }e^{-(x^{2}+y^{2})^{2}}{\mathrm {d} }x{\mathrm {d} }y}
  3. Convert to polar coordinates. Recall that the area integral of a polar rectangle is of the form rdrdθ,{\displaystyle r{\mathrm {d} }r{\mathrm {d} }\theta ,} with the extra r{\displaystyle r} there in order to scale the angle to units of length. This extra r{\displaystyle r} makes this problem trivial.
    • a2∫−∞∞dxe−x22σ2∫−∞∞dye−y22σ2=a2∫0∞rdr∫02πdθe−r22σ2{\displaystyle a^{2}\int _{-\infty }^{\infty }{\mathrm {d} }xe^{-{\frac {x^{2}}{2\sigma ^{2}}}}\int _{-\infty }^{\infty }{\mathrm {d} }ye^{-{\frac {y^{2}}{2\sigma ^{2}}}}=a^{2}\int _{0}^{\infty }r{\mathrm {d} }r\int _{0}^{2\pi }{\mathrm {d} }\theta e^{-{\frac {r^{2}}{2\sigma ^{2}}}}}
  4. Evaluate by means of a u-substitution. Let u=r22σ2.{\displaystyle u={\frac {r^{2}}{2\sigma ^{2}}}.}
    • a2∫0∞rdr∫02πdθe−r22σ2=2πa2σ2∫0∞e−udu=2πa2σ2(−e−∞+e0)=2πa2σ2{\displaystyle {\begin{aligned}a^{2}\int _{0}^{\infty }r{\mathrm {d} }r\int _{0}^{2\pi }{\mathrm {d} }\theta e^{-{\frac {r^{2}}{2\sigma ^{2}}}}&=2\pi a^{2}\sigma ^{2}\int _{0}^{\infty }e^{-u}{\mathrm {d} }u\\&=2\pi a^{2}\sigma ^{2}(-e^{-\infty }+e^{0})\\&=2\pi a^{2}\sigma ^{2}\end{aligned}}}
  5. Arrive at the integral of a Gaussian. Since we were evaluating the square of the integral, we take the square root of our result.
    • ∫−∞∞ae−x22σ2dx=aσ2π{\displaystyle \int _{-\infty }^{\infty }ae^{-{\frac {x^{2}}{2\sigma ^{2}}}}{\mathrm {d} }x=a\sigma {\sqrt {2\pi }}}
    • This is a general result from which we can see that the Gaussian integral ∫−∞∞e−x2=π{\displaystyle \int _{-\infty }^{\infty }e^{-x^{2}}={\sqrt {\pi }}} if we set a=1{\displaystyle a=1} and σ=12.{\displaystyle \sigma ={\frac {1}{\sqrt {2}}}.}
    • Another way to formulate the problem is if we have a Gaussian in the form e−αx2.{\displaystyle e^{-\alpha x^{2}}.} Then, the integral would be πα.{\displaystyle {\sqrt {\frac {\pi }{\alpha }}}.}
  6. (Optional) Normalize the area to find the normalization constant a{\displaystyle a}. In many applications, it is desired that the area of the Gaussian be set to unity. In this case, we set aσ2π=1{\displaystyle a\sigma {\sqrt {2\pi }}=1} and solve for a.{\displaystyle a.}
    • a=1σ2π{\displaystyle a={\frac {1}{\sigma {\sqrt {2\pi }}}}}
    • Here, we arrive at the normalized Gaussian, so desired in such applications as probability theory, quantum mechanics, and so forth. The diagram above lists a few normalized Gaussians with varying standard deviations (actually variances, since they are defined by σ2{\displaystyle \sigma ^{2}}).
      • f(x)=1σ2πe−x22σ2{\displaystyle f(x)={\frac {1}{\sigma {\sqrt {2\pi }}}}e^{-{\frac {x^{2}}{2\sigma ^{2}}}}}


  • It turns out that the Gaussian as defined in the introduction of this article is not the most general form. As seen in the diagram, one can also shift the Gaussian some units μ,{\displaystyle \mu ,} so that the x2{\displaystyle x^{2}} turns into a (x−μ)2{\displaystyle (x-\mu )^{2}} in the exponent. However, it is clear that the translation does not matter when we are integrating over all x.{\displaystyle x.} Nevertheless, the normalized Gaussian looks like this.
    • f(x)=1σ2πe−(x−μ)22σ2{\displaystyle f(x)={\frac {1}{\sigma {\sqrt {2\pi }}}}e^{-{\frac {(x-\mu )^{2}}{2\sigma ^{2}}}}}
Users of Guests are not allowed to comment this publication.