TITLE: Prove that $\sum_{n=1}^{\infty}\frac{1}{n^{2}} = \frac{\pi^{2}}{6}$
QUESTION [9 upvotes]: The goal is to prove for equality: \begin{equation*}
     \sum_{n = 1}^{\infty} \frac{1}{n^{2}}=\frac{\pi^{2}}{6} \end{equation*} To do this, follow the steps below:

Study the poles of the function $\phi(z) = \frac{\pi\cos(\pi z)}{\sin(\pi z)}$.
Find an expression for the integral $$\int_{C_{N}} \frac{\pi\cos(\pi z)}{z^{2}\sin(\pi z)}$$, where $C_{N}$ is a curve
that encloses the integer up until $\pm N$.
Considering $C_{N}$ as the rectangle with vertices $\pm(N+1/2)\pm(N+1/2)i$, prove that
$$\lim_{N\to\infty}\int_{C_{N}}\frac{\phi(z)}{z^{2}}dz=0$$
Conclude.


What i try is
The dist thing is to note that the set of poles on $C_{N}$ is:
\begin{equation*}
    \mathcal{P}(N) = \{k : |k|\leq N\}
\end{equation*}
then I note that the residue on $k=0$ is:
\begin{equation*}
    \begin{split}
        \text{Res}\left(\phi,k=0\right) 
        &=      \lim_{z\to 0}(z-0)\phi(z)\\
        &=      \lim_{z\to0}(z-0)\cdot\frac{\pi\cos(\pi z)}{\sin(\pi z)}\\
        &=      \lim_{z\to0}\cos(\pi z)\cdot\frac{\pi x}{\sin(\pi z)}=1\\
    \end{split}
\end{equation*}
To calculate the integral
\begin{equation*}
    \int_{C_{N}}\frac{\phi(z)}{z^{2}}dz = \int_{C_{N}}\frac{\pi\cos(\pi z)}{z^{2}\sin(\pi z)}dz
\end{equation*}
whe can see that the pole is of order, meanwhile the other poles are simple, then:
\begin{eqnarray*}
    \frac{1}{2\pi i}\int_{C_{N}}\frac{\pi\cos(\pi z)}{z^{2}\sin(\pi z)}dz
    & = &   \sum_{k=-N}^{N}\text{Res}\left(\frac{\phi(z)}{z^{2}},k\right)\\
    & = &   \text{Res}\left(\frac{\phi(z)}{z^{2}},0\right)+\sum_{k=-N,k\neq0}^{N}\text{Res}\left(\frac{\phi(z)}{z^{2}},k\right)\\
    & = & \lim_{z\to0}\frac{1}{2!}\frac{d^{2}}{dz^{2}}\left[(z-0)^{3}\frac{\pi\cos(\pi z)}{z^{2}\sin(\pi z)}\right]+\sum_{k=-N,k\neq0}^{N}\text{Res}\left(\frac{\phi(z)}{z^{2}},k\right)
\end{eqnarray*}
\begin{eqnarray*}
            \text{Res}\left(\frac{\phi(z)}{z^{2}},k\right)
            & = &   \lim_{z\to k}(z-k)\frac{\pi\cos(\pi z)}{z^{2}\sin(\pi z)}\\
            & = &   \frac{1}{k^2}\lim_{z\to k}(z-k)\frac{\pi\cos(\pi z)}{\sin(\pi z)}\\
            & = &   \frac{1}{k^2}\lim_{z\to k}\frac{\pi\cos(\pi z) - (z-k)\pi^{2}\sin(\pi z)}{\pi\cos(\pi z)}\\
            & = &   \frac{1}{k^2}\lim_{z\to k}  \left(\frac{\pi\cos(\pi z)}{\pi\cos(\pi z)}-\frac{(z-k)\pi^{2}\sin(\pi z)}{\pi\cos(\pi z)}\right) = \frac{1}{k^{2}}\\
        \end{eqnarray*}
Entonces
\begin{equation*}
            \frac{1}{2\pi i}\int_{C_{N}}\frac{\pi\cos(\pi z)}{z^{2}\sin(\pi z)}dz = \text{Res}\left(\frac{\phi(z)}{z},0\right) + \sum_{\begin{subarray}{c}k=-N\\k\neq0\end{subarray}}^{N}\frac{1}{k^{2}}
        \end{equation*}
