Stone Weierstrass Theorem Application Prove that continuous functions on $\mathbb{R}$ with period $1$ can be uniformly approximated by trigonometric polynomials, i.e. functions in the linear span of $\{e^{−2πinx}\}_{n \in \mathbb{Z}}$. Explain why $n \in \mathbb{N}$ is not enough.
I think I need to restrict the domain into a compact set and consider the interval $[0,1]$. Since the functions are periodic with period $1$ the approximation on $[0,1]$ can be translated to any point on $\mathbb{R}$. It is easy to show that linear span of $\{e^{−2πinx}\}_{n \in \mathbb{Z}}$ is an algebra and that this algebra has the constant function. 
How do I show that this algebra is closed? 
Why is $n \in \mathbb{N}$ is not enough?
 A: Let us restrict the domain to the interval $ [0,1] $ and use some of the theory of inner-product spaces.
One reason why having $ \mathbb{N} $ as the index set is not enough is because $ e_{1}: x \mapsto e^{2 \pi i x} $ is orthogonal to the set $ \{ e_{- n}: x \mapsto e^{- 2 \pi i n x} \}_{n \in \mathbb{N}_{0}} $. You can easily check this by computing
$$
\forall n \in \mathbb{N}_{0}: \quad
  \langle e_{1},e_{- n} \rangle
= \int_{0}^{1} \overline{{e_{1}}(x)} \cdot {e_{- n}}(x) ~ \mathrm{d}{x}
= 0.
$$
Now, for any $ N \in \mathbb{N}_{0} $ and $ c_{0},\ldots,c_{N} \in \mathbb{C} $, we have
\begin{align*}
       \| e_{1} \|_{2}^{2}
& =    \left|
       \left\langle e_{1},e_{1} - \sum_{n = 0}^{N} c_{n} e_{- n} \right\rangle
       \right| \\
& \leq \| e_{1} \|_{2} \cdot \left\| e_{1} - \sum_{n = 0}^{N} c_{n} e_{- n} \right\|_{2}
       \quad (\text{By the Cauchy-Schwarz Inequality.}) \\
& \leq \| e_{1} \|_{2} \cdot
       \left\| e_{1} - \sum_{n = 0}^{N} c_{n} e_{- n} \right\|_{\infty}.
\end{align*}
Hence, as $ \| e_{1} \|_{2} \neq 0 $, we obtain
$$
\| e_{1} \|_{2} \leq \left\| e_{1} - \sum_{n = 0}^{N} c_{n} e_{- n} \right\|_{\infty}.
$$
If we could approximate $ e_{1} $ uniformly by the linear span of $ \{ e_{- n} \}_{n \in \mathbb{N}_{0}} $, then the right-hand side of the inequality above could be made arbitrarily small, while the left-hand side remains as a non-zero constant. This is a contradiction.
A: The fundamental tenet of Stone-Weierstrass is an algebra of functions $\mathcal{A}$ on $X$ that is closed under complex conjugation, separate points and for every point $x\in X$ there is an $f\in\mathcal{A}$ such that $f(x)\neq 0$.
Your algebra satisfies the first property since $e^{-2\pi inx} = \overline{e^{2\pi inx}}$ so it is closed under conjugation.
Your algebra of trigonometric polynomials satisfies the latter property since for any rational $q$ which we write in lowest terms: $q = \frac{m}{n}$, then if we consider $f(x) = e^{2\pi inx}$, $f(q) = 1$. Since every irrational $x$ can be made close to a rational and the complex exponentials are continuous, we can find $f$ such that $|f(x)|>0$ (by a modest adaptation of the above reasoning). (You could pick $f$ to be a constant function if you were so inclined.)

We need only then to see that it separates points.
Suppose $x\neq y\in[0,1)$. We wish to find $f$ such that $f(x)\neq f(y)$. We will deal with the case that $x=0$ and $y=1$ after. If $x$ and $y$ are rational, write $x = \frac{m}{n}$ and $y=\frac{m'}{n'}$. Without loss of generality, assume $n < n'$. If $n$ does not divide $n'$, consider $f(z) = e^{-2\pi in'z}$; $f(y) = 1$ but $f(x)\neq 1$. If $n$ does divide $n'$, consider $f(z) = e^{-2\pi i(n'+1)z}$. Then $f(y) = e^{-2\pi i\frac{m'}{n'}}$ and $f(x) = e^{-2\pi i\frac{m}{n}}$. These are only equal if $\frac{m'}{n'} = \frac{m}{n}+2k\pi$. However since $y,x\in[0,1]$ and $x\neq y$, this can't happen so $f(x)\neq f(y)$.
If they are irrational, find rationals that are close to them and repeat the same kind of analysis as above.
Suppose that $x=0$ and $y=1$. At these points, every function in your algebra is equivalent. However this is, in fact, not a problem. The reason is that these points are basically equivalent with respect to your functions. Every periodic function (with period $1$) is equal at $0$ and $1$ so you really only needed to focus on $[0,1)$ anyway.
