Let $P$ be a field (as in linear algebra). All the following are in this field.
Let $A$ be a $n\times n$ matrix, $f(\lambda)=|\lambda I-A|$, where $I$ is the identity matrix. $g(\lambda)=f(\lambda)/(f(\lambda),f'(\lambda))$, where $f'(\lambda)$ is the derivative of $f(\lambda)$, and $(f(\lambda),f'(\lambda))$ is the greatest common divisor of $f(\lambda)$ and $f'(\lambda)$. Show that $A$ is diagonalizable if and only if $g(A)=0$.
The only if part is easy. What about the if part?