Evaluating $\int_0^\pi \frac{\cos{n\theta}}{1 -2r\cos{\theta}+r^2} d\theta$

How do I go about evaluating the following integral:

$$\int_0^\pi \frac{\cos{n\theta}}{1 -2r\cos{\theta}+r^2} d\theta$$

for $n \in \mathbb{N}$, and $r \in (0,1)$?

My tack has been to rewrite, using the exponential form of $\cos$, as:

$$\int_0^\pi \frac{e^{i\theta} + e^{-i\theta}}{2(1 - re^{i\theta})(1-re^{-i\theta})} d\theta$$

and letting $z = e^{i\theta}$ and $d\theta = \frac{1}{iz}dz$, we get

$$\frac{1}{2i}\int_{|z|=1} \frac{z^n + \frac{1}{z}^n}{(1 - rz)(z-r)} d\theta$$

This would have a singularity when $z= e^{i\theta} = r$ or when $zr = re^{i \theta} = 1$. Since $r \in (0,1)$ neither of these can occur. So we just need to integrate the above, but I can't see any way about this?

Is my approach valid or along the right lines, and how can I proceed?

• I also see a singularity in $0$... – N74 May 8 '18 at 20:25
• @N74 Does this not require $r=1$? The integrand becomes $\frac{1}{1 -2r + r^2}$, so we solve $1 -2r + r^2=0$ so $r=1$ but $r \in (0,1)$? – Sergestus May 8 '18 at 20:31
• if $r \ne 1$ one of $\frac {1}{1-rz}$ or $\frac {1}{z-r}$ has a singularity on the disk or radius $1.$ (i.e. inside the contour) and as @N74 points out, there is a pole at 0 to consider, as well. – Doug M May 8 '18 at 20:35
• @DougM Ahh I see where I was missing the singularities for $\frac{1}{1-rz}$ and $\frac{1/{z-r}$, I was only looking for ones on the boundary but needed to find ones in the disc. Could you explain how 0 is a pole though, I can't see it? – Sergestus May 8 '18 at 20:40
• you have $\frac {1}{z^n}$ in the numerator, creating a pole. – Doug M May 8 '18 at 20:42

The contour integration way:

Residue theorem reveals within a second that

$$\int_0^\pi \frac{\cos{n\theta}}{1 -2r\cos{\theta}+r^2} d\theta=\pi\frac{r^n}{1-r^2}.$$

Note: To make everything simpler (compared with what you tried in your post) it is enough to use in the numerator $e^{i n\theta}$.

The real method way:

Exploit carefully the well-known series result (which can be proved by real methods)

$$\sum_{n=1}^{\infty} p^n \sin(n x)=\frac{p\sin(x)}{1-2 p \cos(x)+p^2}, |p|<1$$

• Can you expand on "within a second"? It really doesn't seem quick to me (unless there is some other method?) – Sergestus May 14 '18 at 16:55
• @Sergestus read the note above. – user 1591719 May 14 '18 at 18:17
• Ahh taking that, we no longer have the residue at $z=0$ right? And then the residue at $z=r$ gives the required (and I see now how it should have been within seconds!) But why is taking only $e^{in\theta}$ valid? – Sergestus May 14 '18 at 18:37
• @Sergestus right! In general you'll find useful for such integrals to use Euler's formula here en.wikipedia.org/wiki/Euler%27s_formula. In our case, that's the real part you're interested in. – user 1591719 May 14 '18 at 19:04
• That clears everything up, thanks for your answers! – Sergestus May 14 '18 at 19:12