Solution (source code)

= Solution

Let $S_N$ be the <Fourier partial sum> through frequency $N$. By <orthogonality> and the coefficient formulas,
$$
\int_{-L}^{L}S_N^2\,dx
=\frac{La_0^2}{2}+L\sum_{n=1}^{N}(a_n^2+b_n^2),
\qquad
\int_{-L}^{L}fS_N\,dx=\int_{-L}^{L}S_N^2\,dx.
$$
Expanding the nonnegative squared <L2 norm> of the error gives the exact finite identity
$$
\int_{-L}^{L}(f-S_N)^2\,dx
=\int_{-L}^{L}f^2\,dx-\frac{La_0^2}{2}-L\sum_{n=1}^{N}(a_n^2+b_n^2).
$$
For $f$ in the <L2 space>, completeness of the <Fourier basis> makes the left-hand side tend to zero. Dividing the resulting equality by $2L$ proves <Parseval's identity>:
$$
\boxed{\frac1{2L}\int_{-L}^{L}f(x)^2\,dx
=\frac{a_0^2}{4}+\frac12\sum_{n=1}^\infty(a_n^2+b_n^2)}.
$$
This argument uses <convergence in L2> rather than an unqualified exchange of an infinite sum with the <integral> of its square. The <function> in part (c) is continuous and piecewise polynomial, so these hypotheses hold.