How to prove that the span of $\cos((n+1/2)x)$ and $\sin(nx)$ is dense in $L^2(-\pi,\pi)$? 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).
 A: I would say that the answer you have given that the functions are eigenfunctions of a selfadjoint differential operator is a good answer. The operator
$$
                          Lf = -f''
$$
is a closed operator on the domain $H^2(-\pi,\pi)$. And it is selfadjoint when you further restrict to functions $f\in H^2$ for which
$$
               \cos\alpha f(-\pi)+\sin\alpha f'(-\pi)=0 \\
               \cos\beta f(\pi)+\sin\beta f'(\pi) = 0,
$$
where $\alpha,\beta$ are real numbers. The operator $L_{\alpha,\beta}$ is selfadjoint on its subdomain of $H^2(-\pi,\pi)$; its spectrum is discrete with no finite point of accumulation; every point in the spectrum is an eigenvalue; and the eigenspaces are one-dimensional. The normalized eigenfunctions form a complete orthonormal basis of $L^2(-\pi,\pi)$.
The functions $\{\sin(kx)\}_{k=1}^{\infty}$ and $\{ \cos((k+1/2)x) \}_{k=0}^{\infty}$ are the eigenfunctions for $\alpha = 0 = \beta$.
Another way to arrive at this same basis is by observing that $\{ \sin(nx)\}_{n=1}^{\infty}$ is an orthogonal basis on $[0,\pi]$ because any $f\in L^2[0,\pi]$ can be extended to an odd function on $[-\pi,\pi]$ and expanded in a Fourier series on $[-\pi,\pi]$ that will involve only $\sin$ terms. These sin functions can be grouped into sets $\{ \sin(2nx)\}_{n=1}^{\infty}$ and $\{ \sin((2n+1)x)\}_{n=0}^{\infty}$ and considered on $[0,\pi]$. Replacing $x$ by $x+\pi/2$ gives a basis on $[-\pi/2,\pi/2]$ of the form $\{ \sin(2nx) \}_{n=1}^{\infty} \cup \{ \cos((2n+1)x) \}_{n=0}^{\infty}$, which is seen to be equivalent to the $\{\sin(nx)\}_{n=1}^{\infty}\cup\{ \cos((n+1/2)x) \}_{n=0}^{\infty}$ on $[-\pi,\pi]$, which is the desired result.
A: Contrary to some mythologies, there is in general no simple way to prove completeness of one orthogonal system from completeness of another.
For example, presumably you had the Sturm-Liouville problem $u''=f$ with Dirichlet boundary condition, namely, vanishing (of $u$ and of $f$) at the endpoints.
Basic Sturm-Liouville theory (e.g., a relevant Rellich compactness lemma applied to the resolvent, and then the spectral theorem for compact self-adjoint operators) proves that there exists an orthogonal basis of eigenfunctions. (As opposed to there being any continuous spectrum.)
Thus, it suffices to find all eigenfunctions, since we know a-priori that they form a complete system.
Is this responding to your question in a reasonable context?
A: 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)$.
