Integrate $\oint\frac{z}{\cos z-1}dz$ with residue theorem $$\oint\limits_{|z-3|=4}^{}\frac{z}{\cos z-1}dz$$
My attempt:
$$\cos z=1$$
$$z=2\pi k$$
The set includes only $z=0$ and $z=2\pi$. What next?
 A: $$\DeclareMathOperator*{\res}{Res}
\oint_C\frac{z}{\cos z-1}\,dz=2\pi i\res_{z=0}\frac{z}{\cos z-1}+2\pi i\res_{z=2\pi}\frac{z}{\cos z-1}$$
Use the fact that around $z=0$ we have $$\cos(z)\simeq 1-\tfrac12z^2$$
Then $$\frac{z}{\cos z-1}\simeq \frac{z}{1-\tfrac12z^2-1}=-\frac{2}{z}$$
$$\res_{z=0}\frac{z}{\cos z-1}=\res_{z=0}\frac{-2}{z}=-2$$
And around $z=2\pi$:
$$\cos(z)\simeq 1-\tfrac12(z-2\pi)^2$$
$$\res_{z=2\pi}\frac{z}{\cos z-1}=\res_{z=2\pi}\frac{z}{1-\tfrac12(z-2\pi)^2-1}=-\res_{z=2\pi}\frac{2z-4\pi+4\pi}{(z-2\pi)^2}$$
$$=-2-\res_{z=2\pi}\frac{4\pi}{(z-2\pi)^2}=-2$$
Hence $$\oint_C\frac{z}{\cos z-1}\,dz=-8\pi i$$
Why does Taylor approximation work?
$$\cos(z)=1-\tfrac12z^2+\tfrac{1}{24}z^4+...$$
$$\frac{z}{\cos(z)-1}=\frac{z}{-\tfrac12z^2+\tfrac{1}{24}z^4+...}$$
$$=\frac{-2}{z-\tfrac{1}{12}z^3+...}=\frac{-2}{z(1-\tfrac{1}{12}z^2+...)}=g(z)$$
We can break this into
$$g(z)=\frac{A}{z}+\frac{f(z)}{1-\tfrac{1}{12}z^2+...}$$
$$-2\equiv A(1-\tfrac{1}{12}z^2+...)+z\cdot f(z)$$
Especially for $z=0$:
$$-2=A$$
So $$\res_{z=0} g(z)=\res_{z=0} \frac{-2}{z}+\res_{z=0}\frac{f(z)}{1-\tfrac{1}{12}z^2+...}=-2$$
A: Hint: Res {$f(z),z=a$}=coefficient of $1/(z-a)$ in the expansion of $f(z)$ in powers of $(z-a)$.
In case of your question, it is not difficult to obtain the expansions of $f(z)$ in powers of $z$ and $(z-2π)$ as:
$f(z)=-2/z -z/6 +$ ..........
$f(z)=-4π/(z-2π)^2 -2/(z-2π)+$..........
From the above two expansions, the residue at each pole is $-2$. Then, by Cauchy's Residue theorem the given integral is $2πi×$Sum of residues at poles inside contour.
A: The contour circles the singularities at $z=0$ and $z=2\pi$.
$$
\begin{align}
\frac{z}{\cos(z)-1}
&=\frac{z}{-\frac{z^2}2+\frac{z^4}{24}+O\left(z^6\right)}\\
&=-\frac2z\frac1{1-\frac{z^2}{12}+O\left(z^4\right)}\\
&=-\frac2z-\frac z6+O\left(z^3\right)
\end{align}
$$
Thus, the residue at $z=0$ is $-2$.
$$
\begin{align}
\frac{(z-2\pi)+2\pi}{\cos(z-2\pi)-1}
&=\frac{(z-2\pi)+2\pi}{-\frac{(z-2\pi)^2}2+\frac{(z-2\pi)^4}{24}+O\left((z-2\pi)^6\right)}\\
&=-\left(\frac2{z-2\pi}+\frac{4\pi}{(z-2\pi)^2}\right)\frac1{1-\frac{(z-2\pi)^2}{12}+O\left((z-2\pi)^4\right)}\\
&=-\frac{4\pi}{(z-2\pi)^2}-\frac2{z-2\pi}-\frac\pi3-\frac{z-2\pi}6+O\left((z-2\pi)^2\right)
\end{align}
$$
Thus, the residue at $z=2\pi$ is also $-2$.
Therefore, assuming the contour is counterclockwise, the integral is $2\pi i$ times the sum of the residues, which is
$$
-8\pi i
$$
