Solution (source code)

= Solution

Repeated integration by parts in the cosine-coefficient <integral> shows $|c_k|\le C_rk^{-r}$ for every $r$ when $f$ is smooth (endpoint terms vanish after using the even periodic extension). Parseval then bounds the squared tail by $C_r\sum_{k>N}k^{-2r}$, which is $O(N^{-2r+1})$. Choosing $r$ arbitrarily large proves spectral convergence.