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!

An introduction to harmonic analysis.) Do you need an estimate for the rate of convergence when the function happens to be piecewise continuous? $\endgroup$2more comments