Closed Subspaces of Hilbert Spaces I read the following statements. But I do not know how to show it or any example to support it. Could anyone provide some explanation and examples, please? Thank you!

  
*
  
*The subspace $C^\infty$ functions inside $\mathcal L^2(\mathbb R)$ is not closed.
  
*The subspace of simple functions inside $\mathcal L^2(\mathbb R)$ is not closed.
  
*Polynomials inside $C^0$ is not closed.
  

I can think of the following


*

*Not sure. In addition, how do we know that $C^\infty \subset \mathcal L^2(\mathbb R)$ in the first place, please?

*Consider a sequence of functions of the following form: $$f_n (x) := \frac{k}{n}\chi_{\left[\frac{k}{n}, \frac{k+1}{n}\right)}(x),$$ where $n \in \mathbb N$ and $k = 0, 1, \dots$. Each function $f_n$ is defined on $[0, 1)$ and is left continuous. This sequence converges in norm to $f=x\mathbb I_{[0, 1)}$ which is not a simple function. So the set of simple function is not closed. Is this a valid counter example, please?

*I know that polynomials are dense in continuous functions. But there are plenty of continuous functions which are not polynomials. Hence, it is true that polynomials are not closed. But any concrete example, please? 

 A: *

*First, you should know that $C^\infty(\mathbb R) \not\subset L^2(\mathbb R)$ (e.g. $f(x) = x$ is not in $L^2(\mathbb R)$), we are just looking at $C^\infty$ functions which are also in $L^2(\mathbb R)$. Consider the bump function
$$ \phi_n (x) = e^{\frac{-1}{n \cdot (1-x^2)}}$$
for $x \in (0,1)$ and $\phi_n = 0$ outside of $(0,1)$. You can check that $\phi_n$ is smooth. Clearly it is square integrable since it is continuous and compactly supported. Furthermore, the pointwise and $L^2$ limits of $(\phi_n)$ are both $\chi_{(0,1)}$ which is not even continuous.

*If you sum over $k$ from $0$ to $n-1$, your sequence is a valid counter example.

*The Taylor expansion of, for instance, $\sin x$ works as a counter example over a compact interval. Polynomials are not dense over the whole real line. (For example, $\tan^{-1}$ is not the limit of polynomials). We define
$$ f_n(x) = \sum_{k=0}^{n} (-1)^{k} \frac{x^{2k+1}}{(2k+1)!}$$
then notice as $n \to \infty, f_n \to \sin$ on any closed interval.
