# Summation of 1/n^2 using Fourier series on different intervals

I have been going through my notes on complex Fourier series and came across the following anomaly which I hope someone can help me with. I calculated the complex Fourier series for the function $f(\theta)=\theta^{2}$ on $[-\pi,\pi]$ and obtained: \begin{eqnarray*} \theta^{2} &=& \frac{\pi^{2}}{3} + 4\sum_{n=1}^{\infty}\frac{(-1)^{n}\cos(n\theta)}{n^{2}}. \end{eqnarray*} I believe this is the right answer, since I have compared plots of the function $\theta^{2}$ and its series expansion for some truncated upper limit. And also when $\theta=\pi$, $f(\pi)=\pi^{2}$ and this gives a nice proof of \begin{eqnarray*} \sum_{n=1}^{\infty}\frac{1}{n^{2}} &=& \frac{\pi^{2}}{6}. \end{eqnarray*} All is well and good so far. But then I tried to repeat my efforts but on the interval $[0,2\pi]$, which is still legitimate (right?). Then I find \begin{eqnarray*} \theta^{2} &=& \frac{4\pi^{2}}{3} - 4\pi\sum_{n=1}^{\infty}\frac{\sin(n\theta)}{n} + 4\sum_{n=1}^{\infty}\frac{\cos(n\theta)}{n^{2}}. \end{eqnarray*} Again, I plotted $\theta^{2}$ and various truncated series expansions, and they seemed to be in good agreement. But if I choose $\theta=2\pi$, then I seem to arrive at \begin{eqnarray*} \sum_{n=1}^{\infty}\frac{1}{n^{2}} &=& \frac{2\pi^{2}}{3}, \end{eqnarray*} which is incorrect by a factor of four! I notice there seems to be something similarly to Gibbs phenomena at the endpoints, so does this account for the result, or have I made an error in my calculation. It would seem to imply that the interval range should be $[0,2\pi)$ instead or something. Any help would be greatly appreciated.

• Not to mention the baffling $$\sum_{n=1}^\infty{1\over n^2}=-{\pi^2\over3}$$ you get from plugging in $\theta=0$.... – Barry Cipra Mar 3 '15 at 17:59

Recall that Fourier series only converge in the mean: if $f$ is (jump) discontinuous at $x_0$ and we denote by $f^+ = \lim_{x \to x_0^+}f(x)$ and similarly for $f^-$, then the Fourier series of $f$ will return $\frac12(f^+ + f^-)$ at $x_0$.

In this case, you are computing the Fourier series for the $2\pi$-periodic extension of $x^2\vert_{[0,2\pi]}$, which has a jump discontinuity at $2k\pi, k \in \mathbb Z$. In particular, at $2\pi$, the value jumps from $4\pi^2$ to $0$, and so really you should start by writing

$$\frac12 (4\pi^2 + 0) = \frac{4\pi^2}{3} + 4 \sum\frac{\cos(2\pi n)}{n^2}$$

after which, you'll get the expected result.

(and the same thing happens in @Barry Cipra's example: really one should write

$$\dfrac{1}{2}(4\pi^2 + 0) = \frac{4\pi^2}{3} + 4 \sum\frac{\cos(0)}{n^2}$$

and then everything is as it should be.)

• Ah brilliant. Completely forgot about that. Nice to know my calculations aren't completely wrong. Spent so long re-calculating the coefficients and couldn't see an error. Thanks ever so much. – AloneAndConfused Mar 3 '15 at 19:09