finds the trace of the matrix or tensor list.

Tr[list, f]
finds a generalized trace, combining terms with f instead of Plus.

Tr[list, f, n]
goes down to level n in list.


  • Tr[list] sums the diagonal elements .
  • Tr works for rectangular as well as square matrices and tensors.
  • Tr can be used on SparseArray objects. »
New in 4 | Last modified in 5
New to Mathematica? Find your learning path »
Have a question? Ask support »