Diagonal Matrix
Before going to learn what is a diagonal matrix, let us recall a few other types of matrices. There are two types of triangular matrices called "lower triangular matrices" and "upper triangular matrices".
 A lower triangular matrix is a square matrix in which all the elements above the principal diagonal are zeros.
Example: \(\left[\begin{array}{rr}3 & 0 & 0\\ 2 & 1 & 0\\ 4 & 5 & 3\end{array}\right]\)  An upper triangular matrix is a square matrix in which all the elements below the principal diagonal are zeros.
Example: \(\left[\begin{array}{rr}6 & 1 & 2\\ 0 & 4 & 5\\ 0 & 0 & 7\end{array}\right]\)
A diagonal matrix is a matrix that is both lower triangular and upper triangular? Can you now imagine how a diagonal matrix look like? Let us see.
1.  What Is Diagonal Matrix? 
2.  Properties of Diagonal Matrix 
3.  Determinant of Diagonal Matrix 
4.  Inverse of Diagonal Matrix 
5.  Diagonalization of a Matrix 
6.  FAQs on Diagonal Matrix 
What is Diagonal Matrix?
A matrix that is both upper triangular and lower triangular is called a diagonal matrix. i.e., all the elements above and below the principal diagonal are zeros and hence the name "diagonal matrix". By the mathematical definition of a diagonal matrix, a matrix A = [a\(_{ij}\)] is said to be diagonal if
 A is a square matrix
 a\(_{ij}\) = 0 when i ≠ j.
Some examples of diagonal matrices are \(\left[\begin{array}{rr}2 & 0 \\ \\ \\ 0 & 3 \end{array}\right]\), \(\left[\begin{array}{rr}3 & 0 & 0\\ 0 & 1 & 0\\ 0 &0 & 6\end{array}\right]\), \(\left[\begin{array}{rr}4 & 0 & 0&0\\ 0 & 2 & 0&0\\ 0 & 0 & 1&0\\0&0&0&7\end{array}\right] \), etc. But can a diagonal matrix have some (or all) of its diagonal elements to be zeros? Yes, it can have as the only condition for it to be a diagonal matrix is concerned with its nonprincipal diagonal elements (which have to be zeros). In other words, the diagonal elements of a diagonal matrix can be either zeros or nonzeros.
Anti Diagonal Matrix
An anti diagonal matrix is just the mirror image of a diagonal matrix with respect to the placement of the elements. i.e., in an antidiagonal matrix, all the elements above and below the diagonal (which is NOT the principal diagonal) are zeros. Note that any anti diagonal matrix is a non diagonal matrix.
Examples: \(\left[\begin{array}{rr}0 & 1 \\ \\ \\ 2 & 0 \end{array}\right]\), \(\left[\begin{array}{rr} 0 & 0 & 1\\ 0 & 2 & 0\\ 7 &0 & 0\end{array}\right]\), etc.
Properties of a Diagonal Matrix
Here are the properties of a diagonal matrix based upon its definition.
 Every diagonal matrix is a square matrix.
 Identity matrix, null matrix, and scalar matrix are examples of a diagonal matrix as each of them has its nonprincipal diagonal elements to be zeros.
 The sum of two diagonal matrices is a diagonal matrix.
 The product of two diagonal matrices (of the same order) is a diagonal matrix where the elements of its principal diagonal are the products of the corresponding elements of the original matrices.
