I need to calculate the following integral: $$\int_0^{\pi} \frac{ \cos ( kx ) }{ 1 - 2 \tau \cos (x ) } dx$$ for $k \geq 0$ and $| \tau | < \frac{1}{2}$. For $k=0$, I use the reparameterization $t = \tan (x /2)$, but I have no idea how to do it for $k \geq 1$.
Thanks!
If contour integration is acceptable, let $\alpha=\frac{1-\sqrt{1-4\tau^2}}{2\tau}$ and $1/\alpha=\frac{1+\sqrt{1-4\tau^2}}{2\tau}$. $$\newcommand{\Res}{\operatorname*{Res}} \begin{align} \int_0^\pi\frac{\cos(kx)}{1-2\tau\cos(x)}\,\mathrm{d}x &=\frac12\int_{-\pi}^\pi\frac{\cos(kx)+i\sin(kx)}{1-2\tau\cos(x)}\,\mathrm{d}x\tag1\\ &=\frac12\oint_{|z|=1}\frac{z^k}{1-\tau z-\tau z^{-1}}\,\frac{\mathrm{d}z}{iz}\tag2\\ &=\frac1{2i}\oint\frac{z^k}{z-\tau z^2-\tau}\,\mathrm{d}z\tag3\\ &=\frac i{2\tau}\oint\frac{z^k}{(z-\alpha)(z-1/\alpha)}\,\mathrm{d}z\tag4\\ &=\frac1{2i\sqrt{1-4\tau^2}}\oint\left(\frac{z^k}{z-\alpha}-\frac{z^k}{z-1/\alpha}\right)\mathrm{d}z\tag5\\ &=\frac{\pi\alpha^k}{\sqrt{1-4\tau^2}}\tag6 \end{align} $$ Explanation:
$(1)$: since cosine is even, we can double the domain and divide by $2$
$\phantom{(1)\text{:}}$ since sine is odd, adding it to the integral has no effect
$(2)$: write trig functions as functions of $z$ on the unit circle ($z=e^{ix})$
$(3)$: simplify
$(4)$: factor the denominator
$(5)$: partial fractions
$(6)$: $1/\alpha$ is outside the unit circle and $\Res\limits_{z=\alpha}\left(\frac{z^k}{z-\alpha}\right)=\alpha^k$