Prove $\mathrm{codim}(\mathrm{Im}(I+K))<\infty$ for a compact operator As part of a solution of an exercise in functional analysis, I saw the following claim: If $K:X\to X$ is a compact linear operator in Banach space, then $\mathrm{codim}(\mathrm{Im}(I+K))<\infty$.
This was presented without proof in an introductory book on functional analysis, right after learning about Fredholm theory of compact operators.
How can one prove this claim?
 A: By compactness of $K$, the closed unit ball in $\ker(I+K)$ is compact, so $\ker(I+K)$ has finite dimension. Therefore, $X = \ker(I+K) \oplus S$ for some closed subspace $S$ of $X$. The operator $I + K$ restricted to $S$ has an inverse $T : \operatorname{Im}(I+K) \to S$. You can show (by way of contradiction, using compactness of $K$) that $T$ is continuous at $0$ (and hence continuous). Then $\operatorname{Im}(I + K)$ is closed.
To demonstrate that $\operatorname{Im}(I + K)$ has finite codimension, suppose to the contrary that the codimension of $\operatorname{Im}(I + K)$ is infinite. There is a sequence $\operatorname{Im}(I + K) = S_0 \subsetneq S_1 \subsetneq S_2 \subsetneq \cdots$ of closed subspaces of $X$ with $\dim(S_{n+1}/S_n) = 1$ for every $n$. Riesz's lemma gives normalized vectors $x_n\in S_n$ such that $\operatorname{dist}(x_n,S_{n-1}) \ge 0.5$. If $n > m$, then $(I + K)x_n, (I + K)x_m$, and $x_m$ belong to $S_{n-1}$, forcing $$\|Kx_n - Kx_m\| = \|(I + K)x_n - (I + K)x_m + x_m - x_n\| \ge \operatorname{dist}(x_n,S_{n-1}) \ge 0.5$$ Consequently, $(Kx_n)$ has no convergent subsequence, contradicting compactness of $K$.
