TITLE: Calculate the residue of $\cot\pi z$ at poles $z=n$
QUESTION [5 upvotes]: I'm having trouble calculating the residue of $f(z) =\cot\pi z$. The function has  a simple pole for every integer n, and i'm, trying to find the residue at n. 
I know that by the residue theorem: $$\text{Res}(\cos\pi z,n) = \lim_{z\rightarrow n} ( z-n) f(z) $$
And i know (well i think) that the answer is:
$$\text{Res}(\cos\pi z,n) = \frac{\cos\pi n}{\pi \cos\pi n} $$
However i'm completely stuck with how to use the simple pole residue theorem, and how to sub in, or what  i do with the theorem to show that this is the answer.  Do i need to integrate anything ? or something similar? 
Any help welcome! 
Thanks!

REPLY [10 votes]: $$\begin{align} \text{Res}[\cot (\pi z), n] &= \lim_{z \to n} \ (z-n) \cot (\pi z) \\ &= \lim_{z \to n} \ (z-n) \frac{\cos (\pi z)}{\sin (\pi z)} \\ &= \lim_{z \to n} \frac{\cos \pi z - (z-n) \pi \sin (\pi z)}{\pi \cos (\pi z)} \ \ (\text{ L'Hospital's rule}) \\ &= \frac{\cos (\pi n)-0}{\pi \cos(\pi n)} \\&= \frac{1}{\pi} \end{align}$$
In general, if $f(z)$ and $g(z)$ are analytic at $z=z_{0}$, $f(z_{0}) \ne 0$, and $g(z)$ has a simple zero at $z=z_{0}$, then
$$ \text{Res}\Big[ \frac{f(z)}{g(z)}, z_{0} \Big] = \frac{f(z_{0})}{g'(z_{0})}.$$