\documentclass[a4paper,12pt]{article}
\setlength\oddsidemargin{0pt} \setlength\evensidemargin{0pt}
\setlength\topmargin{0pt}
\begin{document}
\parindent=0pt
{\bf Exam Question

Topic: Fourier Series}

Find the Fourier Series for the function $$f(x)=\pi-\vert x\vert\
\ (-\pi\le x \le\pi).$$ \vspace{0.5in}

{\bf Solution}

$f$ is an even function so $b_n=0$ for all $n$.
$$a_0=\mathrm{area\ of\ triangle\ under\ the\ graph\ of\ } f =
\pi$$

\begin{eqnarray*}
a_n & = & \frac{1}{\pi}\int_{-\pi}^{\pi}f(x)\cos nx\ dx =
\frac{2}{\pi}\int_0^{\pi}(\pi-x)\cos nx\ dx \\ & = &
\frac{2}{\pi}\int_0^{\pi}(\pi\cos nx-x\cos nx)\ dx \\ & = &
\frac{2}{\pi}\left[\pi\frac{\sin nx}{n}-x\frac{\sin nx}{n} -
\frac{\cos nx}{n^2}\right]_0^{\pi}\\ & = &
\frac{2}{\pi}\left[-\frac{\cos n\pi}{n^2}+\frac{1}{n^2}\right] =
\frac{2}{n^2\pi}\left(1-(-1)^n\right)
\end{eqnarray*}

So the Fourier Series is
$$\frac{\pi}{2}+\sum_{n=1}^{\infty}\frac{2}{n^2\pi}\left(1-(-1)^n\right)\cos
nx $$


\end{document}
