Half-Range Fourier Sine Series/Cosine over 0 to Pi

Theorem
On the interval $\left({0 \,.\,.\, \pi}\right)$:


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

Proof
Let $f \left({x}\right)$ be the function defined as:
 * $\forall x \in \left({0 \,.\,.\, \pi}\right): f \left({x}\right) = \cos x$

Let $f$ be expressed by a half-range Fourier sine series:


 * $\displaystyle f \left({x}\right) \sim \sum_{n \mathop = 1}^\infty b_n \sin \frac {n \pi x} l$

where for all $n \in \Z_{> 0}$:
 * $b_n = \displaystyle \frac 2 l \int_0^l \cos x \sin \frac {n \pi x} l \, \mathrm d x$

In this context, $l = \pi$ and so this can be expressed more simply as:


 * $\displaystyle f \left({x}\right) \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 \cos x \sin n x \, \mathrm d x$

First the case when $n = 1$:

When $n \ne 1$:

Thus for $n = 2 m$ for $m \in \Z$:

and for $n = 2 m + 1$ for $m \in \Z$:

Thus we have:

and so over the given interval: