Theorem: Half-Range Fourier Sine Series/Sine of Half x over 0 to Pi, Minus Sine of Half x over Pi to 2 Pi

Let $\map f x$ be the real function defined on $\openint 0 {2 \pi}$ as:
:600pxthumbright$\map f x$ and its $7$th approximation
:<nowiki>$\map f x = \begin {cases}
\sin \dfrac x 2 & : 0 \le x < \pi \\
-\sin \dfrac x 2 & : \pi < x \le 2 \pi \end {cases}$</nowiki>
Then its Fourier series can be expressed as:
{{begin-eqn}}
{{eqn | l = \map f x
      | o = \sim
      | r = \frac 8 \pi \sum_{n \mathop = 1}^\infty \paren {-1}^{n - 1} \frac {n \sin n x} {4 n^2 - 1}
      | c = 
}}
{{eqn | r = \frac 8 \pi \paren {\frac {\sin x} {1 \times 3} - \frac {2 \sin 2 x} {3 \times 5} + \frac {3 \sin 3 x} {5 \times 7} - \frac {4 \sin 4 x} {7 \times 9} + \frac {5 \sin 5 x} {9 \times 11} - \dotsb}
      | c = 
}}
{{end-eqn}}

Proof:
By definition of half-range Fourier sine series:
:$\ds \map f x \sim \sum_{n \mathop = 1}^\infty b_n \sin \dfrac {n x} 2$
where:
{{begin-eqn}}
{{eqn | l = b_n
      | r = \frac 2 {2 \pi} \int_0^{2 \pi} \map f x \sin \frac {n \pi x} {2 \pi} \rd x
      | c = 
}}
{{eqn | r = \frac 1 \pi \int_0^{2 \pi} \map f x \sin \frac {n x} 2 \rd x
      | c = 
}}
{{end-eqn}}
for all $n \in \Z_{>0}$.
Thus:
{{begin-eqn}}
{{eqn | l = b_n
      | r = \frac 1 \pi \int_0^{2 \pi} \map f x \sin \dfrac {n x} 2 \rd x
      | c = 
}}
{{eqn | r = \frac 1 \pi \int_0^\pi \sin \dfrac x 2 \sin \dfrac {n x} 2 \rd x + \frac 1 \pi \int_\pi^{2 \pi} -\sin \dfrac x 2 \sin \dfrac {n x} 2 \rd x
      | c = Definition of $f$
}}
{{end-eqn}}
When $\dfrac {n x} 2 \ne \dfrac x 2$, that is, when $n \ne 1$, we have:
{{begin-eqn}}
{{eqn | l = \int \sin \dfrac x 2 \sin \dfrac {n x} 2 \rd x
      | r = \frac {\sin \paren {\dfrac x 2 - \dfrac {n x} 2} } {2 \paren {\dfrac 1 2 - \dfrac n 2} } - \frac {\sin \paren {\dfrac x 2 + \dfrac {n x} 2} } {2 \paren {\dfrac 1 2 + \dfrac n 2} } + C
      | c = Primitive of Sine of $\dfrac x 2$ by Sine of $\dfrac {n x} 2$
}}
{{eqn | r = \frac {\sin \paren {\dfrac {\paren {n - 1} x} 2} } {n - 1} - \frac {\sin \paren {\dfrac {\paren {n + 1} x} 2} } {n + 1} + C
      | c = 
}}
{{end-eqn}}
and so for $n \ne 1$:
{{begin-eqn}}
{{eqn | l = b_n
      | r = \frac 1 \pi \int_0^{2 \pi} \map f x \sin \dfrac {n x} 2 \rd x
      | c = 
}}
{{eqn | r = \frac 1 \pi \intlimits {\frac {\sin \paren {\dfrac {\paren {n - 1} x} 2} } {n - 1} - \frac {\sin \paren {\dfrac {\paren {n + 1} x} 2} } {n + 1} } 0 \pi - \frac 1 \pi \intlimits {\frac {\sin \paren {\dfrac {\paren {n - 1} x} 2} } {n - 1} - \frac {\sin \paren {\dfrac {\paren {n + 1} x} 2} } {n + 1} } \pi {2 \pi}
      | c = 
}}
{{eqn | r = \frac 1 \pi \paren {\paren {\frac {\sin \paren {\dfrac {\paren {n - 1} \pi} 2} } {n - 1} - \frac {\sin \paren {\dfrac {\paren {n + 1} \pi} 2} } {n + 1} } - \paren {\frac {\sin \paren {\dfrac {\paren {n - 1} 0} 2} } {n - 1} - \frac {\sin \paren {\dfrac {\paren {n + 1} 0} 2} } {n + 1} } }
      | c = 
}}
{{eqn | o =
      | ro= -
      | r = \frac 1 \pi \paren {\paren {\frac {\sin \paren {\dfrac {\paren {n - 1} 2 \pi} 2} } {n - 1} - \frac {\sin \paren {\dfrac {\paren {n + 1} 2 \pi} 2} } {n + 1} } - \paren {\frac {\sin \paren {\dfrac {\paren {n - 1} \pi} 2} } {n - 1} - \frac {\sin \paren {\dfrac {\paren {n + 1} \pi} 2} } {n + 1} } }
      | c = 
}}
{{eqn | r = \frac 2 \pi \paren {\frac {\sin \paren {\dfrac {\paren {n - 1} \pi} 2} } {n - 1} - \frac {\sin \paren {\dfrac {\paren {n + 1} \pi} 2} } {n + 1} }
      | c = Sine of Multiple of Pi and simplifying
}}
{{end-eqn}}
When $\dfrac {n x} 2 = \dfrac x 2$, that is, when $n = 1$, we have:
{{begin-eqn}}
{{eqn | l = \int \sin \dfrac x 2 \sin \dfrac x 2 \rd x
      | r = \int \sin^2 \dfrac x 2 \rd x + C
      | c = 
}}
{{eqn | r = \frac x 2 - \frac {\sin 2 \dfrac x 2} {4 \dfrac 1 2} + C
      | c = Primitive of $\sin^2 \dfrac x 2$
}}
{{eqn | r = \frac x 2 - \frac {\sin x} 2 + C
      | c = simplifying
}}
{{end-eqn}}
and so for $n = 1$:
{{begin-eqn}}
{{eqn | l = b_n
      | r = \frac 1 \pi \int_0^{2 \pi} \map f x \sin \dfrac x 2 \rd x
      | c = 
}}
{{eqn | r = \frac 1 \pi \intlimits {\frac x 2 - \frac {\sin x} 2} 0 \pi - \frac 1 \pi \intlimits {\frac x 2 - \frac {\sin x} 2} \pi {2 \pi}
      | c = 
}}
{{eqn | r = \frac 1 \pi \paren {\paren {\frac \pi 2 - \frac {\sin \pi} 2} - \paren {\frac 0 2 - \frac {\sin 0} 2} }
      | c = 
}}
{{eqn | o =
      | ro= -
      | r = \frac 1 \pi \paren {\paren {\frac {2 \pi} 2 - \frac {\sin 2 \pi} 2} - \paren {\frac \pi 2 - \frac {\sin \pi} 2} }
      | c = 
}}
{{eqn | r = \frac 1 \pi \paren {\frac \pi 2 - \frac {2 \pi} 2 + \frac \pi 2}
      | c = Sine of Multiple of Pi
}}
{{eqn | r = 0
      | c = everything vanishes
}}
{{end-eqn}}
Hence:
{{begin-eqn}}
{{eqn | l = \map f x
      | o = \sim
      | r = \sum_{n \mathop = 1}^\infty b_n \sin \dfrac {n x} 2
      | c = 
}}
{{eqn | r = \sum_{n \mathop = 2}^\infty \frac 2 \pi \paren {\frac {\sin \paren {\dfrac {\paren {n - 1} \pi} 2} } {n - 1} - \frac {\sin \paren {\dfrac {\paren {n + 1} \pi} 2} } {n + 1} } \sin \dfrac {n x} 2
      | c = substituting for $b_n$ from above
}}
{{end-eqn}}
When $n$ is odd, we have $n = 2 r + 1$ for $r \ge 1$, and so:
{{begin-eqn}}
{{eqn | o =
      | r = \sum_{r \mathop = 1}^\infty \frac 2 \pi \paren {\frac {\sin \paren {\dfrac {\paren {\paren {2 r + 1} - 1} \pi} 2} } {\paren {2 r + 1} - 1} - \frac {\sin \paren {\dfrac {\paren {\paren {2 r + 1} + 1} \pi} 2} } {\paren {2 r + 1} + 1} } \sin \dfrac {\paren {2 r + 1} x} 2
      | c = 
}}
{{eqn | r = \sum_{r \mathop = 1}^\infty \frac 2 \pi \paren {\frac {\sin \paren {\dfrac {2 r \pi} 2} } {2 r} - \frac {\sin \paren {\dfrac {\paren {2 r + 2} \pi} 2} } {2 r + 2} } \sin \dfrac {\paren {2 r + 1} x} 2
      | c = 
}}
{{eqn | r = \sum_{r \mathop = 1}^\infty \frac 2 \pi \paren {\frac {\sin r \pi} {2 r} - \frac {\sin \paren {r + 1} \pi} {2 r + 2} } \sin \dfrac {\paren {2 r + 1} x} 2
      | c = 
}}
{{eqn | r = 0
      | c = Sine of Multiple of Pi
}}
{{end-eqn}}
When $n$ is even, we have $n = 2 r$ for $r \ge 1$, and so:
{{begin-eqn}}
{{eqn | o =
      | r = \sum_{r \mathop = 1}^\infty \frac 2 \pi \paren {\frac {\sin \paren {\dfrac {\paren {2 r - 1} \pi} 2} } {2 r - 1} - \frac {\sin \paren {\dfrac {\paren {2 r + 1} \pi} 2} } {2 r + 1} } \sin \dfrac {2 r x} 2
      | c = 
}}
{{eqn | r = \frac 2 \pi \sum_{r \mathop = 1}^\infty \paren {\frac {\sin \paren {r - \frac 1 2} \pi} {2 r - 1} - \frac {\sin \paren {r + \frac 1 2} \pi} {2 r + 1} } \sin r x
      | c = 
}}
{{eqn | r = \frac 2 \pi \sum_{r \mathop = 1}^\infty \paren {\frac {\paren {-1}^{r - 1} } {2 r - 1} - \frac {\paren {-1}r} {2 r + 1} } \sin r x
      | c = Sine of Half-Integer Multiple of Pi
}}
{{eqn | r = \frac 2 \pi \sum_{r \mathop = 1}^\infty \paren {\frac {\paren {-1}^{r - 1} } {2 r - 1} + \frac {\paren {-1}^{r - 1} } {2 r + 1} } \sin r x
      | c = 
}}
{{eqn | r = \frac 2 \pi \sum_{r \mathop = 1}^\infty \paren {-1}^{r - 1} \paren {\frac {2 r + 1 + 2 r - 1} {\paren {2 r - 1} \paren {2 r + 1} } } \sin r x
      | c = 
}}
{{eqn | r = \frac 2 \pi \sum_{r \mathop = 1}^\infty \paren {-1}^{r - 1} \frac {4 r} {4 r^2 - 1} \sin r x
      | c = Difference of Two Squares
}}
{{eqn | r = \frac 8 \pi \sum_{r \mathop = 1}^\infty \paren {-1}^{r - 1} \frac {r \sin r x} {4 r^2 - 1} 
      | c = simplifying
}}
{{end-eqn}}
{{qed}}