Let $C$ be the space of all constant polynomials over $\Bbb R.$ Is $C$ closed in $C^1[0,1]$ with respect to $L^2$-norm?
Let $f \in C^1[0,1]$ be a limit point of $C.$ We need to show that $$\displaystyle\inf \left \{\int_{0}^{1} \left (f(x) - c \right )^2\ dx\ \bigg |\ c \in \Bbb R \right \} = 0 \implies f \in C.$$ Let us define a function $g : \Bbb R \longrightarrow \Bbb R$ by $$g(c) = \int_{0}^{1} \left (f(x) - c \right )^2\ dx,\ c \in \Bbb R.$$ Then $g$ is differentiable on $\Bbb R$ and by Leibnitz integral rule we have $$g'(c) = \int_{0}^{1} -2 \left (f(x) - c \right )\ dx.$$ Now if the infimum of $g$ is attained at $c_0 \in \Bbb R$ (the infimum has to be attained at some real number because if $c \to \pm \infty$ then $g(c)$ blows up to $+ \infty$) then $g'(c_0) = 0 \implies \displaystyle \int_{0}^{1} f(x)\ dx = c_0.$ Now if we compute $g(c_0)$ we find that $$g(c_0) = \int_{0}^{1} \left (f(x) \right )^2\ dx - \left ( \int_{0}^{1} f(x)\ dx \right )^2.$$ So by Cauchy-Schwarz inequality we have $$g(c_0) \geq 0\ \ \ \ (\because \left \lvert \left \langle f, 1 \right \rangle \right \rvert \leq \left \|f \right \|_2 \left \|1 \right \|_2 ).$$ So $g(c_0) = 0 \iff f$ is a scalar multiple of $1$ i.e. $f \in C.$ But this proves that $C$ is closed in $C^1[0,1].$
Is my above reasoning correct at all? Would anybody please verify it?
Thanks for your time.