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

Let $\map f x$ be the real function defined on $\openint {-\pi} \pi$ as:
:600pxthumbright$\map f x$ and its $7$th approximation
:$\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:
{{begin-eqn}}
{{eqn | l = \map f x
      | o = \sim
      | r = -\frac 8 \pi \sum_{r \mathop = 1}^\infty \frac {r \sin 2 r x} {4 r^2 - 1}
      | c = 
}}
{{eqn | r = -\frac 8 \pi \paren {\frac {\sin 2 x} {1 \times 3} + \frac {\sin 4 x} {3 \times 5} + \frac {\sin 6 x} {5 \times 7}  + \frac {\sin 8 x} {7 \times 9} + \dotsb}
      | c = 
}}
{{end-eqn}}

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:
:$\ds \map f x \sim \sum_{n \mathop = 1}^\infty b_n \sin n x$
where for all $n \in \Z_{> 0}$:
:$b_n = \ds \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$:
:$\ds b_n = -\frac 2 \pi \int_0^\pi \cos x \sin n x \rd x$
When $n \ne 1$, we have:
{{begin-eqn}}
{{eqn | l = b_n
      | r = -\frac 2 \pi \int_0^\pi \cos x \sin n x \rd x
      | c = 
}}
{{eqn | r = -\frac 2 \pi \intlimits {\frac {-\cos \paren {n - 1} x} {2 \paren {n - 1} } - \frac {\cos \paren {n + 1} x} {2 \paren {n + 1} } } 0 \pi
      | c = Primitive of $\cos x \sin n x$
}}
{{eqn | r = -\frac 2 \pi \paren {\paren {\frac {-\cos \paren {n - 1} \pi} {2 \paren {n - 1} } - \frac {\cos \paren {n + 1} \pi} {2 \paren {n + 1} } } - \paren {\frac {-\cos \paren {n - 1} 0} {2 \paren {n - 1} } - \frac {\cos \paren {n + 1} 0} {2 \paren {n + 1} } } }
      | c = 
}}
{{eqn | r = \frac 1 \pi \paren {\paren {\frac {\cos \paren {n - 1} \pi} {n - 1} + \frac {\cos \paren {n + 1} \pi} {n + 1} } - \paren {\frac 1 {n - 1} + \frac 1 {n + 1} } }
      | c = Cosine of Zero is One and simplifying
}}
{{eqn | r = \frac 1 \pi \paren {\frac {\cos \paren {n - 1} \pi} {n - 1} - \frac 1 {n - 1} + \frac {\cos \paren {n + 1} \pi} {n + 1} - \frac 1 {n + 1} }
      | c = simplifying
}}
{{end-eqn}}
When $n = 1$, we have:
{{begin-eqn}}
{{eqn | l = b_n
      | r = -\frac 2 \pi \int_0^\pi \cos x \sin x \rd x
      | c = 
}}
{{eqn | r = -\frac 2 \pi \intlimits {\frac {\sin^2 x} 2} 0 \pi
      | c = Primitive of $\cos x \sin x$
}}
{{eqn | r = -\frac 2 \pi \paren {\frac {\sin^2 \pi} 2 - \frac {\sin^2 0} 2}
      | c = 
}}
{{eqn | r = 0
      | c = Sine of Multiple of Pi
}}
{{end-eqn}}
Hence:
{{begin-eqn}}
{{eqn | l = \map f x
      | o = \sim
      | r = \sum_{n \mathop = 1}^\infty b_n \sin n x
      | c = 
}}
{{eqn | r = \frac 1 \pi \sum_{n \mathop = 2}^\infty \paren {\frac {\cos \paren {n - 1} \pi} {n - 1} - \frac 1 {n - 1} + \frac {\cos \paren {n + 1} \pi} {n + 1} - \frac 1 {n + 1} } \sin n x
      | c = substituting for $b_n$ from above and rearranging
}}
{{end-eqn}}
When $n$ is odd, we have $n = 2 r + 1$ for $r \ge 1$, and so:
{{begin-eqn}}
{{eqn | o =
      | r = \frac 1 \pi \sum_{r \mathop = 1}^\infty \paren {\frac {\cos \paren {\paren {2 r + 1} - 1} \pi} {\paren {2 r + 1} - 1} - \frac 1 {\paren {2 r + 1} - 1} + \frac {\cos \paren {\paren {2 r + 1} + 1} \pi} {\paren {2 r + 1} + 1} - \frac 1 {\paren {2 r + 1} + 1} } \sin \paren {2 r + 1} x
      | c = 
}}
{{eqn | r = \frac 1 \pi \sum_{r \mathop = 1}^\infty \paren {\frac {\cos 2 r \pi} {2 r} - \frac 1 {2 r} + \frac {\cos \paren {2 r + 2} \pi} {2 r + 2} - \frac 1 {2 r + 2} } \sin \paren {2 r + 1} x
      | c = 
}}
{{eqn | r = \frac 1 \pi \sum_{r \mathop = 1}^\infty \paren {\frac 1 {2 r} - \frac 1 {2 r} + \frac 1 {2 r + 2} - \frac 1 {2 r + 2} } \sin \paren {2 r + 1} x
      | c = Cosine of Multiple of Pi
}}
{{eqn | r = 0
      | c = everything vanishes
}}
{{end-eqn}}
When $n$ is even, we have $n = 2 r$ for $r \ge 1$, and so:
{{begin-eqn}}
{{eqn | o =
      | r = \frac 1 \pi \sum_{r \mathop = 1}^\infty \paren {\frac {\cos \paren {2 r - 1} \pi} {2 r - 1} - \frac 1 {2 r - 1} + \frac {\cos \paren {2 r + 1} \pi} {2 r + 1} - \frac 1 {2 r + 1} } \sin 2 r x
      | c = 
}}
{{eqn | r = \frac 1 \pi \sum_{r \mathop = 1}^\infty \paren {\frac {-1} {2 r - 1} - \frac 1 {2 r - 1} + \frac {-1} {2 r + 1} - \frac 1 {2 r + 1} } \sin 2 r x
      | c = Cosine of Multiple of Pi
}}
{{eqn | r = -\frac 2 \pi \sum_{r \mathop = 1}^\infty \paren {\frac 1 {2 r - 1} + \frac 1 {2 r + 1} } \sin 2 r x
      | c = 
}}
{{eqn | r = -\frac 2 \pi \sum_{r \mathop = 1}^\infty \frac {\paren {2 r + 1} + \paren {2 r - 1} } {\paren {2 r - 1} \paren {2 r + 1} } \sin 2 r x
      | c = 
}}
{{eqn | r = -\frac 2 \pi \sum_{r \mathop = 1}^\infty \frac {4 r} {4 r^2 - 1} \sin 2 r x
      | c = Difference of Two Squares and simplifying
}}
{{eqn | r = -\frac 8 \pi \sum_{r \mathop = 1}^\infty \frac {r \sin 2 r x} {4 r^2 - 1}
      | c = simplifying
}}
{{end-eqn}}
{{qed}}