Find the fourier series representation of a function 
Consider the function 
  $f(x) =
\begin{cases}
\frac{\pi}{2}+x & & x \in (-\pi, 0] \\
\frac{\pi}{2}-x & & x \in (0, \pi]\\
\end{cases}$
  extended 2$\pi$ periodically to $\mathbb{R}$. Calculate $a_0, a_n, b_n$

I understand how to work out a fourier series but I am unsure what to set for $f(x)$ due to the way its set out.
Would I have $a_0=\frac{1}{2\pi}\int_{-\pi}^{\pi}\frac{\pi}{2}+x dx$ due to splitting it into odd and even parts?
 A: Divide it two parts and calculate $$a_{ 0 }=\frac { 1 }{ \pi  } \int _{ -\pi  }^{ \pi  } f\left( x \right) dx=\frac { 1 }{ \pi  } \int _{ -\pi  }^{ 0 }{ \left( \frac { \pi  }{ 2 } +x \right) dx } +\frac { 1 }{ \pi  } \int _{ 0 }^{ \pi  }{ \left( \frac { \pi  }{ 2 } -x \right) dx } =\\ ={ \left( \frac { \pi  }{ 2 } x+\frac { { x }^{ 2 } }{ 2 }  \right)  }_{ -\pi  }^{ 0 }{ +\left( \frac { \pi  }{ 2 } x-\frac { { x }^{ 2 } }{ 2 }  \right)  }_{ -\pi  }^{ 0 }=0\\ { a }_{ n }=\frac { 1 }{ \pi  } \int _{ -\pi  }^{ \pi  } f\left( x \right) \cos { \left( nx \right)  } dx=\frac { 1 }{ \pi  } \left( \int _{ -\pi  }^{ 0 }{ \left( \frac { \pi  }{ 2 } +x \right) \cos { \left( nx \right)  } dx } +\int _{ 0 }^{ \pi  }{ \left( \frac { \pi  }{ 2 } -x \right) \cos { \left( nx \right)  } dx }  \right) \\ { b }_{ n }=\frac { 1 }{ \pi  } \int _{ -\pi  }^{ \pi  } f\left( x \right) \sin { \left( nx \right)  } dx=\frac { 1 }{ \pi  } \left( \int _{ -\pi  }^{ 0 }{ \left( \frac { \pi  }{ 2 } +x \right) \sin { \left( nx \right)  } dx } +\int _{ 0 }^{ \pi  }{ \left( \frac { \pi  }{ 2 } -x \right) \sin { \left( nx \right)  } dx }  \right) $$
Can you take from here?
