Theorem: Half-Range Fourier Cosine Series/Cosine of Non-Integer Multiple of x over 0 to Pi

Let $\lambda \in \R \setminus \Z$ be a real number which is not an integer.
:500pxthumbright$\map f x$ for $\lambda = 4 \cdotp 6$ and its $5$th approximation
Let $\map f x$ be the real function defined on $\openint 0 \pi$ as:
:$\map f x = \cos \lambda x$
Then its half-range Fourier cosine series can be expressed as:
{{begin-eqn}}
{{eqn | l = \map f x
      | o = \sim
      | r = \frac {2 \lambda \sin \lambda \pi} \pi \paren {\frac 1 {2 \lambda^2} + \sum_{n \mathop = 1}^\infty \paren {-1}^n \frac {\cos n x} {\lambda^2 - n^2} }
      | c = 
}}
{{eqn | r = \frac {2 \lambda \sin \lambda \pi} \pi \paren {\frac 1 {2 \lambda^2} - \frac {\cos x} {\lambda^2 - 1} + \frac {\cos 2 x} {\lambda^2 - 4} - \frac {\cos 3 x} {\lambda^2 - 9} + \frac {\cos 4 x} {\lambda^2 - 16} - \dotsb}
      | c = 
}}
{{end-eqn}}

Proof:
By definition of half-range Fourier cosine series:
:$\ds \map f x \sim \frac {a_0} 2 + \sum_{n \mathop = 1}^\infty a_n \cos n x$
where for all $n \in \Z_{> 0}$:
:$a_n = \ds \frac 2 \pi \int_0^\pi \map f x \cos n x \rd x$
Thus by definition of $f$:
{{begin-eqn}}
{{eqn | l = a_0
      | r = \frac 2 \pi \int_0^\pi \map f x \rd x
      | c = Cosine of Zero is One
}}
{{eqn | r = \frac 2 \pi \int_0^\pi \cos \lambda x \rd x
      | c = Definition of $f$
}}
{{eqn | r = \frac 2 \pi \intlimits {\frac {\sin \lambda x} \lambda} 0 \pi
      | c = Primitive of $\cos a x$
}}
{{eqn | r = \frac 2 \pi \paren {\frac {\sin \lambda \pi} \lambda - \frac {\sin 0} \lambda}
      | c = 
}}
{{eqn | r = \frac {2 \sin \lambda \pi} {\pi \lambda}
      | c = Sine of Zero is Zero
}}
{{end-eqn}}
{{qed|lemma}}
Because $\lambda \notin \Z$ we have that $\lambda \ne n$ for all $n$.
Thus for $n > 0$:
{{begin-eqn}}
{{eqn | l = a_n
      | r = \frac 2 \pi \int_0^\pi \map f x \cos n x \rd x
      | c = 
}}
{{eqn | r = \frac 2 \pi \int_0^\pi \cos \lambda x \cos n x \rd x
      | c = Definition of $f$
}}
{{eqn | r = \frac 2 \pi \intlimits {\frac {\sin \paren {\lambda - n} x} {2 \paren {\lambda - n} } + \frac {\sin \paren {\lambda + n} x} {2 \paren {\lambda + n} } } 0 \pi
      | c = Primitive of $\cos \lambda x \cos n x$
}}
{{eqn | r = \frac 2 \pi \paren {\paren {\frac {\sin \paren {\lambda - n} \pi} {2 \paren {\lambda - n} } + \frac {\sin \paren {\lambda + n} \pi} {2 \paren {\lambda + n} } } - \paren {\frac {\sin 0} {2 \paren {\lambda - n} } + \frac {\sin 0} {2 \paren {\lambda + n} } } }
      | c = 
}}
{{eqn | r = \frac 1 \pi \paren {\frac {\sin \paren {\lambda - n} \pi} {\lambda - n} + \frac {\sin \paren {\lambda + n} \pi} {\lambda + n} }
      | c = Sine of Multiple of Pi and simplification
}}
{{eqn | r = \frac 1 \pi \paren {\frac {\sin \lambda \pi \cos n \pi - \cos \lambda \pi \sin n \pi} {\lambda - n} + \frac {\sin \lambda \pi \cos n \pi + \cos \lambda \pi \sin n \pi} {\lambda + n} }
      | c = Sine of Sum
}}
{{eqn | r = \frac {\sin \lambda \pi \cos n \pi} \pi \paren {\frac 1 {\lambda - n} + \frac 1 {\lambda + n} }
      | c = Sine of Multiple of Pi and simplification
}}
{{eqn | r = \frac {\paren {-1}^n \sin \lambda \pi} \pi \frac {\lambda + n + \lambda - n} {\paren {\lambda - n} \paren {\lambda + n} }
      | c = Cosine of Multiple of Pi and manipulation
}}
{{eqn | r = \paren {-1}^n \frac {2 \sin \lambda \pi} \pi \frac \lambda {\lambda^2 - n^2}
      | c = Difference of Two Squares
}}
{{end-eqn}}
{{qed|lemma}}
Finally:
{{begin-eqn}}
{{eqn | l = \map f x
      | o = \sim
      | r = \frac {a_0} 2 + \sum_{n \mathop = 1}^\infty a_n \cos n x
      | c = 
}}
{{eqn | r = \frac 1 2 \frac {2 \sin \lambda \pi} {\pi \lambda} + \sum_{n \mathop = 1}^\infty \paren {-1}^n \frac {2 \sin \lambda \pi} \pi \frac \lambda {\lambda^2 - n^2} \cos n x
      | c = substituting for $a_0$ and $a_n$ from above
}}
{{eqn | r = \frac {2 \sin \lambda \pi} \pi \paren {\frac 1 {2 \lambda} + \sum_{n \mathop = 1}^\infty \paren {-1}^n \frac \lambda {\lambda^2 - n^2} \cos n x}
      | c = simplifying
}}
{{eqn | r = \frac {2 \lambda \sin \lambda \pi} \pi \paren {\frac 1 {2 \lambda^2} + \sum_{n \mathop = 1}^\infty \paren {-1}^n \frac {\cos n x} {\lambda^2 - n^2} }
      | c = further manipulation
}}
{{end-eqn}}
{{qed}}