# Weak convergence on subset of Hilbert space

I'm working on a straightforward problem but my result is the opposite of what I want to show and I cannot find the mistake so any help would be much appreciated.

We have $$K = \{ \sqrt{n} e_n | n \geq 1 \}$$ where $$\{e_n\}$$ is an orthonormal basis of a Hilbert space $$H$$. We are asked to show that the function $$f(x) = \begin{cases} 1 \textit{ if } x \in K \\ 0 \textit{ if } x \notin K\end{cases}$$ is not weakly continuous in $$0$$ but that we have that $$x_n$$ converges weakly to $$0$$, we must have that $$f(x_n)$$ converges to $$0$$.

For the first part, the preimage of a small ball around $$0$$ is just the preimage of $$0$$ or $$K^c$$. We need to show that $$\exists x \in K^c: \forall y_1,\dots,y_n \forall \epsilon >0:\exists z\in K: \forall i: |\langle y_i,z-x \rangle |< \epsilon$$.

This I think can be done by setting $$x=0$$, since if $$y_i=\sum_{n}a_{in}e_n$$, we have $$|\langle y_i, \sqrt{n}e_n\rangle|=\sqrt n |a_{in}|$$ and this becomes arbitrary small since the coefficients $$|a_{in}|$$ have to converge faster to zero than $$1/n$$. So I think that is correct.

But now if $$x_n= \sqrt n e_n$$, we have now proven that $$| \langle y,x_n \rangle |$$ converges to zero for all $$y$$ so that $$\langle x_n,y \rangle \rightarrow \langle 0,y \rangle$$ and thus $$x_n$$ converges to $$0$$ weakly. But for this sequence $$f(x_n) \rightarrow 1$$. So I don't see why this approach seems to work for the first part and fail for the second part.

Any help?

thanks

With the choice $$x_n=\sqrt ne_n$$, the sequence $$\left(\lVert x_n\rVert\right)_{n\geqslant 1}$$ is not bounded in $$H$$ hence cannot converge weakly to zero.
Let $$\left(x_n\right)_{n\geqslant 1}$$ be a sequence converging weakly to $$0$$. We have to show that $$f(x_n)\to 0$$ and since $$f$$ takes only the values $$0$$ or $$1$$, we have to prove that there exists an $$n_0$$ such that $$f(x_n)=0$$ for $$n\geqslant n_0$$. If this $$n_0$$ does not exist, then we can find $$n_k\uparrow \infty$$ such that $$x_{n_k}\in K$$ for all $$k$$. Let $$I =\{i\geqslant 1,x_{n_k}=\sqrt{i}e_i\mbox{ for some }k\}$$. Then the set $$I$$ is finite (otherwise, this would contradict the boundedness of $$(x_n)$$. This contradict the weak convergence to zero.