The trace of a square matrix is the sum of its diagonal entries.

The trace has several properties that are used to prove important results in matrix algebra and its applications.

Let us start with a formal definition.

Definition Let be a matrix. Then, its trace, denoted by or , is the sum of its diagonal entries:

Some examples follow.

Example Define the matrixThen, its trace is

Example Define the matrixThen, its trace is

The following subsections report some useful properties of the trace operator.

The trace of a sum of two matrices is equal to the sum of their traces.

Proposition Let and be two matrices. Then,

Proof

Remember that the sum of two matrices is performed by summing each element of one matrix to the corresponding element of the other matrix (see the lecture on Matrix addition). As a consequence,

The next proposition tells us what happens to the trace when a matrix is multiplied by a scalar.

Proposition Let be a matrix and a scalar. Then,

Proof

Remember that the multiplication of a matrix by a scalar is performed by multiplying each entry of the matrix by the given scalar (see the lecture on Multiplication of a matrix by a scalar). As a consequence,

The two properties above (trace of sums and scalar multiples) imply that the trace of a linear combination is equal to the linear combination of the traces.

Proposition Let and be two matrices and and two scalars. Then,

Transposing a matrix does not change its trace.

Proposition Let be a matrix. Then,

Proof

The trace of a matrix is the sum of its diagonal elements, but transposition leaves the diagonal elements unchanged.

The next proposition concerns the trace of a product of matrices.

Proposition Let be a matrix and an matrix. Then,

Proof

Note that is a matrix and is an matrix. Then,where in steps and we have used the definition of matrix product, in particular, the facts that is equal to the dot product between the -th row of and the -th column of , and is equal to the dot product between the -th row of and the -th column of .

A trivial, but often useful property is that **a scalar is equal to its
trace** because a scalar can be thought of as a
matrix, having a unique diagonal element, which in turn is equal to the trace.

This property is often used to write dot products as traces.

Example Let be a row vector and a column vector. Then, the product is a scalar, andwhere in the last step we have use the previous proposition on the trace of matrix products. Thus, we have been able to write the scalar as the trace of the matrix .

Below you can find some exercises with explained solutions.

Let be a matrix defined byFind its trace.

Solution

By summing the diagonal elements, we obtain

Let be a matrix and a vector. Write the productas the trace of a product of two matrices.

Solution

Since is a scalar, we have that Furthermore, is and is . Therefore,where both and are .

Please cite as:

Taboga, Marco (2021). "Trace of a matrix", Lectures on matrix algebra. https://www.statlect.com/matrix-algebra/trace-of-a-matrix.

The books

Most of the learning materials found on this website are now available in a traditional textbook format.

Featured pages

- Student t distribution
- Exponential distribution
- Independent events
- Multivariate normal distribution
- Chi-square distribution
- Statistical inference

Explore

Main sections

- Mathematical tools
- Fundamentals of probability
- Probability distributions
- Asymptotic theory
- Fundamentals of statistics
- Glossary

About

Glossary entries

- Continuous mapping theorem
- Almost sure
- Alternative hypothesis
- Integrable variable
- Convolutions
- Estimator

Share

- To enhance your privacy,
- we removed the social buttons,
- but
**don't forget to share**.