Solution (source code)

= Solution

A square <matrix> is a <diagonalizable matrix> over the chosen field when there are an <invertible matrix> $P$ and a <diagonal matrix> $D$ such that $A=PDP^{-1}$. If $v_j$ is column $j$ of $P$ and $D_{jj}=\lambda_j$, the identity $AP=PD$ gives $Av_j=\lambda_jv_j$. Invertibility makes these $n$ columns <linearly independent> <eigenvectors>.

Conversely, put $n$ <linearly independent> <eigenvectors> in the columns of $P$ and their <eigenvalues> in $D$. Then $P$ is invertible and $AP=PD$, giving
$$
\boxed{A\text{ is diagonalizable}\ \Longleftrightarrow\ A\text{ has an eigenbasis of }n\text{ vectors}.}
$$
Repeated <eigenvalues> are allowed; the requirement is a complete <eigenbasis>, not distinctness of the eigenvalues.