Calculate the trace of a matrix: the sum of the elements on the main diagonal of a square matrix.
Try it yourself: