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

Is there a trick to solving this definite integral?

  1. Sep 3, 2009 #1
    Hi,
    For evaluating the entropy of a gaussian distribution, I need to evaluate this integral:
    [tex]\int^{\infty}_{-\infty}exp(x^2)x^2dx[/tex]
    There is no analytical solution for the indefinite integral, but is there a trick for evaluating this particular definite one?

    Thanks a lot
    -Patrick
     
  2. jcsd
  3. Sep 3, 2009 #2

    jgens

    User Avatar
    Gold Member

    It looks like that definite integral never converges . . .
     
  4. Sep 4, 2009 #3

    HallsofIvy

    User Avatar
    Staff Emeritus
    Science Advisor

    As jgens said, that integral does not converge. Since you are talking about a Gaussian distribution I suspect you actually meant
    [tex]\int_{-\infty}^\infty x^2e^{-x^2} dx[/tex]

    [itex]e^{-x^2}[/itex] is [itex]\sqrt{2}[/itex] times the Gaussian distribution with mean 0 and standard deviation 1. The square of the standard deviation of any probability density function, f(x), is [itex]\int (x-\mu)^2 f(x)dx[/itex] and, with [itex]\mu= 0[/itex], [itex]\sigma= 1[/itex], as here, [itex]\int x^2f(x)dx= 1[/itex]. That is,
    [tex]\frac{1}{\sqrt{2}}\int_{-\infty}^\infty x^2e^{-x^2}dx= 1[/tex]
    so
    [tex]\int_{-\infty}^\infty x^2e^{-x^2}dx= \sqrt{2}[/itex]
     
    Last edited: Sep 4, 2009
  5. Sep 4, 2009 #4

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    You forgot the normalization factor, Halls.

    The "trick" (not much of a trick) is to integrate by parts using [itex]u=x[/itex], [itex]dv=x\exp(-x^2)\;dx[/itex], from which [itex]du=dx[/itex], [itex]v=-1/2\exp(-x^2)[/itex]. Then

    [tex]\int_{-\infty}^{\infty} x^2\exp(-x^2)\,dx =
    \left.-\,\frac 1 2 x \exp(-x^2)\right|_{-\infty}^{\infty} \,\,+\quad
    \frac 1 2 \int_{-\infty}^{\infty} \exp(-x^2)\,dx[/tex]

    The first term vanishes at the integration limits. The second term is just half the Gaussian integral. Thus

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


    OR one could use Hall's approach and look at this as the expected value of x2 for some normal distribution. The normal distribution is

    [tex]f(x;\mu,\sigma) = \frac 1 {\sigma\sqrt{2\pi}} \exp\left(-\,\frac 1 2 \left(\frac {x-\mu}{\sigma}\right)^2\right)[/tex]

    While the given function is not in the form of a Gaussian pdf, it is very close. By inspection, the given function is the Gaussian pdf for a mean of zero and a variance of 1/2, but without the normalization factor:

    [tex]g(x) = \surd{\pi} \,f(x;0,1/\surd 2)[/tex]

    Using the fact that the expected value of x2 for a normal distribution is the variance [itex]\sigma^2[/itex],

    [tex]\int_{-\infty}^{\infty} x^2\exp(-x^2)\,dx = \frac{\sqrt \pi}{2}[/tex]
     
  6. Sep 4, 2009 #5
    Thank you very much for the help. You guys interpreted my mistake correctly. I did mean to have exp(-x^2) not exp(x^2).

    The tip on properly using integration by parts helped very much. Thank you DH. I've tried integration by parts, but failed to find the right u and dv to use. Clearly I haven't done enough exercises in Calculus I.

    Thanks again
    -Patrick
     
  7. Sep 4, 2009 #6

    Mute

    User Avatar
    Homework Helper

    For Gaussian integrals like that I like to use the following trick: consider the integral

    [tex]\int_{-\infty}^\infty dx~e^{-\alpha x^2} = \sqrt{\frac{\pi}{\alpha}};[/tex]

    any integral of the form

    [tex]\int_{-\infty}^\infty dx~x^{2n} e^{-\alpha x^2}[/tex]

    can then be computed by taking derivatives of the first integral with respect to [itex]\alpha[/itex], then at the end of the calculation set [itex]\alpha[/itex] to whatever it actually is in the problem.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Is there a trick to solving this definite integral?
Loading...