Find $I=\int_{0}^{2\pi}\frac{\cos^2\theta}{5+4\sin\theta}d\theta$ I've found by Cauchy's Integral Formula that
$$\int_{\gamma (0,1)}\frac{\Re(z)}{2z-i}dz=-\frac{\pi}{4}i$$ but now not sure how to find $I$ using this? And help much appreciated!
 A: Sub $z=e^{i \theta}$, $\cos{\theta}=\frac12 (z+z^{-1})$, $\sin{\theta}=\frac{1}{2 i} (z-z^{-1})$.  Then $d\theta = -i dz/z$ and we can rewrite the integral as an intgeral over the unit circle:
$$-i \oint_{|z|=1} \frac{dz}{z} \frac{\frac14 (z+z^{-1})^2}{5-i 2 (z-z^{-1})} = \frac14 \oint_{|z|=1} \frac{dz}{z^2} \frac{(z^2+1)^2}{2 z^2+i 5 z-2}$$
You may then apply the residue theorem by finding the zeroes of the denominator and evaluating the residues  at the poles inside the unit circle.  The answer is then $i 2 \pi$ times the sum of those residues.
The poles are at $z=0$ (double pole), $z_{+}=-2 i$, and $z_-=-i/2$.  Of these, only $z=0$ and $z=z_-$ are within the unit circle.
For the double pole at $z=0$, the residue is given by the derivative of $z^2$ times the integrand at $z=0$:
$$\operatorname*{Res}_{z=0} \frac{1}{4 z^2} \frac{(z^2+1)^2}{2 z^2+i 5 z-2} = \frac14 \left [\frac{d}{dz} \frac{(z^2+1)^2}{2 z^2+i 5 z-2} \right ]_{z=0} = -i \frac{5}{16}$$
For the simple pole at $z=z_-$, the residue is given by $z-z_-$ times the integrand evaluated at $z-z_-$.  For an integrand of the form $p(z)/q(z)$, the residue may be computed as $p(z_-)/q'(z_-)$ as follows:
$$\operatorname*{Res}_{z=z_-} \frac{1}{4 z^2} \frac{(z^2+1)^2}{2 z^2+i 5 z-2} = \frac{(z_-^2+1)^2}{4 z_-^2 (4 z_-+i 5)} = i \frac{3}{16}$$
The value of the integral is then $i 2 \pi$ times the sum of these residues, or $\pi/4$.
