# how to integrate this $\int_0^{\infty} r^2 e^{\frac{-r^2}{2}} \, dr$?

What am I doing wrong when integrating this? $$\int_0^{\infty} r^2 e^{\frac{-r^2}{2}} \, dr$$ I used integration by parts and set $u=r^2$ and $dv=e^{\frac{-r^2}{2}}dr$ and I get $$-re^{\frac{-r^2}{2}}+\frac{2e^{\frac{-r^2}{2}}}{-r} \Bigg|_0^{\infty}$$ but when I plug in the bounds I get $(0-0)-(0-\text{undefined})$? The answer key shows $\sqrt{\frac{\pi}{2}}$ and I even checked it on wolfram and got $\sqrt{\frac{\pi}{2}}$.

What did I do wrong?

Your choice of $dv$ is unlikely to work, since the integral of that function does not have an elementary expression - there's almost surely a mistake in your computation here.

Rather, try $u = r$ and $dv = r e^{-r^2/2}$. This leads to $v = -e^{-r^2/2}$, and

$$-re^{-r^2/2}\big|_0^{\infty} + \int_0^{\infty} e^{-r^2/2} dr$$

This last integral can be computed in a number of ways (e.g. polar coordinates), and is known to be $\sqrt{\pi/2}$. A good search term is "Gaussian integral."

It's worth mentioning that the function $r^2 e^{-r^2/2}$ does not have an elementary antiderivative, but rather one that must be expressed in terms of the error function (which just puts the Gaussian integral under the rug).

• Wikipedia article about the error function $\rm{erf}$ – Kamil Jarosz Dec 15 '15 at 20:25
• Small typo: thats $\sqrt \pi /2$ not $\sqrt{\pi/2}$ – Elliot G Dec 15 '15 at 20:29
• @ElliotG this is not a typo, note the $-r^2\color{red}{/2}$ in the exponent – Kamil Jarosz Dec 15 '15 at 20:35
• Yeah, polar coordinates is the way to go! – Be-Wise Independent Dec 15 '15 at 20:35
• You're correct, my bad. – Elliot G Dec 15 '15 at 20:36

Notice, let $\frac{\Large r^2}{\Large 2}=t\implies$ $r\ dr=dt$, hence one should have $$\int_{0}^{\infty}r^2e^{-\large \frac{r^2}{2}}\ dr=\int_{0}^{\infty}\sqrt{2t}\ e^{-t}\ dt$$ $$=\sqrt{2}\int_{0}^{\infty}t^{1/2}\ e^{-t}\ dt$$ Now, using Laplace transform $\int_{0}^{\infty}t^n\ e^{-st}\ dt=\frac{\Gamma{(n+1)}}{s^{n+1}}$, $$=\sqrt{2}\left[\frac{\Gamma\left({\frac{1}{2}+1}\right)}{s^\left({\frac{1}{2}+1}\right)}\right]_{s=1}$$ $$=\sqrt{2}\left[\frac{\frac{1}{2}\Gamma\left({\frac{1}{2}}\right)}{s^{3/2}}\right]_{s=1}$$ $$=\frac{1}{\sqrt{2}}\frac{\sqrt{\pi}}{1}=\color{red}{\sqrt{\frac{\pi}{2}}}$$

From Stewart(RIP)'s Calculus:

When integrating $2x^2e^{x^2}$, we don't choose $dv = e^{x^2}$. We choose $dv = xe^{x^2}$ (or $2xe^{x^2}$)

You should end up with something that looks like:

$\int 2x^2e^{x^2} dx$ = [Antiderivative of $(2x^2+1)e^{x^2}$ minus $\int e^{x^2} dx$]

Unfortunately your case still involves evaluating something non-elementary:

$$\int_0^{\infty} e^{-r^2/2} dr$$

By symmetry of $e^{-r^2/2}$, we have

$$\int_{-\infty}^{\infty} e^{-r^2/2} dr = 2 \int_0^{\infty} e^{-r^2/2} dr$$

This formula gives us:

$$\int_{-\infty}^{\infty} e^{-r^2/2} dr = \sqrt{2\pi}$$

note: $$I=\int_0^\infty r^2e^{-r^2/2}dr$$ if we let: $$u=r/\sqrt{2}$$ then $$dr=\sqrt{2}du$$ and our integral becomes: $$I=2\sqrt{2}\int_0^\infty u^2e^{-u^2}du$$ and this looks more like something we know. Now we can see $$v=u^2$$ so $$du=\frac{dv}{2u}$$ and our integral becomes: $$I=\sqrt{2}\int_{0}^\infty v^{1/2}e^{-v}dv=\sqrt{2}\Gamma\left(\frac{3}{2}\right)$$