I'm practicing some old exams for my Functional Analysis test and i'm stuck on the following question:
Let $X$ be any Banach space with $Y \subset X$, $Y \neq X$ and $Y$ dense in $X$. Show that the identity operator on $Y$ cannot be extended to a continuous function from $X$ to $Y$.
A hint says that the Hahn-Banach extension theorem is an essential argument for the proof.
I came up with the following proof:
Suppose that the identity operator $I_Y$ on $Y$ can be to a continuous function $f$ from $X$ to $Y$. Let $x \in X-Y$ and $\{y_n\} \subset Y$ such that $y_n \rightarrow x$; this sequence exists since $Y$ is dense in $X$. Now because of the continuity of $f$ we have $$ Y \ni f(x) = f(\lim_{n\to\infty}y_n) = \lim_{n\to\infty} f(y_n) = \lim_{n\to\infty} I_Y(y_n) = x,$$ and hence $Y=X$.
I'm a bit confused since the proof seems right but it does not use the Hahn-Banach extension. Am i missing something here?