Cauchy Theorem

In general we have

n!2πif(z)(zp)n+1dz=f(n)(p)\frac{n!}{2\pi i} \oint \frac{f(z)}{(z-p)^{n+1}}dz = f^{(n)}(p)

Which can be proven from the power series of f(z)f(z) and the fact that 1/z=2πi\oint 1/z = 2\pi i while 1/zn=0\oint 1/z^n = 0. (True by loop arguments, see figure below)``

The interesting bit is that defining the taylor coefficients like this also works, meaning a smooth complex function has a power series! You prove this with cursed analysis.

Residue theorem

A residue takes a pole α\alpha and writes

f(z)=h(z)(zα)nf(z) = \frac{h(z)}{(z-\alpha)^n}

Where h(z)h(z) is regular, and this equality holds in some circle around z=αz = \alpha. The residue is then defined as


The residue theorem is that

rf(z)dz=2πi  ×  {sum of residues}\oint_r f(z)dz = 2\pi i \;\times \; \left\{\text{sum of residues}\right\}

Prove this by contracting around each pole to get Which, after writing f(z)=h(n1)(α)(zα)nf(z) = \frac{h^{(n-1)}(\alpha)}{(z-\alpha)^n} around each pole α\alpha and summing gives

rf(z)dz={i=1nhi(z)(zαi)ni}dz=2πi{i=1nhi(ni1)(αi)(ni1)!}\oint_r f(z)dz = \oint \left\{\sum_{i=1}^{n} \frac{h_i(z)}{(z-\alpha_i)^{n_i}}\right\}dz = 2\pi i \left\{\sum_{i=1}^n \frac{h_i^{(n_i-1)}(\alpha_i)}{(n_i-1)!}\right\}


We're going to show 1/n2=π2/6\sum 1/n^2 = \pi^2/6 by computing a contour integral around the 2N+12N+1 box, then letting NN \to \infty.

First use the residue theorem on

z2cot(πz)dz\oint z^{-2}\cot{(\pi z)}dz

There's a pole at every zZz \in \mathbf{Z}, first compute the residues. Consider z=0z = 0 and zZ{0}z \in \mathbf{Z}\setminus \{0\} seperately.

Let αZ{0}\alpha \in \mathbf{Z} \setminus \{0\} be a pole. We can write

f(z)=z2cot(πz)=h(z)(zα)f(z) = z^{-2}\cot(\pi z) = \frac{h(z)}{(z - \alpha)}

For regular h(z)h(z). In other words h(z)=zαz2cot(πz)h(z) = \frac{z-\alpha}{z^2}\cot(\pi z). Computing the residue is h(0)(α)/0!=limzαh(z)h^{(0)}(\alpha)/0! = \lim_{z \to \alpha} h(z) which, using LHopital's rule gives

limzαzαz2cos(πz)sin(πz)=limzα1πz2=1πα2\lim_{z \to \alpha} \frac{z-\alpha}{z^2} \frac{\cos(\pi z)}{\sin(\pi z)} = \lim_{z \to \alpha} \frac{1}{\pi z^2} = \frac{1}{\pi \alpha^2}

(This is where we get the 1/n21/n^2 in the sum from!)

Now consider the pole at z=0z = 0. It's multiplicity 33 (22 from z2z^{-2} and 11 from cot(πz)\cot(\pi z)) meaning we can write

h(z)=z3cot(πz)z2=zcot(πz)h(z) = \frac{z^3 \cot(\pi z)}{z^2} = z\cot(\pi z)

Computing the residue means computing h(2)(0)/2!h^{(2)}(0)/2!, taking derivatives gives

h(2)(z)2!=π(πzcot(πz)1)csc2(πz)\frac{h^{(2)}(z)}{2!} = \pi(\pi z\cot(\pi z) - 1)\csc^2(\pi z)

As z0z \to 0 the limit goes to π/3-\pi/3 (source: trust me bro.) meaning the integral (by the residue theorem) equals

