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$.

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. 
