I need to calculate the following integral
$$\int_{|z| = 4} \frac{1}{(z+i)^2\cos z}\,\mathrm dz$$
I would imagine you are suppose to use the residue theorem in this problem. I know that the integrand has singularities at $z = -i, \pi/2, -\pi/2$. The residues at $-i$ is pretty easy to calculate because $\cos(z)$ is analytic at $z = -i.$ However, I was wondering how to calculate the residue at the other two points.
I realize that one way is to find the laurent expansion of the integrand at these points. I am getting that the residues at $z = \pm \pi/2$and is $0$ (I am not sure I am doing this correctly though). Thus, the integral would $2\pi i \tan^2(i)$. However, this seems like a strange answer to me. I am particularly concerned that I have calculated the residues at $z = \pm \pi/2$ incorrectly. Is there a simple way to calculate this integral that I am missing?
The poles at $\pm\pi/2$ are simple, so you can compute them as $$ \text{Res}(f,c)=\lim_{z\to c}f(z)(z-c) $$ where $c=\pm \pi/2$. To find the limit of $\frac{z-c}{\cos(z)}$ when $z\to c$, note that this will be $1$ over the derivative of $\cos$ at $c$.