Skip to content

Esta página también está en español.

Léela en español

このページは日本語でも読めます。

日本語で読む

本页也有简体中文版本。

阅读简体中文版本

Trace of a matrix (trace)

Trace of a square matrix: the sum of its diagonal.

How to write it

trace(matrix)

matrix
A square matrix. Takes a matrix, written as a list of rows.

Examples

  • tr⁡((1234))=5\displaystyle \operatorname{tr}\left(\begin{pmatrix} 1 & 2 \\ 3 & 4 \end{pmatrix}\right) = 5
    trace([[1, 2], [3, 4]])

    In the solver, trace([[1, 2], [3, 4]]) gives 5.

    Open in the solver