Let $u:[0,2\pi)\to \mathbb{R}$ be the step function
$$u(x) = \begin{cases}
1 & \text{if } x \in [0,\pi), \\
0 & \text{if } x \in [\pi,2\pi)
\end{cases}$$
By a direct computation, one discovers that 
\begin{equation}\tag{$\*$}
\|u-S\_N u\|\_{L^2} \leq C N^{-1/2},
\end{equation}
where $S\_N u $ is the truncated Fourier series of $u$:
$$S\_N u(x) = \sum\_{k = -N}^N c\_k e^{i k x}, \quad c\_k = \frac{1}{2\pi}\int\_0^{2\pi} u(x) e^{-ikx} dx.$$


I am quite sure that a bound of the form $(\*)$ holds for generic piecewise continuous functions on $[0,2\pi)$, but I didn't manage to find anything in the literature... The books that I consulted usually explain the Gibbs phenomenon for discontinuous functions, but $L^2$ error estimates are provided only when $u$ is regular.


Please give me a reference or maybe a counterexample, if I am wrong. Thank you!



Fourier approximation error in L^2 for piecewise continuous functions
Such an assertion is close enough to being an "exercise" that there may not be a really clear "reference" for it... but such a result can be explained easily and shortly enough, I think:


Finite sums of (dilates of translates of) derivatives of $\cos x/2$ can be subtracted from a given (finitely-) piecewise smooth periodic function to give a $C^2$ periodic function (meaning $C^2$ on the circle, so imposing a matching condition at $0$ and $2\pi$). The derivatives of $\cos x/2$ are essentially itself and $\sin x/2$, so direct computation shows that the Fourier coefficients of any derivative of $\cos x/2$ decay like $1/n$, so that the $L^2$ norm of tails are like $1/\sqrt{N}$, as desired.


(The same conclusion is a little less obvious if the discontinuities are approximated by piecewise-polynomial functions, because then the boundary terms in integration by parts play a role...)


