Evaluation of $\int_0^\pi \! \ln\left(1-2\alpha\cos x+\alpha^2\right) \mathrm{d}x$ I have got a trouble with integral $$\int_0^\pi \! \ln\left(1-2\alpha\cos x+\alpha^2\right) \, \mathrm{d}x,\quad |\alpha|<1.$$
My teacher said there are two ways of solving such ones, if there is no straight solution. The first one is when you simply differentiate by $\alpha$, then, if it helps, integrate by $x$ and then again integrate by $\alpha$. The second is more sophisticated, then you substitute any allowed $\alpha$ and integrate, but I did not get it properly. Can anyone help me with this one? Thank you in advance.
 A: Consider integrating
$$\,I(\alpha)=\int_0^\pi\,\ln(1-2\alpha\cos x+\alpha^2)\;dx \qquad |\alpha| > 1.$$
Now, 
$$  \begin{align}
  \frac{d}{d\alpha}\,I(\alpha) &=\int_0^\pi \frac{-2\cos x+2\alpha }{1-2\alpha \cos x+\alpha^2}\;dx\, \\[8pt]
    &=\frac{1}{\alpha}\int_0^\pi\,\left(1-\frac{1-\alpha^2}{1-2\alpha \cos x+\alpha^2}\,\right)\,dx   \\[8pt]
    &=\frac{\pi}{\alpha}-\frac{2}{\alpha}\left[\,\arctan\left(\frac{1+\alpha}{1-\alpha}\cdot\tan\left(\frac{x}{2}\right)\right)\,\right]\,\bigg|_0^\pi.
  \end{align}$$
As $x$ varies from $0$ to $\pi$, $\left[\frac{1+\alpha}{1-\alpha}\cdot\tan\left(\frac{x}{2}\right)\right]\,$ varies through positive values from $0$ to $\infty$ when $|\alpha| < 1$ and $\left[\frac{1+\alpha}{1-\alpha}\cdot\tan\left(\frac{x}{2}\right)\right]\,$ varies through negative values from $0$ to $-\infty$ when $|\alpha| > 1$.
Hence, 
$$\arctan\left(\frac{1+\alpha}{1-\alpha}\cdot\tan\left(\frac{x}{2}\right)\right)\,\bigg|_0^\pi=\frac{\pi}{2}\,$$ when $|\alpha| < 1$.
$$\arctan\left(\frac{1+\alpha}{1-\alpha}\cdot\tan\left(\frac{x}{2}\right)\right)\,\bigg|_0^\pi=-\frac{\pi}{2}\,$$ when $|\alpha| > 1$.
Therefore,
$$\frac{d}{d\alpha}\,I(\alpha)\,=0\,$$ when $|\alpha| < 1$ and
$$\frac{d}{d\alpha}\,I(\alpha)\,=\frac{2\pi}{\alpha}\,$$ when $|\alpha| > 1$.
Upon integrating both sides with respect to $\alpha$, we get $I(\alpha) = C_1$ when $|\alpha| < 1$ and $I(\alpha) = 2\pi \ln|\alpha| + C_2$ when $|\alpha| > 1$.
$C_1$ may be determined by setting $\alpha=0$ in $I(\alpha)$:
$$  I(0) =\int_0^\pi \ln(1)\;dx =\int_0^\pi 0\;dx=0$$
Thus, $C_1=0$. Hence, $I(\alpha)=0$ when $|\alpha| < 1$.
To determine $C_2$ in the same manner, we should need to substitute in a value of $\alpha>1$ in $I(\alpha)$. This is somewhat inconvenient. Instead, we substitute $\alpha = \frac{1}{\beta}$, where $|\beta| < 1$. Then,
$$\begin{align}
    I(\alpha)    &=\int_0^\pi\left(\ln(1-2\beta \cos x+\beta^2)-2\ln|\beta|\right)\;dx\ \\[8pt]
    &=0-2\pi\ln|\beta|\,    \\[8pt]
    &=2\pi\ln|\alpha|\,
  \end{align}$$
Therefore, $C_2 = 0$ and $I(\alpha)=2\pi\ln|\alpha|$ when $|\alpha| > 1$.
$$I(\alpha)=\begin{cases}
0 &,\quad|\alpha| < 1\\[10pt]
2\pi\ln|\alpha| &,\quad |\alpha| > 1
\end{cases}$$
The foregoing discussion, of course, does not apply when $\alpha=\pm1$, since the conditions for differentiability are not met.

Source : Wikipedia
