Solution (source code)

= Solution

<Eigenvectors> belonging to distinct <eigenvalues> are linearly independent. Indeed, suppose
$$
\sum_{j=1}^m c_jv_j=0
$$
is a shortest nontrivial relation, where $Av_j=\lambda_jv_j$ and the $\lambda_j$ are distinct. Applying $A-\lambda_mI$ gives
$$
\sum_{j=1}^{m-1}c_j(\lambda_j-\lambda_m)v_j=0,
$$
a shorter nontrivial relation, a contradiction.

Thus $n$ distinct <eigenvalues> provide a <basis> of $n$ <eigenvectors>, proving that $A$ is diagonalizable over $\mathbb C$. If $A$ is real and all its <eigenvalues> are real, each real singular <matrix> $A-\lambda I$ has a nonzero real null <vector>. Choosing one for each <eigenvalue> gives a real eigenbasis. Hence the real <matrix> is diagonalizable over $\mathbb R$. This is the <distinct eigenvalues imply diagonalizability> criterion.