I am trying to integrate the Fourier series of $$f(x) = x,-\pi<x<\pi.$$ Using complex exponentials to find the series, I get the series $$\frac{2}{\pi} \sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n} \cdot \sin(nx).$$
Integrating will add an $n$ to the denominator and result in more rapid convergence. But when I try to integrate this series, I just end up with the series times the integral $\int_{-\pi}^{\pi}\sin(nx) \,dx$, which makes everything zero. If I integrate it termwise, I also end up with zero.
Does anybody know what mistake I am making? I am told by that integrating this, one can obtain $$\sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n^2} = 1 - \frac{1}{4} + \frac{1}{9}-\frac{1}{16} + ... = \frac{\pi^2}{12}.$$
Any help at all is appreciated, as I am quite flustered that this simple problem has stumped me.
]if you multiply by $x$ before integrating you have: $$ \int_{-\pi}^{\pi} x^2 dx = 2 \sum_{n=1}^{\infty}\frac{(-1)^{n+1}}{n} \cdot \int_{-\pi}^{\pi} x \sin(nx) dx $$ which (integrated by parts) gives: $$ \frac{2\pi^3}3 = 2 \sum_{n=1}^{\infty}\left[ (-1)^n \frac{x \cos nx}{n^2} \right]_{-\pi}^{\pi} $$ or $$ \sum_{n=1}^{\infty} \frac1{n^2} = \frac{\pi^2}6 $$ from this you have (given absolute convergence of the series) $$ \sum_{n=1}^{\infty} (-1)^{n+1}\frac1{n^2} = \sum_{n=1}^{\infty} \frac1{n^2} -2 \cdot \frac14 \sum_{n=1}^{\infty} \frac1{n^2} \\ = \frac{\pi^2}{12} $$