The equality holds over any commutative ring.
Short proof. It suffices to show that the equality holds for diagonal matrices, which is straightforward.
Slightly longer proof. Let $ (a_{ij})_{i,j=1}^n $ be indeterminates. It is enough to check that the equality holds for the matrix $ A\in M_n(\mathbb Q(a_{11},\dots,a_{nn})) $ whose $(i,j)$ entry is $a_{ij}$. But this clear since $A$ is semi-simple.
More details.
Why does it suffice to check the equality in this particular case?
Let $B$ be in $M_n(K)$, where $K$ is a commutative ring. The statement we must prove says that a certain matrix $F(B)$, depending on $B$, is zero. But each entry of $F(B)$ is a polynomial in the entries of $B$, and the coefficients of this polynomial are integers depending only on $n$.
Why is $A$ semi-simple?
Because the discriminant of its characteristic polynomial is nonzero.