# Integral of x^{2} e^{-x^2} dx

1. May 2, 2008

### niks

I ran into an integral while working on response of a signal processing filter, it looks like:

$$\int_{-\infty}^{\infty} x^{2} e^{-x^{2}} dx$$

While trying integration by parts u = $$x^{2}$$ we get du = 2xdx but can't proceed with dv = $$e^{-x^{2}}$$ because then
v = $$\int e^{-x^{2}}$$
can't be integrated unless we use the limits.

Can anyone suggest an approach for this?

Thanks,
Niks

2. May 2, 2008

### HallsofIvy

What exactly are you trying to do? As you point out, your v is not any elementary function, and that tells you that neither is
$$\int x^2e^{-x^2} dx$$
You might be able to do that in terms of the "error function", Erf(x), which is defined to be
$$\int e^{-x^2} dx$$

3. May 2, 2008

### Big-T

If you just want to calculate the definite integral, I don't see why you wouldn't want to include the limits when integrating by parts?

4. May 2, 2008

### HallsofIvy

His point, about the limits of integration, was that it is well known that
$$\int_{-\infty}^{\infty} e^{x^2}dx= 2\sqrt{\pi}[/itex] while the anti-derivative is not an elementary function. in other words, he could, theoretically, do it as a definite integral with the right limits but not as an indefinite integral. 5. May 2, 2008 ### Big-T Was that adressed to me? Anyway, Maple tells me that: [tex] \int_{-\infty}^{\infty} x^{n} e^{-x^{2}}\rm{d} x=\frac{1}{2}\Gamma\left(\frac{n}{2}+\frac{1}{2}\right)\left(1+(-1)^n\right)$$ ,
which should be possible to prove by induction.

6. May 2, 2008

### nicksauce

A cute way to solve this is to recall that

$$\int_{-\infty}^{\infty}e^{-ax^2}=\frac{\sqrt{\pi}}{\sqrt{a}}$$

Then use Feynman's favorite trick and differentiate both sides with respect to a, and evaluate at a = 1.

7. May 2, 2008

### gamesguru

For one, it's $e^{-x^2}$ and for two, it's $\sqrt{\pi}$.

8. May 2, 2008

### niks

I think I should use this as a guideline for future problems. Both u and v should be elementary functions otherwise integration by parts becomes too messy(perhaps impossible).

Yes, that was what I had in mind. That's why I got stuck there.

Thanks!! That will help me move forward.

Thanks to everyone who replied, I learnt a lot from this thread.

-Niks

9. May 2, 2008

### thebetapirate

Using lots of substitutions and integration by parts I get this:

$$\int x^{2}e^{-{x^2}}dx=xe^{x^{2}}\left[1-\sum_{n=1}^{\infty}\frac{\prod_{k=2}^{n}\left(2k-3\right)}{2^{n}x^{2n}}\right]$$

I would go over the derivation but LaTex is killing me.

10. May 3, 2008

### Big-T

Quite frankly, I think using Leibniz' rule, as suggested by Nicksauce, would by far be the simplest method in this case.

11. May 3, 2008

### TheoMcCloskey

Quite true.

But, if doing by parts, then the proper selection of u an dv is

$$u=x$$

$$dv= x*e^{-x^2}dx$$

and then things won't be so messy - however, it will involve the definite integral $\int^{\infty}_{-\infty}{ e^{-{x^2}}dx}$ which we know equals $\sqrt{\pi}$.

12. May 3, 2008

### ice109

umm mathematica gives me $$\frac{\sqrt{\pi}}{2}$$

and for the indefinite :

$$\frac{1}{4} \sqrt{\pi } \text{erf}(x)-\frac{1}{2} e^{-x^2} x$$

13. May 3, 2008

Well, perhaps the very simplest approach is to recognize that the integral is $\sqrt{\pi}$ times the variance of a Gaussian random variable with mean 0 and standard deviation $\frac{1}{\sqrt{2}}$. That's certainly all I'd bother doing in the signal processing context the OP mentioned.