Let $A ∈ \mathbb{R}^{n \times n}$ have eigenvalues $λ_1, \ldots , λ_k$. 
Let $A ∈ \mathbb{R}^{n \times n}$ have eigenvalues $λ_1, \ldots , λ_k$. Prove that $\operatorname{ker}(A − λiI) = \operatorname{ker}((A − λiI)^2)$ for each $i = 1,\ldots, k$ if and only if $A$ is diagonalizable.

I have seen a similar question (for the rank). But how do I proceed to prove the only if direction using the Jordan normal form? Also, I would appreciate the proof for the if direction too. Thanks.
 A: Hint: all you need is to do it for a Jordan block.
A: Let $A=SJS^{-1}$ be the Jordan decomposition of $A$. Because $A$ and $J$ are similar, $\ker((A-tI)^k)=\ker((J-tI)^k)$ for any $t$ and $k$. (Can you show this?) This further shows they have the same eigenvalues. So, without loss of generality, we can instead prove the following:

Let $A$ be a Jordan matrix. Then $\ker(A-\lambda_i I) = \ker((A-\lambda_i I)^2)$ for all $i$ if and only if $A$ is diagonal.


Let $A$ be diagonal. Then the diagonal elements of $A$ are $\lambda_i$ (possibly with repetitions). $A-\lambda_i I$ will be diagonal with some zeros on the diagonal. There is a simple characterization of the kernel (e.g., it has a basis consisting of standard basis vectors). The square $(A-\lambda_i I)^2$ also has some zeros on the diagonal. How do they compare with the zeros on the diagonal of $A-\lambda_i I$? What does that tell you about the kernels?

Suppose $A$ is a non-diagonal Jordan matrix. Then there exists some Jordan block of size $> 1$ corresponding to some eigenvalue $\lambda_i$. Then in $A - \lambda_i I$ the block has zeros on the diagonal, and $1$s on the off-diagonal, e.g.
$$\begin{bmatrix} 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0\end{bmatrix}$$
Think about what this says about the kernel of $A-\lambda_i I$.
The square $(A-\lambda_i I)^2$ is also block diagonal, and the block of interest is the square of the above matrix that had zeros on the diagonal. Try squaring some examples of such Jordan blocks to see if you can understand how it will look, and think about what the kernel is. You'll find that it is strictly larger than the kernel of the original Jordan block. Thus, $\ker(A-\lambda_i I) \subsetneq \ker((A-\lambda_i I)^2)$.
