What Is a Diagonal Matrix?
A diagonal matrix is a square matrix whose entries are all zero except possibly on the main diagonal, the line of positions running from the top-left corner to the bottom-right. In symbols, $a_{ij} = 0$ whenever $i \neq j$. The diagonal entries themselves can be any value, including zero.
A 3x3 example:
$$D = \begin{bmatrix} 4 & 0 & 0 \ 0 & 7 & 0 \ 0 & 0 & 2 \end{bmatrix}$$
Everything off the diagonal is zero; the diagonal holds 4, 7, and 2.
Variable glossary. $a_{ij}$ is the entry in row $i$, column $j$. The main diagonal is the set of entries where $i = j$ (positions $a_{11}, a_{22}, a_{33}, \dots$). "Off-diagonal" means any position where $i \neq j$.
The matrix must be square first: the order has to be $n \times n$ for a main diagonal to be defined at all.
What Are the Properties of a Diagonal Matrix?
Diagonal matrices behave so cleanly because the zeros do most of the work. The properties worth memorizing:
A diagonal matrix is symmetric. Reflecting across the diagonal changes nothing, since the off-diagonal entries are all zero, so $D = D^T$.
It is both upper- and lower-triangular. There are no nonzero entries above or below the diagonal, which is the cleanest link to the triangular matrix.
Diagonal matrices commute. For two diagonal matrices, $D_1 D_2 = D_2 D_1$, which is rare, since most matrices do not commute.
Products and sums stay diagonal. Add or multiply two diagonal matrices of the same order and the result is still diagonal; you just add or multiply the diagonal entries position by position.
Powers are trivial. $D^k$ raises each diagonal entry to the power $k$ and leaves the zeros alone.
That last property is why diagonal matrices are the goal of diagonalization: turning an ugly matrix into a diagonal one so its powers become easy.
How Do You Find the Determinant and Inverse of a Diagonal Matrix?
Both reduce to one-line operations on the diagonal.
Determinant. The determinant of a diagonal matrix is simply the product of its diagonal entries. For $D$ above:
$|D| = 4 \times 7 \times 2 = 56$
No cofactor expansion is needed, since the zeros kill every other term.
Inverse. A diagonal matrix is invertible exactly when no diagonal entry is zero. The inverse is found by replacing each diagonal entry with its reciprocal:
$$D^{-1} = \begin{bmatrix} \tfrac{1}{4} & 0 & 0 \ 0 & \tfrac{1}{7} & 0 \ 0 & 0 & \tfrac{1}{2} \end{bmatrix}$$
If even one diagonal entry is zero, the determinant is zero, and no inverse exists.
What Is Diagonalization of a Matrix?
Diagonalization is the process of rewriting a square matrix $A$ as $A = PDP^{-1}$, where $D$ is a diagonal matrix and $P$ is an invertible matrix whose columns are the eigenvectors of $A$. The diagonal entries of $D$ are the eigenvalues of $A$. Not every matrix can be diagonalized, but when one can, the payoff is large.
The reason this matters connects straight back to the properties above: powers of a diagonal matrix are trivial. Once $A = PDP^{-1}$, raising $A$ to a power telescopes,
$$A^k = PD^kP^{-1},$$
because every interior $P^{-1}P$ collapses to the identity. So instead of multiplying $A$ by itself $k$ times, you raise each diagonal entry of $D$ to the power $k$ and sandwich the result between $P$ and $P^{-1}$. The whole point of diagonalization is to trade a hard computation on $A$ for an easy one on $D$. The machinery rests on eigenvalues, which decide whether a matrix is diagonalizable in the first place.
Special Cases: Scalar, Identity, and Null Matrices
Three named matrices are all diagonal matrices wearing a more specific label.
Scalar matrix: a diagonal matrix where every diagonal entry is the same value $\lambda$. It acts like multiplying by the single number $\lambda$.
Identity matrix: the special scalar matrix where that value is 1. The identity matrix is the diagonal matrix with 1s down the diagonal.
Null (zero) matrix: a diagonal matrix where every diagonal entry happens to be zero.
The chain is one-directional: every identity is scalar, every scalar is diagonal, but a diagonal matrix is usually neither. This is exactly the relationship readers ask about most: "is an identity matrix a diagonal matrix?" Yes, and so is a scalar matrix.
Examples of a Diagonal Matrix
Example 1
Is $\begin{bmatrix} 5 & 0 \ 0 & 9 \end{bmatrix}$ a diagonal matrix?
Check every off-diagonal entry. Position $(1,2) = 0$ and position $(2,1) = 0$.
All off-diagonal entries are zero, and the matrix is square.
Final answer: Yes, it is a $2 \times 2$ diagonal matrix.
Example 2
Find the determinant of $\begin{bmatrix} 3 & 0 & 0 \ 0 & 6 & 0 \ 0 & 0 & 0 \end{bmatrix}$.
This is the wrong-path-first example.
Wrong attempt. A student sees a diagonal matrix and writes "diagonal matrices are always invertible, so the determinant is nonzero," then guesses a value.
Why it is wrong. The shortcut "diagonal means invertible" is false. Invertibility needs every diagonal entry to be nonzero. Here the third entry is 0.
Correct. Multiply the diagonal entries:
$|D| = 3 \times 6 \times 0$
$|D| = 0$
Final answer: $|D| = 0$. The matrix is singular and has no inverse, because a zero sits on the diagonal.
Example 3
Find the inverse of $\begin{bmatrix} 2 & 0 \ 0 & 8 \end{bmatrix}$.
Reciprocate each diagonal entry:
$2 \to \tfrac{1}{2}$
$8 \to \tfrac{1}{8}$
$$D^{-1} = \begin{bmatrix} \tfrac{1}{2} & 0 \ 0 & \tfrac{1}{8} \end{bmatrix}$$
Final answer: $D^{-1} = \begin{bmatrix} \tfrac{1}{2} & 0 \ 0 & \tfrac{1}{8} \end{bmatrix}$.
Example 4
Compute $D^3$ for $D = \begin{bmatrix} 2 & 0 \ 0 & 3 \end{bmatrix}$.
Cube each diagonal entry, leave the zeros:
$2^3 = 8$
$3^3 = 27$
$$D^3 = \begin{bmatrix} 8 & 0 \ 0 & 27 \end{bmatrix}$$
Final answer: $D^3 = \begin{bmatrix} 8 & 0 \ 0 & 27 \end{bmatrix}$. Compare the effort to cubing a full matrix — this is the diagonal payoff.
Example 5
Multiply $\begin{bmatrix} 4 & 0 \ 0 & 5 \end{bmatrix}$ by $\begin{bmatrix} 2 & 0 \ 0 & 3 \end{bmatrix}$.
Multiply the diagonal entries position by position:
$4 \times 2 = 8$
$5 \times 3 = 15$
$$\begin{bmatrix} 8 & 0 \ 0 & 15 \end{bmatrix}$$
Final answer: $\begin{bmatrix} 8 & 0 \ 0 & 15 \end{bmatrix}$, still diagonal, and the order would not change if you reversed the two matrices.
Example 6
A diagonal matrix has order $3 \times 3$ with diagonal entries 1, 1, 1. Name it.
Every diagonal entry equals 1, off-diagonal entries are zero, and it is square.
Final answer: This is the $3 \times 3$ identity matrix, $I_3$, the most famous diagonal matrix of all.
Why Diagonal Matrices Matter: "Simplicity that scales"
Diagonal matrices exist as the simplest non-trivial matrices, and the entire effort of diagonalization is aimed at turning hard problems into this easy shape. When a system decouples — when each variable evolves on its own without dragging the others along — the matrix describing it is diagonal, and the math becomes one independent equation per variable.
The destination shows up across applied fields:
Population and growth models. When several groups grow at fixed rates independently, the transition matrix is diagonal, and projecting many years ahead is just raising each rate to a power.
Computer graphics scaling. Stretching an object by different factors along the x, y, and z axes is a single diagonal matrix; the diagonal entries are the stretch factors.
Principal component analysis. A core data-science technique works by rotating data until its covariance matrix becomes diagonal, so the dimensions stop interfering with each other. The connection runs through the covariance matrix and eigenvalues.
A diagonal matrix is what every messier matrix wishes it were. That is why "diagonalize it" is one of the most common instructions in linear algebra.
Diagonal Matrix - Common Confusions Cleared Up
Mistake 1: Thinking every diagonal matrix is invertible
Where it slips in: Computing the inverse without checking the diagonal.
Don't do this: Assume a zero on the diagonal still gives an inverse.
The correct way: Reciprocate only when every diagonal entry is nonzero. A single zero on the diagonal makes the determinant zero and kills the inverse. The habit of scanning the diagonal for zeros before reaching for reciprocals is what catches this, because the reciprocal step makes a zero entry visibly impossible, since $1/0$ is undefined.
Mistake 2: Confusing the diagonal matrix with the scalar or identity matrix
Where it slips in: Naming a matrix from its shape.
Don't do this: Call any diagonal matrix "scalar" or "identity."
The correct way: Diagonal allows different values on the diagonal; scalar needs them all equal; identity needs them all equal to 1. The point of confusion between these three close ideas is the most common source of wrong answers here: a matrix can be diagonal without being scalar, and scalar without being the identity.
Mistake 3: Including off-diagonal nonzeros and still calling it diagonal
Where it slips in: A matrix with a stray nonzero entry above or below the diagonal.
Don't do this: Treat $\begin{bmatrix} 3 & 1 \ 0 & 4 \end{bmatrix}$ as diagonal because two of its entries are on the diagonal.
The correct way: Every off-diagonal entry must be zero. That stray 1 makes the matrix upper-triangular, not diagonal. The silent understander who "kind of" sees the diagonal pattern but cannot say why the stray entry disqualifies it has a fragile grip — the rule is all-or-nothing on the off-diagonal zeros.
Diagonal Matrix - In Five Bullets
A diagonal matrix is square with every off-diagonal entry zero; values sit only on the main diagonal.
It is symmetric, both upper- and lower-triangular, and diagonal matrices commute with each other.
Its determinant is the product of the diagonal entries; its inverse reciprocates them, but only when none of them is zero.
Scalar, identity, and null matrices are all special diagonal matrices.
Powers, products, and inverses all reduce to one-line operations, which is why diagonalization is a central goal in linear algebra.
Practice Questions on Diagonal Matrices
Solve these, then check your work below.
Is $\begin{bmatrix} 6 & 0 & 0 \ 0 & 0 & 0 \ 0 & 0 & 4 \end{bmatrix}$ a diagonal matrix? Is it invertible?
Find the determinant of $\begin{bmatrix} 5 & 0 \ 0 & 9 \end{bmatrix}$.
Find the inverse of $\begin{bmatrix} 3 & 0 \ 0 & 6 \end{bmatrix}$.
Compute $D^4$ for $D = \begin{bmatrix} 2 & 0 \ 0 & 1 \end{bmatrix}$.
Name the diagonal matrix whose order is $2 \times 2$ with both diagonal entries equal to 5.
Answer to Question 1: Yes, it is diagonal (every off-diagonal entry is zero and it is square), but it is not invertible because a zero sits on the diagonal, so $|D| = 0$.
Answer to Question 2: $|D| = 5 \times 9 = 45$.
Answer to Question 3: $D^{-1} = \begin{bmatrix} \tfrac{1}{3} & 0 \ 0 & \tfrac{1}{6} \end{bmatrix}$.
Answer to Question 4: $D^4 = \begin{bmatrix} 16 & 0 \ 0 & 1 \end{bmatrix}$.
Answer to Question 5: A scalar matrix (a diagonal matrix with all equal diagonal entries), $5I_2$.
Where to Go From Here
Practice these to solidify your understanding: build three diagonal matrices, compute each determinant and inverse, and cube one of them to feel how the work collapses to the diagonal. Then test whether a matrix with one off-diagonal nonzero still counts as diagonal — it does not. If the scalar-versus-identity distinction blurs, come back to the special-cases section. Next, the closely related triangular matrix and the symmetric matrix build directly on this shape.
Want a live Bhanzu trainer to walk through more diagonal matrix problems? Book a free demo class.
Was this article helpful?
Your feedback helps us write better content