Example: For two matrices A = \(\left[\begin{array}{rr}5 & 0 \\ \\ \\ 0 & 2 \end{array}\right]\) and B = \(\left[\begin{array}{rr}7 & 0 \\ \\ \\ 0 & 10 \end{array}\right]\),
AB = \(\left[\begin{array}{rr}35 & 0 \\ \\ \\ 0 & 20 \end{array}\right]\)  Diagonal matrices are commutative under both addition and multiplication.
Example: For two matrices A = \(\left[\begin{array}{rr}1 & 0 \\ \\ \\ 0 & 4 \end{array}\right]\) and B = \(\left[\begin{array}{rr}5 & 0 \\ \\ \\ 0 & 8 \end{array}\right]\),
A + B = B + A = \(\left[\begin{array}{rr}6 & 0 \\ \\ \\ 0 & 4 \end{array}\right]\) and
AB = BA = \(\left[\begin{array}{rr}5 & 0 \\ \\ \\ 0 & 32 \end{array}\right]\)  Diagonal matrices are symmetric matrices as for any diagonal matrix A, A^{T }= A.
Determinant of Diagonal Matrix
The determinant of a diagonal matrix is the product of its diagonal elements. Let us verify this by taking a 3 x 3 diagonal matrix. Let A = \(\left[\begin{array}{rr}2 & 0 & 0\\ 0 & 3 & 0\\ 0 &0 & 5\end{array}\right]\). We will find its determinant.
det A = 2(15  0)  0 (0  0) + 0 (0  0) = 30, which is the product of principal diagonal's elements 2, 3 and 5. Thus,
Thus, a diagonal matrix is a nonsingular matrix (whose determinant is not zero) only if all of its principal diagonal elements are nonzeros.
Inverse of Diagonal Matrix
The inverse of a diagonal matrix is a diagonal matrix where the elements of the principal diagonal are the reciprocals of the corresponding elements of the original matrix. Let us verify this by taking a 3 x 3 diagonal matrix. Let A = \(\left[\begin{array}{rr}2 & 0 & 0\\ 0 & 3 & 0\\ 0 &0 & 5\end{array}\right]\). We found (in the previous section) its determinant to be 30. Now we will find its adjoint matrix.
adj A = \(\left[\begin{array}{rr}15 & 0 & 0\\ 0 & 10 & 0\\ 0 &0 & 6\end{array}\right]\)
We know that the inverse of a matrix A is, A^{1} = (adj A) / (det A)
= 1/(30) \(\left[\begin{array}{rr}15 & 0 & 0\\ 0 & 10 & 0\\ 0 &0 & 6\end{array}\right]\)
= \(\left[\begin{array}{rr}1/2 & 0 & 0\\ 0 & 1/3 & 0\\ 0 &0 & 1/5\end{array}\right]\)
Here, we can see that A^{1} is also a diagonal matrix and its elements in the principal diagonal are the reciprocals of the corresponding elements of A. Thus,
Diagonalization of a Matrix
We study the diagonalization of matrices in linear algebra. Any square matrix A can be written as the product A = XDX^{1}, where D is a diagonal matrix that is formed by the eigenvalues of A and X is formed by the corresponding eigenvectors of A. i.e., if \(\lambda_1, \lambda_2, ..., \lambda_n\) are the eigenvalues of the matrix A, then
 D = \(\left[\begin{array}{ccccc}\lambda_{1} & 0 & 0 & \ldots & 0 \\ 0 &\lambda_{2} & 0 & \ldots & 0 \\ 0 & 0 & \lambda_{3} & \ldots & 0 \\ \vdots & \vdots & \vdots & & \vdots \\ 0 & 0 & 0 & \ldots & \lambda_{n}\end{array}\right]\)
 X = \(\left[\begin{array}{llll}\overrightarrow{ {x_1}} & {\overrightarrow{ {x}}}_{ {2}} & \ldots & {\overrightarrow{ {x}}}_{ {n}}\end{array}\right]\), where \(\overrightarrow{ {x_1}}, \overrightarrow{ {x_2}}, ..., \overrightarrow{ {x_n}}\) are the eigenvectors correspoding to the eigenvalues \(\lambda_1, \lambda_2, ..., \lambda_n\) in order and are written as column vectors.
We can see an example of diagonalizing a matrix in the "Solved Examples" section below.
Related Topics:
Here are some topics that you may be interested in while studying about the diagonal matrix.
Solved Examples Using Diagonal Matrix

