Why is $\int_0^\pi \log|1 + 2\cos(x)| \, dx=0$? In my research I came across the integral
$$ \int_0^\pi \log|1 + 2\cos(x)| \, dx. $$
Maple wasn't able to evaluate it exactly, but gave a complex answer that is extremely close to $0$. So I put it in Wolfram Alpha, which gave an answer of $0$ but wouldn't give me a proof without me paying for Pro. (As an academic I'm pretty sure I could very easily get free access to this - but I thought that this question might be nice for the Math.SE community, as it's quite an intriguing result for which I could not find a proof using a Google search.)
So my question is: why is this $0$?

Equivalent formulations:
$$ \int_0^{\frac{2\pi}3} \log(1 + 2\cos(x)) \, dx \ = \ -\int_{\frac{2\pi}3}^\pi \log(-1-2\cos(x)) \, dx $$
or (by multiplying the original integral by 2)
$$ \int_0^{\pi} \log(1 + 4\cos(x) + 2\cos(2x)) \, dx \ = \ 0. $$
By symmetry, the integrals from $0$ to $\pi$ can equivalently be taken as $0$ to $2\pi$ (in which case also $\cos$ can equivalently be replaced by $\sin$).
 A: The integrand is $$\ln|e^{ix}+1+e^{-ix}|=\ln\left|\frac{\sin(3x/2)}{\sin(x/2)}\right|
=\ln|2\sin(3x/2)|-\ln|2\sin(x/2)|.$$
It's well-known that
$$\int_0^{\pi}\ln(2\sin x)\,dx=0.$$
By the relation $\sin(\pi-x)=\sin x$ then
$$\int_0^{\pi/2}\ln(2\sin x)\,dx=0$$
and by periodicity,
$$\int_{m\pi/2}^{(m+1)\pi/2}\ln|2\sin x|\,dx=0$$
for integers $m$, and so
$$\int_{m\pi/2}^{n\pi/2}\ln|2\sin x|\,dx=0$$
for integers $m$ and $n$.
Then
$$\int_0^\pi\ln|2\sin(x/2)|\,dx=2\int_0^{\pi/2}\ln(2\sin y)\,dy=\int_0^\pi\ln
(2\sin y)\,dy=0$$
and
$$\int_0^\pi\ln|2\sin(3x/2)|\,dx=\frac23\int_0^{3\pi/2}\ln|2\sin y|\,dy=0.$$
The original integral is zero.
A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$
\begin{align}
I_{\pm} & \equiv \bbox[5px,#ffd]{\int_{0}^{\pi}
\ln\pars{\verts{1 \pm 2\cos\pars{x}}}\,\dd x}
\\[5mm] & =
\int_{-\pi/2}^{\pi/2}\ln\pars{\verts{1 \mp 2\sin\pars{x}}}
\,\dd x
\\[5mm] & =
\int_{0}^{\pi/2}\ln\pars{\verts{1 \mp 2\sin\pars{x}}}\,\dd x
\\[1mm] & +
\int_{0}^{\pi/2}\ln\pars{\verts{1 \mp 2\sin\pars{-x}}}\,\dd x
\\[5mm] & =
\int_{0}^{\pi/2}\ln\pars{\verts{1 - 4\sin^{2}\pars{x}}}\,\dd x
\\[5mm] & = 
\int_{0}^{\pi/2}
\ln\pars{\verts{1 - 4\,{1 - \cos{2x} \over 2}}}\,\dd x
\\[5mm] & =
\int_{0}^{\pi/2}
\ln\pars{\verts{-1 + 2\cos\pars{2x}}}\,\dd x
\\[5mm] & =
{1 \over 2}\int_{0}^{\pi}
\ln\pars{\verts{1 - 2\cos\pars{x}}}\,\dd x =
{1 \over 2}\,I_{-}
\\[5mm] & \implies
\left\{\begin{array}{rcl}
\ds{I_{+}} & \ds{=} & \ds{{1 \over 2}\,I_{-}} 
\\
\ds{I_{-}} & \ds{=} & \ds{{1 \over 2}\,I_{-}} 
\end{array}\right.
\\[5mm]  
&\implies I_{+}  \equiv
\bbx{\int_{0}^{\pi}
\ln\pars{\verts{1 + 2\cos\pars{x}}}\,\dd x = 0}
\\ &
\end{align}
A: $$I=\int_0^\pi \log|1 + 2\cos(x)| \, dx=\int_0^{\frac {2\pi}3} \log|1 + 2\cos(x)| \, dx+\int_{\frac {2\pi}3}^\pi \log|1 + 2\cos(x)| \, dx=I_1+I_2$$
$$I_1=\int_0^{\frac {2\pi}3} \log|1 + 2\cos(x)| \, dx=\frac{1}{54} \left(-4 i \pi ^2+3 \left(\sqrt{3}+i\right) \psi
   ^{(1)}\left(\frac{1}{3}\right)-3 \left(\sqrt{3}-i\right) \psi
   ^{(1)}\left(\frac{2}{3}\right)\right)$$
$$I_2=\int_{\frac {2\pi}3}^\pi \log|1 + 2\cos(x)| \, dx=\frac{1}{54} \left(-4 i \pi ^2-3 \left(\sqrt{3}-i\right) \psi
   ^{(1)}\left(\frac{1}{3}\right)+3 \left(\sqrt{3}+i\right) \psi
   ^{(1)}\left(\frac{2}{3}\right)\right)$$
$$I=I_1+I_2=-\frac{1}{27} i \left(4 \pi ^2-3 \psi ^{(1)}\left(\frac{1}{3}\right)-3 \psi
   ^{(1)}\left(\frac{2}{3}\right)\right)=0$$
A: I'm just wondering if you could use the fact that
$$\int \ln{f(x)}dx=x\ln{f(x)}-\int\frac{xf'(x)}{f(x)}dx$$
So
$$\int\ln(1+2\cos{x})dx=x\ln(1+2\cos{x})-\int \frac{2x\sin{x}}{1+2\cos{x}}dx$$
