Solution (source code)

= Solution

Use the <Maclaurin series> $\sin3x=3x-\tfrac92x^3+O(x^5)$ and $\cos x=1-\tfrac12x^2+O(x^4)$. Multiplication gives
$$
\boxed{f(x)=3x-6x^3+O(x^5)}.
$$
The same terms follow from the two sine harmonics in the <Fourier series> found above.