Let $X=C([-1,1])$ and define $Y=\{f\in C([-1,1]): f(x)=0~\forall x\leq 0\}$. On $X$ we have the scalar product $\langle f_1,f_2\rangle=\int_{-1}^1 f_1(x)\overline{f_2(x)}dx$. I want to show that $Y$ is a closed subspace of $X$.
I wanted to start as follows: Let us take $f_n\in Y$ a convergent subsequence, say $f_n\rightarrow f$ in $X$. Since $X$ is complete we know that $f\in C([-1,1])$. So it remains to show that $f(x)=0$ for all $x\leq 0$.
I wanted to assume that there exists $x\leq 0$ such that $f(x)\neq 0$ but somehow I don't see how to get a contradiction with this. Did I start in the wrong way?
$\newcommand{\d}{\,\mathrm{d}}$One simple solution: as $X$ has the topology of a metric space, we need to check that $f_n\to f$ in $L^2$-norm, with $(f_n)\subseteq Y$, implies $f\in Y$.
How I'd do this question:
As Ryszard comments, we know $f(x)=0$ for almost every $x\le0$. How can we see this implies $f(x)\equiv0,\,x\le0$ by continuity?
One easy way to do this is by integrating (which is essentially what I am doing in the above argument). Another 'direct' way to do this:
Can you generalise this to show: $$Y:=\{f\in X:f(x)=c,\,\forall x\in[a,b]\}$$Is closed in $X$ for any choice of $c\in\Bbb R,\,[a,b]\subseteq[-1,1]$?