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.

In my post, I found that
$$
\int_{0}^{\pi} \ln (b \cos x+c) d x=\pi \ln \left(\frac{c+\sqrt{c^{2}-b^{2}}}{2}\right)
$$
where $\left|\frac{b}{c}\right| \leqslant 1$ and $c \neq 0$.
$$
\begin{aligned}
\int_{0}^{\pi} \ln \left(1-2 r \cos t+r^{2}\right) d t =& \pi \ln \left(\frac{1+r^{2}+\sqrt{\left(1+r^{2}\right)^{2}-(-2 r)^{2}}}{2}\right) = 0 .
\end{aligned}
$$
