i was trying to solve this exercise from Royden:
Let X be a locally convex topological vector space, let $Y \subset X$ be a closed subspace and $x_0 \in X-Y$.Prove that there exists a continuous linear functional $\varphi: X \rightarrow \mathbb{R}$ such that $\varphi(y) = 0$ if $y \in Y$ and $\varphi(x_0) \ne 0$
I don't understand where to use the fact that $Y$ is closed. My attempt was to construct a positive homogeneous and subadditive functional $p_y(x) = 1 - \chi_{Y}$. It's not hard to see that it has the desired properties. Moreover it is clear that $p_y(x_0) = 1$. Thus one can take $\varphi(\lambda x_0) = \lambda$ and extend it to a linear functional $\varphi \le p_y$ on $X$. Observing that $p_y(x) \le 1$ we have that $\varphi$ is bounded on $X$ and thus, because $X$ is locally convex topological vector spaces, continuous.
Isn't it right?
Since both the sets $Y$ and $\{x_0 \}$ are closed and $\{x_0\}$ is compact then from separation theorem there exists a linear functional $f: X\to \mathbb{R} $ and real numbers $a< b$ such that $f(y)<a $ for $y\in Y $ and $f(x_0 ) =b .$ Now, take any $u\in Y$ then $$f(ny )<a $$ for all $n\in \mathbb{N}$ hence $f(y)\leqslant 0$ and analogously $$f(-ny )<a$$ thus $f(y) \geqslant 0$ and finally $$f(y)=0.$$