Evaluating $\int_0^{2 \pi} \ln(a^2 -2 a \cos(t - \phi) + 1) dt$ I'm trying to evaluate $$\int_0^{2 \pi} \ln(a^2 -2 a \cos(t - \phi) + 1) dt$$
where $a\in \mathbb{R}$, $a \in (0, 1)$ and $\phi \in \mathbb{R}$.
I suspect the answer is just $0$, but I'm not sure how to demonstrate that succintly.
I attempted a contour integral using the subsitution $z = e^{i t}$, $cos(t) = \frac{1}{2} (z + \frac{1}{z})$ but it's not clear to me how to handle $z = 0$ when finding the residues.
 A: We proved here
$$\sum_{n=1}^{\infty}a^{n-1} \cos(nx)=\frac{\cos(x)-a}{1-2a\cos(x)+a^2}, \ |a|<1$$
Integrating both sides with respect to $a$ yields
$$\sum_{n=1}^{\infty}\frac{a^n}{n}\cos(nx)=-\frac12\ln(1-2a\cos(x)+a^2)+C$$
where $C=0$ if we set $a=0$
Replace $x$ with $t-\phi$ then integrate both sides from $t=0$ to $t=2\pi$ we get
$$-\frac12\int_0^{2\pi}\ln(1-2a\cos(t-\phi)+a^2)\ dt=\sum_{n=1}^{\infty}\frac{a^n}{n}\int_0^{2\pi}\cos(n(t-\phi))\ dt$$
$$=\sum_{n=1}^{\infty}\frac{a^n}{n}\left(\frac{\sin(2\pi n-\phi n)}{n}-\frac{\sin(- \phi n)}{n}\right)$$
$$\sum_{n=1}^{\infty}\frac{a^n}{n}\left(\frac{\sin(- \phi n)}{n}-\frac{\sin(-\phi n)}{n}\right)=0$$
A: Since this hasn't been closed yet as a duplicate, we offer for $|a|<1$,
$$\begin{align}I&=\int_0^{2\pi}\ln(a^2-2a\cos(t-\phi)-1)dt\\
&=\int_0^{2\pi}\ln(1-ae^{i(t-\phi)})dt+\int_0^{2\pi}\ln(1-ae^{-i(t-\phi)})dt\tag{1}\\
&=\oint_{|z|=1}\ln(1-aze^{-i\phi})\frac{dz}{iz}-\oint_{|z|=1}\ln(1-aze^{i\phi})\frac{dz}{(-iz)}\tag{2}\\
&=\lim_{z\rightarrow0}2\pi i\left(\frac{\ln(1-aze^{-i\phi})}{i}+\frac{\ln(1-aze^{i\phi})}{i}\right)=0\tag{3}\end{align}$$
$(1)$ Being careful arguments of all logarithms are positive real when $t=\phi+n\pi$
$(2)$ Letting $z=e^{it}$, $dz=ie^{it}dt=iz\,dz$ in the first integral and $z=e^{-it}$, $dz=-ie^{-it}dt=-iz\,dz$ in the second. The minus sign is there because the substitution would run the second integral around the unit circle clockwise.
$(3)$ Since we ran our branch cuts away from the unit circle, the residue theorem applies.      
If $|a|>1$ then
$$\begin{align}\int_0^{2\pi}\ln(a^2-2a\cos(t-\phi)+1)dt&=\int_0^{2\pi}\left(\ln(a^2)+\ln\left(1-\frac2a\cos(t-\phi)+\frac1{a^2}\right)\right)dt\\
&=4\pi\ln|a|\end{align}$$
Because then $\left|\frac1a\right|<1$ and $\ln(a^2)=2\ln|a|$.
Pretty close to robjohn's solution but a little more algebraic and less geometric.
