(a) Extend the definition of <em>f(x)</em> to make it an even function <em>f*(x)</em>,
and we take <em>f*</em> to be periodic over an interval of length <em>P</em> = 4. We compute the coefficients of the cosine series:
Note that <em>a₀</em> = 1 (you can compute the integral again without the cosine, or just take the limit as <em>n</em> -> 0). For all other even integers <em>n</em>, the numerator vanishes, so we split off the odd case for <em>n</em> = 2<em>k</em> - 1 :
Then the cosine series of <em>f(x)</em> is
(b) For the sine series, you instead extend <em>f(x)</em> to an odd function <em>f*(x)</em>,
Again, <em>P</em> = 4, and the coefficient of the sine series are given by
which we can again split into the even/odd cases,
So the sine series is
I've attached plots of the extended versions of <em>f(x)</em> along with the corresponding series up to degree 4.