Tr
Tr[m] gives the trace of a square matrix (sum of diagonal elements).
Examples
Compute matrix trace:
Tr[{{1, 2}, {3, 4}}]
(* 5 *)
Tr[IdentityMatrix[3]]
(* 3 *)
(* Trace with symbolic elements *)
Tr[{{a, b}, {c, d}}]
(* a + d *)Please visit the official Wolfram Language Reference for more details.