and
\begin{equation*}
\cot(z) = \frac{1}{z} - \frac{z}{3}-\frac{z^{3}}{45}+o(z^{5})
\end{equation*}
with this we calculate
$$\text{Res}\left(\frac{\phi(z)}{z^{2}},0\right)=\text{Res}\left(\frac{\pi\cot(z)}{z^{2}},0\right)$$
On the other side:
\begin{equation*}
\cot(\pi z) = \frac{\cos(\pi z)}{\sin(\pi z)} = i\frac{e^{\pi i z} + e^{-\pi i z}}{e^{\pi i z} - e^{-\pi i z}} = i\frac{e^{2\pi i z} + 1}{e^{2\pi i z} - 1}
\end{equation*}
as $|\cot(\pi z)|<2$, then
\begin{eqnarray*}
\left|\int_{C_{N}}\frac{\phi(z)}{z^{2}}dz\right|
& \leq &   \int_{C_{N}}\left|\frac{\phi(z)}{z^{2}}\right|dz\\
& \leq &   \int_{C_{N}}\left|\frac{2\pi}{z^{2}}\right|dz\\
& \leq &   |2\pi|\int_{C_{N}}\frac{1}{\left|z^{2}\right|}dz\\
& \leq &   2\pi\max_{z\in C_{N}}\left(\frac{1}{z^{2}}\right)\cdot L(C_{N})\\
\end{eqnarray*}
Could someone help me with this part (3)?

REPLY [2 votes]: You had the right idea using the series expansion to calculate the residue at 0. You can do the following:
In our case we have that $\cot(\pi z) = \frac{1}{\pi z} - \frac{\pi z}{3} - \frac{(\pi z)^3}{45} + o(z^5)$. Then:
\begin{eqnarray*}
    \text{Res}\left(\frac{\phi(z)}{z^{2}},0\right)
    & = & \lim_{z\to0}\frac{1}{2!}\frac{d^{2}}{dz^{2}}\left[(z-0)^{3}\frac{\cot(\pi z)}{z^{2}}\right] \\
    & = & \lim_{z\to0}\frac{1}{2!}\frac{d^{2}}{dz^{2}}\left[z\pi\cot(\pi z)\right] \\
    & = & \lim_{z\to0}\frac{1}{2}\frac{d^{2}}{dz^{2}}\left[1 - \frac{(\pi z)^2}{3} - \frac{(\pi z)^3}{45} + o(z^5) \right] \\
    & = & \lim_{z\to0}\frac{1}{2}\frac{d}{dz}\left[\frac{2 \pi^2 z}{3} - \frac{3 \pi z^2}{45}  \right] \\
    & = & \lim_{z\to0}\frac{1}{2}\left[\frac{ 2\pi}{3} - \frac{6 \pi z}{45}\right] \\
    & = & \frac{- \pi }{3}
\end{eqnarray*}
Note that if you write  out the expansion with higher orders, they'll go to zero as $z \to 0$ just like the term $\frac{(\pi z)^3}{45}$.
Now we can see that  $C_{N}\subseteq B(0,kN)$ for some $k\in\mathbb{R}$, so we have that $L(C_{N})\leq 2\pi kN$, then we have the upper bound:
\begin{equation*}
            \frac{1}{z^{2}} \leq \frac{2\pi k}{N^{2}}
        \end{equation*}
Now we can say that:
\begin{equation*}
            2\pi\max_{z\in C_{N}} \left(\frac{1}{z^{2}}\right) \cdot L(C_{N})\leq2\pi\max_{z\in C_{N}}\left(\frac{2\pi k}{N^{2}}\right)\cdot L(C_{N})\to0\text{ when }N\to\infty
        \end{equation*}
Then it's easy to see the next limit:
\begin{equation*}
            \left|\int_{C_{N}}\frac{\phi(z)}{z^{2}}dz\right|\to0
        \end{equation*}
Finally, considering we have:
\begin{eqnarray*}
            0=\lim_{N\to\infty}\int_{C_{N}}\frac{\phi(z)}{z^{2}}dz
            & = &   2\pi i\lim_{N\to\infty}    \left( -\frac{\pi^{3}}{3} + \sum_{\begin{subarray}{c}k=-N\\k\neq0\end{subarray}}^{N}\frac{\pi}{k^{2}} \right)\\
            & = &   2\pi i\lim_{N\to\infty}    \left( -\frac{\pi^{3}}{3} + \sum_{k=1}^{N}\frac{2\pi}{k^{2}} \right)\\
        \end{eqnarray*}
We can conclude that
\begin{equation*}
            \sum_{k=1}^{\infty}\frac{1}{k^{2}}=\frac{\pi^{2}}{6}
        \end{equation*}