Find the value of $\frac{i}{4-\pi}\int_{|z|=4}\frac{1}{z\cos{z}}dz$ Find the value of $$\frac{i}{4-\pi}\int_{|z|=4}\frac{1}{z\cos{z}}dz$$.
My attempt:
The integrand has singularities at $z=0, \frac{\pi}{2}, \frac{-\pi}{2}$, so 
$$\frac{i}{4-\pi}\int_{|z|=4}\frac{1}{z\cos{z}}dz=\frac{i}{4-\pi}2\pi i ~Res_{z=z_k}\phi(z)=\frac{-2\pi}{4-\pi}\{Res_{z=0}\frac{1}{\cos(z)}+Res_{z=\pi/2}\frac{1}{z}+Res_{z=-\pi/2}\frac{1}{z}\}=\frac{-2\pi}{4-\pi}$$
But the given answer is $2$. Where did I made mistake? Please help me out.
 A: The computation of the residues is messed up. You must consider the function as a whole, but you tossed away $1/z$ and $\cos z$ where it mattered. The rule is: $${\rm Res}\left(\frac{f(z)}{g(z)},a\right) = \frac{f(a)}{g'(a)},$$if $a$ is a simple pole of $g$. Let's save the $i/(4-\pi)$ for later. We have: $$\int_{|z|=4}\frac{{\rm d}z}{z\cos z} = 2\pi i\left(\underbrace{{\rm Res}\left(\frac{1}{z \cos z}, 0\right)}_{(a)} +  \underbrace{{\rm Res}\left(\frac{1}{z \cos z}, \frac{\pi}{2}\right)}_{(b)}+\underbrace{{\rm Res}\left(\frac{1}{z \cos z}, -\frac{\pi}{2}\right)}_{(c)}\right)$$
One at a time, we get:
$$(a) = {\rm Res}\left(\frac{1}{z \cos z}, 0\right) = {\rm Res}\left(\frac{1/\cos z}{z}, 0\right) = \frac{1/ \cos 0}{1} = 1;$$
$$(b) = {\rm Res}\left(\frac{1}{z\cos z},\frac{\pi}{2}\right) = {\rm Res}\left(\frac{1/z}{\cos z},\frac{\pi}{2}\right) = \frac{1/(\pi/2)}{-\sin (\pi/2)} = -\frac{2}{\pi};$$
$$ (c) = {\rm Res}\left(\frac{1}{z\cos z},-\frac{\pi}{2}\right) = {\rm Res}\left(\frac{1/z}{\cos z},-\frac{\pi}{2}\right) = \frac{1/(-\pi/2)}{-\sin (-\pi/2)} = -\frac{2}{\pi},$$so that: $$\int_{|z|=4}\frac{{\rm d}z}{z \cos z} = 2\pi i \left(1- \frac{2}{\pi} - \frac{2}{\pi}\right) = 2\pi i \frac{(\pi-4)}{\pi} = 2i(\pi - 4),$$and finally: $$\frac{i}{4-\pi}\int_{|z|=4}\frac{{\rm d}z}{z\cos z} = \frac{i}{4-\pi}(2i(\pi-4)) = 2,$$as wanted.
