Show that $\int_0^\pi \log( 1 - 2r\cos(t) + r^2)\, dt=0$ Show that for $r \in (-1,1)$
$$ \int_0^\pi \log( 1 - 2r\cos(t) + r^2)\, dt = 0$$
Here's what I did so far:
$$f(r,t) = \log(1 - 2r\cos(t) + r^2) = \log( (1-re^{it})(1-re^{-it}))$$
The Leibniz rule states that $$\dfrac{d}{dr} \int_0^\pi f(r,t)\ dt = \int_0^\pi \dfrac{\partial}{\partial r} f(r,t) \ dt$$
After calculating the right part I found $2\pi r$ which means that $\displaystyle\int_0^\pi f(r,t)\ dt = \pi r^2$ when it should be $0$.
Thanks in advance.

By substitution $(z=e^{it})$ and computing residues, we have the well known integrals:
$$J_1 = \int_0^{2\pi} \frac{dt}{1-2r\cos t+ r^2} = \frac{2\pi}{1-r^2}, \quad (|r|<1),$$
$$J_2 = \int_0^{2\pi} \frac{\cos t\, dt }{1-2r\cos t+ r^2} = \frac{2\pi r}{1-r^2}, \quad (|r|<1).$$
Let $$J_0(r) = \int_0^{2\pi} \log \left( {1-2r\cos t+ r^2} \right) dt$$
$$\frac{dJ_0}{dr} = \int_0^{2\pi} \frac{\partial  \log \left( {1-2r\cos t+ r^2} \right)}{\partial r}dt=2 \int_0^{2\pi} \frac{r-\cos t}{ {1-2r\cos t+ r^2} }dt=rJ_1-J_2=0.$$
$$J_0(r) = \text{const}.$$
Since $J_0(0)=0,$ we have $$J_0(r) = 0,$$ but this is twice the integral we want, which is thus zero.
