Mishandling polynomials for fun and profit
One of the more surprising results a mathematician comes across in a university course is that the infinite sum $S = 1 + \frac{1}{4} + \frac{1}{9} + … + \frac{1}{n^2} + …$ comes out as $\frac{\pi^2}{6}$. If $\pi^2$s are going to crop up in sums like that, they should be required to explain themselves!
There is, though, a lovely - if not strictly rigorous - argument for why it should be. (It was put forward by Euler, which is a pretty good argument from authority, if nothing else.)
Consider the function $f(x)=\frac{\sin(x)}{x}$. Anyone with a little bit of analysis under their belt knows that $f(x)$ approaches 1 as $x$ approaches 0; it’s also pretty clear that it has zeros at $\pm \pi$, $\pm 2\pi$, and generally at $\pm n\pi$ for natural $n$.
Factorising!
If we were to approximate it as a polynomial, we might write it in factorised form as $f_F(x) = \left(1-\frac{x}{\pi}\right) \left(1+\frac{x}{\pi}\right) \left(1-\frac{x}{2\pi}\right) \left(1+\frac{x}{2\pi}\right) \left(1-\frac{x}{3\pi}\right) \left(1+\frac{x}{3\pi}\right)… \left(1-\frac{x}{n\pi}\right) \left(1+\frac{x}{n\pi}\right)…$. Better still, spotting that each pair of brackets is the difference of two squares, we can instead go for $f_F(x)= \left(1-\frac{x^2}{\pi^2}\right) \left(1-\frac{x^2}{4\pi^2}\right) \left(1-\frac{x^2}{9\pi^2}\right) … \left(1-\frac{x^2}{n^2\pi^2}\right) …$.
That’s all very pretty, and has some $\pi^2$s in but what does it have to do with the price of fish?
Maclaurin!
Well, you see, $f(x)$ also has a Maclaurin series: $f_M(x) = 1 - \frac{x^2}{6} + \frac{x^4}{120} - …$
If we were to expand $f_F(x)$ up to the $x^2$ term, we’d get $1 - \frac{x^2}{\pi^2} - \frac{x^2}{4\pi^2} - \frac{x^2}{9\pi^2} - … - \frac{x^2}{n^2 \pi^2} - …$.
The price of fish!
Matching coefficients for the $x^2$ term gives $\frac{1}{6} = \frac{1}{\pi^2} + \frac{1}{4\pi^2} + \frac{1}{9\pi^2} + … + \frac{1}{n^2 \pi^2} + …$.
Multiplying both sides by $\pi^2$ gives the result we’re after: $\frac{\pi^2}{6} = \sum_{k=1}^{\infty} \frac{1}{k^2}$.
Glossing over a few issues ((we’re playing a bit fast and loose with infinity here)), it’s a really neat approach, and a similar method using $\cos(x)$ as your function gives a result for the reciprocals of odd squares (namely, they sum to $\frac{\pi^2}{8})$.
I’d be curious to see other proofs of this - preferably at a level I can follow!
* Edited 2017-09-11 to fix something before @realityminus3 spotted it.