TITLE: Prove that, if $A, B$ are matrices from $M_4(R)$ so that $AB=BA$
QUESTION [9 upvotes]: Prove that, if $A, B$ are matrices from $M_4(\Bbb R)$ so that $AB=BA$  and $\det(A^2 −AB + B^2) = 0$ then:
$$
\det(A + B) + 3\det(A − B) = 6 (\det(A) + \det(B)) \tag 1
$$ 
What I tried:
Because of $AB=BA$ we can use, let's say, the Newton's binomial expansion for $A$ and $B$, but it didn't take me to the solution. 
Also it's easy to show that $\det (A^3 + B^3) = 0$.

REPLY [6 votes]: Let $\omega$ be a third root of unity. Since $A$ and $B$ commute, the condition that $\det(A^2-AB+B^2)=0$ becomes
$$\det(A+\omega B)\det(A+\omega^2 B)=0$$
and so either $\det(A+\omega B)=0$ or $\det(A+\omega^2 B)=0$.
Now consider the function $p(x)=\det(A+xB)$. This is a polynomial of degree at most $4$ with real coefficients, and from the above we see that either $\omega$ or $\omega^2$ is a root of $p$. Since $p$ has real coefficients, we then see that in fact both $\omega$ and $\omega^2$ are roots of $p$, and that $x^2+x+1$ is a factor of $p$.
Let $p(x)=(x^2+x+1)q(x)$ where $q$ is a polynomial of degree at most $2$, and let $q(x)=ax^2+bx+c$ where $a,b$ and $c$ are some real numbers.
Now consider the polynomial $r(x)=\det(xA+B)$.
For any $x\neq 0$, we have that
$$r(x)=\det\left(xA+B\right)=\det\left(x\left(A + \frac{1}{x}B\right)\right) = x^4\det\left(A + \frac{1}{x}B\right) = x^4p\left(\frac{1}{x}\right)$$
Then we have that
$$r(x)=x^4\left(\frac{1}{x^2}+\frac{1}{x}+1\right)\left(\frac{a}{x^2}+\frac{b}{x}+c\right)=(x^2+x+1)(a+bx+cx^2)$$
for any $x\neq 0$. The left and right hand sides of this expression are polynomials which agree at every point except possibly $x=0$, and so they must in fact be equal for all real $x$, including $x=0$. We see that
$$\det(B)=r(0)=a$$
Now we note that
$$\det(A+B)+3\det(A-B)=p(1)+3p(-1)=3q(1)+3q(-1)$$
which is equal to
$$6(a+c) = 6(\det(B)+q(0))=6(\det(B)+p(0))=6(\det(B)+\det(A))$$
as required.