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

Theorem
On the interval $\openint 0 \pi$:


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

Proof
Let $\map f x$ be the function defined as:
 * $\forall x \in \openint 0 \pi: \map f x = \cos x$

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


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

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

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


 * $\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 \cos x \sin n x \rd 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: