I am trying to calculate the following integral using complex transformation;
$$\int_0^{2\pi}\frac{\cos^3\theta}{1-2a \cos\theta+a^2}d\theta$$ where $$\left\lvert a \right\rvert<1$$ I am comfortable with sine or cosine with their 1st power, but 3rd power gave me a really hard time. Any ideas?
Notice that $1-2a\cos\theta+a^2 = (1-ae^{i\theta})(1-ae^{-i\theta})$, hence
$$\frac{1}{1-2a\cos\theta+a^2}=\sum_{j\geq 0}a^j e^{ji\theta}\sum_{k\geq 0}a^k e^{-ki\theta}\tag{1}$$ has a simple Fourier cosine series. The same holds for $\cos^3\theta$: $$ \cos^3\theta = \frac{3}{4}\cos(x)+\frac{1}{4}\cos(3x) \tag{2}$$ and since $\int_{0}^{2\pi}\cos(n\theta)\cos(m\theta)\,d\theta=\pi\,\delta(m,n) $, $$ \int_{0}^{2\pi}\frac{\cos^3\theta}{1-2a\cos\theta+a^2}\,d\theta=\pi\left[\frac{3}{4}\sum_{|j-k|=1}a^{j+k}+\frac{1}{4}\sum_{|j-k|=3}a^{j+k}\right]\tag{3}$$ that simplifies to: $$ \pi\left[\frac{3}{4}\sum_{j\geq 0}a^{2j+1}+\frac{3}{4}\sum_{j\geq 1}a^{2j-1}+\frac{1}{4}\sum_{j\geq 0}a^{2j+3}+\frac{1}{4}\sum_{j\geq 3}a^{2j-3}\right]$$ then to: $$\boxed{ \int_{0}^{2\pi}\frac{\cos^3\theta}{1-2a\cos\theta+a^2}\,d\theta = \color{red}{\frac{a (3+a^2)}{1-a^2}\cdot\frac{\pi}{2}}}\tag{4}$$ This question is strictly related with the residue theorem and the Poisson kernel.