# Integral $\int r^2 e^{-(r-b)^2} \ \mathrm dr$

Could somebody please evaluate the following integral?

It's been hours could somebody help evaluate the following??

$$\int r^2 e^{-(r-b)^2} \ \mathrm dr$$

• is the formatted text represent your problem correctly? if yes, share where are you stuck on this problem. – Vikram Oct 21 '13 at 13:04
• It is formatted correctly. – user102296 Oct 21 '13 at 13:06
• PS: b is some constant – user102296 Oct 21 '13 at 13:06

Assuming that you have the correct integral now, you can evaluate it use integration by parts with $u=r\implies\,du=\,dr$ and $\displaystyle dv= re^{-(r-b)^2}\,dr\implies v= \int re^{-(r-b)^2}\,dr$. After performing a couple substitutions (I leave the work to you), we end up with $$v=-\frac{1}{2}e^{-(r-b)^2}+\frac{b\sqrt{\pi}}{2}\mathrm{erf}(r-b).$$ Thus, it follows that \begin{aligned}\int r^2e^{-(r-b)^2}\,dr &= -\frac{1}{2}re^{-(r-b)^2}+\frac{b\sqrt{\pi}}{2}r\,\mathrm{erf}(r-b) - \int\left(-\frac{1}{2}e^{-(r-b)^2}+\frac{b\sqrt{\pi}}{2}\mathrm{erf}(r-b)\right)\,dr \\ &= -\frac{1}{2}re^{-(r-b)^2} + \frac{b\sqrt{\pi}}{2}r\,\mathrm{erf}(r-b) + \frac{\sqrt{\pi}}{4}\mathrm{erf}(r-b)-\frac{b\sqrt{\pi}}{2}\int\mathrm{erf}(r-b)\,dr\end{aligned} To evaluate $\displaystyle\int\mathrm{erf}(r-b)\,dr$, we apply integration by parts again with $u=\mathrm{erf}(r-b)$ and $dv=dr$ to get $$\int\mathrm{erf}(r-b)\,dr = r\,\mathrm{erf}(r-b)+\frac{1}{\sqrt{\pi}}e^{-(r-b)^2}-b\,\mathrm{erf}(r-b)+C.$$ Again, I leave the verification of that to you. Putting this all together now gives us \begin{aligned}\int r^2e^{-(r-b)^2}\,dr &= -\frac{1}{2}re^{-(r-b)^2}+\frac{\sqrt{\pi}}{4}\mathrm{erf}(r-b) -\frac{1}{2}be^{-(r-b)^2}+\frac{b^2\sqrt{\pi}}{2}\mathrm{erf}(r-b)+C\\ &= -\frac{1}{2}e^{-(r-b)^2}(r+b) +\frac{\sqrt{\pi}}{4}(2b^2+1)\,\mathrm{erf}(r-b)+C\end{aligned} Which matches up with Wolfram Alpha's solution since $\mathrm{erf}(r-b) = -\mathrm{erf}(b-r)$.
With $a \equiv 1-b$ we can write (using the Wofram Comp engine),
• Ok so, I saw the "reformat" after I posted this, originally you had written $(r-br)^{2}$ which is why I factorised to $r^{2}(1-b)^{2}$. – Autolatry Oct 21 '13 at 14:39