I have to find $I=\int_{0}^{\pi}\ln(1-2a \cos x+a^2)\, dx$ I have to find 
$$I=\int_{0}^{\pi}\ln(1-2a \cos x+a^2)\,dx$$ 
Can someone help me to solve it?
 A: 
I thought that it might be interesting to present a way forward that exploits Gauss' Mean Value Theorem.  

To proceed, we write the integral of interest as 
$$\begin{align}
\int_0^\pi \log(1-2a\cos(x)+a^2)\,dx&=\frac12 \int_{-\pi}^\pi \log(1-2a\cos(x)+a^2)\,dx\\\\
&= \int_{-\pi}^\pi \log|1-ae^{i\theta}|\,d\theta \tag 1\\\\
&= \int_{0}^{2\pi} \log|1+ae^{i\theta}|\,d\theta \tag 2\\\\
&= \int_{0}^{2\pi} \log|1-ae^{i\theta}|\,d\theta \tag 3
\end{align}$$
where in going from $(1)$ to $(2)$ we enforced the substitution $\theta\to \theta -\pi$ and in arriving at $(3)$ we exploited the $2\pi$-periodicity of the integrand.  Therefore, we may assume without loss of generality that $a>0$

Now, for $0<a<1$, Gauss' Mean Value Theorem guarantees that 
$$\begin{align}
\int_{0}^{2\pi} \log(1+ae^{i\theta})\,d\theta&=\log(1) \tag 4\\\\
&=0 
\end{align}$$
since $\log(1+z)$ is analytic in and on the disk of radius $a<1$ with center at the origin. 
We can write the integrand on the left-hand side of $(4)$ as
$$\log(1+ae^{i\theta})=\log|1+ae^{i\theta}|+i\arg(1+ae^{i\theta}) \tag 5$$
Therefore, integrating $(5)$ reveals
$$\int_{0}^{2\pi} \log(1+ae^{i\theta})\,d\theta=\int_{0}^{2\pi} \log|1+ae^{i\theta}|\,d\theta+i\int_{0}^{2\pi} \arg(1+ae^{i\theta})\,d\theta $$
whence we conclude from $(2)$ that 
$$\begin{align}
\int_0^\pi \log(1-2a\cos(x)+a^2)\,dx&=\int_{0}^{2\pi} \log|1+ae^{i\theta}|\,d\theta\\\\
&=\text{Re}\left(\int_0^{2\pi}\log(1+ae^{i\theta})\,d\theta\right)\\\\
&=0
\end{align}$$
as was to be shown!


For $a>1$, we simply write
$$\int_0^{2\pi} \log(1+ae^{i\theta})\,d\theta=2\pi \log(a)+\int_0^{2\pi}\log\left(\frac1a +e^{i\theta}\right)\,d\theta \tag 6$$
Applying Gauss' Mean Value Theorem to the integral on the right-hand side of $(6)$, we obtain for $a>1$
$$\int_0^\pi \log(1-2a\cos(x)+a^2)\,dx=2\pi \log(a)$$

A: We have:
$$ 1-2a\cos x+a^2 = (1-a e^{ix})(1-a e^{-ix})\tag{1}$$
and for every $a$ such that $|a|<1$ we have:
$$ \log\left(1-a e^{ix}\right) = -\sum_{n\geq 1}\frac{a^n e^{inx}}{n}\tag{2} $$
so that:

$$ \int_{0}^{\pi} \log(1-2a\cos x+a^2)\,dx = -\sum_{n\geq 1}\frac{a^n}{n}\int_{0}^{\pi}2\cos(nx)\,dx =\color{red}{\large 0}.\tag{3}$$

Thanks to @ddsLeonardo, this page deals with the complementary case $|\alpha|>1$ through differentiation under the integral sign (aka Feynman's trick).
