StatLect
Index > Matrix algebra

Diagonal matrix

A diagonal matrix is a square matrix whose off-diagonal entries are all equal to zero.

A diagonal matrix is at the same time:

As such, it enjoys the properties enjoyed by triangular matrices, as well as other special properties.

Table of Contents

Definition

A formal definition follows.

Definition A $K	imes K$ matrix $D$ is a diagonal matrix if and only if $D_{ij}=0$ when $i
eq j$.

Thus, the entries of a diagonal matrix whose row index i and column index $j$ do not coincide (i.e., the entries not located on the main diagonal) are equal to 0.

Examples

We now provide some examples of diagonal matrices.

Example The $3	imes 3$ matrix[eq1]is diagonal.

Example The $4	imes 4$ matrix[eq2]is diagonal. Note that one of the diagonal entries ($D_{22}$) 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.

Multiplication by a diagonal matrix

Two useful results about products involving diagonal matrices are reported below.

Proposition Let A be a $K	imes L$ matrix and $D$ a $K	imes K$ diagonal matrix. Then, the product[eq3]is a $K	imes L$ matrix whose i-th row is equal to the i-th row of A multiplied by $D_{ii}$ (for every $i=1,ldots ,K$).

Proof

By the definition of matrix product, the $left( i,j
ight) $-th entry of $DA$ is[eq4]where we have used the fact that $D_{ik}=0$ when $k
eq i$. The coefficient $D_{ii}$ is the same for all column indices $j$ in a given row i. Therefore, all the elements of the i-th row of $DA$ are equal to the corresponding elements of the i-th row of A, multiplied by the constant $D_{ii}$.

Proposition Let A be a $K	imes L$ matrix and $D$ a $L	imes L$ diagonal matrix. Then, the product[eq5]is a $K	imes L$ matrix whose $j$-th column is equal to the $j$-th column of A multiplied by $D_{jj}$ (for every $j=1,ldots ,L$).

Proof

The proof is similar to that of the previous proposition. The $left( i,j
ight) $-th entry of $AD$ is[eq6]because $D_{lj}=0$ when $l
eq j$. The coefficient $D_{jj}$ is the same for all row indices i in a given column $j$. Therefore, all the elements of the $j$-th column of $AD$ are equal to the corresponding elements of the $j$-th column of A, multiplied by the constant $D_{jj}$.

In other words, we have that:

Example Define[eq7]and[eq8]Let us pre-multiply A by $D$:[eq9]This gives the same result as multiplying the first row of A by $2$ and the second row by $4$. Let us post-multiply A by $D$:[eq10]This gives the same result as multiplying the first column of A by $2$ and the second column of A by $4$.

Products of diagonal matrices

The next proposition is a direct consequence of the results in the previous section.

Proposition Let A and $B$ be two $K	imes K$ diagonal matrices. Then, their products $AB$ and $BA$ are also diagonal. Furthermore,[eq11]The diagonal elements of the products are[eq12]for $i=1,ldots ,K$.

Proof

By the results in the previous section, computing the product $AB$ is the same as multiplying the rows of $B$ by the diagonal entries of A. This fact, together with the fact that the off-diagonal entries of $B$ are zero, implies that the off-diagonal entries of $AB$ are zero. Therefore, the product matrix $AB$ is diagonal. Its diagonal entries are[eq13]where we have used the fact that $A_{ij}=0$ if $i
eq j$. In a completely analogous manner, we can prove that the off-diagonal entries of $BA$ are zero and that its diagonal entries are equal to those of $AB$.

In other words, matrix multiplication, which is in general not commutative, becomes commutative when all the matrices involved in the multiplication are diagonal.

Powers

Thanks to the above result about products, powers of diagonal matrices are easy to derive.

Proposition Let $D$ be a $K	imes K$ diagonal matrix. Then, the n-th power $D^{n}$ is also diagonal and[eq14]for $i=1,ldots ,K$.

Proof

The proof is by induction. We start from[eq15]We have that the product $DD$ is diagonal and [eq16]If the result is true for $n-1$, then[eq17]is diagonal and[eq18]

Diagonal and triangular matrices

Remember that a matrix is:

Therefore, the following proposition holds.

Proposition A matrix is diagonal if and only if it is both upper and lower triangular.

Proof

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

Inverse

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.

Proof

The next proposition shows how to actually compute the inverse when it exists.

Proposition Let $D$ be a $K	imes K$ diagonal matrix whose diagonal entries are non-zero. Then, its inverse $D^{-1}$ is a diagonal matrix such that[eq19]for $i=1,ldots ,K$.

Proof

We need to check that the proposed inverse satisfies the definition of inverse:[eq20]where I is the identity matrix. But we know that the product of two diagonal matrices is diagonal. Furthermore, its non-zero entries are[eq21]for $i=1,ldots ,K$. All the other (off-diagonal) entries are zero, both in the identity matrix and in the product $DD^{-1}$.

Symmetry

Another simple property is stated below.

Proposition A diagonal matrix $D$ is symmetric, that is, equal to its transpose:[eq22]

Proof

A matrix $D$ is symmetric if and only if[eq23]for any $j$ and i. But the above equality always holds when $i=j$, and it holds for diagonal matrices when $i
eq j$ because[eq24]

The book

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