Search for a tool
Trace of a Matrix

Tool to compute the trace of a matrix. The trace of a square matrix M is the addition of values of its main diagonal, and is noted Tr(M).

Results

Trace of a Matrix -

Tag(s) : Matrix

Share
dCode and more

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!

Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!

Feedback and suggestions are welcome so that dCode offers the best 'Trace of a Matrix' tool for free! Thank you!

# Trace of a Matrix

## Square Matrix Trace Calculator NxN

Loading...
(if this message do not disappear, try to refresh this page)

## Rectangular Matrix Trace Calculator NxM

Loading...
(if this message do not disappear, try to refresh this page)

## Answers to Questions (FAQ)

### What is the matrix trace? (Definition)

The trace of a square matrix is the addition of the values on its main diagonal (starting from the top left corner and shifting one space to the right and down). So the trace of a square matrix uses these values:

$$\begin{bmatrix} X & . & . \\ . & X & . \\ . & . & X \end{bmatrix}$$ or, for a rectangular matrix: $$\begin{bmatrix} X & . & . \\ . & X & . \end{bmatrix}$$ or $$\begin{bmatrix} X & . \\ . & X \\ . & . \end{bmatrix}$$

### How to calculate a matrix trace?

To calculate the trace of a square matrix $M$ of size $n$, make the sum of diagonal values:

$$\mathrm{Tr}(M) = \sum_{i=1}^{n} a_{i \, i}$$

— For a 2x2 matrix: $$M = \begin{bmatrix} a & b \\ c & d \end{bmatrix} \\ \mathrm{Tr}(M) = a+d$$

Example: $$M = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \\ \mathrm{Tr}(M) = 1+4 = 5$$

— For a 3x3 matrix: $$M = \begin{bmatrix} a & b & c \\d & e & f \\ g & h & i \end{bmatrix} \\ \mathrm{Tr}(M) = a+e+i$$

— For a rectangular matrix $M$ of size $m \times n$, the diagonal used is the one of the included square matrix (from top left corner).

Example: $$M = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \end{bmatrix} \Rightarrow \mathrm{Tr}(M) = \mathrm{Tr} \begin{bmatrix} 1 & 2 \\ 4 & 5 \end{bmatrix}$$

### How to find a matrix trace from its eigenvalues?

Calculation from the eigenvalues of a matrix: the trace of a $M$ matrix is equal to the sum of its eigenvalues (including complex values and multiplicity).

NB: The product of the eigenvalues is the determinant of the matrix.

### What are trace mathematical properties?

Trace follows the following properties:

— The trace of an identity matrix $I_n$ (of size $n$) equals $n$.

$$\mathrm{Tr}(I_n) = n$$

— For A and B of the same order (that can be added):

$$\mathrm{Tr}(A + B) = \mathrm{Tr}(A) + \mathrm{Tr}(B)$$

— The trace is invariant for a cyclic permutation: for A and B of compatible size (and therefore A.B is a square matrix by multiplication">matrix multiplication):

$$\mathrm{Tr}(AB) = \mathrm{Tr}(BA) \\ \mathrm{Tr}(ABC) = \mathrm{Tr}(CAB) = \mathrm{Tr}(BCA)$$

but in the general case $\mathrm{Tr}(ABC) \neq \mathrm{Tr}(ACB) \neq \mathrm{Tr}(BAC)$

— For a given scalar c:

$$\mathrm{Tr}(c A) = c \mathrm{Tr}(A)$$

— For $A^T$ the transposed matrix of A:

$$\mathrm{Tr}(A^T) = \mathrm{Tr}(A)$$

## Source code

dCode retains ownership of the "Trace of a Matrix" source code. Except explicit open source licence (indicated Creative Commons / free), the "Trace of a Matrix" algorithm, the applet or snippet (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or the "Trace of a Matrix" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) and all data download, script, or API access for "Trace of a Matrix" are not public, same for offline use on PC, mobile, tablet, iPhone or Android app!
Reminder : dCode is free to use.

## Cite dCode

The copy-paste of the page "Trace of a Matrix" or any of its results, is allowed (even for commercial purposes) as long as you cite dCode!
Exporting results as a .csv or .txt file is free by clicking on the export icon
Cite as source (bibliography):
Trace of a Matrix on dCode.fr [online website], retrieved on 2023-09-27, https://www.dcode.fr/matrix-trace

## Need Help ?

Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!

## Questions / Comments

Feedback and suggestions are welcome so that dCode offers the best 'Trace of a Matrix' tool for free! Thank you!

https://www.dcode.fr/matrix-trace
© 2023 dCode — The ultimate 'toolkit' to solve every games / riddles / geocaching / CTF.

Feedback