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

(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.

• Joke Ask WA the antiderivative. I cried. Cheers :-) Sep 21, 2022 at 6:05
• Joke I already have. I cried. @ClaudeLeibovici Sep 21, 2022 at 6:06
• Your conjecture is correct (at least for 500 decimal places). How did you guess the number ? Sep 21, 2022 at 7:05
• I have an absolutely disgusting brute force proof of this. I'll see if I can type something up tomorrow. Sep 21, 2022 at 7:28
• The residue theorem may be useful. One can present it as a complex contour integral,$$\oint_C \arctan\left(\frac1{\sqrt3}\left(1+z+\frac1z\right)\right) \frac{dz}{iz}$$where $C$ is the unit circle centered at the origin. Probably will require a branch cut. Sep 21, 2022 at 7:41

$$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)}$$

• I had an answer I was getting ready to post based on the same arctan addition formula insight. But the second part of your answer was a heck of a lot more elegant than what I did. Bravo! Sep 21, 2022 at 12:16
• Thank you for the compliment! Also, surely different approaches are always welcome. Sep 21, 2022 at 12:28
• Wait how did you deal with the cosine substitution bounds? Why is it -1 and 1? Sep 21, 2022 at 12:48
• @CaptainChicky Well, first the bounds were reduced from $\int_0^{2\pi}$ to $2\int_0^\pi$ (that's why there's a $2$ factor there), then $\cos 0 = 1$ and $\cos \pi = -1$. Sep 21, 2022 at 12:51
• +1 for the new ideas and full solution. Thank you very much for your effort! Sep 23, 2022 at 6:01

Using your appoach, I think that I should focus on $$I=\int \log(a+b \cos(x))\,dx$$ Using the tangent half-angle substitution $$I=2\int \frac {\log\left[(a-b) t^2 +(a+b)\right]}{1+t^2} dt -2\int \frac {\log\left[1+ t^2 \right]}{1+t^2} dt$$ which are not bad if, we write $$\frac {\log\left(c t^2 +d\right)}{1+t^2}=\frac{\log \left(t-i \sqrt{\frac{d}{c}}\right)+\log \left(t+i \sqrt{\frac{d}{c}}\right)}{(t-i) (t+i)}+\frac{\log(c)}{1+t^2}$$ and use partial fraction to face things such as $$J_\pm=\int \frac {\log(t+\alpha)}{t\pm i}\,dt$$ which are simple.

Where the difficulty start is at the time we need to evaluate since $$a$$ and $$b$$ are already complex numbers.

Since there is an antiderivative, there is a closed form for the definite integral. Now, what is it ?

• +1 for a new idea. I'll work it out and see what I can get. Sep 21, 2022 at 6:51
• @Accelerator. I am crying more than before Sep 21, 2022 at 6:57

Let $$I(a)=\int_0^\pi \tan^{-1}\frac{\cos a+ \cos x}{\sin a}dx$$. Then, $$I(0) = \frac{\pi^2}2$$ and $$I’(a)=-\int_0^\pi\frac{1+\cos a \cos x}{1+2\cos a \cos x +\cos^2 x}dx=-\frac\pi{2\sqrt2}\left( \sqrt{\tan\frac a2} + \sqrt{\cot\frac a2}\right)$$ and \begin{align} &\int_0^{2\pi }\tan^{-1}\frac{1+ 2\cos x}{\sqrt3}dx\\ =& \ 2I(\frac\pi3) = 2\left(I(0) +\int_0^{\pi/3}I’(a)da\right)\\ =& \ {\pi^2}- \frac\pi{\sqrt2}\int_0^{\pi/3} \left( \sqrt{\tan\frac a2} + \sqrt{\cot\frac a2}\right)da\\ =& \ \pi^2 -2\pi \sin^{-1}\left(\sin\frac a2-\cos\frac a2\right)\bigg|_0^{\pi/3} =2\pi \csc^{-1}(\sqrt3+1)\\ \end{align}

• +1 for the new ideas and interesting solution. Nice job. I can study this and fill in the rest of the steps. Sep 23, 2022 at 6:00
• May you provide a hint as to how you evaluated $\int_{0}^{\pi}\frac{1+\cos\left(a\right)\cos\left(x\right)}{1+2\cos\left(a\right)\cos\left(x\right)+\cos^{2}\left(x\right)}dx$? I tried using the tangent half-angle formula and using residues but I was getting a mess. Sep 24, 2022 at 8:06

