# Find $\int_0^{2\pi}\frac{1-\frac{1}{4}\cos\theta}{1+\frac{1}{16}\cos^2\theta}d\theta$

How to evaluate the following integral? $$\int_0^{2\pi}\frac{1-\frac{1}{4}\cos\theta}{1+\frac{1}{16}\cos^2\theta}d\theta$$ This is an exercise in complex analysis. It looks like a holomorphic function $f(z)$ that we integrate along a circle and take the real part, but I can't see which function could produce that. More precisely, by Cauchy Integral formula, $$f(z)=\frac{1}{2\pi i}\int_0^{2\pi}\frac{f(e^{i\theta})}{e^{i\theta}-z}ie^{i\theta}d\theta$$ so I tried to find a holomorphic function and a $z\in\mathbb{C}$ such that $$\Re\left(\frac{f(e^{i\theta})}{e^{i\theta}-z}ie^{i\theta}\right)=\frac{1-\frac{1}{4}\cos\theta}{1+\frac{1}{16}\cos^2\theta}$$ but this attempt failed.

The standard way to attack integrals of this sort (i.e., rational functions of sine and cosine over a complete cycle) is to sub $z=e^{i \theta}$; then $d\theta=-i dz/z$ and $\cos{\theta}=\frac12 (z+z^{-1})$, and the integral becomes

$$-i \oint_{|z|=1} \frac{dz}{z} \frac{1-\frac18 (z+z^{-1})}{1+\frac{1}{64} (z+z^{-1})^2}$$

which is equal to

$$i 8 \oint_{|z|=1} dz \frac{ z^2-8z+1}{z^4+66 z^2+1}$$

You may now use the residue theorem to evaluate the integral: find the poles of the integrand and evaluate the residues of those poles inside the unit circle. The poles are where

$$z^4+66z^2+1=0 \implies z^2=-33\pm 8\sqrt{17} = -(\sqrt{17}\pm 4)^2$$

which means that either $z=\pm i \left (\sqrt{17}-4\right )$ or $z=\pm i \left (\sqrt{17}+4\right )$. Of these, only the former pair are within the unit circle, so we need only take residues at those poles. The integral is $i 2 \pi$ times the sum of these residues, which may be taken to be twice the real part of one of the residues. The expression for the residue is

$$i 8 \frac{z^2-8 z+1}{4 z^3+132 z}$$

Plug in $z= i \left (\sqrt{17}-4\right )$, take the real part, and multiply by two. The arithmetic is messy but straightforward; the result is

$$\int_0^{2 \pi} d\theta \frac{1-\frac14 \cos{\theta}}{1+\frac{1}{16} \cos^2{\theta}} = \frac{8 \pi}{\sqrt{17}}$$

Hint:
Try substitute $\cos{\varphi}=\dfrac{e^{i\varphi}+e^{-i\varphi}}{2}$ and $z=e^{i\varphi}.$ Then integral becomes to the contour integral along the circle $|z|=1.$

When you have an integral of the form

$$\int_0^{2\pi} R(\cos \theta,\sin\theta)\,d\theta,$$

where $R$ is a rational function, it is often much easier to evaluate it after the substitution $z = e^{i\theta}$ as an integral of a holomorphic function over the unit circle. With

$$\cos\theta = \frac12\left(z + \frac1z\right);\quad \sin\theta = \frac{1}{2i}\left( z - \frac1z\right);\quad d\theta = \frac{dz}{iz},$$

we obtain

$$\int_{\lvert z\rvert = 1} R\left(\frac12\left(z+\frac1z\right),\, \frac{1}{2i}\left(z-\frac1z\right)\right)\, \frac{dz}{iz}.$$

Here, we have no occurrence of $\sin$, and we get

$$\int_0^{2\pi} \frac{1-\frac14\cos\theta}{1+\frac{1}{16}\cos^2\theta}\,d\theta = \frac{1}{i}\int_{\lvert z\rvert = 1} \frac{1-\frac18(z+z^{-1})}{1+\frac1{64}(z+z^{-1})^2}\cdot\frac{dz}{z}.$$

After bringing the rational integrand into canonical form, you get an integrand in relatively simple form, the zeros of the denominator are easily found, and you can evaluate that integral with Cauchy's integral formula (or the residue theorem, if you already know it).