Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Integration Involving a Gaussian Function

  1. Feb 9, 2010 #1
    This is a University quantum physics problem but I'm posting it in this section as what I'm having trouble with is the integration.

    1. The problem statement, all variables and given/known data

    2. Relevant equations
    Normalisation condition: [tex]\int ^{\infty}_{-\infty} \left| \psi(x)^2 \right| dx = 1[/tex]

    3. The attempt at a solution
    So the integral that I'm having trouble with is
    [tex]\int ^{\infty}_{-\infty} \left| x^{2}e^{- \frac{x^{2}}{a^{2}}} \right| dx[/tex]

    I tried integration by parts but I really don't know how to handle the [tex]e^{- \frac{x^{2}}{2a^{2}}}[/tex] part. After some initial confusion I realise this is a Gaussian and the integral of it from minus infinity to infinity is [tex]a \sqrt{\pi}[/tex] which would be fine if it wasn't being multiplied by [tex]x^{2}[/tex].

    So integration by parts, setting [tex]u = x^{2}[/tex] and [tex]dv = e^{- \frac{x^{2}}{2a^{2}}} dx[/tex] doesn't work as then I have to integrate dv without limits, which gives the http://mathworld.wolfram.com/Erf.html" [Broken] which I only just heard of by putting this integral into Wolfram Alpha and don't know what to do with.

    Putting [tex]u = e^{- \frac{x^{2}}{2a^{2}}}[/tex] is even worse as when I differentiate [tex]du = \frac{x}{a^{2}} e^{- \frac{x^{2}}{2a^{2}}} dx[/tex] which means I would have to do integration by parts on this new integral and I think you can see why that's not going to work.

    Of course I can just get the answer but I want to know how to solve this problem myself. Do I have to work with the error function or is there a way of getting around it by an application of the limits (or some other trick) that I'm not seeing?
    Last edited by a moderator: May 4, 2017
  2. jcsd
  3. Feb 9, 2010 #2
    Try integration by parts with

    [tex]u = x[/tex]


    [tex]dv = x \exp(- \frac{x^2}{2a^2}}) \, dx[/tex]
  4. Feb 9, 2010 #3
    How to calculate integrals in the form [tex] I(n)=\int_{0}^{\infty}x^ne^{-ax^2}dx [/tex]

    This first part is to demonstrate to reach the method, but you won't have to reproduce it, just the result.

    Starting with [tex] I=\int_{-\infty}^{\infty}e^{\alpha^2}d\alpha [/tex] you can see that
    [tex]I^2=\int_{-\infty}^{\infty}e^{x^2}dx\int_{-\infty}^{\infty}e^{y^2}dy[/tex], because x is a mute variable.

    So you get [tex]\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}e^{-(x^2+y^2)}dxdy[/tex]

    Changing to polar coordinates one gets [tex]\int_{0}^{2\pi}\int_{0}^{\infty}e^-r^2}drd\theta = \sqrt{\pi}[/tex].

    If that is true, then [tex]\int_{0}^{\infty}e^-u^2}du = \frac{\sqrt{\pi}}{2}[/tex] also holds.

    Now, if we have something like [tex]\int_{0}^{\infty}e^{-ax^2}dx [/tex] we can change the variables to [tex]z^2=-ax^2, dz=\sqrt{a}dx, dx=\frac{dz}{\sqrt{a}} [/tex] and then calculate the integral in the form
    [tex] \int_{0}^{\infty}e^{-z^2}\frac{dz}{\sqrt{a}}=\sqrt{\frac{\pi}{a}}\frac{1}{2} [/tex] wich in the form [itex]I(n)[/itex] is [itex]I(0)[/itex].

    We need to calculate one more integral in order to have the complete set.

    [tex]I(1)=\int_{0}^{\infty}xe^{-ax^2}, z^2=ax^2[/tex]

    [tex]\int_{0}^{\infty}\frac{z}{\sqrt{a}}e^{z^2}\frac{dz}{\sqrt{a}}=\frac{1}{a}\int_{0}^{\infty}ze^{-z^2} = \frac{1}{2a} [/tex]

    So, in order to calculate any integral [itex]I(n)[/itex] all you have to is calculate
    [tex]-\frac{d}{da}I(n-2)[/tex] because [tex]\int_{0}^{\infty}-\frac{d}{da}x^{n-2}e^{-ax^2}=\int_{0}^{\infty}-(-x^2)x^{n-2}e^{-ax^2}dx[/tex].

    It's obvious now that both integrals are the same because [tex]x^2x^{n-2}=x^n[/tex].

    So to recap all that was done here, [tex]I(n)=-\frac{d}{da}I(n-2), I(0)=\sqrt{\frac{\pi}{a}}\frac{1}{2}, I(1)=\frac{1}{2a}[/tex] and this is all you need to solve any integral in [itex]I(n)[/itex] form.

    If I wasn't clear in any of the steps just say so, I hope this helps anyone with this sort of problem.
  5. Feb 9, 2010 #4


    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper
    Education Advisor

    One way to do it is to note that when the gaussian has a mean of zero, E(x2) is equal to the variance:

    [tex]\sigma^2 = \frac{1}{\sqrt{2\pi\sigma^2}}\int_{-\infty}^{\infty} x^2 e^{-\frac{x^2}{2\sigma^2}}dx[/tex]

    Comparing this integral to yours, you can identify [itex]a^2[/itex] with [itex]2\sigma^2[/itex] so that [itex]\sigma=a/\sqrt{2}[/itex]; therefore,

    [tex]\int_{-\infty}^{\infty} x^2 e^{-\frac{x^2}{a^2}}dx = \sqrt{2\pi}(a/\sqrt{2})^3 = \frac{\sqrt{\pi}a^3}{2}[/tex]

    Another way to do it is to use this trick:

    [tex]\int_{-\infty}^{\infty} x^2 e^{-\alpha{x^2}} dx = \int_{-\infty}^{\infty} \left( -\frac{d}{d\alpha}\right) e^{-\alpha{x^2}} dx=-\frac{d}{d\alpha} \int_{-\infty}^{\infty} e^{-\alpha{x^2}} dx=-\frac{d}{d\alpha}\left(\sqrt{\frac{\pi}{\alpha}\right)= \frac{1}{2}\sqrt{\frac{\pi}{\alpha^3}[/tex]

    Setting [itex]\alpha=1/a^2[/itex] gives

    [tex]\int_{-\infty}^{\infty} x^2 e^{-\frac{x^2}{a^2}} dx = \frac{\sqrt{\pi}a^3}{2}[/tex]
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook