How to calculate the integral $\int\limits_0^{\pi} \ln(1-2\alpha\cos{x}+\alpha^2) dx$? How to calculate the integral $\int\limits_0^{\pi} \ln(1-2\alpha\cos{x}+\alpha^2) dx$ by Fourier Series?
I have $\dfrac{q\sin{x}}{1-2q\cos{x}+q^2}=\sum\limits_{n=0}^{\infty} q^n\sin{nx} (q<1)$ now, I tried term wise integration but I cannot figure it out. 
The answer is $0$ if $|\alpha|\leqslant 1$, $2\pi\ln|\alpha|$ if $|\alpha|<1$.
 A: We can recognize the cosine law in the argument:
$$1-2\alpha \cos\phi + \alpha^2 = |1-\alpha e^{i\phi}|^2.$$
Then you have $z=\alpha e^{i\phi}$, $\ln |1-z|^2=2 Re \ln (1-z)$, use the series for log (under condition $|z|<1$ for which the series converges):
$$\ln(1-2\alpha \cos \phi + \alpha^2)=2 \operatorname{Re} \ln (1-z) =2\operatorname{Re}\sum_{n=1}^\infty \frac{z^n}{n}=2 \sum_{n=1}^\infty\frac{\alpha^n \cos n\phi}{n} $$
where the last step was just using the Euler's formula and taking the real part.
But this is precisely the Fourier series of the integrant, which you can integrate term-wise and get zero because you are integrating cosine over a symmetric interval (over a whole period or over half-period from max to min value).
The above series for logarithm only works for $|z|<1$ (the convergence radius). For $|z|>1$, you have to transform the logarithm differently:
$$\ln |1-z|=\ln |z-1|=\ln(|z||1-z^{-1}|)=\ln|z|+\ln|1-z^{-1}|$$
The first term is a constant, equal to $\ln \alpha$, and the second term leads to the same cosine integrals which lead to zero. So we can ignore the second term and just get
$$\int_0^\pi 2 \ln |\alpha|d\phi+0=2\pi \ln |\alpha|$$
