Continuous even functions closed and dense Let $C_e([−1,1],R)$ denote the set of even functions in $C([−1,1],R)$
(a) Show $C_e$ is closed and not dense in $C$.
(b) show the even polynomials are dense in $C_e$, but not in $C$.
 A: To show that $C_e$ is closed in $C$:
We need to show that if we have a convergent sequence of even continuous functions $f_n$ with limit $f \in C$, then $f \in C_e$. (This is by an equivalent definition of closed sets in metric spaces).
Suppose not for contradiction. Then there exists a convergent sequence of even continuous functions $f_n$ with limit $f \in C$, but $f \notin C_e$.
Then $f_n(x) = f_n(-x)$ for all $x \in [-1,1]$, for all $n$ and there exists an $x \in [-1,1]$ such that $f(x) \neq f(-x)$. So there exist $\epsilon >0$ and $x \in [-1,1]$ such that $|f(x) - f(-x)| = \epsilon$. (1)
Since $f_n$ converges to $f$ under the sup norm, there exists an $N$ such that for all $n \geq N$, $\sup_\limits{x\in [ -1,1]} |f_n(x) - f(x)| < \frac{\epsilon} {2}$, so for all $x \in [-1,1]$, $|f_n(x) - f(x)| < \frac{\epsilon} {2}$ . 
Additionally, for all $x \in [-1,1]$, $|f_n(-x) - f(-x)| < \frac{\epsilon} {2}$.
Since $f_n(x) = f_n(-x)$ for all $x$ and $n$, $|f_n(x) -f_n(-x)| = 0$.
Hence for all $x \in [-1,1]$, $$|f(x) - f(-x)| \leq |f(x) - f_n(x)| +|f_n(x) - f_n(-x)| +|f_n(-x) - f(-x)| $$
$$< \frac{\epsilon} {2} + 0 + \frac{\epsilon} {2} = \epsilon$$
This is a contradiction with (1).
Therefore the limit $f$ must be even. So the set of even continuous functions is closed in $C$.
To show $C_e$ is not dense in $C$:
We need to show that there exists a continuous function which is not even and is not the limit of any sequence of even continuous functions.
Take the function $x$. Clearly $x$ is not even and is continuous.
Suppose there is a sequence of even continuous functions $g_n$ that converges in the sup norm to $x$. Hence $g_n$ converges uniformly to $x$ on $[-1,1]$. 
Therefore, by the properties of uniform convergence and the Riemann integral, $\lim_\limits{n\to \infty} \int_{-1}^1 g_n = \int_{-1}^1 \lim_\limits{n\to \infty} g_n =\int_{-1}^1 x = 0 $
Since all the $g_n$ are even, $\int_{-1}^1 g_n = 2 \int_{0}^1 g_n $ for all $n$.
Since the function is continuous and on a compact interval, all these Riemann integrals are defined, so  $\lim_\limits{n\to \infty} \int_{0}^1 g_n = \frac{1}{2} \lim_\limits{n\to \infty} \int_{-1}^1 g_n = 0$ .
Take $\epsilon = \frac{1}{4}$, then there exists an $N_1$ such that for all $n \geq N$,  $|\int_{0}^1 g_n| < \frac{1}{4}$.
Also, since $g_n$ converges uniformly to $x$ on $[0,1]$,  $\lim_\limits{n\to \infty} \int_{0}^1 g_n = \int_{0}^1 x = \frac{1}{2}$. So there exists an $N_2$ such that for all $n \geq N$,  $|\int_{0}^1 g_n -\frac{1}{2}| < \frac{1}{4}$.
Let $N :=\max\{N_1,N_2\}$. Then for all $n\geq N$, $$\frac{1}{2} = |\int_{0}^1 g_n + \frac{1}{2}- \int_{0}^1 g_n | \leq|\int_{0}^1 g_n |+ |\int_{0}^1 g_n -\frac{1}{2}| < \frac{1}{4}+ \frac{1}{4} =\frac{1}{2}$$
which is a contradiction.
Try to do something similar with the second part.
A: Note that convergence in this metric is simply uniform convergence.
$\pmb C_e$ is closed.
Let $(f_n)_n$ be a sequence in $C_e$ that has a limit $f \in C$. We show that $f \in C_e$. To this end, let $x \in [-1, 1]$ be arbitrary. Then, since $f_n \to f$ uniformly, we know that $f_n \to f$ pointwise as well. Thus, $$f(x) = \lim_{n \to \infty} f_n(x) = \lim_{n \to \infty} f_n(-x) = f(-x),$$
where the middle equality follows since $f_n \in C_e$. Thus, we have shown that $f \in C_e$.
$\pmb C_e$ is not dense.
Since $C_e$ is closed and not all of $C$, we have $\overline{C_e} = C_e \neq C$ and thus, $C_e$ is not dense in $C$.
(Recall that $C_e$ being dense in $C$ would mean that $\overline{C_e} = C$.)
Even polynomials are dense in $\pmb C_e$
Let $f : [-1, 1] \to \Bbb R$ be a continuous even function. Define $g : [0, 1] \to \Bbb R$ by $$g(x) = f(\sqrt{x}).$$ Then, $g$ is continuous and thus, there exists a sequence $(p_n)_n$ of polynomial functions such that $p_n \to g$ uniformly on $[0, 1]$. (Existence follows from the Weierstrass approximation theorem.)
Consider the sequence $(q_n)_n$ defined as $$q_n(x) = p_n(x^2).$$ Thus, $(q_n)_n$ is a sequence of even polynomials. Moreover, note that
\begin{align}
\|q_n - f\| &= \sup_{x \in [-1, 1]} |p_n(x^2) - g(x^2)| \\
&= \sup_{x \in [0, 1]} |p_n(x) - g(x)| = \|p_n - g\| \to 0.
\end{align}
Thus, $q_n \to f$ uniformly.
Even polynomials are not dense in $\pmb C$.
Obvious since even $C_e$ is not dense in $C$.
