Formula for the Sum of a Series Over All Integers Using the Residue Theorem
Formula
Let $f$ be a ratio of polynomial functions, that is, a rational function, such that $f(n) \ne 0$ for $n \in \mathbb{Z}$ and $\lim_{z \to \infty} z f(z) = 0$. When $f$ has finitely many singularities $z_{1}, \cdots , z_{m}$, $$ \sum_{n=-\infty}^{\infty} f(n) = - \sum_{n = 1}^{m} \text{Res}_{z_{n}} (\pi f(z) \cot \pi z) $$
Explanation
The significance lies not merely in summing all the natural numbers, but in expressing the sum over all integers as a finite sum. Of course, if the given $f$ is an even function, taking half of it also makes it applicable to computing the sum over the natural numbers. Because of the complicated form in which the cotangent, and even $\pi$, are multiplied here and there, it is hard to memorize and use, but let us at least be aware that such a tool exists.
Derivation 1
Part1 . Boundedness of $\cos \pi z$ on the square

For a natural number $k \in \mathbb{N}$, consider the contour $\mathscr{C}_{k}$ as shown in the figure above. Assume that the rational function $f$ is continuous on $\mathscr{C}_{k}$ for $k > k_{0}$ for some natural number $k_{0}$, and that $\displaystyle \lim_{z \to \infty} z f(z) = 0$.
For each $\mathscr{C}_{k}$, from the assumptions that $\displaystyle |z| \ge k + {{1 } \over {2}} > k$ and that $f$ is continuous, for every $\varepsilon> 0$ there exists $\delta > 0$ satisfying $$ {{1} \over {|z|} } < \delta \implies |z f(z) | < \varepsilon $$ If we choose $\displaystyle k > {{1} \over {\delta}}$, then on $\mathscr{C}_{k}$ there exists $k$ satisfying $\displaystyle |f(z)| < {{\varepsilon} \over {k + 1/2}}$ for $\varepsilon > 0$.
- Addition theorems for trigonometric functions: $$ \sin\left( \alpha +\beta \right) =\sin\alpha \cos\beta +\cos\alpha \sin\beta \\ \sin\left( \alpha -\beta \right) =\sin\alpha \cos\beta -\cos\alpha \sin\beta \\ \cos\left( \alpha +\beta \right) =\cos\alpha \cos\beta -\sin\alpha \sin\beta \\ \cos\left( \alpha -\beta \right) =\cos\alpha \cos\beta +\sin\alpha \sin\beta \\ \tan\left( \alpha +\beta \right) =\frac { \tan\alpha +\tan\beta }{ 1-\tan\alpha \tan\beta } \\ \tan\left( \alpha -\beta \right) =\frac { \tan\alpha -\tan\beta }{ 1+\tan\alpha \tan\beta } $$
- Relations between trigonometric and hyperbolic functions: $$ \begin{align*} \sinh (iz) =& i \sin z \\ \sin (iz) =& i \sinh z \\ \cosh (iz) =& \cos z \\ \cos (iz) =& \cosh z \end{align*} $$
- Relations between trigonometric and exponential functions: $$ \sin z = { {e^{iz} - e^{-iz}} \over 2 i } \\ \cos z = { {e^{iz} + e^{-iz}} \over 2 } $$
For convenience, setting $\alpha := k + 1/2$, we have $\cos \alpha \pi = 0$ and $\sin \alpha \pi = (-1)^{k}$. On $\mathscr{C}_{k}$, since $|\cot \pi z|$ on the vertical lines of $\mathscr{C}_{k}$ satisfies $z = \pm \alpha + iy$ with $\left| y \right| \le \alpha$, $$ \begin{align*} |\cot \pi z| =& \left| {{ \cos \pi z } \over { \sin \pi z }} \right| \\ =& \left| {{ \cos \alpha \pi \cos i \pi y - \sin \pm \alpha \pi \sin i \pi y } \over { \sin \pm \alpha \pi \cos i \pi y + i \cos \alpha \pi \sin i \pi y }} \right| \\ =& \left| {{ \cos \alpha \pi \cosh \pi y \mp i \sin \alpha \pi \sinh \pi y } \over { \pm \sin \alpha \pi \cosh \pi y + i \cos \alpha \pi \sinh \pi y }} \right| \\ =& \left| {{ 0 + 1 \cdot \sinh \pi y} \over { 1 \cdot \cosh \pi y + 0 }} \right| \\ =& \left| \tanh \pi y \right| \\ <& 1 \end{align*} $$ and on the horizontal lines of $\mathscr{C}_{k}$ we have $z = x \pm i \alpha$, and likewise $\left| x \right| \le \alpha$. Since the magnitude of an imaginary power of a real number is always $1$, by the triangle inequality, $$ \begin{align*} \left| e^{i \pi x} e^{\mp \alpha \pi} + e^{ - i \pi x} e^{\pm \alpha \pi} \right| \le& \left| e^{i \pi x} e^{\mp \alpha \pi} \right| + \left| e^{ - i \pi x} e^{\pm \alpha \pi} \right| = e^{\alpha \pi} + e^{ - \alpha \pi} \\ \left| e^{i \pi x} e^{\mp \alpha \pi} - e^{ - i \pi x} e^{\pm \alpha \pi} \right| \ge& \left| \left| e^{i \pi x} e^{\mp \alpha \pi} \right| - \left| e^{ - i \pi x} e^{\pm \alpha \pi} \right| \right| = e^{\alpha \pi} - e^{ - \alpha \pi} \end{align*} $$ from which we obtain the following. $$ \begin{align*} |\cot \pi z| = \left| {{ \cos \pi z } \over { \sin \pi z }} \right| \\ =& \left| {{ e^{i \pi z} + e^{ - i \pi z} } \over { e^{i \pi z} - e^{ -i \pi z} }} \right| \\ =& \left| {{ e^{i \pi x} e^{\mp \alpha \pi} + e^{ - i \pi x} e^{\pm \alpha \pi} } \over { e^{i \pi x} e^{\mp \alpha \pi} - e^{ -i \pi x} e^{\pm \alpha \pi} }} \right| \\ \le & {{e^{\alpha \pi} + e^{- \alpha \pi}}\over {e^{\alpha \pi} - e^{- \alpha \pi}}} \\ =& \cot \alpha \pi \\ \le& \max \left\{ \pm \cot {{1} \over {2}} \pi, \pm \cot {{3} \over {2}} \pi \right\} & \because \sin \alpha \pi = (-1)^{k} \\ \le& \cot {{3} \over {2}} \pi \\ <& 2 \end{align*} $$ Consequently, $|\cot \pi z|$ is always bounded on the square $\mathscr{C}_{k}$.
Part 2. $\lim_{k \to \infty} \int_{\mathscr{C}_{k}} f(z) \cot \pi z dz = 0$
Since the length of $\mathscr{C}_{k}$ is $$ 8 \left( k + {{1 } \over {2}} \right) $$ by the ML lemma, $$ {{1} \over {k}} < \delta \implies \left| \int_{\mathscr{C}_{k}} f(z) \cot \pi z dz \right| \le {{8 (k + 1/2) 2 \varepsilon } \over { k + 1/2}} = 16 \varepsilon $$ therefore $$ \lim_{k \to \infty} \int_{\mathscr{C}_{k}} f(z) \cot \pi z dz = 0 $$
Part 3. $\sum_{n=-\infty}^{\infty} f(n) = - \sum_{n = 1}^{m} \text{Res}_{z_{n}} (\pi f(z) \cot \pi z)$
Now, defining $F(z) := \pi f(z) \cot \pi z$, since $f(n) \ne 0$, all the $n \in \mathbb{Z}$ become simple poles of $F$. Computing the residues, $$ \text{Res}_{n} F(z) = {{ \pi f(z) \cos \pi z} \over { (\sin \pi z)' }} = \left. {{ \pi f(z) \cos \pi z} \over { \pi \cos \pi z }} \right|_{z = n} = f(n) $$ By assumption, $F$ still has the singularities $z_{1} , z_{2} , \cdots , z_{m}$, so by the residue theorem, $$ \begin{align*} \lim_{k \to \infty} \int_{\mathscr{C}_{k}} F(z) dz =& \lim_{k \to \infty} 2 \pi i \left( \sum_{n = -k} ^{k} f(n) + \sum_{n = 1} ^{m} \text{Res}_{z_{n}} F(z) \right) \\ =& 2 \pi i \left( \sum_{n=-\infty}^{\infty} f(n) + \sum_{n = 1}^{m} \text{Res}_{z_{n}} (\pi f(z) \cot \pi z) \right) \end{align*} $$ Since we have already shown above that $\displaystyle \lim_{k \to \infty} \int_{\mathscr{C}_{k}} f(z) \cot \pi z dz = 0$, $$ \sum_{n=-\infty}^{\infty} f(n) = - \sum_{n = 1}^{m} \text{Res}_{z_{n}} (\pi f(z) \cot \pi z) $$
■
Formula for Alternating Series
Formula for the sum of an alternating series over all integers: For a rational function $f$, let $$ \lim_{z \to \infty} z f(z) = 0 $$ and $f(n) \ne 0$ for $n \in \mathbb{Z}$. When $f$ has finitely many singularities $z_{1}, \cdots , z_{m}$, $$ \sum_{n=-\infty}^{\infty} (-1)^{n}f(n) = - \sum_{n = 1}^{m} \text{Res}_{z_{n}} (\pi f(z) \csc \pi z) $$
Meanwhile, the alternating series case can be derived similarly to the above, so let us try doing it by hand ourselves.
Osborne (1999). Complex variables and their applications: p182~184. ↩︎
