Prove that there exist integers $p$ and $q$ such that $\det(A^3+B^3) = p^3+q^3$ 
Let $A$ and $B$ be $3 \times 3$ matrices with integer entries so that $AB = BA$ and $\det(A) = \det(B) = 0$. Prove that there exist integers $p$ and $q$ such that $\det(A^3+B^3) = p^3+q^3$.

I thought about factorizing $A^3+B^3$. We have $$A^3+B^3 = (A+B)(A^2-AB+B^2).$$ Then we have $$\det(A^3+B^3) = \det(A+B)\det(A^2-AB+B^2).$$ How do we use the fact that $A$ and $B$ are $3 \times 3$? For $3 \times 3$ matrices is it true that $\det(A+xB) = x(a+bx)$ where $a,b$ are integers? If so, then we have since $$A^2-AB+B^2 = (A-e^{2\pi i/3}B)(A-e^{-2\pi i/3}B),$$ that $$\det(A^3+B^3) = (a+b)(a-be^{2\pi i/3})(a-be^{-2 \pi i/3}).$$

An alternative, with the additional assumption that both $A$ and $B$ are diagonalizable: Then, since they commute we can write 
$$A=PD_AP^{-1}, B=PD_BP^{-1}$$
where $D_A$ and $D_B$ are diagonal matrices. We have
$$A^{3}=PD_A^{3}P^{-1}, B^{3}=PD_B^{3}P^{-1}$$
and 
$$det(A^{3}+B^{3})=det(P(D_A^{3}+D_B^{3})P^{-1})=det(D_A^{3}+D_B^{3}).$$
Now, let the diagonal of $D_A$ be $(a_1, a_2, a_3)$ and that of $D_B$ analogously. Thus we get
$$det(D_A^{3}+D_B^{3})=(a1^{3}+b_1^{3})(a_2^{3}+b_2^{3})(a_3^{3}+b_3^{3})$$
We know since $det(A)=det(B)=0$ that at least one of $a_1,a_2,a_3$ must be zero. The same holds for $B$. Now, we can identify two cases:


*

*$det(A^{3}+B^{3})=0$   This corresponds to the case when $a_i=b_i=0$ for some $i$ (i.e. the eigenvalue at the same position is zero). Then, $p=q=0$ solves the problem.

*$det(A^{3}+B^{3})\neq 0$. This means that $a_ib_i\neq 0$ for all $i=1,2,3$. W.l.o.g. assume $a_1=0, b_2=0$. Then $det(A^{3}+B^{3})=b_1^{3}a_2^{3}(a_3^{3}+b_3^{3})=(b_1a_2a_3)^{3}+(b_1a_2b_3)^{3}$ proving the second case.