Example 1: Is the product of a diagonal matrix and a nondiagonal matrix a diagonal matrix? Justify your answer.
Solution:
Let us consider a diagonal matrix A = \(\left[\begin{array}{rr}2 & 0 \\ \\ \\ 0 & 3 \end{array}\right]\) and a nondiagonal matrix B = \(\left[\begin{array}{rr}1 & 2 \\ \\ \\ 3 & 4 \end{array}\right]\).
We find their product.
AB = \(\left[\begin{array}{rr}2 & 0 \\ \\ \\ 0 & 3 \end{array}\right]\) \(\left[\begin{array}{rr}1 & 2 \\ \\ \\ 3 & 4 \end{array}\right]\)
= \(\left[\begin{array}{rr}2(1)+0(3) & 2(2)+0(4) \\ \\ \\ 0(1)+(3)(3) & 0(2)+(3)(4) \end{array}\right]\)
= \(\left[\begin{array}{rr}2 & 4 \\ \\ \\ 9 & 12 \end{array}\right]\)
We see that AB is NOT a diagonal matrix.
Answer: The product of a diagonal matrix and a nondiagonal matrix is NOT a diagonal matrix.

Example 2: Find the inverse of the matrix \(\left[\begin{array}{rr}7 & 0 & 0\\ 0 & 1 & 0\\ 0 &0 & 4\end{array}\right]\).
Solution:
The given matrix is a diagonal matrix. We know that the inverse of a diagonal matrix is obtained by replacing all its principal diagonal elements with their reciprocals and keeping the other elements as they are. Therefore, the inverse of the given matrix is, \(\left[\begin{array}{rr}1/7 & 0 & 0\\ 0 & 1 & 0\\ 0 &0 & 1/4\end{array}\right]\).
Answer: The inverse of the given matrix is \(\left[\begin{array}{rr}1/7 & 0 & 0\\ 0 & 1 & 0\\ 0 &0 & 1/4\end{array}\right]\).

Example 3: Diagonalize the matrix A = \(\left[\begin{array}{rr}3 & 4 \\ \\ \\ 5 & 6 \end{array}\right]\).
Solution:
The diagonalization of the given matrix A is writing as the product of matrices, XDX^{1}, where
 D = Diagonal matrix with eigenvalues
 X = Matrix of corresponding eigenvectors
