The trace of $AB$, in general, is not equal to the product of the trace of $A$ and the trace of $B$, if you mean $a_{1,1} + a_{2,2} + \dots + a_{n,n}$ by "the trace of $A = [a_{i,j}]_{n \times n}$". However, it is true that the trace of $AB$ equals that of $BA$.
I would like to list some facts for your reference:
- The determinant of $AB$ equals the product of the determinant of $A$ and the determinant of $B$ (in which $A$ and $B$ are $n \times n$ matrices). Hence the determinant of $AB$ equals that of $BA$, since the multiplication of numbers is indeed commutative.
- The trace of $A + B$ equals the sum of the trace of $A$ and the trace of $B$. The trace of $A + B$ equals that of $B + A$, by the way.
- The determinant of $A + B$, in general, is not equal to the sum of the determinant of $A$ and the determinant of $B$. The determinant of $A + B$, however, equals that of $B + A$.