Fourier Series/Cosine of x over Minus Pi to Zero, Minus Cosine of x over Zero to Pi

Theorem
Let $\map f x$ be the real function defined on $\openint {-\pi} \pi$ as:


 * $\map f x = \begin {cases}

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

Then its Fourier series can be expressed as:


 * $\displaystyle \map f x \sim -\frac 8 \pi \sum_{r \mathop = 1}^\infty \frac {r \sin 2 r x} {4 r^2 - 1}$

Proof
It is apparent by inspection that $\map f x$ is an odd function over $\openint {-\pi} \pi$.

It follows from Fourier Series for Odd Function over Symmetric Range:


 * $\displaystyle \map f x \sim \sum_{n \mathop = 1}^\infty b_n \sin n x$

where for all $n \in \Z_{> 0}$:
 * $b_n = \displaystyle \frac 2 \pi \int_0^\pi \map f x \sin n x \rd x$

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

Thus by definition of $f$:


 * $\displaystyle b_n = -\frac 2 \pi \int_0^\pi \cos x \sin n x \rd x$

When $n \ne 1$, we have:

When $n = 1$, we have:

Hence:

When $n$ is odd, we have $n = 2 r + 1$ for $r \ge 1$, and so:

When $n$ is even, we have $n = 2 r$ for $r \ge 1$, and so: