Find coefficients

\(\displaystyle{a}_{{0}}={\frac{{{1}}}{{{2}}}}{\left({f{{\left({0}\right)}}}+{f{{\left(\pi\right)}}}\right)}={\frac{{{1}}}{{{2}}}}{\left({1}+{2}\right)}={\frac{{{3}}}{{{2}}}}\)

\(\displaystyle{a}_{{1}}={\left({f{{\left({0}{\cos{{\left({0}\right)}}}+{f{{\left(\pi\right)}}}{\cos{{\left(\pi\right)}}}\right)}}}={\left({1}{\cos{{\left({0}\right)}}}+{2}{\cos{{\left(\pi\right)}}}\right)}=-{1}\right.}\)

\(\displaystyle{b}_{{1}}={\left({f{{\left({0}\right)}}}{\sin{{\left({0}\right)}}}+{f{{\left(\pi\right)}}}{\sin{{\left(\pi\right)}}}\right)}={\left({1}{\sin{{\left({0}\right)}}}+{2}{\sin{{\left(\pi\right)}}}\right)}={0}\)

Fourier appromation is

\(\displaystyle{g}_{{1}}={\frac{{{3}}}{{{2}}}}-{\cos{{\left({x}\right)}}}\)

\(\displaystyle{a}_{{0}}={\frac{{{1}}}{{{2}}}}{\left({f{{\left({0}\right)}}}+{f{{\left(\pi\right)}}}\right)}={\frac{{{1}}}{{{2}}}}{\left({1}+{2}\right)}={\frac{{{3}}}{{{2}}}}\)

\(\displaystyle{a}_{{1}}={\left({f{{\left({0}{\cos{{\left({0}\right)}}}+{f{{\left(\pi\right)}}}{\cos{{\left(\pi\right)}}}\right)}}}={\left({1}{\cos{{\left({0}\right)}}}+{2}{\cos{{\left(\pi\right)}}}\right)}=-{1}\right.}\)

\(\displaystyle{b}_{{1}}={\left({f{{\left({0}\right)}}}{\sin{{\left({0}\right)}}}+{f{{\left(\pi\right)}}}{\sin{{\left(\pi\right)}}}\right)}={\left({1}{\sin{{\left({0}\right)}}}+{2}{\sin{{\left(\pi\right)}}}\right)}={0}\)

Fourier appromation is

\(\displaystyle{g}_{{1}}={\frac{{{3}}}{{{2}}}}-{\cos{{\left({x}\right)}}}\)