Finding Eigenvalues:
Let A  \(\lambda\) I = 0, where I is identity matrix.
\(\left\begin{array}{cc}3\lambda & 4 \\ \\ 5 & 6\lambda\end{array}\right=0\)
\((3\lambda)(6\lambda)(4)(5)=0\)
\(18+3 \lambda6 \lambda+\lambda^{2}+20=0\)
\(\lambda^{2}3 \lambda+2=0\)
\((\lambda1)(\lambda2)=0\)
\(\lambda=1 \quad \lambda=2\)
Thus, D = \(\left[\begin{array}{ll}1 & 0 \\ 0 & 2\end{array}\right]\)
Finding Eigenvectors:
When \(\lambda\) = 1:
A  \(\lambda\) I = A  I
= \(\left[\begin{array}{cc}3 & 4 \\ \\ 5 & 6\end{array}\right]  \left[\begin{array}{cc}1 & 0 \\ \\ 0 & 1\end{array}\right]\)
= \(\left[\begin{array}{cc}4 & 4 \\ \\ 5 & 5\end{array}\right]\)
From this, we get two equations, 4x\(_1\)  4x\(_2\) = 0 and 5x\(_1\) + 5x\(_2\) = 0
Assume that x\(_2\) = 1.
Substitute this in 5x\(_1\) + 5x\(_2\) = 0. Then we get 5x\(_1\) + 5 = 0. From this, x\(_1\) = 1.
So the eigenvector corresponding to \(\lambda\) = 1 is, \(\overrightarrow{\mathrm{x}}_{1}=\left[\begin{array}{c}1 \\ 1\end{array}\right]\).
Similarly, we can find the eignvector corresponding to \(\lambda\) = 2 to be \(\vec{x}_{2}=\left[\begin{array}{c}4 / 5 \\ 1\end{array}\right]\).
Thus, \(X=\left[\vec{x}_{1}, \vec{x}_{2}\right] = \left[\begin{array}{cc}1 & 4 / 5 \\ \\ 1 & 1\end{array}\right]\)
We can find its inverse to be \(X^{1} = \left[\begin{array}{cc}5 & 4 \\ \\ 5 & 5\end{array}\right]\)
Therefore,
A = XDX^{1}
= \(\left[\vec{x}_{1}, \vec{x}_{2}\right] = \left[\begin{array}{cc}1 & 4 / 5 \\ \\ 1 & 1\end{array}\right]\) \(\left[\begin{array}{ll}1 & 0 \\ \\ 0 & 2\end{array}\right]\) \(\left[\begin{array}{cc}5 & 4 \\ \\ 5 & 5\end{array}\right]\)
Answer: The diagonalization of the given matrix is \(\left[\begin{array}{cc}1 & 4 / 5 \\ \\ 1 & 1\end{array}\right]\) \(\left[\begin{array}{ll}1 & 0 \\ \\ 0 & 2\end{array}\right]\) \(\left[\begin{array}{cc}5 & 4 \\ \\ 5 & 5\end{array}\right]\).
FAQs on Diagonal Matrix
What Is a Diagonal Matrix?
A diagonal matrix is a square matrix in which all the elements that are NOT in the principal diagonal are zeros and the elements of the principal diagonal can be either zeros or nonzeros.
Is Identity Matrix a Diagonal Matrix?
In the identity matrix, all the elements in the principal diagonal are 1s and the rest are zeros. Since all its nonprincipal diagonal's elements are zeros, it is a diagonal matrix.
What is the Difference Between a Scalar and Diagonal Matrix?
In a diagonal matrix, all elements other than the principal diagonal must be zeros but there is no constraint with respect to the diagonal's elements. They can be either the same or not the same, either zeros or nonzeros. But in a scalar matrix, all nondiagonal elements must be zeros and all diagonal's elements must be equal (to a constant).
Is a Diagonal Matrix Singular Always?
No, here is the explanation. The determinant of a diagonal matrix is the product of elements of its diagonal. So the determinant is 0 only when one of the principal diagonal's elements is 0. We say that a matrix is singular when its determinant is zero, Thus,
 A diagonal matrix is singular if one of its principal diagonal's elements is a zero.
 A diagonal matrix is nonsingular if all of its principal diagonal's elements are nonzeros.
Is a Null Matrix a Diagonal Matrix?
A null matrix is a matrix in which all elements are zeros. So obviously all its nonprincipal diagonal's elements are zeros. Thus, it is a diagonal matrix.
Is a Scalar Matrix a Diagonal Matrix?
A scalar matrix is a matrix in which all elements of the principal diagonals are some scalars and the rest are zeros. Thus, it is a diagonal matrix.
How To Find A Diagonal Matrix?
If in a matrix, all the elements above and below the principal diagonal are zeros, then it is a diagonal matrix. The principal diagonal's elements can be either zeros or nonzeros.
Is the Product of Two Diagonal Matrices a Diagonal Matrix?
Yes, the product of two diagonal matrices is a diagonal matrix. For example, for A = \(\left[\begin{array}{rr}2 & 0 \\ \\ \\ 0 & 5 \end{array}\right]\) and B = \(\left[\begin{array}{rr}3 & 0 \\ \\ \\ 0 & 7 \end{array}\right]\), AB = \(\left[\begin{array}{rr}6 & 0 \\ \\ \\ 0 & 35 \end{array}\right]\), which is a diagonal matrix.
Is the Sum of Two Diagonal Matrices a Diagonal Matrix?
Yes, the product of two diagonal matrices is a diagonal matrix. For example, for A = \(\left[\begin{array}{rr}2 & 0 \\ \\ \\ 0 & 5 \end{array}\right]\) and B = \(\left[\begin{array}{rr}3 & 0 \\ \\ \\ 0 & 7 \end{array}\right]\), A + B = \(\left[\begin{array}{rr}5 & 0 \\ \\ \\ 0 & 12 \end{array}\right]\), which is a diagonal matrix.
Are Diagonal Matrices Commutative?
The diagonal matrices are commutative under addition and multiplication. For example, for any two diagonal matrices A and B, AB = BA and A + B = B + A.
visual curriculum