<s>[INST] How to show the following problem of determinant If the matrices $A,B\in M_{3}(\Bbb{Z})$ are singular and $AB=BA$, show that the number $$\det(A^3+B^3)+\det(A^3-B^3)$$ is the double of a perfect cube.
I have considered the polynomial $$\det(A+xB)=\det A+mx+nx^2+x^3\det B$$
From this how I can show
 [/INST] Following Anurag A's suggestion in the comments, let $\omega$ be a primitive third root of unity (so $\omega^2+\omega + 1=0$).
Then observe that since $A$ and $B$ commute, we have $$A^3+B^3 = (A+B)(A+\omega B)(A+\omega^2B)$$ and $$A^3-B^3 = (A-B)(A-\omega B)(A-\omega^2 B).$$
Then using that $\det(A)=\det(B)=0$, we have that $p(x)=\det(A+xB)= x(m+nx)$ for some integers $n$ and $m$ from the formula that you've written in the question.
Thus 
$$\det(A^3+B^3)+\det(A^3-B^3) = p(1)p(\omega)p(\omega^2) +p(-1)p(-\omega)p(-\omega^2) $$
$$= (m+n)(m+n\omega)(m+n\omega^2) - (m-n)(m-n\omega)(m-n\omega^2) = m^3+n^3 - (m^3-n^3) = 2n^3.$$
</s>