When does a product of two symmetric matrices commute?

660 Views Asked by At

I have two $n\times n$ symmetric matrices.

I know that $\operatorname{tr}(AB)=\operatorname{tr}(BA)$. But it does not mean $AB=BA$. I wonder what is the condition for $AB=BA$.