Skip to main content ☰ Contents You! < Prev ^ Up Next > \(\newcommand{\R}{\mathbb R}
\newcommand{\T}{\mathsf{T}}
\newcommand{\lt}{<}
\newcommand{\gt}{>}
\newcommand{\amp}{&}
\definecolor{fillinmathshade}{gray}{0.9}
\newcommand{\fillinmath}[1]{\mathchoice{\colorbox{fillinmathshade}{$\displaystyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\textstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptstyle \phantom{\,#1\,}$}}{\colorbox{fillinmathshade}{$\scriptscriptstyle\phantom{\,#1\,}$}}}
\)
Subsection 2.3 The trace of a matrix
Definition 2.3.46 . Trace.
The trace of a square matrix \(\boldsymbol{A}\text{,}\) denoted \(\text{tr}\left(\boldsymbol{A}\right)\text{,}\) is the sum of the diagonal elements of \(\boldsymbol{A}\text{.}\)
Example 2.3.47 . Find the trace of a matrix.
Find the \(\text{tr}\left(\boldsymbol{A}\right)\text{,}\) where
\begin{equation*}
\boldsymbol{A} = \left[ \begin{array}{rrrr}
2 \amp -1 \amp 0 \amp 2\\
3 \amp -3 \amp 4 \amp 1\\
-2 \amp 1 \amp 1 \amp 0\\
1 \amp 2 \amp 3 \amp 4
\end{array}\right]
\end{equation*}
The trace is
\begin{equation*}
\begin{array}{ccc}
\text{tr}\left(\boldsymbol{A}\right) \amp = \amp
a_{11} + a_{22} + a_{33} + a_{44}\\
\amp = \amp 2 \hspace{0.15cm} - \hspace{0.15cm} 3 \hspace{0.15cm} + \hspace{0.15cm} 1 \hspace{0.15cm} + \hspace{0.15cm} 4 \\
\amp = \amp 4.
\end{array}
\end{equation*}
Checkpoint 2.3.48 . Finding the trace.
Activate
Find the trace of the given matrix
\begin{equation*}
\begin{array}{lrrrrrr}
\lceil \amp {-1} \amp {2} \amp {-6} \amp {1} \amp {4} \amp \rceil\\
\vert \amp {-3} \amp {1} \amp {5} \amp {6} \amp {-8} \amp \vert\\
\vert \amp {6} \amp {9} \amp {6} \amp {5} \amp {-9} \amp \vert\\
\vert \amp {8} \amp {-9} \amp {3} \amp {4} \amp {1} \amp \vert\\
\lfloor \amp {-4} \amp {8} \amp {-2} \amp {-5} \amp {-2} \amp \rfloor\\
\end{array}
\end{equation*}
Trace =
Answer .
Solution .
\begin{equation*}
\text{tr}(\boldsymbol{A}) = ({-1}) + ({1})+({6}) +({4}) + ({-2}) = {8}
\end{equation*}
Subsubsection 2.3.1 Properties of the trace
Trace of a sum .
The trace of the sum of two matrix is equal to the sum of the traces of each matrix.
\begin{equation*}
\text{tr}\left(\boldsymbol{A}+\boldsymbol{B}\right) = \text{tr}\left(\boldsymbol{A}\right) + \text{tr}\left(\boldsymbol{B}\right)
\end{equation*}
Example 2.3.49 .
Let,
\begin{equation*}
\boldsymbol{A} = \left[ \begin{array}{rrr}
1 \amp 2 \amp -3 \\
1 \amp -3 \amp -2 \\
-2 \amp 0 \amp 1
\end{array}\right], \hspace{1cm}
\boldsymbol{B} = \left[ \begin{array}{rrr}
2 \amp -2 \amp 1 \\
3 \amp -1 \amp 0 \\
4 \amp 0 \amp 1
\end{array}\right].
\end{equation*}
In this case,
\begin{equation*}
\begin{array}{ccc}
\text{tr}\left(\boldsymbol{A}\right) \amp = \amp 1-3+1 = -1,\\
\text{tr}\left(\boldsymbol{B}\right) \amp = \amp 2-1+1 = 2.\\
\amp \amp\\
\text{tr}\left(\boldsymbol{A}\right)+ \text{tr}\left(\boldsymbol{B}\right) \amp = \amp -1 +2 = 1.
\end{array}
\end{equation*}
For the sum we have,
\begin{equation*}
\boldsymbol{A}+ \boldsymbol{B} =
\left[ \begin{array}{rrr}
1 \amp 2 \amp -3 \\
1 \amp -3 \amp -2 \\
-2 \amp 0 \amp 1
\end{array}\right] +
\left[ \begin{array}{rrr}
2 \amp -2 \amp 1 \\
3 \amp -1 \amp 0 \\
4 \amp 0 \amp 1
\end{array}\right] =
\left[ \begin{array}{rrr}
3 \amp 0 \amp -2 \\
4 \amp -4 \amp -2 \\
2 \amp 0 \amp 2
\end{array}\right].
\end{equation*}
\begin{equation*}
\text{tr}\left(\boldsymbol{A}+ \boldsymbol{B}\right) = 3-4+2 = 1.
\end{equation*}
\(\,\)
Trace of a product .
The trace of \(\boldsymbol{A}\,\boldsymbol{B} \) is the same as the trace of \(\boldsymbol{B}\,\boldsymbol{A}. \)
\begin{equation*}
\text{tr}\left(\boldsymbol{A}\,\boldsymbol{B}\right) = \text{tr}\left(\boldsymbol{B}\,\boldsymbol{A}\right).
\end{equation*}
Example 2.3.50 .
Let
\begin{equation*}
\boldsymbol{A} = \left[ \begin{array}{rrr}
1 \amp 2 \amp -3 \\
1 \amp -3 \amp -2 \\
-2 \amp 0 \amp 1
\end{array}\right], \hspace{1cm}
\boldsymbol{B} = \left[ \begin{array}{rrr}
2 \amp -2 \amp 1 \\
3 \amp -1 \amp 0 \\
4 \amp 0 \amp 1
\end{array}\right].
\end{equation*}
Then,
\begin{equation*}
\boldsymbol{A}\,\boldsymbol{B} = \left[ \begin{array}{rrr}
1 \amp 2 \amp -3 \\
1 \amp -3 \amp -2 \\
-2 \amp 0 \amp 1
\end{array}\right]\,
\left[ \begin{array}{rrr}
2 \amp -2 \amp 1 \\
3 \amp -1 \amp 0 \\
4 \amp 0 \amp 1
\end{array}\right]=
\left[ \begin{array}{rrr}
-4 \amp -4 \amp -2 \\
-15 \amp 1 \amp -1 \\
0 \amp 4 \amp -1
\end{array}\right]
\end{equation*}
Giving,
\begin{equation*}
\text{tr}\left(\boldsymbol{A}\,\boldsymbol{B}\right) = -4 + 1 -1 = -4.
\end{equation*}
Similarly,
\begin{equation*}
\boldsymbol{B}\,\boldsymbol{A} = \left[ \begin{array}{rrr}
2 \amp -2 \amp 1 \\
3 \amp -1 \amp 0 \\
4 \amp 0 \amp 1
\end{array}\right]\,
\left[ \begin{array}{rrr}
1 \amp 2 \amp -3 \\
1 \amp -3 \amp -2 \\
-2 \amp 0 \amp 1
\end{array}\right]
=
\left[ \begin{array}{rrr}
-2 \amp 10 \amp -1 \\
2 \amp 9 \amp -7 \\
2 \amp 8 \amp -11
\end{array}\right]
\end{equation*}
\begin{equation*}
\text{tr}\left(\boldsymbol{B}\,\boldsymbol{A}\right) = -2 + 9 -11 = -4.
\end{equation*}
\(\,\)
Trace of a matrix-scalar product .
The trace of the product of a matrix and a scalar is equal to the scalar times the trace of the matrix.
\begin{equation*}
\text{tr}\left(c\,\boldsymbol{A}\right) = c\,\text{tr}\left(\boldsymbol{A}\right).
\end{equation*}
Example 2.3.51 .
Let
\begin{equation*}
\boldsymbol{A} = \left[ \begin{array}{rrr}
1 \amp 2 \amp -3 \\
1 \amp -3 \amp -2 \\
-2 \amp 0 \amp 1
\end{array}\right].
\end{equation*}
Then,
\begin{equation*}
\text{tr}\left(\boldsymbol{A}\right) = 1 -3 + 1 = -1.
\end{equation*}
If we multiply \(\boldsymbol{A}\) by \(4\text{,}\) we get,
\begin{equation*}
4\,\boldsymbol{A} = \left[ \begin{array}{rrr}
4 \amp 8 \amp -12 \\
4 \amp -12 \amp -8 \\
-8 \amp 0 \amp 4
\end{array}\right],
\end{equation*}
and,
\begin{equation*}
\text{tr}\left(4\boldsymbol{A}\right) = 4 -12 + 4 = -4.
\end{equation*}
Compare to
\begin{equation*}
4\, \text{tr}\left(\boldsymbol{A}\right) = 4 \times -1 = -4.
\end{equation*}
\(\,\)
Trace of a transpose .
The trace of a transpose is equal to the trace of the original matrix.
\begin{equation*}
\text{tr}\left(\boldsymbol{A}\right) = \text{tr}\left(\boldsymbol{A}^{\mathsf{T}}\right).
\end{equation*}
Example 2.3.52 .
Let
\begin{equation*}
\boldsymbol{A} = \left[ \begin{array}{rrr}
1 \amp 2 \amp -3 \\
1 \amp -3 \amp -2 \\
-2 \amp 0 \amp 1
\end{array}\right].
\end{equation*}
\begin{equation*}
\text{tr}\left(\boldsymbol{A}\right) = 1 -3 + 1 = -1.
\end{equation*}
The transpose of \(\boldsymbol{A} \) is,
\begin{equation*}
\boldsymbol{A}^{\mathsf{T}} = \left[ \begin{array}{rrr}
1 \amp 1 \amp -2 \\
2 \amp -3 \amp 0\\
-3 \amp -2 \amp 1
\end{array}\right].
\end{equation*}
and its trace is
\begin{equation*}
\text{tr}\left(\boldsymbol{A}^{\mathsf{T}}\right) = 1 -3 + 1 = -1.
\end{equation*}
\(\, \)