Integral: $\int_{0}^{2\pi}\arctan\left(\frac{1+2\cos x}{\sqrt{3}}\right)dx$

calculuscomplex numberscomplex-analysisdefinite integralsintegration

(Context) While working on an integral for fun, I stumbled upon the perplexing conjecture:

$$\int_{0}^{2\pi}\arctan\left(\frac{1+2\cos x}{\sqrt{3}}\right)dx = 2\pi\operatorname{arccot}\left(\sqrt{3+2\sqrt{3}}\right).$$

(Attempt) I tried multiple methods. One method that stuck out to me was using the formula $$\arctan(\theta) = \frac{1}{2i}\ln{\left(\frac{1+i\theta}{1-i\theta}\right)}$$ so that my integral becomes

$$\frac{1}{2i}\int_{0}^{2\pi}\ln\left(1+i\left(\frac{1+2\cos x}{\sqrt{3}}\right)\right)dx-\frac{1}{2i}\int_{0}^{2\pi}\ln\left(1-i\left(\frac{1+2\cos x}{\sqrt{3}}\right)\right).$$

Both of these look similar to the integral

$$\int_{0}^{2\pi}\ln\left(1+r^2-2r\cos(x)\right)dx=\begin{cases}
0, &\text{for}\; |r|<1,\\
2\pi\ln \left(r^2\right), &\text{for}\; |r|>1,
\end{cases}\tag{2}$$

and its solution can be found here.

I tried to get my integrals to "look" like the above result but to no avail. Not wanting to give up, I searched on this site for any ideas, and it seems like a few people have stumbled upon the same kind of integral, such as here and here.

In the first link, the user @Startwearingpurple says,

"Now we have
\begin{align}
4\sqrt{21}\pm i(11-6\cos\varphi)=A_{\pm}\left(1+r_{\pm}^2-2r_{\pm}\cos\varphi\right)
\end{align}

with
$$r_{\pm}=\frac{11-4\sqrt7}{3}e^{\pm i\pi/3},\qquad A_{\pm}=(11+4\sqrt7)e^{\pm i\pi /6}."$$

I tried to replicate his method but even after doing messy algebra, I couldn't figure out how to manipulate the inside of my logarithm such that it looked like what he did. I also tried letting $\operatorname{arg}\left(1+i\left(\frac{1+2\cos x}{\sqrt{3}}\right)\right) \in \left(-\pi/2, \pi/2\right)$, if that helps.

(Another method I tried was noticing that the original integral's function is periodic, so I tried using residue theory by letting $z=e^{ix}$, but I wasn't able to calculate the residues.)

(Question) Can someone help me approach this integral (preferably finding a closed form)? Any methods are absolutely welcome. And if someone could figure out how to get my logarithms to look like $\ln{\left(1+r^2-2r\cos{(x)}\right)}$, that would be nice.

(Edit) After using @SangchulLee's integral,

$$ \int_{0}^{\pi} \arctan(a + b\cos\theta) \, d\theta = \pi \arg \left(1 + ia + \sqrt{b^2 + (1+ia)^2}\right), $$

found here, I was able to deduce that

$$\int_{0}^{2\pi}\arctan\left(\frac{1+2\cos x}{\sqrt{3}}\right)dx\ =\ 2\pi\operatorname{arccot}\left(\sqrt{3+2\sqrt{3}}\right).$$

I still have no idea how they proved it though.

Best Answer

$$I=\int_0^{2\pi}\arctan\left(\frac{1+2\cos x}{\sqrt 3}\right)dx\overset{\tan \frac{x}{2}\to x}=4\int_0^\infty \frac{\arctan(\sqrt 3)-\arctan\left(\frac{x^2}{\sqrt 3}\right)}{1+x^2}dx$$


$$I(t)=\int_0^\infty \frac{\arctan\left(tx^2\right)}{1+x^2}dx\Rightarrow I'(t)=\int_0^\infty \frac{x^2}{1+t^2x^4}\frac{1}{1+x^2}dx$$ $$=\frac{\pi}{2\sqrt 2}\frac{1}{1+t^2}\left(\sqrt t+\frac{1}{\sqrt t}\right)-\frac{\pi}{2}\frac{1}{1+t^2}$$


$$I\left(\frac{1}{\sqrt 3}\right)=\frac{\pi}{2\sqrt 2}\int_0^\frac{1}{\sqrt 3}\frac{1}{1+t^2}\left(\sqrt t+\frac{1}{\sqrt t}\right)dt-\frac{\pi}{2}\int_0^\frac{1}{\sqrt 3}\frac{1}{1+t^2}dt$$ $$=\frac{\pi}{2}\arctan\left(\frac{\sqrt {2t}}{1-t}\right)\bigg|_0^\frac{1}{\sqrt 3}-\frac{\pi^2}{12}=\boxed{\frac{\pi}{2}\arctan\left(\sqrt{3+2\sqrt 3}\right)-\frac{\pi^2}{12}}$$

$$\Rightarrow I=4\left(\frac{\pi^2}{6}-\mathcal J\left(\frac{1}{\sqrt 3}\right)\right)=\boxed{2\pi\operatorname{arccot}\left(\sqrt{3+2\sqrt 3}\right)}$$