$f$ is the $4$-periodic function $f(x) = 1$ if $x \in [0,2)$ and $f(x) = - 1$ if $x \in [2,4)$
The Fourier series of $f$ is
$$F(t) = {4 \over \pi} \sum_{n=1}^{\infty} {\sin({\pi \over 2}(2n + 1)t) \over 2n + 1}$$
for sure because I calculated it like three times
I want to find the sum $\sum_{n = 1}^{\infty} 1/n^2$ using this. I know I should integrate from $0$ to $1$:
$$1 = \int_0^1 f(t) dt = \int_0^1 F(t) dt = {4 \over \pi} \sum_{n=1}^{\infty} {1 \over 2n+1}\int_0^1 \sin({\pi \over 2}(2n + 1)t)dt = {8 \over \pi^2} \sum_{n=1}^{\infty} {1 \over (2n + 1)^2}$$
now I just break the sum into even and odd terms to find its value
question: how to give complete justification for this interchange of sum and integral?
Help is much appreciated
reply to current answer
we can't interchange integral and sum unless the series is uniformly convergent or the function is positive.. maybe there are weaker conditions but this does not always work!
The series is not uniformly convergent on an interval that includes $0$, typical of Fourier series converging to piecewise continuous functions with jump discontinuities. Furthermore, it is not always possible to apply dominated convergence to justify interchanging the sum and integral.
Nevertheless, you can apply a general result that the Fourier series of a function in $L^1$ can be integrated term-by-term.
Suppose, in general, that $f$ is $2T-$periodic with Fourier sine series
$$f(t) = \sum_{n=1}^\infty b_n \sin\frac{n \pi t}{T}. $$
The series obtained formally by integrating term-by term 0ver $[0,t]$ is
$$\hat{F}(t) = -\sum_{n=1}^\infty \frac{Tb_n}{\pi n} \cos\frac{n \pi t}{T} + \sum_{n=1}^\infty\frac{Tb_n}{\pi n}. $$
Now consider
$$F(t) = \int_0^t f(s) \, ds.$$
Since $f$ is integrable and periodic, it follows that $F$ is absolutely continuous with the same periodicity. Hence, $F$ has a convergent Fourier series
$$F(t) = \frac{A_0}{2} + \sum_{n=1}^\infty \left( A_n\cos\frac{n \pi t}{T} + B_n \sin\frac{n \pi t}{T} \right), $$
where
$$ A_n = \frac{1}{T}\int_0^{2T}F(t) \cos \frac{n \pi t}{T} \, dt, \\ B_n = \frac{1}{T}\int_0^{2T}F(t) \sin \frac{n \pi t}{T} \, dt.$$
Now use integration by parts, with boundary terms vanishing due to periodicity , to obtain
$$A_n = \left.f(t) \frac{1}{\pi}\sin \frac{n \pi t}{T}\right|_0^{2T} - \frac{1}{T} \int_0^{2T} f(t) \frac{T}{\pi n} \sin \frac{n \pi t}{T} \, dt = - \frac{T b_n}{\pi n}, \\ B_n = \left.-f(t) \frac{1}{\pi}\cos \frac{n \pi t}{T}\right|_0^{2T} + \frac{1}{T} \int_0^{2T} f(t) \frac{T}{\pi n} \cos \frac{n \pi t}{T} \, dt = 0. $$
Hence,
$$F(t) = \frac{A_0}{2} - \sum_{n=1}^\infty \frac{Tb_n}{\pi n}\cos\frac{n \pi t}{T}.$$
Since, $F(0) = 0$ we have
$$\frac{A_0}{2} = \sum_{n=1}^\infty \frac{Tb_n}{\pi n},$$
and
$$F(t) = \hat{F}(t).$$