= Solution
Separate the already finite sine terms from the even part $g(x)=x^2-\pi|x|$. Since $g$ is an <even function>, it has no sine coefficients. Its constant coefficient is
$$
a_0=\frac2\pi\int_0^\pi(x^2-\pi x)dx=-\frac{\pi^2}{3}.
$$
For $n\geq1$, <integration by parts> gives
$$
\int_0^\pi x\cos nx\,dx=\frac{(-1)^n-1}{n^2},\qquad
\int_0^\pi x^2\cos nx\,dx=\frac{2\pi(-1)^n}{n^2}.
$$
Therefore the cosine <Fourier coefficients> are
$$
a_n=\frac2\pi\int_0^\pi(x^2-\pi x)\cos nx\,dx
=\frac{2(1+(-1)^n)}{n^2}.
$$
Only even frequencies survive: $a_{2m}=1/m^2$. The sine <Fourier coefficients> are $b_1=1$, $b_2=-2$, with all others zero. Hence
$$
\boxed{f(x)=\sin x-2\sin2x-\frac{\pi^2}{6}
+\sum_{m=1}^\infty\frac{\cos2mx}{m^2}}.
$$
The periodic function is continuous at zero and at its endpoint joins, and its coefficients are absolutely summable. Thus this <Fourier series> represents it everywhere, including those joins.
Back to article page