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.
hint
$$1-2r\cos(t)+r^2=$$ $$(r-\cos(t))^2+\sin^2(t)$$