Project DelphiTensors Workshop
Knowledge

The trace

The trace is the sum of the diagonal entries of a matrix: Tr(A) = Σᵢ Aᵢ,ᵢ. For the matrix with rows [4, 1] and [3, 6], Tr(A) = 4 + 6 = 10.

It lets you write sums without Σ notation, and it comes with useful identities:

  • Tr(A) = Tr(Aᵀ).
  • Cyclic property: Tr(ABC) = Tr(CAB) = Tr(BCA), whenever the products are defined. Only cyclic moves are allowed: move the last factor to the front. It holds even when the shapes change: for A ∈ ℝᵐˣⁿ and B ∈ ℝⁿˣᵐ, Tr(AB) = Tr(BA), though AB is m × m and BA is n × n.
  • A scalar is its own trace: a = Tr(a).
  • The Frobenius norm is ‖A‖_F = √Tr(AAᵀ).