# Integrating a product of exponentials and error functions

I have the following integral $$\int\limits_0^\infty x^2\exp(-\delta x^2)\operatorname{erf}(\gamma x)\,dx.$$
Ideally, I would like a closed-form in terms of common functions, but a series answer will do.

## 2 Answers

I think it's best to just proceed as is natural

\displaystyle \begin{aligned}\int_0^{\infty}x^2e^{-\delta x^2}\text{erf}(\gamma x)\; dx &= \frac{2}{\sqrt{\pi}}\sum_{n=0}^{\infty}\frac{(-1)^n\gamma^{2n+1}}{n!(2n+1)}\int_0^{\infty} e^{-\delta x^2}x^{2n+3}\; dx\\ &= \frac{1}{\sqrt{\pi}}\sum_{n=0}^{\infty}\frac{(-1)^n\gamma^{2n+1}\Gamma(n+2)}{n!(2n+1)\delta^{n+2}}\\ &=\frac{1}{\sqrt{\pi}}\sum_{n=0}^{\infty}\frac{(-1)^n\gamma^{2n+1}(n+1)}{\delta^{n+2}(2n+1)}\\ &=\frac{1}{\delta^{\frac{3}{2}}\sqrt{\pi}}\left(\frac{1}{2}\sum_{n=0}^{\infty}(-1)^n\left(\frac{\gamma}{\sqrt{\delta}}\right)^{2n+1}+\frac{1}{2}\sum_{n=0}^{\infty}\frac{(-1)^n\left(\frac{\gamma}{\sqrt{\delta}}\right)^{2n+1}}{2n+1}\right)\\ &=\frac{1}{2\delta^{\frac{3}{2}}\sqrt{\pi}}\left(\frac{\gamma\sqrt{\delta}}{\gamma^2+\delta}+\arctan\left(\frac{\gamma}{\sqrt{\delta}}\right)\right)\end{aligned}

Where the only non-trivial facts used was the common expression $\displaystyle \int_0^{\infty}e^{-x^2}x^n\; dx=\frac{\Gamma\left(\frac{n+1}{2}\right)}{2}$. Also, note that I used the Maclaurin series for arctangent, and so we need to have a restriction on $\displaystyle \frac{\gamma}{\sqrt{\delta}}$.

Let $\mathcal{I}(\gamma)= \int_0^\infty x^2\exp(-\delta x^2)\operatorname{erf}(\gamma x)\, \mathrm{d} x$, then $I^\prime(\gamma) = \frac{2}{\sqrt{\pi}} \int_0^\infty x^3 \exp(-x^2 \left( \delta + \gamma^2 \right) ) \mathrm{d} x = \frac{1}{(\gamma^2 + \delta)^2} \frac{1}{\sqrt{\pi}}$.

Integrating: $$I(\gamma) = \int_0^\gamma \frac{1}{\sqrt{\pi}} \frac{1}{(\gamma^2+\delta)^2} \mathrm{d} \gamma = \frac{\gamma }{2 \sqrt{\pi } \delta \left(\gamma ^2+\delta \right)}+\frac{1}{2 \sqrt{\pi } \delta ^{3/2}} \arctan\left(\frac{\gamma }{\sqrt{\delta }}\right)$$

• Ah, I like it. Error function and exponential should have screamed differentiation inside of the integral. Nice one! – Alex Youcis Nov 3 '11 at 18:08
• can you explain why you've integrated between 0 and gamma in the final step? – Alexander Kartun-Giles Feb 14 '14 at 20:25
• @AlexanderGiles Because, assuming $f(x)$ is differentiable $f(x) = f(x) + \int_0^x f^\prime(z) \mathrm{d}z$. – Sasha Feb 15 '14 at 5:32
• you mean $f(0)$ instead of $f(x)$ on the RHS? – Alexander Kartun-Giles Feb 15 '14 at 15:30
• so essentially this is because your first line in the answer $I(\gamma)$ is $0$ at $\gamma=0$? – Alexander Kartun-Giles Feb 15 '14 at 15:36