Trace(AB) = Trace(BA): The Matrix Property That Will Blow Your Mind
At the intersection of linear algebra and mathematical physics, one encounters elegant properties that reveal the inherent symmetry of matrix operations. The question of whether the trace of a product remains invariant under cyclic permutations—specifically, is trace(ab) = trace(ba)—touches upon a fundamental truth about square matrices. This identity is not merely a computational trick; it is a cornerstone concept that ensures the robustness of definitions in multilinear algebra and provides intuitive geometric interpretations for complex transformations.
The Definition of the Trace
To understand the cyclic property, we must first anchor our discussion in the definition of the trace itself. For a given square matrix $A$ of size $n \times n$, the trace, denoted as $\text{tr}(A)$, is defined as the sum of the elements on its main diagonal. If we denote the elements of $A$ as $a_{ij}$, where $i$ represents the row index and $j$ represents the column index, the trace is expressed as the summation from $i = 1$ to $n$ of $a_{ii}$. This operation effectively reduces a matrix to a single scalar value, capturing the "total magnitude" of the transformation it represents without regard to the off-diagonal complexities.
Algebraic Proof of the Equality
We can prove the equality trace(ab) = trace(ba) through direct computation using sigma notation. Let $A$ and $B$ be $n \times n$ matrices. The $(i, i)$ element of the product $AB$ is given by the sum over $k$ of $a_{ik} b_{ki}$. Consequently, the trace of $AB$ is the sum over $i$ of these products, resulting in the double summation $\sum_{i=1}^n \sum_{k=1}^n a_{ik} b_{ki}$. If we examine the product $BA$, its trace is calculated similarly as $\sum_{k=1}^n \sum_{i=1}^n b_{ki} a_{ik}$. Due to the commutativity of scalar multiplication and the finiteness of the sums, the order of summation can be interchanged, making the two expressions identical. This algebraic manipulation confirms that the total sum of the pairwise products is independent of the order of the indices, provided the indices cycle through the same range.
Geometric and Intuitive Interpretation
Beyond the symbolic manipulation of entries, trace(ab) = trace(ba) finds a profound geometric meaning in the concept of inner products and Frobenius norms. The trace of the product of a matrix $A^T$ with another matrix $B$ defines the Frobenius inner product, $\langle A, B \rangle_F = \text{tr}(A^T B)$. This operation behaves exactly like the dot product for vectors, measuring the "alignedness" or projection between two matrices in a high-dimensional vector space. Because the standard dot product is commutative, the inner product of $A$ and $B$ must equal the inner product of $B$ and $A$. Consequently, $\text{tr}(A^T B) = \text{tr}(B^T A)$, demonstrating that the cyclic property is essential for maintaining the logical consistency of geometric measurements in matrix space.
Implications for Eigenvalues and Determinants
The invariance of the trace under cyclic permutations extends its utility to the analysis of eigenvalues. The trace of a single square matrix is equal to the sum of its eigenvalues (counting algebraic multiplicity). When dealing with the product of two matrices $AB$ and $BA$, the non-zero eigenvalues of these two products are identical. Although the full set of eigenvalues might differ if the matrices are of different sizes (for rectangular matrices), for square matrices, this eigenvalue equivalence ensures that trace(ab) = trace(ba). This connection is vital because it links the trace—the sum of diagonal elements—to the fundamental spectral properties of the transformation, reinforcing why the trace is referred to as a similarity invariant.
Applications in Advanced Mathematics and Physics
The principle that trace(ab) = trace(ba) is not confined to theoretical exercises; it is a workhorse in various advanced fields. In quantum mechanics, physical states are represented by density matrices, and the expectation value of an observable $A$ is calculated as $\text{tr}(\rho A)$. The cyclic property ensures that the order of operations in a cyclic permutation does not affect the measurable probability, which is crucial for the consistency of quantum calculations. In differential geometry, the trace is used to define the Ricci curvature tensor, where the cyclic property of the underlying Riemann curvature tensor is necessary to contract indices meaningfully and produce physically meaningful quantities such as scalar curvature.
In the realm of machine learning and statistics, the trace frequently appears in the derivation of algorithms and the evaluation of model fits. For instance, the calculation of the covariance matrix or the minimization of reconstruction error in techniques like Principal Component Analysis (PCA) often involves expressions like $\text{tr}(X^T X)$. The ability to cyclically permute these expressions allows mathematicians and data scientists to rearrange equations to find optimal solutions, simplify gradients, or prove convergence properties. This trace identity ensures that the optimization landscapes remain well-behaved and that the mathematics describing complex data relationships retains its elegance and symmetry.