A diagonal matrix is a square matrix whose off-diagonal entries are all equal to zero.
A diagonal matrix is at the same time:
upper triangular;
lower triangular.
As such, it enjoys the properties enjoyed by triangular matrices, as well as other special properties.
A formal definition follows.
Definition A matrix is a diagonal matrix if and only if when .
Thus, the entries of a diagonal matrix whose row index and column index do not coincide (i.e., the entries not located on the main diagonal) are equal to .
We now provide some examples of diagonal matrices.
Example The matrixis diagonal.
Example The matrixis diagonal. Note that one of the diagonal entries () is zero. This is allowed because the definition is concerned only with off-diagonal entries (which must be zero), and any value is allowed for the diagonal elements.
Two useful results about products involving diagonal matrices are reported below.
Proposition Let be a matrix and a diagonal matrix. Then, the productis a matrix whose -th row is equal to the -th row of multiplied by (for every ).
By the definition of matrix product, the -th entry of iswhere we have used the fact that when . The coefficient is the same for all column indices in a given row . Therefore, all the elements of the -th row of are equal to the corresponding elements of the -th row of , multiplied by the constant .
Proposition Let be a matrix and a diagonal matrix. Then, the productis a matrix whose -th column is equal to the -th column of multiplied by (for every ).
The proof is similar to that of the previous proposition. The -th entry of isbecause when . The coefficient is the same for all row indices in a given column . Therefore, all the elements of the -th column of are equal to the corresponding elements of the -th column of , multiplied by the constant .
In other words, we have that:
when we pre-multiply by a diagonal matrix , the rows of are multiplied by the diagonal elements of ;
when we post-multiply by , the columns of are multiplied by the diagonal elements of .
Example DefineandLet us pre-multiply by :This gives the same result as multiplying the first row of by and the second row by . Let us post-multiply by :This gives the same result as multiplying the first column of by and the second column of by .
The next proposition is a direct consequence of the results in the previous section.
Proposition Let and be two diagonal matrices. Then, their products and are also diagonal. Furthermore,The diagonal elements of the products arefor .
By the results in the previous section, computing the product is the same as multiplying the rows of by the diagonal entries of . This fact, together with the fact that the off-diagonal entries of are zero, implies that the off-diagonal entries of are zero. Therefore, the product matrix is diagonal. Its diagonal entries arewhere we have used the fact that if . In a completely analogous manner, we can prove that the off-diagonal entries of are zero and that its diagonal entries are equal to those of .
In other words, matrix multiplication, which is in general not commutative, becomes commutative when all the matrices involved in the multiplication are diagonal.
Thanks to the above result about products, powers of diagonal matrices are easy to derive.
Proposition Let be a diagonal matrix. Then, the -th power is also diagonal andfor .
The proof is by induction. We start fromWe have that the product is diagonal and If the result is true for , thenis diagonal and
Remember that a matrix is:
lower triangular if and only if the entries above its main diagonal are zero;
upper triangular if and only if all the entries below its main diagonal are zero.
Therefore, the following proposition holds.
Proposition A matrix is diagonal if and only if it is both upper and lower triangular.
Being contemporaneously upper and lower triangular and being diagonal are the same thing because the set of all off-diagonal entries (that are zero in a diagonal matrix) is the union of the set of entries above the main diagonal (that are zero in a lower triangular matrix) and the set of entries below the main diagonal (that are zero in an upper triangular matrix).
The next proposition provides a simple criterion for the existence of the inverse of a diagonal matrix.
Proposition A diagonal matrix is invertible if and only if all the entries on its main diagonal are non-zero.
A diagonal matrix is triangular and a triangular matrix is invertible if and only if all the entries on its main diagonal are non-zero.
The next proposition shows how to actually compute the inverse when it exists.
Proposition Let be a diagonal matrix whose diagonal entries are non-zero. Then, its inverse is a diagonal matrix such thatfor .
We need to check that the proposed inverse satisfies the definition of inverse:where is the identity matrix. But we know that the product of two diagonal matrices is diagonal. Furthermore, its non-zero entries arefor . All the other (off-diagonal) entries are zero, both in the identity matrix and in the product .
Another simple property is stated below.
Proposition A diagonal matrix is symmetric, that is, equal to its transpose:
A matrix is symmetric if and only iffor any and . But the above equality always holds when , and it holds for diagonal matrices when because
Please cite as:
Taboga, Marco (2021). "Diagonal matrix", Lectures on matrix algebra. https://www.statlect.com/matrix-algebra/diagonal-matrix.
Most of the learning materials found on this website are now available in a traditional textbook format.