Desity of Trigonometric Polynomials 
Define
  $$\mathcal{A}:=\Big\{p_n(x) = a_0+\sum^n_{k=1}(a_k\cos(kx)+b_k\sin(kx)): 
1\leq k\leq n, \,{\rm and}\,\, a_0,a_k,b_k\in \mathbb{R}\Big\}$$
  a) Prove that $\mathcal{A}$ is not dense in $C([0,2\pi])$ but $\mathcal{A}$ is dense in $$\mathcal{G}:=\{g\in C([0,2\pi]:g(0) = g(2\pi)\}$$
  b) Prove that $\mathcal{A}$ is dense in $L^1([0,2\pi])$

I have recently studied the Stone-Weierstrass theorem and suspect that I can use it for this problem. I think that every $p_n(x)$ separates points because when sine does not separate points, cosine separates, and when cosine does not separate sine separates. So I believe $\mathcal{A}$ satisfies the conditions for Stone-Weierstrass theorem. But I have failed to prove that $\mathcal{A}$ not dense in $[0,2\pi]$ and moreover why is $\mathcal{A}$ dense in $\mathcal{G}$.
 A: Let $f \in C([0,2\pi])$ such that $f(0) \ne f(2 \pi)$ (for example $f(x)=x$.)
Suppose that $\mathcal{A}$ is dense in $C([0,2\pi])$. Then there is a sequence $(p_n)$ in $\mathcal{A}$ which converges uniformly to $f$ on $[0,2\pi]$.
Then we get from $p_n(0)=p_n( 2 \pi)$, with $n \to \infty$, that $f(0) = f(2 \pi)$, a contradiction.
A: The example in the comment and other answer shows why ${\cal A}$ is not
dense in $C[0,2 \pi]$. The key missing feature is that the subalgebra does not separate points. There is no $g \in {\cal A}$ that separates $0,2 \pi$.
For ${\cal G}$, we can consider the functions $C(\mathbb{T})$ instead, and
note that $\mathbb{T}$ is compact in the usual metric and ${\cal A}$ does separate points of $\mathbb{T}$ and contains the function $x \mapsto 1$. Hence Stone Weierstraß applies and hence ${\cal A}$ is dense in ${\cal G}$.
To prove that ${\cal A}$ is dense in $L^1[0,1]$, note that ${\cal A}$ is dense
in indicator functions of intervals, hence of open sets and hence of
measurable sets. Since simple functions are dense in $L^1[0,1]$, we obtain
the desired result.
