Solution (source code)

= Solution
{c}

For the <Fourier cosine series>, first take the <even extension> $F_e(x)=f(|x|)$ on $[-\pi,\pi]$, and then its $2\pi$-<periodic extension>. Evenness eliminates the <sine> terms. With the constant term written as $a_0/2$, the <Fourier coefficients> and <series> are
$$
\boxed{a_n=\frac2\pi\int_0^\pi f(x)\cos(nx)\,dx\quad(n=0,1,2,\ldots),\qquad
\frac{a_0}{2}+\sum_{n=1}^\infty a_n\cos(nx).}
$$
For the <Fourier sine series>, take the <odd extension> $F_o(x)=f(x)$ for $0<x<\pi$ and $F_o(x)=-f(-x)$ for $-\pi<x<0$, and extend with period $2\pi$. Values assigned at isolated endpoints do not change the <Fourier coefficients>. Oddness eliminates the constant and <cosine> terms, leaving
$$
\boxed{b_n=\frac2\pi\int_0^\pi f(x)\sin(nx)\,dx\quad(n\geq1),\qquad
\sum_{n=1}^\infty b_n\sin(nx).}
$$
Both formulas follow by <orthogonality> on $[-\pi,\pi]$ and the parity of the extensions.