Proof of Sum of inverse squares Equaling $\pi^2/6$ I'm a 15 year old interested in higher level mathematics. I've recently been studying Complex Analysis from notes of my math teacher from his college math classes. I've understood everything up until the very last 2 pages, when he provides part of a proof that the sum of $1/(n^2)$ from $n=1\to \infty$ is equal to $\pi^2/6$ using residues and the Residue Theorem.
He has written the Residues of the function 
$$
f(z) = \frac{\pi \cot(\pi z)}{z^2}
$$ 
But I want to understand how he got them, so that I feel that I fully understand it myself. I got all the residues at $z = 0, 1, -1, 2, -2, 3, -3, \ldots$ but what I don't understand is this : Res at the pole $z=0$ is $\pi^2/3$. Why? Please explain how he got this to me. I've tried working it out using several methods but can not figure it out.
Thanks.
 A: I will outline Euler's second proof of the Basel problem. If we start with the identity:
$$ \frac{\sin(\pi x)}{\pi x}=\prod_{n\geq 1}\left(1-\frac{x^2}{ n^2}\right) \tag{1}$$
and consider $-\frac{d}{dx}\log(\cdot)$ of both sides, we get:
$$ \frac{1}{x}-\pi\cot(\pi x) = \sum_{n\geq 1}\frac{2x}{n^2-x^2}\tag{2}$$
then rearranging and expanding the terms of the sum in the RHS as geometric series,
$$\frac{1-\pi x\cot(\pi x)}{2}=\sum_{n\geq 1}\frac{x^2}{n^2-x^2}=\sum_{n\geq 1}\sum_{m\geq 1}\frac{x^{2m}}{n^{2m}}=\sum_{m\geq 1}\zeta(2m)\,x^{2m}\tag{3} $$
so the Taylor series of $g(x)=\frac{1-\pi x\cot(\pi x)}{2}$ in the origin gives us the values of $\zeta(2),\zeta(4),\zeta(6),\ldots$
In particular,
$$\zeta(2m) = (2m)!\cdot g^{(2m)}(0). \tag{4}$$
A: For a pole of order $n$, the residue can be evaluated SEE THIS using the formula

$$\text{Res}(f,z=z_0)=\frac{1}{(n-1)!}\lim_{z\to z_0}\frac{d^{(n-1)}}{dz^{(n-1)}}\left((z-z_0)^nf(z)\right) \tag 1$$

Let $f(z)=\frac{\pi \cot(\pi z)}{z^2}$.  Note that $f$ has a pole of order $3$ at $z=0$.  Using $(1)$ with $z_0=0$ and $n=3$, the residue of $f$ at $0$ is given by
$$\begin{align}
\text{Res}\left(\frac{\pi \cot(\pi z)}{z^2},z=0\right)&=\frac12\lim_{z\to 0}\frac{d^2((\pi z) \cot(\pi z))}{dz^2}\\\\
&=\pi^2\lim_{z\to 0}(\pi z \cot(\pi z)\csc^2(\pi z)-\csc^2(\pi z))\tag 2\\\\
&=\bbox[5px,border:2px solid #C0A000]{-\pi^2/3 }\tag 3
\end{align}$$

NOTE:
In going from $(2)$ to $(3)$, we used
$$\pi z\cot(\pi z)=\frac{1-\frac12 (\pi z)^2+O(z^4)}{ (1-\frac16 \pi^2 z^2+O(z^4))}=1-\frac13 \pi ^2z^2+O(z^4)$$
and 
$$\csc^2(\pi z)=\frac{1}{\pi^2 z^2}\left(1+O(z^2)\right)$$

SUPPLEMENTAL DEVELOPMENT:
In THIS ANSWER, I evaluated the series $\sum_{n=1}^\infty \frac1{n^2}$ using real analysis only.  In that development, we used $$\sum_{n=1}^\infty \frac1{n^2}=\int_0^1\int_0^1 \frac{1}{1-xy}\,dx\,dy$$which can be shown by expanding the term $\frac1{1-xy}$ in a geometric series, interchanging the sum and the integrals, and carrying out the trivial integrals $\int_0^1 x^n\,dx$ and $\int_0^1 y^n \,dy$.
A: $$f(z)=\frac{\pi \cot(\pi z)}{z^2}=\frac{\pi \cos(\pi z)}{z^2 \sin(\pi z)}$$
$z=0$ is a pole of order 3 (because $\sin(\pi z)$ has a simple zero at $z=0$).
Therefore 
$$res(f,0)=\frac{1}{2!} \lim_{z \to 0} \left(z^3\frac{\pi \cos(\pi z)}{z^2 \sin(\pi z)} \right)''=\frac{\pi }{2!} \lim_{z \to 0} \left(z \cot(\pi z) \right)'' \\=\frac{\pi }{2!} \lim_{z \to 0} 2 \pi^2 z \cot(\pi z)\csc^2(\pi z)-2 \pi\csc^2(\pi z) \\
=\pi^2 \lim_{z \to 0}  \frac{ \pi z\cos(\pi z)-  \sin(\pi z)}{\sin^3(\pi z)}\\
=\pi^2 \lim_{z \to 0}  \frac{ -\frac{\pi ^3 z^3}{3}+\frac{\pi ^5 z^5}{30}+...}{\pi ^3 z^3-\frac{\pi ^5 z^5}{2}+...}=-\frac{\pi^2}{3}\\$$
A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

Clearly,
  $\ds{{\pi\cot\pars{\pi z} \over z^{2}} \sim {1 \over z^{3}}}$ as $\ds{z \to 0}$
  because
  $\ds{\cot\pars{\pi z} \sim {1 \over \pi}\,{1 \over z}}$ as $\ds{z \to 0}$.

Then, I write
\begin{equation}
{\pi\cot\pars{\pi z} \over z^{2}} \sim
{b_{-3} \over z^{3}} + {b_{-2} \over z^{2}} + {\color{#f00}{b_{-1}} \over z}
\label{1}\tag{1}
\end{equation}
I'm interested in the $\ds{\color{#f00}{b_{-1}}}$ $value$. It's convenient to rewrite \eqref{1} as
\begin{equation}
\pi \sim
\tan\pars{\pi z}\pars{{b_{-3} \over z} + b_{-2} + \color{#f00}{b_{-1}}\,z}
\label{2}\tag{2}
\end{equation}
Note that
$\ds{\tan\pars{\pi z} = \pi z - {\pi^{3} \over 3}\,z^{3} +
{2\pi^{5} \over 15}\,z^{5} + \mrm{O}\pars{z^{7}}}$. \eqref{2} becomes
\begin{equation}
\pi \sim
\pars{\pi z - {\pi^{3} \over 3}\,z^{3}}\pars{{b_{-3} \over z} + b_{-2} + \color{#f00}{b_{-1}}\,z} \equiv \,\mc{F}\pars{z}
\label{3}\tag{3}
\end{equation}
Then, with expression \eqref{3}:
\begin{align}
\pi & = \bracks{z^{0}}\,\mc{F}\pars{z} = \pi b_{-3}\implies
\bbx{\ds{b_{-3} = 1}}
\\
0 & = \bracks{z}\,\mc{F}\pars{z} = \pi b_{-2}\,\,\,\implies b_{-2} = 0
\\
0 & = \bracks{z^{2}}\,\mc{F}\pars{z} =
\pi\color{#f00}{b_{-1}} - {\pi^{3} \over 3}\,b_{-3}\,\,\,\implies
\bbx{\ds{\color{#f00}{b_{-1}} = {\pi^{2} \over 3}\,b_{-3} =
\color{#f00}{\pi^{2} \over 3}}}
\end{align}
