TITLE: Integrate: $\int_0^{\pi} \log ( 1 - 2 r \cos \theta + r^2)d\theta$
QUESTION [6 upvotes]: If $r \in \Bbb R$ how to integrate $\displaystyle \int_0^{\pi} \log ( 1  - 2 r \cos \theta + r^2)d\theta$? 
I need some hints. Special case, if $r = 1$ then I know the above integral is zero.
Here is my working
\begin{align*}
\int_0^{\pi}\log (1 - 2 r \cos \theta + r^2)d\theta &= \int_0^\pi\log ((1 - re^{i \theta})(1 -re^{-i\theta} )) d\theta\\ 
 &= \int_0^\pi \log(1 - r e^{i\theta})d\theta + \int_0^\pi\log(1 - re^{-i\theta})d\theta\\ 
 &= \int_0^{2\pi} \log( 1 - re^{i\theta})d\theta \\
 &= 0
\end{align*}

REPLY [2 votes]: Hint: Note that when $r<1$ this is the real part of
$$\frac12 \int_{|z|=r} \log(1-z)^2\,\frac{dz}{iz}$$
for the usual branch of $\log$.
When $r>1$, you're going to need to make a branch cut.