Let $A, B \in M_{2}(\mathbb{R})$ be two square matrices such that $$AB \ne BA$$ and $$A^3 = B^3$$ Prove that $\mbox{Tr} (A^n) = \mbox{Tr} (B^n)$ for all $n \in \mathbb{N}$, where $\mbox{Tr} (\cdot)$ is the trace.
First, it's clear that $\det A = \det B$ and $A \ne B$. Also, using Cayley-Hamilton it is enough to prove it for $n=1$. I have played around with Cayley-Hamilton for both matrices, with no result. Any idea is welcome.
It suffices to check that the characteristic polynomial of $A$ and $B$ coincide. To this end, we show that the given condition yields $\operatorname{tr}(A) = \operatorname{tr}(B)$ and $\det(A) = \det(B)$.
First, the latter equality is immediate from $\det(A)^3 = \det(A^3) = \det(B^3) = \det(B)^3$ together with $\det(A), \det(B) \in \mathbb{R}$.
Next, by the Cayley-Hamilton theorem we have $A^2 = \operatorname{tr}(A)A - \det(A)I_2$ and consequently
$$ A^3 = (\operatorname{tr}(A)^2 - \det(A))A - \det(A)\operatorname{tr}(A)I_2. \tag{*}$$
So if $\operatorname{tr}(A)^2 - \det(A) \neq 0$, then it follows that $A = pA^3 + qI_2$ for some $p, q \in \mathbb{R}$. Since $A^3 = B^3$, this forces that $AB = BA$, contradicting the assumption. Hence we have
$$\operatorname{tr}(A)^2 = \det(A).$$
We consider two cases separately:
If $\det(A) = \det(B) = 0$, then this implies that $\operatorname{tr}(A) = \operatorname{tr}(B) = 0$.
If $\det(A) = \det(B) \neq 0$, then taking trace to both sides of $\text{(*)}$ and using the identity above, we have
$$ \operatorname{tr}(A^3) = \operatorname{tr}(A)^3 - 3\det(A)\operatorname{tr}(A) = -2\det(A) \operatorname{tr}(A).$$
Dividing both sides by $-2\det(A)$, it follows that $\operatorname{tr}(A)$ is completely determined by $A^3$, hence again we have $\operatorname{tr}(A) = \operatorname{tr}(B)$.
Therefore in any cases we have $\operatorname{tr}(A) = \operatorname{tr}(B)$ as desired.
Remark. When the condition $AB \neq BA$ is dropped, we have an obvious counter-example $A = I_2$ and $B$ is the rotation matrix by angle $2\pi/3$. In this case, we have
$$A^3 = B^3 = I_2 \qquad \text{but} \qquad \operatorname{tr}(A) = 2 \neq -1 = \operatorname{tr}(B). $$