The integral $\int_{0}^{\pi/2} \sin 2\theta ~ \mbox{erf}(\sin \theta)~ \mbox{erf}(\cos \theta)~d\theta=e^{-1}$

In a work it was required to find an integral akin to $$I=\int_{0}^{\pi/2} \sin 2 \theta~\tanh(\sin\theta) \tanh(\cos \theta)~d\theta.$$ Since $$\tanh x$$ and $$\operatorname{erf}(x)$$ are similar functions so it was a pleasure to see that its variant namely $$J=\int_{0}^{\pi/2} \sin 2\theta ~ \operatorname{erf}(\sin \theta)~ \operatorname{erf}(\cos \theta)~d\theta=e^{-1}$$ could be solved by Mathematica.

So the question is: Can one do it ($$J$$) by hand?

• Where this integral comes from? – Seewoo Lee Jun 20 '19 at 3:08
• @Seewoo Lee I have edited it, you may see how it came about. – Z Ahmed Jun 20 '19 at 3:35
• It is easy to have a good approximation of J by hand using the series expansion of $\text{erf}(x)$ but I don't suppose that it could be an answer. – Claude Leibovici Jun 20 '19 at 3:45
• an interesting integral @DrZafar Ahmed DSc. – user569129 Jun 20 '19 at 3:59
• Another variation $\int_{0}^{\pi/2}x\sin(2x)erf(\cos x)erf(\sin x)dx=\frac{\pi}{4}e^{-1}$ – user569129 Jun 20 '19 at 4:01

The antiderivative can be found by hand. Integrate by parts $$\newcommand{\erf}{\operatorname{erf}} \mathrm{d}u=\sin 2\theta\,\mathrm{d}\theta,\quad v=\erf(\cos \theta)\erf(\sin \theta)$$ gives $$-\frac12\cos 2\theta\erf(\sin \theta)\erf(\cos \theta)+ \frac1{\sqrt\pi}\int\cos(2\theta)\left[e^{-\sin^2 \theta}\cos \theta\erf(\cos \theta)-e^{-\cos^2 \theta}\sin \theta\erf(\sin \theta)\right]\,\mathrm{d}\theta$$ Hence we are reduced to computing $$\int\cos(2\theta)\left[e^{-\sin^2 \theta}\cos \theta\erf(\cos \theta)-e^{-\cos^2 \theta}\sin \theta\erf(\sin \theta)\right]\,\mathrm{d}\theta\\ =e^{-1}\int\cos(2\theta)\left[e^{\cos^2 \theta}\cos \theta\erf(\cos \theta)-e^{\sin^2 \theta}\sin \theta\erf(\sin \theta)\right]\,\mathrm{d}\theta$$ But note that \begin{align*} &\frac{\mathrm{d}}{\mathrm{d}\theta}\left[e^{\cos^2 \theta}\sin \theta\erf(\cos \theta)\right]\\ &=(-2\sin \theta\cos \theta)e^{\cos^2 \theta}\sin \theta\erf(\cos \theta) +e^{\cos^2 \theta}\cos \theta\erf(\cos \theta) +e^{\cos^2 \theta}\sin \theta\frac2{\sqrt\pi}e^{-\cos^2 \theta}(-\sin \theta)\\ &=(-2\sin^2 \theta+1)e^{\cos^2 \theta}\cos \theta\erf(\cos \theta) -\frac{2\sin^2 \theta}{\sqrt\pi}\\ &=\cos (2 \theta)e^{\cos^2 \theta}\cos \theta\erf(\cos \theta) -\frac{2\sin^2 \theta}{\sqrt\pi} \end{align*} and the similar equation with $$\cos \theta$$ and $$\sin \theta$$ interchanged. So putting these two together, \begin{align*} &\int\cos(2\theta)\left[e^{\cos^2 \theta}\cos \theta\erf(\cos \theta)-e^{\sin^2 \theta}\sin \theta\erf(\sin \theta)\right]\,\mathrm{d}\theta\\ &=\left( e^{\cos^2 \theta} \erf(\cos \theta) \sin \theta - e^{\sin^2 \theta} \erf(\sin \theta) \cos \theta\right)+\int\frac2{\sqrt\pi}(\sin^2 \theta+\cos^2 \theta)\,\mathrm{d}\theta \end{align*} and of course you know how to do the final integral.

