<s>[INST] Calculate $\int_0^{\pi} \frac{ \cos ( kx ) }{ 1 - 2 \tau \cos (x ) } dx$ 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!
 [/INST] Using the fact that for all $r\in (-1,1)$ and all real $x$,
\begin{align*}
\sum_{n=-\infty}^\infty r^{|n|}e^{inx} =\frac{1-r^2}{1+r^2 - 2r\cos x}
\end{align*} (for background, this is the series representation of the Poisson kernel) we get
\begin{align*}
\int_0^{\pi} \frac{\cos(kx)}{1+r^2 -2r\cos x} dx =& \frac 1 2 \int_{-\pi}^{\pi} \frac{e^{ikx}}{1+r^2 -2r\cos x} dx\\
=&\frac 1{2}\int_{-\pi}^{\pi} \left(\frac 1 {1-r^2}\sum_{n=-\infty}^\infty r^{|n|}e^{inx}\right)e^{ikx} dx\\
=&\frac 1{2(1-r^2)}\sum_{n=-\infty}^\infty r^{|n|}\underbrace{\int_{-\pi}^{\pi} e^{i(n+k)x} dx}_{=0 \ \text{ if }\ n+k\ne 0}\\
=&\frac { \pi r^k}{1-r^2}.
\end{align*} Now solving for $$\frac r{1+r^2} = \tau \ \ \Longrightarrow \ \ r=\frac {1-\sqrt{1-4\tau^2}}{2\tau} \in (-1,1)
$$ we finally get
\begin{align*}
\int_0^{\pi} \frac{\cos(kx)}{1 -2\tau\cos x} dx = &\frac{\pi r^k(1+r^2)}{1-r^2} =\frac{\pi}{ \sqrt{1-4\tau^2}}\left(\frac{1-\sqrt{1-4\tau^2}}{2\tau}\right)^{k}.
\end{align*}
</s>