Theorem: Fourier Series/1 over -1 to 0, Cosine of Pi x over 0 to 1

Let $\map f x$ be the real function defined on $\openint {-1} 1$ as:
:800pxthumbright$\map f x$ and its $7$th approximation
:$\map f x = \begin{cases}
1 & : -1 < x < 0 \\
\map \cos {\pi x} & : 0 < x < 1
\end{cases}$
Then its Fourier series can be expressed as:
:$\map f x \sim \displaystyle \dfrac 1 2 + \frac {\cos \pi x} 2 + \sum_{r \mathop = 1}^\infty \paren {\dfrac {4 r \sin 2 r \pi x} {\pi \paren {2 r + 1} \paren {2 r - 1} } - \dfrac {2 \map \sin {2 r + 1} \pi x } {\pi \paren {2 r + 1} } }$

Proof:
By definition of Fourier series:
:$\displaystyle \map f x \sim \frac {a_0} 2 + \sum_{n \mathop = 1}^\infty \paren {a_n \cos n \pi x + b_n \sin n \pi x}$
where:
{{begin-eqn}}
{{eqn | l = a_n
      | r = \int_{-1}^1 \map f x \cos n \pi x \rd x
}}
{{eqn | l = b_n
      | r = \int_{-1}^1 \map f x \sin n \pi x \rd x
}}
{{end-eqn}}
for all $n \in \Z_{>0}$.
Thus:
{{begin-eqn}}
{{eqn | l = a_0
      | r = \int_{-1}^1 \map f x \rd x
      | c = Cosine of Zero is One
}}
{{eqn | r = \int_{-1}^0 1 \rd x + \int_0^1 \map \cos {\pi x} \rd x
      | c = 
}}
{{eqn | r = \bigintlimits x {-1} 0 + \intlimits {\frac {\map \sin {\pi x} } \pi} 0 1
      | c = Primitive of Power, Primitive of $\cos \pi x$
}}
{{eqn | r = \paren {0 - \paren {-1} } - \paren {\frac {\sin \pi} \pi - \frac {\sin 0} \pi}
      | c = 
}}
{{eqn | r = 1 - 0
      | c = Sine of Multiple of Pi
}}
{{eqn | r = 1
      | c = 
}}
{{end-eqn}}
{{qed|lemma}}
For $n > 0$:
{{begin-eqn}}
{{eqn | l = a_n
      | r = \int_{-1}^1 \map f x \cos n \pi x \rd x
      | c = 
}}
{{eqn | r = \int_{-1}^0 \cos n \pi x \rd x + \int_0^1 \cos \pi x \cos n \pi x \rd x
      | c = Definition of $f$
}}
{{end-eqn}}
Splitting this up into bits:
{{begin-eqn}}
{{eqn | o = 
      | r = \int_{-1}^0 \cos n \pi x \rd x
      | c = 
}}
{{eqn | r = \intlimits {\frac {\sin n \pi x} {n \pi} } {-1} 0
      | c = Primitive of $\cos n \pi x$
}}
{{eqn | r = \paren {\frac {\sin 0} {n \pi} } - \paren {\frac {\map \sin {-n \pi} } {n \pi} }
      | c = 
}}
{{eqn | r = 0
      | c = Sine of Multiple of Pi
}}
{{end-eqn}}
For $0 < x < 1$, there are two cases that need to be addressed: when $n = 1$ and when $n > 1$.
First let $n > 1$.
We have:
{{begin-eqn}}
{{eqn | o = 
      | r = \int_0^1 \cos \pi x \cos n \pi x \rd x
      | c = 
}}
{{eqn | r = \intlimits {\frac {\map \sin {\pi - n \pi} x} {2 \paren {\pi - n \pi} } + \frac {\map \sin {\pi + n \pi} x} {2 \paren {\pi + n \pi} } } 0 1
      | c = Primitive of $\cos \pi x \cos n \pi x$
}}
{{eqn | r = \intlimits {\frac {\map \sin {1 - n} \pi x} {2 \paren {1 - n} \pi} + \frac {\map \sin {1 + n} \pi x} {2 \paren {\paren {1 + n} \pi} } } 0 1
      | c = 
}}
{{eqn | r = \paren {\frac {\map \sin {1 - n} \pi} {2 \paren {1 - n} \pi} + \frac {\map \sin {1 + n} \pi} {2 \paren {\paren {1 + n} \pi} } } - \paren {\frac {\sin 0} {2 \paren {1 - n} \pi} + \frac {\sin 0} {2 \paren {\paren {1 + n} \pi} } }
      | c = 
}}
{{eqn | r = 0 - 0
      | c = Sine of Multiple of Pi
}}
{{eqn | r = 0
      | c = 
}}
{{end-eqn}}
Now let $n = 1$.
We have:
{{begin-eqn}}
{{eqn | o = 
      | r = \int_0^1 \cos \pi x \cos \pi x \rd x
      | c = 
}}
{{eqn | r = \int_0^1 \cos^2 \pi x \rd x
      | c = 
}}
{{eqn | r = \intlimits {\frac x 2 + \frac {\sin 2 \pi x} {4 \pi} } 0 1
      | c = Primitive of $\cos^2 \pi x$
}}
{{eqn | r = \paren {\frac 1 2 + \frac {\sin 2 \pi} {4 \pi} } - \paren {\frac 0 2 + \frac {\sin 0} {4 \pi} }
      | c = 
}}
{{eqn | r = \paren {\frac 1 2 + 0} - \paren {0 + 0}
      | c = Sine of Multiple of Pi
}}
{{eqn | r = \frac 1 2
      | c = 
}}
{{end-eqn}}
There is only one non-vanishing term:
:$a_1 = \dfrac 1 2$
{{qed|lemma}}
Now for the $\sin n \pi x$ terms:
{{begin-eqn}}
{{eqn | l = b_n
      | r = \int_{-1}^1 \map f x \sin n \pi x \rd x
      | c = 
}}
{{eqn | r = \int_{-1}^0 \sin n \pi x \rd x + \int_0^1 \cos \pi x \sin n \pi x \rd x
      | c = 
}}
{{end-eqn}}
For $-1 < x < 0$:
{{begin-eqn}}
{{eqn | o = 
      | r = \int_{-1}^0 \sin n \pi x \rd x
      | c = 
}}
{{eqn | r = \intlimits {\frac {-\cos n \pi x} {n \pi} } {-1} 0
      | c = Primitive of $\sin n \pi x$
}}
{{eqn | r = \paren {\frac {-\cos 0} {n \pi} } - \paren {\frac {-\map \cos {-n \pi} } {n \pi} }
      | c = 
}}
{{eqn | r = \frac {\map \cos {-n \pi} - 1} {n \pi}
      | c = Cosine of Zero is One and rearrangement
}}
{{eqn | r = \frac {\paren {-1}^n - 1} {n \pi}
      | c = Cosine of Multiple of Pi
}}
{{eqn | r = \begin {cases} 0 & : \text {$n$ even} \\ \dfrac {-2} {n \pi} & : \text {$n$ odd} \end {cases}
      | c = 
}}
{{eqn | ll= \leadsto
      | l = b_{2 r + 1}
      | r = \dfrac {-2} {\pi \paren {2 r + 1} }
      | c = substituting $n = 2 r + 1$ and simplifying
}}
{{end-eqn}}
For $0 < x < 1$, there are two cases that need to be addressed: when $n = 1$ and when $n > 1$.
First let $n > 1$.
{{begin-eqn}}
{{eqn | o = 
      | r = \int_0^1 \cos \pi x \sin n \pi x \rd x
      | c = 
}}
{{eqn | r = \intlimits {\frac {-\map \cos {n \pi - \pi} x} {2 \paren {n \pi - \pi} } - \frac {\map \cos {n \pi + \pi} x} {2 \paren {n \pi + \pi} } } 0 1
      | c = Primitive of $\cos \pi x \sin n \pi x$
}}
{{eqn | r = \intlimits {\frac {-\map \cos {n - 1} \pi x} {2 \paren {n - 1} \pi} - \frac {\map \cos {n + 1} \pi x} {2 \paren {n + 1} \pi} } 0 1
      | c = 
}}
{{eqn | r = \paren {\frac {-\map \cos {n - 1} \pi} {2 \paren {n - 1} \pi} - \frac {\map \cos {n + 1} \pi} {2 \paren {n + 1} \pi} } - \paren {\frac {-\cos 0} {2 \paren {n - 1} \pi} - \frac {\cos 0} {2 \paren {n + 1} \pi} }
      | c = 
}}
{{eqn | r = \dfrac 1 {2 \pi} \paren {\frac {1 - \map \cos {n - 1} \pi} {n - 1} + \frac {1 - \map \cos {n + 1} \pi} {n + 1} }
      | c = Cosine of Zero is One and simplifying
}}
{{eqn | r = \dfrac 1 {2 \pi} \paren {\frac {1 - \paren {-1}^{n - 1} } {n - 1} + \frac {1 - \paren {-1}^{n + 1} } {n + 1} }
      | c = Cosine of Multiple of Pi
}}
{{eqn | r = \dfrac 1 {2 \pi} \paren {\begin {cases} \paren {\dfrac 2 {n - 1} + \dfrac 2 {n + 1} } & : \text {$n$ even} \\ 0 & : \text {$n$ odd} \end {cases} }
      | c = 
}}
{{eqn | ll= \leadsto
      | l = b_{2 r}
      | r = \dfrac 1 \pi \paren {\dfrac 1 {2 r - 1} + \dfrac 1 {2 r + 1} }
      | c = substituting $n = 2 r$ and simplifying
}}
{{eqn | r = \dfrac 1 \pi \dfrac {\paren {2 r + 1} + \paren {2 r - 1} } {\paren {2 r + 1} \paren {2 r - 1} }
      | c = 
}}
{{eqn | r = \dfrac {4 r} {\pi \paren {2 r + 1} \paren {2 r - 1} }
      | c = 
}}
{{end-eqn}}
Now let $n = 1$.
{{begin-eqn}}
{{eqn | o = 
      | r = \int_0^1 \cos \pi x \sin \pi x \rd x
      | c = 
}}
{{eqn | r = \intlimits {\frac {\sin^2 \pi x} {2 \pi} } 0 1
      | c = Primitive of $\cos \pi x \sin \pi x$
}}
{{eqn | r = \paren {\frac {\sin^2 \pi} {2 \pi} } - \paren {\frac {\sin^2 \pi 0} {2 \pi} }
      | c = 
}}
{{eqn | r = 0 - 0
      | c = Sine of Multiple of Pi
}}
{{eqn | r = 0
      | c = 
}}
{{end-eqn}}
In summary:
:$\begin {cases} a_0 = 1 \\ a_1 = \dfrac 1 2 \\ b_{2 r} = \dfrac {4 r} {\pi \paren {2 r + 1} \paren {2 r - 1} } \\ b_{2 r + 1} = \dfrac {-2} {\pi \paren {2 r + 1} } \end {cases}$
{{qed|lemma}}
Finally:
{{begin-eqn}}
{{eqn | l = \map f x
      | o = \sim
      | r = \frac {a_0} 2 + \sum_{n \mathop = 1}^\infty \paren {a_n \cos n x + b_n \sin n x}
      | c = 
}}
{{eqn | r = \frac {1 + \cos \pi x} 2 + \sum_{r \mathop = 1}^\infty \paren {\dfrac {4 r \sin 2 r \pi x} {\pi \paren {2 r + 1} \paren {2 r - 1} } - \dfrac {2 \map \sin {2 r + 1} \pi x } {\pi \paren {2 r + 1} } }
      | c = substituting for $a_0$, $a_n$ and $b_n$ from above
}}
{{end-eqn}}
{{qed}}