# Approximation of integral of error function?

My research requires to approximate an integral that involves an error function. The integral is, $$\int_{0}^{\infty}\operatorname{erfc}\left(\sqrt{\dfrac ax}\right)\cos(bx)\,dx. \tag{1}$$

I found two formulas that are very similar to above integral (Ng and Geller, 1968), $$\int_{0}^{\infty}\operatorname{erfc}\left(\sqrt{\dfrac ax}\right)\sin(bx)\,dx=\frac{1}{b}\exp\left[-(2ab)^{1/2}\right]\cos\left[(2ab)^{1/2}\right], \tag{2}$$ $$\int_{0}^{\infty}\operatorname{erf}\left(\sqrt{\dfrac ax}\right)\cos(bx)\,dx=\frac{1}{b}\exp\left[-(2ab)^{1/2}\right]\sin\left[(2ab)^{1/2}\right].\tag{3}$$

I am trying to represent equation (1) as a product of exponential and trigonometric functions, which is very important for my following work, but I didn't figure it out how the equations (2) and (3) are obtained. I really appreciate for any help from you. Thanks in advance.

Reference: Ng, E.W., Geller, M., (1968) A table of integrals of the error functions, journal of research of the national bureau of standards, 73B, 1.

• The integral (1) has an exact solution, which is also included in the paper you quote (formula 4.5.17 on pag. 12) - the formula reads $$\int_{0}^{\infty}\mathrm{erfc}(\sqrt{a/x})\cos(bx)dx=-\frac{1}{b}\exp[-(2ab)^{1/2}]\sin[(2ab)^{1/2}]\ .$$ – Pierpaolo Vivo Mar 7 '18 at 19:01
• Thanks for your reply @Pierpaolo Vivo. It seems the formula 4.5.17 involves $erf(x)$ instead of $erfc(x)$ before the $cos(bx)$. I don't know if there is a easy way to change $erf(x)$ to $erfc(x)$ in equation (3). – kchen Mar 7 '18 at 20:53
• Uhm, I believe it's a typo in the paper...the formula as I quoted agrees with numerics. Even though to be honest it is not clear to me that your integral (1) even converges... – Pierpaolo Vivo Mar 7 '18 at 22:20
• Thanks so much ! That makes my life much easier. – kchen Mar 7 '18 at 22:50
• @Pierpaolo Vivo May I ask how did you verify the formula you quoted. I try Mathematica and Matlab, but both of them cannot converge for integral from 0 to infinity. – kchen Mar 8 '18 at 5:19

Not really a full answer, but too long for a comment. If I try to numerically integrate your (1) in Mathematica with

a = 0.7; b = 3.1; NIntegrate[Erfc[Sqrt[a/x]] Cos[b x], {x, 0, Infinity}];
(-1/b) Exp[-Sqrt[2 a b]] Sin[Sqrt[2 a b]]


and compare with the 'exact' result, I get agreement (the value is $-0.0350084...$) between the two.

BUT

Mathematica gives me a flag:

NIntegrate::deodiv: DoubleExponentialOscillatory returns a finite integral
estimate, but the integral might be divergent


Such flag is not given when computing the same integral with $\mathrm{erf}$, instead of $\mathrm{erfc}$.

Now, the more I look at it, the more indeed your integral (1) looks divergent to me. There are a number of red flags:

• If you plot the integrand, the oscillations do not 'die out' but persists all the way to infinity. [This does not happen with the $\mathrm{erf}$ version]
• Knowing that $\mathrm{erfc}(z)=1-\mathrm{erf}(z)$, your integral (1) can be effectively written as $$\int_{0}^{\infty}\operatorname{erfc}\left(\sqrt{\dfrac ax}\right)\cos(bx)\,dx= \int_{0}^{\infty}\cos(bx)dx-\int_{0}^{\infty}\operatorname{erf}\left(\sqrt{\dfrac ax}\right)\cos(bx)dx\ ,$$ i.e. the sum of a divergent integral minus a (probably) convergent one.
• The paper you quote displays a rather suspicious 'asymmetry' (eqs. 4.5.16 and 4.5.17), as you have certainly noted too. If both the integrals with $\mathrm{erf}$ and $\mathrm{erfc}$ were convergent, then I see no reason to omit the other two 'obvious' integrals (where you swap sine with cosine) in the list!

None of this is a smoking gun per se, but my feeling is that (1) is divergent (as well as its sine version), and the paper you quote has a number of typos (except perhaps not the typo I thought it had in a comment I left earlier underneath your question!) - while similar integrals with $\mathrm{erf}$ are convergent (both in their sine and cosine version).

In terms of proving any assertion about such integrals, maybe an approach worth attempting is to write your (1) (or its $\mathrm{erf}$ version) as $$\mathrm{Re}\int_{0}^{\infty}\operatorname{erfc}\left(\sqrt{\dfrac ax}\right)\exp(\mathrm{i}bx)\,dx\ ,$$ and then try integration by parts (the $\mathrm{erfc}$ has a 'nice' derivative, while $\exp(\mathrm{i}bx)$ has a nice antiderivative). This should conclusively prove whether my hunch is correct (no time to do it myself now, though...).

• Thanks so much for your detailed reply! It is true that there are typos in the paper I cited first and the authors had published another paper for corrections(the link in the post is updated and directed to the new paper). As you said, the integrand is erfc(x) instead of erf(x), I have modify integral (1) by replacing erfc(x) with erf(x) and everything makes sense and looks good to me now. I really appreciate for your help! – kchen Mar 8 '18 at 16:35

For $a>0$, $\operatorname{erf} \sqrt{a/x}$ is $O(1)$ at positive zero and $O(x^{-1/2})$ at infinity. So the integrals of $\operatorname{erf} \sqrt{a/x} \sin b x$ and $\operatorname{erf} \sqrt{a/x} \cos b x$ converge, provided that $b$ is real and nonzero, and the integrals with $\operatorname{erfc}$ diverge.

The values for $b>0$ are $$\int_0^\infty \operatorname{erf} \sqrt{\frac a x} \sin b x \,dx = \frac 1 b -\frac 1 b e^{-\sqrt{2 a b}} \cos \sqrt{2 a b} ,\\ \int_0^\infty \operatorname{erf} \sqrt{\frac a x} \cos b x \,dx = \frac 1 b e^{-\sqrt{2 a b}} \sin \sqrt{2 a b}.$$ These can be computed by differentiating the integrand wrt $a$, making the indefinite integral doable in terms of $\operatorname{erf}$, after which the limit is expressible in terms of elementary functions. Then one has to integrate the result and recover the term independent of $a$. The latter can be done by substituting $a=0$.