Solution (source code)

= Solution

Put $E=\operatorname{im}S$, a finite-dimensional subspace, and decompose $H=E\oplus E^\perp$. The restriction
$$
(S-\lambda I)|_E:E\to E
$$
is injective, because a nonzero vector in its kernel would be a $\lambda$-eigenvector of $S$. By finite-dimensionality it is therefore surjective.

Given $y=y_E+y_\perp$, first put $x_\perp=-y_\perp/\lambda$. Then $Sx_\perp\in E$, so choose $x_E\in E$ such that
$$
(S-\lambda I)x_E=y_E-Sx_\perp.
$$
For $x=x_E+x_\perp$ we obtain $(S-\lambda I)x=y$. Hence $S-\lambda I$ is surjective. This is the <finite-rank Fredholm alternative>.