Evaluate \[ \int_0^{2\pi}\frac{d\theta}{1-2r\cos\theta+r^2}, \] where \(r^2\ne1\).
Solution
For the real parameter \(r\) in the problem, \(r^2\ne1\) implies either \(\abs{r}<1\) or \(\abs{r}>1\). Write \(I(r)\) for the integral in the problem.
1. With \(z=e^{i\theta}\), the integral is\[ I(r) = \oint_{\abs{z}=1} \frac{dz}{i(z-r)(1-rz)}. \]
On \(\abs{z}=1\), \[ d\theta=\frac{dz}{iz} \qquad\text{and}\qquad \cos\theta=\frac{1}{2}\left(z+z^{-1}\right). \] Hence \[ z\left(1-2r\cos\theta+r^2\right) =(z-r)(1-rz), \] so substitution into the original integral gives the displayed contour integral.
2. If \(\abs{r}<1\), then\[ I(r)=\frac{2\pi}{1-r^2}. \]
In this case the integrand in step 1 has exactly one pole inside \(\abs{z}=1\), namely \(z=r\). Its residue there is \[ \frac{1}{i(1-r^2)}. \] The residue theorem therefore gives \[ I(r) = 2\pi i\frac{1}{i(1-r^2)} = \frac{2\pi}{1-r^2}. \]
3. If \(\abs{r}>1\), then\[ I(r)=\frac{2\pi}{r^2-1}. \]
Now \(z=r\) lies outside the unit circle, while \(z=1/r\) lies inside it. Thus the only enclosed pole is \(z=1/r\). Its residue is \[ \frac{1}{i(r^2-1)}, \] because \[ \lim_{z\to1/r} \frac{z-1/r}{i(z-r)(1-rz)} = \frac{1}{i(1/r-r)(-r)} = \frac{1}{i(r^2-1)}. \] The residue theorem gives the stated value.
4. Therefore\[ \boxed{ \int_0^{2\pi} \frac{d\theta}{1-2r\cos\theta+r^2} = \frac{2\pi}{\abs{1-r^2}} }. \]
If \(\abs{r}<1\), then \(1-r^2>0\), so step 2 gives the boxed formula. If \(\abs{r}>1\), then \(r^2-1>0\), so step 3 gives the same formula.
5. Q.E.D.
Step 4 is the requested evaluation.