A question for Riesz lemma https://mathprelims.wordpress.com/2008/07/17/rieszs-lemma/ Here is the proof of Riesz lemma. I just wonder why we require the linear subspace to be closed, what happens if the linear subspace is open? Any help will be appreciated.
 A: I will adopt the notation used in the link in the question.
In the proof of the Riesz Lemma you need the fact that the subspace $Y$ is closed for proving that $a>0$. Indeed the fact that $Y$ is closed is used in the following way: once $a$ is defined to be $a:=\inf_{y\in Y} \| v-y\|$ for the fixed $v\in Z\setminus Y$, if by contradiction it happens that $a=0$ it means that there exists a sequence $y_n\in Y$ such that $\|v- y_n\|\to0$, that is $y_n$ converges to $v$, and since $Y$ is closed (by assumption) this implies that $v\in Y$, that is a contradiction.
This is fundamental in the proof, in fact in infinite-dimensional spaces it can happen that a proper non-closed subspace is dense; a basic example is the subspace of $C^\infty_c(I)$ functions in $L^2(I)$ on some interval $I$. So if a subspace $Y$ is dense in a normed vector space $Z$, then for any $v\in Z$ there is a sequence $y_n\in Y$ converging to $v$, therefore it happens that $\inf_{y\in Y} \|v-y\|=0$ for any $v\in Z$ and the proof of Riesz Lemma doesn't work.
