Is there a trick to solving this definite integral?

CuppoJava
Messages
23
Reaction score
0
Hi,
For evaluating the entropy of a gaussian distribution, I need to evaluate this integral:
\int^{\infty}_{-\infty}exp(x^2)x^2dx
There is no analytical solution for the indefinite integral, but is there a trick for evaluating this particular definite one?

Thanks a lot
-Patrick
 
Physics news on Phys.org
It looks like that definite integral never converges . . .
 
As jgens said, that integral does not converge. Since you are talking about a Gaussian distribution I suspect you actually meant
\int_{-\infty}^\infty x^2e^{-x^2} dx

e^{-x^2} is \sqrt{2} 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 \int (x-\mu)^2 f(x)dx and, with \mu= 0, \sigma= 1, as here, \int x^2f(x)dx= 1. That is,
\frac{1}{\sqrt{2}}\int_{-\infty}^\infty x^2e^{-x^2}dx= 1
so
\int_{-\infty}^\infty x^2e^{-x^2}dx= \sqrt{2}[/itex]
 
Last edited by a moderator:
HallsofIvy said:
e^{-x^2} is \sqrt{2} times the Gaussian distribution with mean 0 and standard deviation 1. ... so
\int_{-\infty}^\infty x^2e^{-x^2}dx= \sqrt{2}[/itex]
<br /> You forgot the normalization factor, Halls.<br /> <br /> The &quot;trick&quot; (not much of a trick) is to integrate by parts using u=x, dv=x\exp(-x^2)\;dx, from which du=dx, v=-1/2\exp(-x^2). Then<br /> <br /> \int_{-\infty}^{\infty} x^2\exp(-x^2)\,dx =&lt;br /&gt; \left.-\,\frac 1 2 x \exp(-x^2)\right|_{-\infty}^{\infty} \,\,+\quad&lt;br /&gt; \frac 1 2 \int_{-\infty}^{\infty} \exp(-x^2)\,dx<br /> <br /> The first term vanishes at the integration limits. The second term is just half the Gaussian integral. Thus<br /> <br /> \int_{-\infty}^{\infty} x^2\exp(-x^2)\,dx = \frac{\sqrt \pi}{2}OR one could use Hall&#039;s approach and look at this as the expected value of <i>x</i><sup>2</sup> for some normal distribution. The normal distribution is<br /> <br /> f(x;\mu,\sigma) = \frac 1 {\sigma\sqrt{2\pi}} \exp\left(-\,\frac 1 2 \left(\frac {x-\mu}{\sigma}\right)^2\right)<br /> <br /> 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:<br /> <br /> g(x) = \surd{\pi} \,f(x;0,1/\surd 2)<br /> <br /> Using the fact that the expected value of <i>x</i><sup>2</sup> for a normal distribution is the variance \sigma^2,<br /> <br /> \int_{-\infty}^{\infty} x^2\exp(-x^2)\,dx = \frac{\sqrt \pi}{2}
 
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
 
For Gaussian integrals like that I like to use the following trick: consider the integral

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

any integral of the form

\int_{-\infty}^\infty dx~x^{2n} e^{-\alpha x^2}

can then be computed by taking derivatives of the first integral with respect to \alpha, then at the end of the calculation set \alpha to whatever it actually is in the problem.
 
Back
Top