Fourier Series/Minus Pi over 0 to Pi, x minus Pi over Pi to 2 Pi

Theorem
Let $f \left({x}\right)$ be the real function defined on $\left({0 \,.\,.\, 2 \pi}\right)$ as:


 * $f \left({x}\right) = \begin{cases}

-\pi & : 0 < x \le \pi \\ x - \pi & : \pi < x < 2 \pi \end{cases}$

Then its Fourier series can be expressed as:


 * $f \left({x}\right) \sim \displaystyle -\frac \pi 4 + \sum_{n \mathop = 1}^\infty \left({\frac {1 - \left({-1}\right)^n} {n^2 \pi} \cos n x + \frac {\left({-1}\right)^n - 1} n \sin n x}\right)$

Proof
By definition of Fourier series:


 * $\displaystyle f \left({x}\right) \sim \frac {a_0} 2 + \sum_{n \mathop = 1}^\infty \left({a_n \cos n x + b_n \sin n x}\right)$

where:

for all $n \in \Z_{>0}$.

Thus:

For $n > 0$:

Now for the $\sin n x$ terms:

Finally: