TITLE: Evaluate $\int_0^{\pi/2} \frac{\arctan{\left(\frac{2\sin{x}}{2\cos{x}-1}\right)}\sin{\left(\frac{x}{2}\right)}}{\sqrt{\cos{x}}} \, \mathrm{d}x$
QUESTION [6 upvotes]: Evaluate: $$\int_0^{\frac{\pi}{2}} \frac{\arctan{\left(\frac{2\sin{x}}{2\cos{x}-1}\right)}\sin{\left(\frac{x}{2}\right)}}{\sqrt{\cos{x}}} \, \mathrm{d}x$$
I believe there is a "nice" closed form solution but Wolfram is too weak.  These arctan integrals are so tricky!  I sense a substitution like $\sin{\frac{x}{2}}$ because of arctan argument and $\sqrt{\cos{x}}$ but I just cant get it.  Any ideas or tips please.
Source: https://tieba.baidu.com/p/4794735082 (Exercise 3.1.22).

REPLY [10 votes]: $$\boxed{I=\int_0^\frac{\pi}{2}\arctan\left(\frac{2\sin x}{2\cos x -1}\right)\frac{\sin\left(\frac{x}{2}\right)}{\sqrt{\cos x}}dx=\sqrt 2 \pi \ln\varphi-\frac{\pi}{\sqrt 2}\ln(2+\sqrt 3),\ \varphi =\frac{1+\sqrt 5}{2}}$$
To show this result, we'll do some substitutions until it's clear how to simplify that $\arctan $ term.
$$I\ \,\overset{\cos x=t}=\frac1{\sqrt 2}\int_0^1 \arctan \left(\frac{2\sqrt{1-t^2}}{2t-1}\right)\frac{dt}{\sqrt t\sqrt{1+t}}\overset{\large t=\frac{1-x}{1+x}}=\int_0^1 \frac{\arctan\left(\frac{4\sqrt x}{1-3x}\right)}{\sqrt{1-x}(1+x)}dx$$
$$=\int_0^1\frac{\arctan (\sqrt x)+\arctan(3\sqrt x)}{\sqrt{1-x}(1+x)}dx-\int_\frac13^1\frac{\pi}{\sqrt{1-x}(1+x)}dx=\mathcal J-\frac{\pi}{\sqrt2}\ln(2+\sqrt 3)$$
The second integral appears since for $x>\frac13$ we have $\sqrt x \cdot 3\sqrt x>1$.
Now in order to show $\mathcal J=\sqrt 2\pi\ln \varphi$ we can differentiate under the integral sign, considering:
$$\mathcal J(a)=\int_0^1\frac{\arctan(a\sqrt x)+\arctan(3\sqrt x)}{\sqrt{1-x}(1+x)}dx$$
$$\Rightarrow \mathcal J'(a)=\int_0^1 \frac{\sqrt x}{\sqrt{1-x}(1+x)(1+a^2 x)}dx\overset{\frac{1-x}{x}=t}=\int_0^\infty \frac{dt}{\sqrt t(2+t)(1+a^2+t)}$$
$$\overset{t=x^2}=\frac{2}{1-a^2}\int_0^\infty \left(\frac{1}{1+a^2+x^2}-\frac{1}{2+x^2}\right)dx=\frac{\pi}{1-a^2}\left(\frac{1}{\sqrt{1+a^2}}-\frac{1}{\sqrt 2}\right)$$
We are looking to find $\mathcal J(1)=\mathcal J$, but $\mathcal J(-3)=0$ therefore our integral is:
$$\mathcal J=\int_{-3}^1 \frac{\pi}{1-a^2}\left(\frac{1}{\sqrt{1+a^2}}-\frac{1}{\sqrt 2}\right)da\overset{-a=\frac{1-x}{1+x}}=\frac{\pi}{2\sqrt 2}\int_0^2\frac{1}{x}\left(1-\frac{1-x}{\sqrt{1+x^2}}\right)dx$$
$$=\frac{\pi}{2\sqrt 2}\left(\ln\left(x+\sqrt{1+x^2}\right)+\ln\left(1+\sqrt{1+x^2}\right)\right)\bigg|_0^2=\sqrt 2 \pi \ln \varphi$$