Evaluate the integral $ \int_0^\infty r^2 e^{-r^2/2\sigma^2} dr$ I'm trying to evaluate the integral
$$ \int_0^\infty r^2 e^{-r^2/2\sigma^2} dr$$
Wolfram Alpha gives the answer
$$ \frac{\sqrt{\frac{\pi}{2}}}{(\frac{1}{\sigma^2})^{3/2}} $$
However, when I evaluated the integral it's undefined.
Let $u = r^2$ and $dv = e^{-r^2/2\sigma^2} dr$. Then $du = 2r \ dr$ and $v = - \frac{\sigma^2}{r} e^{-r^2/2\sigma^2}$.
$$ \int_0^\infty r^2 e^{-r^2/2\sigma^2} dr = \int_0^\infty u \ dv = u v\Big|^\infty_0 - \int_0^\infty v \ du $$
$$= \Big{[}- \sigma^2 r e^{-r^2/2\sigma^2} \Big{]}^\infty_0 + \int_0^\infty 2 \sigma^2 e^{-r^2/2\sigma^2} dr $$
For the first term,
$$ \lim_{r \to \infty} - \sigma^2 r e^{-r^2/2\sigma^2} = \lim_{r \to \infty} \frac{- \sigma^2 r }{e^{r^2/2\sigma^2}}$$
Since the numerator and denominator both tend to infinity, by l'Hospital's Rule,
$$ \stackrel{H}{=} \lim_{r \to \infty} \frac{- \sigma^2 }{\frac{r}{\sigma^2}e^{r^2/2\sigma^2}} = 0$$
For the other limit of the first term,
$$ \lim_{r \to 0} - \sigma^2 r e^{-r^2/2\sigma^2} = - \sigma^2 (0) (1) = 0 $$
So the first term is zero which means
$$ \int_0^\infty r^2 e^{-r^2/2\sigma^2} dr = \int_0^\infty 2 \sigma^2 e^{-r^2/2\sigma^2} dr = 2 \sigma^2 \Big{[}\frac{-\sigma^2}{r}e^{-r^2/2\sigma^2}\Big{]}^\infty_0$$
$$ = 2 \sigma^2 \Big{[}\lim_{r \to \infty}\frac{-\sigma^2}{r e^{r^2/2\sigma^2}} + \lim_{r \to 0}\frac{\sigma^2}{r e^{r^2/2\sigma^2}} \Big{]} = 2 \sigma^2 [0 \pm \infty]. $$
Any help is appreciated.
 A: Your error is to consider that
$$
dv = e^{-r^2/2\sigma^2} dr \implies v = - \frac{\sigma^2}{r} e^{-r^2/2\sigma^2}
$$ which is wrong as one may see by differentiating the latter expression.
If you want to make an integration by parts, you can rather write
$$
u=r,\quad dv = re^{-r^2/2\sigma^2} dr, \quad du=dr,\quad v = -\frac1{\sigma^2}e^{-r^2/2\sigma^2}.
$$
A: HINT
The way to fix it is to pick $dv = re^{-r^2/2\sigma^2}dr$ and let $u = r$
A: You dont choose the correct term in the integral by parts .
You should pick $u=r$ and $v'=r e^{-r^2/2\sigma^2}$
Also, the term in the last integrals is wrong $- \sigma^2 r e^{-r^2/2\sigma^2} $.
One easy way to look at the results is to write 
$$\int_0^\infty r^2 e^{-r^2/2\sigma^2} dr=\frac{\sqrt{2\pi}}{\sqrt{2\pi}}\int_0^\infty r^2 e^{-r^2/2\sigma^2} dr$$
and use the change of variable $u=\frac{r}{\sigma}$
$$\int_0^\infty r^2 e^{-r^2/2\sigma^2} dr=\sigma^3\sqrt{2\pi}\frac{1}{\sqrt{2\pi}}\int_0^\infty u^2 e^{-u^2/2} dr$$
We know that if we define $X$ a standard normal variable(variance equals $1$), $E(X^2 1_{X>0})=\frac{1}{\sqrt{2\pi}}\int_0^\infty u^2 e^{-u^2/2} $ , which is also equal to $\frac{1}{2}$, by symmetry.
The final result is then $$\frac{\sigma^3\sqrt{2\pi}}{2}$$
A: $$\int_0^\infty r^2 e^{-r^2/2\sigma^2} dr$$
Let $r=\sigma\cdot x$, then we have:
$$\int_0^\infty \sigma^2x^2 e^{-x^2/2} \sigma dx=\sigma^3 \int_0^\infty x^2 e^{-x^2/2}dx$$
Now, we appeal to integration by parts:
$$\int_0^\infty x^2 e^{-x^2/2}dx=\int_0^\infty \left(-e^{-x^2/2}\right)'(x)dx$$
$$=-xe^{-x^2/2}|_0^\infty+\int_0^\infty e^{-x^2/2}\,dx=(0-0)+\sqrt{\frac{\pi}{2}}$$
by the celebrated Gaussian integral.
This gives the final solution as $\sigma^3 \sqrt{\frac{\pi}{2}}$.