Here's a solution by Taylor series abuse. We have the useful Taylor series $$\begin{equation} \arctan\left(\frac{1+2y}{\sqrt{3}}\right)=\frac{\pi}{6}+\frac{\sqrt{3}}{2}\sum_{k=1}^\infty\frac{a_ky^k}{k} \end{equation}$$ converging for $$y\in [-1,1]$$, where $$(a_k)_k$$ is a sequence of period $$3$$ with $$(a_1,a_2,a_3)=(1,-1,0)$$. We thus have that $$\begin{equation} I=\int_0^{2\pi} \arctan\left(\frac{1+2\cos(x)}{\sqrt{3}}\right)dx=\frac{\pi^2}{3}+\frac{\sqrt{3}}{2}\sum_{k=1}^\infty\frac{a_k}{k}\int_0^{2\pi}\cos^k(x)dx \end{equation}$$ Noting that $$\begin{equation} \int_0^{2\pi}\cos^k(x)dx=\frac{\pi}{2^{k-1}}{k\choose k/2} \end{equation}$$ when $$k$$ is even, and the integral vanishes when $$k$$ is odd, we may simplify $$\begin{equation} I=\frac{\pi^2}{3}+\pi\sqrt{3}\sum_{k=1}^\infty\frac{a_{2k}}{2^{2k}(2k)}{2k\choose k} \end{equation}$$ Note that $$a_{2k}$$ may also be expressed as $$\begin{equation} a_{2k}=-\frac{i\sqrt{3}}{3}\left[e^{i2k\pi/3}-e^{i4k\pi/3}\right] \end{equation}$$ Using this fact, and noting that the following useful Taylor series $$\begin{equation} \sum_{k=1}^\infty\frac{y^k}{2^{2k}(2k)}{2k\choose k}=-\log\left(\frac{1+\sqrt{1-y}}{2}\right) \end{equation}$$ converges on the $$3$$rd roots of unity, we thus may write $$\begin{equation} \begin{split} I&=\frac{\pi^2}{3}-i\pi\sum_{k=1}^\infty\frac{1}{2^{2k}(2k)}{2k\choose k}\left[e^{i2k\pi/3}-e^{i4k\pi/3}\right]\\ &=\frac{\pi^2}{3}+i\pi\left[\log\left(\frac{1+\sqrt{1-e^{i2\pi/3}}}{2}\right)-\log\left(\frac{1+\sqrt{1-e^{i4\pi/3}}}{2}\right)\right]\\ &=\frac{\pi^2}{3}+2\pi\text{arctan}\left(\frac{\mathfrak{I}(1-e^{i2\pi/3})}{\mathfrak{R}(1-e^{i2\pi/3})}\right)\\ &=\frac{\pi^2}{3}+2\pi\arctan\left(-\frac{\sqrt{2\sqrt{3}-3}}{2+\sqrt{3+2\sqrt{3}}}\right)\\ &=2\pi\text{arccot}\left(\sqrt{3+2\sqrt{3}}\right) \end{split} \end{equation}$$ where the last equality can be obtained through the arctan addition formula, and by noting that $$\frac{\pi^2}{3}=2\pi\arctan\left(\frac{1}{\sqrt{3}}\right)$$.

• +1 for the new ideas and for a full solution. Nice job! Sep 23, 2022 at 5:59

Take advantage of symmetry, substitute $$y=\cos x$$, integrate by parts, and fold up the integral to get

\begin{align*} \mathcal I &= \int_0^{2\pi} \arctan \frac{1+2\cos x}{\sqrt3} \, dx \\ &= 2 \int_0^\pi \arctan \frac{1+2\cos x}{\sqrt3} \, dx \\ &= 2 \int_{-1}^1 \frac1{\sqrt{1-y^2}} \arctan \frac{1+2y}{\sqrt3} \, dy & y=\cos x \\ &= \frac{\pi^2}6 - \sqrt3 \int_{-1}^1 \frac{\arcsin y}{y^2+y+1} \, dy \\ &= \frac{\pi^2}6 + 2\sqrt3 \int_0^1 \frac{y \arcsin y}{y^4+y^2+1} \, dy \end{align*}

Applying the same strategy as in this post, i.e. substituting $$\arcsin y = \arctan z$$ and choosing the right contour, let $$\omega_\pm$$ denote the poles of the subsequent integrand with $$\pm$$ real part.

\begin{align*} \omega_+ &= \sqrt{-\dfrac12 + \dfrac i{2\sqrt3}} \\ \omega_- &= - \sqrt{-\dfrac12 - \dfrac i{2\sqrt3}} \\ \end{align*}

where we use the principal branch of $$\sqrt{z}$$ with $$\arg z\in(-\pi,\pi)$$. Apply the residue theorem and conclude

\begin{align*} \mathcal I &= \frac{\pi^2}6 + \sqrt3 \int_{\infty}^\infty \frac{z \arctan z}{3z^4+3z^2+1} \, dz \\ &= \frac{\pi^2}6 + \sqrt3 \left(i2\pi \sum \underset{z=\omega_\pm}{\operatorname{Res}} \frac{z \arctan z}{3z^4+3z^2+1} - \pi \int_1^\infty \frac{z}{3z^4 - 3z^2 + 1} \, dz\right) \\ &= i 2\pi \sqrt3 \cdot \frac i{2\sqrt3} \left(\arctan \omega_- - \arctan \omega_+\right) \\ &= \boxed{\pi \arctan \sqrt{\frac{\sqrt3}2}} = \frac\pi2\arccos\left(7-4\sqrt3\right) \end{align*}

• Nice! Thanks for the answer :) 10 hours ago