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?

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.

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.