How to Integrate Gaussian Functions
Begin with the integral., Consider the square of the integral., Convert to polar coordinates., Evaluate by means of a u-substitution., Arrive at the integral of a Gaussian., Consider the integral of the general Gaussian function., (Optional)...
Step-by-Step Guide
-
Step 1: Begin with the integral.
∫−∞∞e−x2dx{\displaystyle \int _{-\infty }^{\infty }e^{-x^{2}}{\mathrm {d} }x} -
Step 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. ∫−∞∞dxe−x2∫−∞∞dye−y2{\displaystyle \int _{-\infty }^{\infty }{\mathrm {d} }xe^{-x^{2}}\int _{-\infty }^{\infty }{\mathrm {d} }ye^{-y^{2}}} , 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. ∫−∞∞dxe−x2∫−∞∞dye−y2=∫0∞rdr∫02πdθe−r2{\displaystyle \int _{-\infty }^{\infty }{\mathrm {d} }xe^{-x^{2}}\int _{-\infty }^{\infty }{\mathrm {d} }ye^{-y^{2}}=\int _{0}^{\infty }r{\mathrm {d} }r\int _{0}^{2\pi }{\mathrm {d} }\theta e^{-r^{2}}} , Let u=r2.{\displaystyle u=r^{2}.} Then the differential du=2rdr{\displaystyle {\mathrm {d} }u=2r{\mathrm {d} }r} will cancel out the extra r{\displaystyle r} that we got from changing to polar.
Since the integrand has no θ{\displaystyle \theta } dependence, we can evaluate the θ{\displaystyle \theta } integral immediately. ∫0∞rdr∫02πdθe−r2=π∫0∞e−udu=π(−e−∞+e0)=π{\displaystyle {\begin{aligned}\int _{0}^{\infty }r{\mathrm {d} }r\int _{0}^{2\pi }{\mathrm {d} }\theta e^{-r^{2}}&=\pi \int _{0}^{\infty }e^{-u}{\mathrm {d} }u\\&=\pi (-e^{-\infty }+e^{0})\\&=\pi \end{aligned}}} , Since we were evaluating the square of the integral, we take the square root of our result. ∫−∞∞e−x2dx=π{\displaystyle \int _{-\infty }^{\infty }e^{-x^{2}}{\mathrm {d} }x={\sqrt {\pi }}} Importantly, the Gaussian function is even. ∫−∞∞e−x2dx=2∫0∞e−x2dx=2⋅π2{\displaystyle \int _{-\infty }^{\infty }e^{-x^{2}}{\mathrm {d} }x=2\int _{0}^{\infty }e^{-x^{2}}{\mathrm {d} }x=2\cdot {\frac {\sqrt {\pi }}{2}}} , This function is determined by the parameters a{\displaystyle a} and σ,{\displaystyle \sigma ,} 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. f(x)=ae−x22σ2{\displaystyle f(x)=ae^{-{\frac {x^{2}}{2\sigma ^{2}}}}} Follow the steps shown above to verify this integral. ∫−∞∞ae−x22σ2dx=aσ2π{\displaystyle \int _{-\infty }^{\infty }ae^{-{\frac {x^{2}}{2\sigma ^{2}}}}{\mathrm {d} }x=a\sigma {\sqrt {2\pi }}} Another way to formulate the problem is if we have a Gaussian in the form e−αx2.{\displaystyle e^{-\alpha x^{2}}.} Verify this integral as well. ∫−∞∞e−αx2dx=πα{\displaystyle \int _{-\infty }^{\infty }e^{-\alpha x^{2}}{\mathrm {d} }x={\sqrt {\frac {\pi }{\alpha }}}} , 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}}}}} , The Gaussian integral ∫0∞e−αx2dx=12πα{\displaystyle \int _{0}^{\infty }e^{-\alpha x^{2}}{\mathrm {d} }x={\frac {1}{2}}{\sqrt {\frac {\pi }{\alpha }}}} is a result that can be used to find numerous related integrals.
The ones below are called moments of the Gaussian.
Below, n{\displaystyle n} is a positive number. ∫0∞xne−x2dx{\displaystyle \int _{0}^{\infty }x^{n}e^{-x^{2}}{\mathrm {d} }x} , The result from differentiating under the integral is that even powers of x{\displaystyle x} get brought down.
Notice that as the integral gets negated, the result on the right also gets negated because of the negative power in α,{\displaystyle \alpha ,} so the answers remain positive.
Since differentiation is much easier than integration, we could do this all day, making sure to set α=1{\displaystyle \alpha =1} at a convenient time.
We list some of these integrals below.
Make sure to verify them for yourself. ∫0∞e−αx2dx=12πα{\displaystyle \int _{0}^{\infty }e^{-\alpha x^{2}}{\mathrm {d} }x={\frac {1}{2}}{\sqrt {\frac {\pi }{\alpha }}}} ∫0∞x2e−x2dx=−∫0∞∂∂αe−αx2dx=−ddα(12πα)=π4{\displaystyle \int _{0}^{\infty }x^{2}e^{-x^{2}}{\mathrm {d} }x=-\int _{0}^{\infty }{\frac {\partial }{\partial \alpha }}e^{-\alpha x^{2}}{\mathrm {d} }x=-{\frac {\mathrm {d} }{{\mathrm {d} }\alpha }}\left({\frac {1}{2}}{\sqrt {\frac {\pi }{\alpha }}}\right)={\frac {\sqrt {\pi }}{4}}} ∫0∞x4e−x2dx=3π8{\displaystyle \int _{0}^{\infty }x^{4}e^{-x^{2}}{\mathrm {d} }x={\frac {3{\sqrt {\pi }}}{8}}} ∫0∞x6e−x2dx=15π16{\displaystyle \int _{0}^{\infty }x^{6}e^{-x^{2}}{\mathrm {d} }x={\frac {15{\sqrt {\pi }}}{16}}} , Then we can use the Gamma function to easily evaluate.
Below, we choose n=9{\displaystyle n=9} and n=1/3{\displaystyle n=1/3} as examples. ∫0∞x9e−x2dx=12∫0∞u4e−udu=4!2=12{\displaystyle \int _{0}^{\infty }x^{9}e^{-x^{2}}{\mathrm {d} }x={\frac {1}{2}}\int _{0}^{\infty }u^{4}e^{-u}{\mathrm {d} }u={\frac {4!}{2}}=12} ∫0∞x1/3e−x2dx=12∫0∞u−1/3e−udu=Γ(2/3)2{\displaystyle \int _{0}^{\infty }x^{1/3}e^{-x^{2}}{\mathrm {d} }x={\frac {1}{2}}\int _{0}^{\infty }u^{-1/3}e^{-u}{\mathrm {d} }u={\frac {\Gamma (2/3)}{2}}} It is interesting to note that we could've used the Gamma function for even n{\displaystyle n} as well.
It is a more general method of evaluating these types of integrals that typically is no more involved than differentiating under the integral. , The result is general enough such that α{\displaystyle \alpha } can even take on complex values.
Recall Euler's formula relating the complex exponential function to the trigonometric functions.
If we take the real and imaginary parts of our result, we obtain two integrals for free.
Neither of the two real integrals have antiderivatives that can be written in closed form. e−ix2=cosx2−isinx2{\displaystyle e^{-ix^{2}}=\cos x^{2}-i\sin x^{2}} ∫0∞e−ix2dx=12πi=π2e−iπ/4=π22(1−i){\displaystyle \int _{0}^{\infty }e^{-ix^{2}}{\mathrm {d} }x={\frac {1}{2}}{\sqrt {\frac {\pi }{i}}}={\frac {\sqrt {\pi }}{2}}e^{-i\pi /4}={\frac {\sqrt {\pi }}{2{\sqrt {2}}}}(1-i)} ∫0∞cosx2dx=∫0∞sinx2dx=π22{\displaystyle \int _{0}^{\infty }\cos x^{2}{\mathrm {d} }x=\int _{0}^{\infty }\sin x^{2}{\mathrm {d} }x={\frac {\sqrt {\pi }}{2{\sqrt {2}}}}} These two integrals are special cases of the Fresnel integrals, where they are important in the study of optics.
If you are not very familiar with complex numbers, the number i{\displaystyle i} can be rewritten in polar form as eiπ/2,{\displaystyle e^{i\pi /2},} because imaginary exponents are rotations in the complex plane
- in this case, by an angle of π/2.{\displaystyle \pi /2.} Polar form simplifies almost everything associated with complex numbers, so we can easily take the square root. , Calculating the Fourier transform is computationally very simple, but it requires a slight modification.
We opt to complete the square because we recognize the property that the integral is independent of the shift (see the discussion).
Since we have to add 0 in order to not change the integrand, we have to compensate by adding a −ω24{\displaystyle
-{\frac {\omega ^{2}}{4}}} term.
Watch the signs
- they can be tricky.
F{e−t2}=∫−∞∞e−t2e−iωtdt=∫−∞∞e−(t2+iωt−ω2/4+ω2/4)dt=e−ω2/4∫−∞∞e−(t+iω/2)2dt=πe−ω2/4{\displaystyle {\begin{aligned}{\mathcal {F}}\{e^{-t^{2}}\}&=\int _{-\infty }^{\infty }e^{-t^{2}}e^{-i\omega t}{\mathrm {d} }t\\&=\int _{-\infty }^{\infty }e^{-(t^{2}+i\omega t-\omega ^{2}/4+\omega ^{2}/4)}{\mathrm {d} }t\\&=e^{-\omega ^{2}/4}\int _{-\infty }^{\infty }e^{-(t+i\omega /2)^{2}}{\mathrm {d} }t\\&={\sqrt {\pi }}e^{-\omega ^{2}/4}\end{aligned}}} Interestingly, the Fourier transform of a Gaussian is another (scaled) Gaussian, a property that few other functions have (the hyperbolic secant, whose function is also shaped like a bell curve, is also its own Fourier transform).
For physicists and engineers, Gaussian integrals are incredibly useful.
Proficiency in evaluating them is a must. -
Step 3: Convert to polar coordinates.
-
Step 4: Evaluate by means of a u-substitution.
-
Step 5: Arrive at the integral of a Gaussian.
-
Step 6: Consider the integral of the general Gaussian function.
-
Step 7: (Optional) Normalize the area to find the normalization constant a{\displaystyle a}.
-
Step 8: Consider the integral below.
-
Step 9: If n{\displaystyle n} is even
-
Step 10: consider the related integral (written below) and differentiate under the integral.
-
Step 11: If n{\displaystyle n} is not even
-
Step 12: use the u-sub u=x2{\displaystyle u=x^{2}}.
-
Step 13: Set α=i{\displaystyle \alpha =i} to obtain three integrals.
-
Step 14: Calculate the Fourier transform of the Gaussian function by completing the square.
Detailed Guide
∫−∞∞e−x2dx{\displaystyle \int _{-\infty }^{\infty }e^{-x^{2}}{\mathrm {d} }x}
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. ∫−∞∞dxe−x2∫−∞∞dye−y2{\displaystyle \int _{-\infty }^{\infty }{\mathrm {d} }xe^{-x^{2}}\int _{-\infty }^{\infty }{\mathrm {d} }ye^{-y^{2}}} , 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. ∫−∞∞dxe−x2∫−∞∞dye−y2=∫0∞rdr∫02πdθe−r2{\displaystyle \int _{-\infty }^{\infty }{\mathrm {d} }xe^{-x^{2}}\int _{-\infty }^{\infty }{\mathrm {d} }ye^{-y^{2}}=\int _{0}^{\infty }r{\mathrm {d} }r\int _{0}^{2\pi }{\mathrm {d} }\theta e^{-r^{2}}} , Let u=r2.{\displaystyle u=r^{2}.} Then the differential du=2rdr{\displaystyle {\mathrm {d} }u=2r{\mathrm {d} }r} will cancel out the extra r{\displaystyle r} that we got from changing to polar.
Since the integrand has no θ{\displaystyle \theta } dependence, we can evaluate the θ{\displaystyle \theta } integral immediately. ∫0∞rdr∫02πdθe−r2=π∫0∞e−udu=π(−e−∞+e0)=π{\displaystyle {\begin{aligned}\int _{0}^{\infty }r{\mathrm {d} }r\int _{0}^{2\pi }{\mathrm {d} }\theta e^{-r^{2}}&=\pi \int _{0}^{\infty }e^{-u}{\mathrm {d} }u\\&=\pi (-e^{-\infty }+e^{0})\\&=\pi \end{aligned}}} , Since we were evaluating the square of the integral, we take the square root of our result. ∫−∞∞e−x2dx=π{\displaystyle \int _{-\infty }^{\infty }e^{-x^{2}}{\mathrm {d} }x={\sqrt {\pi }}} Importantly, the Gaussian function is even. ∫−∞∞e−x2dx=2∫0∞e−x2dx=2⋅π2{\displaystyle \int _{-\infty }^{\infty }e^{-x^{2}}{\mathrm {d} }x=2\int _{0}^{\infty }e^{-x^{2}}{\mathrm {d} }x=2\cdot {\frac {\sqrt {\pi }}{2}}} , This function is determined by the parameters a{\displaystyle a} and σ,{\displaystyle \sigma ,} 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. f(x)=ae−x22σ2{\displaystyle f(x)=ae^{-{\frac {x^{2}}{2\sigma ^{2}}}}} Follow the steps shown above to verify this integral. ∫−∞∞ae−x22σ2dx=aσ2π{\displaystyle \int _{-\infty }^{\infty }ae^{-{\frac {x^{2}}{2\sigma ^{2}}}}{\mathrm {d} }x=a\sigma {\sqrt {2\pi }}} Another way to formulate the problem is if we have a Gaussian in the form e−αx2.{\displaystyle e^{-\alpha x^{2}}.} Verify this integral as well. ∫−∞∞e−αx2dx=πα{\displaystyle \int _{-\infty }^{\infty }e^{-\alpha x^{2}}{\mathrm {d} }x={\sqrt {\frac {\pi }{\alpha }}}} , 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}}}}} , The Gaussian integral ∫0∞e−αx2dx=12πα{\displaystyle \int _{0}^{\infty }e^{-\alpha x^{2}}{\mathrm {d} }x={\frac {1}{2}}{\sqrt {\frac {\pi }{\alpha }}}} is a result that can be used to find numerous related integrals.
The ones below are called moments of the Gaussian.
Below, n{\displaystyle n} is a positive number. ∫0∞xne−x2dx{\displaystyle \int _{0}^{\infty }x^{n}e^{-x^{2}}{\mathrm {d} }x} , The result from differentiating under the integral is that even powers of x{\displaystyle x} get brought down.
Notice that as the integral gets negated, the result on the right also gets negated because of the negative power in α,{\displaystyle \alpha ,} so the answers remain positive.
Since differentiation is much easier than integration, we could do this all day, making sure to set α=1{\displaystyle \alpha =1} at a convenient time.
We list some of these integrals below.
Make sure to verify them for yourself. ∫0∞e−αx2dx=12πα{\displaystyle \int _{0}^{\infty }e^{-\alpha x^{2}}{\mathrm {d} }x={\frac {1}{2}}{\sqrt {\frac {\pi }{\alpha }}}} ∫0∞x2e−x2dx=−∫0∞∂∂αe−αx2dx=−ddα(12πα)=π4{\displaystyle \int _{0}^{\infty }x^{2}e^{-x^{2}}{\mathrm {d} }x=-\int _{0}^{\infty }{\frac {\partial }{\partial \alpha }}e^{-\alpha x^{2}}{\mathrm {d} }x=-{\frac {\mathrm {d} }{{\mathrm {d} }\alpha }}\left({\frac {1}{2}}{\sqrt {\frac {\pi }{\alpha }}}\right)={\frac {\sqrt {\pi }}{4}}} ∫0∞x4e−x2dx=3π8{\displaystyle \int _{0}^{\infty }x^{4}e^{-x^{2}}{\mathrm {d} }x={\frac {3{\sqrt {\pi }}}{8}}} ∫0∞x6e−x2dx=15π16{\displaystyle \int _{0}^{\infty }x^{6}e^{-x^{2}}{\mathrm {d} }x={\frac {15{\sqrt {\pi }}}{16}}} , Then we can use the Gamma function to easily evaluate.
Below, we choose n=9{\displaystyle n=9} and n=1/3{\displaystyle n=1/3} as examples. ∫0∞x9e−x2dx=12∫0∞u4e−udu=4!2=12{\displaystyle \int _{0}^{\infty }x^{9}e^{-x^{2}}{\mathrm {d} }x={\frac {1}{2}}\int _{0}^{\infty }u^{4}e^{-u}{\mathrm {d} }u={\frac {4!}{2}}=12} ∫0∞x1/3e−x2dx=12∫0∞u−1/3e−udu=Γ(2/3)2{\displaystyle \int _{0}^{\infty }x^{1/3}e^{-x^{2}}{\mathrm {d} }x={\frac {1}{2}}\int _{0}^{\infty }u^{-1/3}e^{-u}{\mathrm {d} }u={\frac {\Gamma (2/3)}{2}}} It is interesting to note that we could've used the Gamma function for even n{\displaystyle n} as well.
It is a more general method of evaluating these types of integrals that typically is no more involved than differentiating under the integral. , The result is general enough such that α{\displaystyle \alpha } can even take on complex values.
Recall Euler's formula relating the complex exponential function to the trigonometric functions.
If we take the real and imaginary parts of our result, we obtain two integrals for free.
Neither of the two real integrals have antiderivatives that can be written in closed form. e−ix2=cosx2−isinx2{\displaystyle e^{-ix^{2}}=\cos x^{2}-i\sin x^{2}} ∫0∞e−ix2dx=12πi=π2e−iπ/4=π22(1−i){\displaystyle \int _{0}^{\infty }e^{-ix^{2}}{\mathrm {d} }x={\frac {1}{2}}{\sqrt {\frac {\pi }{i}}}={\frac {\sqrt {\pi }}{2}}e^{-i\pi /4}={\frac {\sqrt {\pi }}{2{\sqrt {2}}}}(1-i)} ∫0∞cosx2dx=∫0∞sinx2dx=π22{\displaystyle \int _{0}^{\infty }\cos x^{2}{\mathrm {d} }x=\int _{0}^{\infty }\sin x^{2}{\mathrm {d} }x={\frac {\sqrt {\pi }}{2{\sqrt {2}}}}} These two integrals are special cases of the Fresnel integrals, where they are important in the study of optics.
If you are not very familiar with complex numbers, the number i{\displaystyle i} can be rewritten in polar form as eiπ/2,{\displaystyle e^{i\pi /2},} because imaginary exponents are rotations in the complex plane
- in this case, by an angle of π/2.{\displaystyle \pi /2.} Polar form simplifies almost everything associated with complex numbers, so we can easily take the square root. , Calculating the Fourier transform is computationally very simple, but it requires a slight modification.
We opt to complete the square because we recognize the property that the integral is independent of the shift (see the discussion).
Since we have to add 0 in order to not change the integrand, we have to compensate by adding a −ω24{\displaystyle
-{\frac {\omega ^{2}}{4}}} term.
Watch the signs
- they can be tricky.
F{e−t2}=∫−∞∞e−t2e−iωtdt=∫−∞∞e−(t2+iωt−ω2/4+ω2/4)dt=e−ω2/4∫−∞∞e−(t+iω/2)2dt=πe−ω2/4{\displaystyle {\begin{aligned}{\mathcal {F}}\{e^{-t^{2}}\}&=\int _{-\infty }^{\infty }e^{-t^{2}}e^{-i\omega t}{\mathrm {d} }t\\&=\int _{-\infty }^{\infty }e^{-(t^{2}+i\omega t-\omega ^{2}/4+\omega ^{2}/4)}{\mathrm {d} }t\\&=e^{-\omega ^{2}/4}\int _{-\infty }^{\infty }e^{-(t+i\omega /2)^{2}}{\mathrm {d} }t\\&={\sqrt {\pi }}e^{-\omega ^{2}/4}\end{aligned}}} Interestingly, the Fourier transform of a Gaussian is another (scaled) Gaussian, a property that few other functions have (the hyperbolic secant, whose function is also shaped like a bell curve, is also its own Fourier transform).
For physicists and engineers, Gaussian integrals are incredibly useful.
Proficiency in evaluating them is a must.
About the Author
Paul Davis
Writer and educator with a focus on practical home improvement knowledge.
Rate This Guide
How helpful was this guide? Click to rate: