Suppose you have a reasonable continuous function on some interval, say on , and you want to approximate it by a trigonometric polynomial. A straightforward approach is to write
where and are the Fourier coefficients:
(Integration can be done with the standard Calculus torture device). With , we get
which, frankly, is not a very good deal for the price.
Still using the standard Fourier expansion formulas, one can improve approximation by shifting the function to and expanding it into the cosine Fourier series.
Then replace with to shift the interval back. With , the partial sum is
which gives a much better approximation with fewer coefficients to calculate.
To see what is going on, one has to look beyond the interval on which is defined. The first series actually approximates the periodic extension of , which is discontinuous because the endpoint values are not equal:
Cosines, being even, approximate the symmetric periodic extension of , which is continuous whenever is.
Discontinuities hurt the quality of Fourier approximation more than the lack of smoothness does.
Just for laughs I included the pure sine approximation, also with .