The final upshot is \begin{align*} &\int\sin(2\theta)\erf(\sin\theta)\erf(\cos\theta)\,\mathrm{d}\theta\\ &=\frac2{e\pi}\theta-\frac12\cos 2\theta\erf(\sin \theta)\erf(\cos \theta)\\ &\quad+\frac1{e\sqrt\pi} \left( e^{\cos^2 \theta} \erf(\cos \theta) \sin \theta - e^{\sin^2 \theta} \erf(\sin \theta) \cos \theta\right) \end{align*}

For $$I$$, this approach doesn't work, and I don't think there is a closd form solution to the definite integral. However, we can express the MacLaurin series $$\tanh z=\sum_{k\geq 0} 2\frac{(-1)^k}{\pi^{2k+2}}\left(1-\frac1{4^{k+1}}\right)\zeta(2k+2)z^{2k+1}$$ so $$I=4\sum_{k,k'\geq 0}(1-4^{-k-1})(1-4^{-k'-1})\frac{(-1)^{k+k'}\zeta(2k+2)\zeta(2k'+2)\Gamma(k+\frac12)\Gamma(k'+\frac12)}{\Gamma(k+k'+1)\pi^{2(k+k')+4}}$$ which doesn't really simplify the task.

• This is very surprising...(+1) – Seewoo Lee Jun 20 '19 at 6:00
• @User10354138 Your solution is amazing but there are typos which may spoil a general interest., for instance you are not carrying $1/\sqrt{\pi}$ after your first integration. Then, in the last equation $e^{-1}$ shouldn't be there. Also $\sin 2\theta$ is missing in the last equation. Your final answer is $e^{-1} \sqrt{\pi}$. You may edit your solution once. – Z Ahmed Jun 20 '19 at 8:40
• @DrZafarAhmedDSc Where are you saying the missing $\sin 2\theta$ (in $I$? That already went in the Beta function as $2\sin\theta\cos\theta$)? And regarding the non-carrying of $1/\sqrt{\pi}$ that's the reason for taking it out of the integral so it doesn't waste space on my small screen. – user10354138 Jun 20 '19 at 8:52
• @user10354138 I am bothering only about $J$ integral. In your last step I guess you are doing integration by parts taking $\cos 2 \theta$ as second function, then why $\frac{sin 2\theta }{2}$ is missing after the equality sign. – Z Ahmed Jun 20 '19 at 9:23
• @DrZafarAhmedDSc No, the last step is to rewrite $\frac{\mathrm{d}}{\mathrm{d}\theta}[e^{\cos^2\theta}\sin\theta\operatorname{erf}(\cos\theta)]=\dots$ from the previous equation as $\int\dots\,\mathrm{d}\theta=e^{\cos^2\theta}\sin\theta\operatorname{erf}(\cos\theta)$ and combining with the unwritten one where $\sin$ and $\cos$ are interchanged in $e^{\cos^2\theta}\sin\theta\operatorname{erf}(\cos\theta)$. There is no integration by parts there. – user10354138 Jun 20 '19 at 9:27

$$J=\int_{0}^{\pi/2} \sin 2\theta \mbox{erf}(\sin \theta) \mbox{erf}(\cos \theta).$$ I get clue from the fact that though $$\tanh x$$ and erf$$(x)$$ are similar, but the latter one enjoys beautiful expansions! Expanding $$\mbox{erf}(x)= e^{-x^2} \sum_{n=0}^{\infty} \frac{x^{2n+1}}{\Gamma(n+3/2)}.$$ We re-write $$J=2e^{-1}\sum_{m=0}^{\infty} \sum _{n=0}^{\infty} \int_{0}^{\pi/2} \frac{ \sin^{2m+2} \theta ~\ cos^{2n+2} \theta} {\Gamma(m+3/2)~\Gamma(n+3/2)} ~d \theta.$$
By Beta-integral, we get $$J=e^{-1}\sum_{m=0}^{\infty} \sum_{n=0}^{\infty} \frac{1}{\Gamma(m+n+2)}=e^{-1}\sum_{k=1}^{\infty} \sum_{m=0}^{k-1} \frac{1}{(m+1)!}=e^{-1}\sum_{k=1}^{\infty} \frac{k}{(k+1)!}.$$ $$\Rightarrow e^{-1} \sum_{k=0} \left( \frac{1}{k!}-\frac{1}{(k+1)!} \right)=e^{-1}.$$