Consider the following functions in $L^2(-\pi,\pi)$:
$$ f_n(x)=\cos\big((n+1/2)x\big), g_k(x)=\sin(kx), n=0,1,\dots, k=1,2,\dots.$$
I am trying to prove $\text{span}(f_n \cup g_k)$ is dense in $L^2(-\pi,\pi)$.
I already know the standard trigonometric polynomials are dense, that is $\cos(nx),\sin(nx) $ form a complete orthonormal system.
Is there any easy way to reduce the problem to this well-known fact?
One way to prove the density of the trigonometric polynomials is to use Stone-Weierstrass theorem, but here our set of "modified" trigonometric polynomials do not form an algebra, so we can't use the theorem directly.
Any advice?
(The reason I am interested in this specific set of generators is that they arise naturally as eigenfunctions of a differential operator).
We'll show that any continuous function $f$ on $[-\pi, \pi]$ with $f(-\pi)=f(\pi)=0$ can be uniformly approximated by finite linear combinations of $\sin n x$ and $\cos \frac{2n+1}{2}x$. Enough to show:
every odd continuous function on $[-\pi, \pi]$ with $f(-\pi)=f(\pi)=0$ can be uniformly approximated by finite linear combinations of $\sin n x$ .
every even continuous function on $[-\pi, \pi]$ with $f(-\pi)=f(\pi)=0$ can be uniformly approximated by finite linear combinations of $\cos \frac{2n+1}{2}x$.
First, recall the Weierstrass approximation theorem that any continuous function $f$ on $[\pi, \pi]$ with $f(-\pi)=f(\pi)$ can be uniformly approximated by finite linear combinations of $\cos nx$ and $\sin nx$. This implies 1. right away ( average).
Consider now $f$ continous on $[\pi, \pi]$, even, $f(-\pi)=f(\pi)=0$. We may assume moreover that $f$ is smooth, since any such continous function can be approximated by a smooth one with the same symmetry. The function $f_1(x)\colon = f(x) - f(0) \cos \frac{x}{2}$ satisfy also $f_1(0)=0$. The function $h(x)\colon = \frac{f_1(x)}{2\sin \frac{x}{2}}$ is smooth, odd, and satisfies $h(-\pi)=h(\pi)=0$. Hence $h$ can be uniformly approximated by a linear combination of $\sin n x$. Therefore $f_1(x)$ can be approximated by a linear combination of $2 \sin\frac{x}{2}\sin n x = \cos\frac{2n-1}{2}x-\cos\frac{2n+1}{2}x$.
Added: The functions $\sin nx$, $\cos \frac{2n+1}{2}x$ form an orthogonal system as one can check easily.
Consider the expansion
$$f \sim \sum_{n\ge 1} (a_n \cos (n-\frac{1}{2})x + b_n \sin nx)$$
We have $$\pi a_n = \int_{-\pi}^{\pi} f(x) \cos(n-\frac{1}{2})x=\int_{-\pi}^{\pi} (f(x) \cos \frac{x}{2}) \cos n x+ \int_{-\pi}^{\pi} (f(x) \sin \frac{x}{2})\sin n x$$
We have another orthogonal system on $[-\pi, \pi]$ consisting of the functions $1$ and $\cos nx$, $\sin(n-\frac{1}{2})x$ for $n\ge 1$. We can show that the Parseval equalities are valid simultaneously for both these systems, which is another way to prove completeness. The proof uses the completeness of $1$, $\cos nx$, $\sin nx$ and the corresponding Parseval equalities for $f(x) \sin \frac{x}{2}$, $f(x)\cos\frac{x}{2}$ whose sum of squares equals $f^2(x)$.