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

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).


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:

enter image description here

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}$$