Let $H$ be a Hilbert space over $\mathbb{C}$ and $A\colon H\to H$ a bounded linear map. Assume that $A(M)$ is closed for all closed subspaces $M$ of $H$. How do I prove that $A(H)$ and $\ker(A)$ cannot both be infinite dimensional?
As the hint of the exercise suggests, I tried to construct an orthonormal sequence $u_{n}:=a_{n}x_{n}+b_{n}y_{n}$ for some suitable scalars $a_{n},b_{n}\in\mathbb{C}$, and orthonormal sequences $x_{n}\in\ker(A)^{\perp}$ and $y_{n}\in\ker(A)$. Then the closed linear span $M$ of $\{u_{n}\}_{n}$ should yield a contradiction.
So if $\ker(A)$ is infinite dimensional, we can indeed find an orthonormal sequence $(y_{n})$ in $\ker(A)$. I'm not sure why we can find one in $\ker(A)^{\perp}$ yet, but assume that it is possible and choose an orthonormal sequence in $(x_{n})$ in $\ker(A)^{\perp}$. Then choose a real sequence $a\in\ell^{1}(\mathbb{N})$ with $a_{n}^{2}\leq1$ and define another sequence by $b_{n}:=(1-a_{n}^{2})^{1/2}$ (for example $a_{n}=1/n^{2}$). Then $u_{n}:=a_{n}x_{n}+b_{n}y_{n}$ is an orthonormal sequence. Then define $$v_{m}:=\sum_{n=1}^{m}u_{n}$$ and note that $$Av_{m}=\sum_{n=1}^{m}\alpha_{n}Ax_{n}\qquad\text{(since $Ay_{n}=0$)}.$$ The sequence $(v_{m})$ does not converge because it is a sum of pairwise orthonormal vectors. Now I was hoping to conclude that $(Av_{m})$ does converge and that the limit does not lie in $A(M)$, where $M$ is closed span of $\{u_{n}\}_{n}$.
Is my reasoning right? And if it is, how do I finish the proof? Any suggestions are greatly appreciated.
By the decomposition $H = (\ker A) \oplus (\ker A)^{\perp}$ we have $A(H) = A\bigl((\ker A)^{\perp}\bigr)$, so if $(\ker A)^{\perp}$ were finite-dimensional then $A(H)$ would also be finite-dimensional.
Thus under the assumption that $A \in B(H)$ has infinite-dimensional kernel and image we can find orthonormal sequences $(x_n)$ in $(\ker A)^{\perp}$ and $(y_n)$ in $\ker A$.
With these we construct a closed subspace $M$ such that $A(M)$ isn't closed. You already have most of the ingredients, only a condition on the sequence $a$ (that your given example satisfies) needs to be stated, and then you need the final argument.
You say to pick a real $a \in \ell^1(\mathbb{N})$ with $a_n^2 \leqslant 1$ for all $n$. It is not necessary to choose $a$ real (but of course it doesn't harm), but we need $a_n \neq 0$ for all $n$. We need this condition to have $M \cap \ker A = \{0\}$. Also it's not necessary to choose $a \in \ell^1(\mathbb{N})$, it would also work for $a \in c_0(\mathbb{N})$.
Thus, having chosen $a \in \ell^1(\mathbb{N})$ (or $c_0$) with $0 < \lvert a_n\rvert \leqslant 1$ for all $n$, we choose $b_n \in \mathbb{C}$ with $\lvert a_n\rvert^2 + \lvert b_n\rvert^2 = 1$ and put $u_n = a_nx_n + b_ny_n$ for all $n$. Then $(u_n)$ is an orthonormal sequence in $H$, and we define $$M = \overline{\operatorname{span} \{u_n : n \in \mathbb{N}\}}\,.$$ By construction $M$ is closed. The condition $a_n \neq 0$ for all $n$ ensures that $M \cap \ker A = \{0\}$: Let $$w = \sum_{n \in \mathbb{N}} c_nu_n \in M \cap \ker A\,.$$ Then for each $k \in \mathbb{N}$ we have $$0 = \langle w, x_k\rangle = \sum_{n \in \mathbb{N}} c_n\langle u_n,x_k\rangle = \sum_{n \in \mathbb{N}} c_na_n\langle x_n,x_k\rangle = c_ka_k\,.$$ Since $a_k \neq 0$ it follows that $c_k = 0$ for all $k$, i.e. $w = 0$, as desired.
Now we're ready to finish, using the open mapping theorem. If $A(M)$ were closed, then $A\lvert_M \colon M \to A(M)$ would be a continuous linear bijection between Banach spaces, and hence there would be $\delta > 0$ such that $\lVert Av\rVert \geqslant \delta \lVert v\rVert$ for all $v\in M$. But $$\lVert Au_n\rVert = \lVert A(a_nx_n)\rVert = \lvert a_n\rvert\lVert Ax_n\rVert \leqslant \lvert a_n\rvert\lVert A\rVert =(\lvert a_n\rvert\lVert A\rVert)\lVert u_n\rVert$$ and $\lvert a_n\rvert\lVert A\rVert \to 0$, thus $\lvert a_n\rvert\lVert A\rVert < \delta$ for all sufficiently large $n$. It follows that $A(M)$ isn't closed.