Compute $$ \int_L \frac{\cos^2 z}{z^2}\,dz$$ where $L$ is the closed loop that goes counterclockwise around the square with vertices $-1$, $-i$, $1$ and $i$.
I was trying to compute this using the series expansion. I had that $$\cos^2{z}=1-z^2+\frac{z^4}{3}-\frac{2z^6}{45}+\cdots,$$ and so $$\oint_L\frac{\cos^2{z}}{z^2}dz=\frac{1}{z^2}-1+\frac{z^2}{3}-\frac{2z^4}{45}+\cdots$$
I was hoping to be able to say that all but 1 of these integrate to zero, which I believe is the case. But the term that doesn't integrate to zero is -1. This makes the total integral $-1z\cdot 2\pi i \cdot v(L,0)$. Which I believe is $-2\pi i$.
I think that I have done something wrong.
Help?
By Cauchy formula, $$\int_L\frac{\cos^2 z}{z^2}dz=2\pi if'(0)=0$$
where $f(z)=\cos^2 z$.
An equivalente way to do is to use the residue theorem. As you said $$\frac{\cos^2 z}{z^2}=\frac{1}{z^2}-1+...$$ therefore $$\text{Res}_{z=0}\left(\frac{\cos^2 z}{z^2}\right)=0$$
and thus,
$$\int_L\frac{\cos^2 z}{z^2}dz=2\pi i\text{Res}_{z=0}\left(\frac{\cos^2 z}{z^2}\right)=0.$$