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).

Trace of a Matrix - dCode

Tag(s) : Matrix

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*!

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).

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).

$$ \begin{bmatrix} X & . & . \\ . & X & . \\ . & . & X \end{bmatrix} or \begin{bmatrix} X & . & . \\ . & X & . \end{bmatrix} or \begin{bmatrix} X & . \\ . & X \\ . & . \end{bmatrix} $$

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 **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} $$

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) $$

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) $$

dCode retains ownership of the online 'Trace of a Matrix' tool source code. Except explicit open source licence (indicated CC / Creative Commons / free), any algorithm, applet or snippet (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, translator), or any function (convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (PHP, Java, C#, Python, Javascript, Matlab, etc.) no data, script or API access will be for free, same for Trace of a Matrix download for offline use on PC, tablet, iPhone or Android !

Please, check our community Discord for help requests!

trace,matrix,tr,square,identity,diagonal

Source : https://www.dcode.fr/matrix-trace

© 2020 dCode — The ultimate 'toolkit' to solve every games / riddles / geocaching / CTF.

Feedback

▲