Almost every square matrix satisfies Cayley-Hamilton Theorem I was watching Steve Brunton's lecture and he pointed out that Cayley Hamilton theorem is not true for every single square matrix, but it's true for almost every of them:

Someone pointed out to me that this might not actually be true for every single square matrix $A$. So, almost every matrix $A$ satisfies its own characteristic equation. I don't want to get into the edge cases where this is not true. You can look this up in a linear algebra book and find out if this is true everywhere, but basically this is true for most matrices, OK? I think it might actually be true for every matrix...

Could you clarify what is the matrix which does not satisfy the theorem?
 A: Brunton's comment is strange, even in context. He claims someone unspecified pointed out to him there may be exceptions, but settles for claiming "almost every" square matrix satisfies the theorem, as he didn't want to elaborate on edge cases. (This is unfortunate for anyone who hopes they can apply the theorem at some point.)
The comments have discussed the fact that matrices not on a commutative ring may be exceptions, but I don't think he had these in mind. If he did, his language should have been more careful, because "almost every" means the set of counterexamples should be of measure $0$.
I actually think it's more likely that he and an unnamed colleague are data scientists and not linear algebra experts, leading to sloppiness on their part. What is true is that:

*

*in a commutative ring, $n\times n$ diagonalizable matrices "satisfy the theorem" (which I'm using as an unfortunate shorthand for $p_A(A)=O_n$);

*these are dense in the full space of $n\times n$ matrices in the commutative ring;

*this implies the non-diagonalizable ones satisfy the theorem too (because the characteristic polynomial is of finite degree, in finitely many entries of the matrix whose characteristic polynomial is computed).

