Tr

Tr[list]

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.

Details

  • Tr[list] sums the diagonal elements list[[i,i,]].
  • Tr works for rectangular as well as square matrices and tensors.
  • Tr can be used on SparseArray objects. »

Examples

open allclose all

Basic Examples  (1)

The trace of a matrix is the sum of the diagonal elements:

In[1]:=
Click for copyable input
Out[1]=

Scope  (2)

Generalizations & Extensions  (6)

Applications  (2)

Properties & Relations  (2)

See Also

Total  Diagonal  Transpose  Det  DiagonalMatrix  Eigenvalues

Tutorials

Introduced in 1999
(4.0)
| Updated in 2003
(5.0)