Why the $\lambda$-generalized eigenspace is invariant? The following comes from a text book, I am very confused about the last sentence,



For a matrix $A$, a subspace $V$ is invariant w.r.t $A$ if $AV\subseteq V$. From my understanding we need to show $\forall x\in V_{\lambda_i},Ax\in V_{\lambda_i}$, i.e. $(A-\lambda_iI)^n(Ax)=0$.
 A: Indeed, you need to show $(A-\lambda_iI)^n(Ax)=0$. But this is easy since if $f(A)$ is a (analytic) function of operator $A$, then $[f(A),A]=0$, i.e. you have an operator identity $f(A) \cdot A = A \cdot f(A)$ and thus
$$(A-\lambda_iI)^n(Ax)=\left[(A-\lambda_iI)^n\cdot A\right]x=\left[A\cdot (A-\lambda_iI)^n\right]x=A\left((A-\lambda_iI)^nx\right)=0$$
In this problem, just by using the property that every operator commutes with $I$ and itself, you can show
\begin{align*}
(A-\lambda_iI)^n\cdot A &= \sum _{k=0}^n\binom{n}{k} A^k (-\lambda _i I)^{n-k} \cdot A=\sum _{k=0}^n \binom{n}{k} A^k \left(A\cdot (-\lambda _i I)^{n-k} \right) \\
&= \sum _{k=0}^n \binom{n}{k}\left(A^k \cdot A\right) (-\lambda _i I)^{n-k}=\sum _{k=0}^n \binom{n}{k}\left(A\cdot A^k \right) (-\lambda _i I)^{n-k}\\
&=A\cdot \sum _{k=0}^n \binom{n}{k}\ A^k  (-\lambda _i I)^{n-k} =A\cdot (A-\lambda_iI)^n
\end{align*}
A: Consider $x \in V_{\lambda_i}$ and the following computation, noting that we've subtracted zero from the first expression and factored the second.
\begin{align*}
(A - \lambda_{i}I)^n(Ax) &= (A - \lambda_{i}I)^n(Ax) - \lambda_{i}(A - \lambda_{i}I)^{n}x \\
                         &= (A - \lambda_{i}I)^n(A - \lambda_{i}I)x \\
                         &= (A - \lambda_{i}I)(A - \lambda_{i}I)^{n}x \\
                         &= 0
\end{align*}
So $A$ maps elements of $V_{\lambda_i}$ to itself. 