z2cot(πz)dz=2πi(π3+2i=1N1πn2)\oint z^{-2}\cot{(\pi z)}dz = 2\pi i\left(-\frac{\pi}{3} + 2\sum_{i=1}^{N} \frac{1}{\pi n^2} \right)

If we can just show this integral goes to zero as NN \to \infty that'll imply

i=1N1n2π26\sum_{i=1}^N \frac{1}{n^2} \to \frac{\pi^2}{6}

We show the integral goes to zero by bounding the integrand via a constant, since all constants have zero contour integral. It's possible to show

cot(πz)2(for large N and z on the 2N+1 box boundary)|\cot(\pi z)| \le 2 \quad\text{(for large $N$ and $z$ on the $2N+1$ box boundary)}

Using Eulers formula and some algebra. First use the formula

cot(πz)=eiπz+eiπzeiπzeiπz=1+e2πiz1e2πiz\cot(\pi z) = \frac{e^{i \pi z} + e^{-i\pi z}}{e^{i\pi z} - e^{-i\pi z}} = \frac{1 + e^{-2\pi i z}}{1 - e^{-2\pi i z}}

Then set z=(N+1/2)+iwz = (N+1/2) + iw for the vertical ones, we have (separating real and imaginary parts)

cot(π(2N+1)+iw)=1+e2πi(N+1/2)e2πi(iw)1e2πi(N+1/2)e2πi(iw)=1e2πi(iw)1+e2πi(iw)=1e2πw1+e2πw\begin{aligned} \cot(\pi (2N+1) + iw) &= \frac{1 + e^{-2\pi i(N+1/2)}e^{-2\pi i(iw)}}{1 - e^{-2\pi i(N+1/2)}e^{-2\pi i(iw)}} \\ &= \frac{1 - e^{-2\pi i(iw)}}{1 + e^{-2\pi i(iw)}} \\ &= \frac{1 - e^{2\pi w}}{1 + e^{2\pi w}} \end{aligned}

At this point you either realize this equals tanh(2πw)\tanh(2\pi w) and so is bounded in norm by 11, or you see that

1ex1+ex=21+ex1<1\left|\frac{1 - e^{x}}{1 + e^x}\right| = \left|\frac{2}{1 + e^x} - 1\right| < 1

Now for the horizontal ones set z=w+i(N+1/2)z = w + i(N+1/2) and simplify the exponents

cot(πz)=1+e2πiwe2π(N+1/2)1e2πiwe2π(N+1/2)\begin{aligned} \cot(\pi z) &= \frac{1 + e^{-2\pi iw}e^{2\pi (N+1/2)}}{1 - e^{-2\pi iw} e^{2\pi (N+1/2)}} \end{aligned}

The e2πiwe^{-2\pi i w} has norm 11, and as NN \to \infty the e2π(N+1/2)e^{2\pi (N+1/2)} terms dominate, meaning the ratio goes to 11, meaning for all ϵ>0\epsilon > 0 there exists an NN large enough that

1+e2πiwe2π(N+1/2)1e2πiwe2π(N+1/2)1+ϵ\left| \frac{1 + e^{-2\pi iw}e^{2\pi (N+1/2)}}{1 - e^{-2\pi iw} e^{2\pi (N+1/2)}}\right| \le 1 + \epsilon

Setting ϵ=1\epsilon = 1 and combining this with out previous result gives

cot(πz)z22N2\left|\frac{\cot(\pi z)}{z^2}\right| \le \frac{2}{N^2}

Which multiplied by the perimeter 4(2N+1)4(2N+1) gives an upper bound for the path integral around the boundary (which is the contour integral).

z2cot(πz)dzP2N2dz(2N2)(8N+4)20N\left|\oint z^{-2}\cot(\pi z)dz\right| \le \left|\int_P \frac{2}{N^2}dz\right| \le \left(\frac{2}{N^2}\right)\left(8N+4\right) \le \frac{20}{N}

This goes to zero as NN \to \infty