Diagonal Matrix
Diagonal Matrix
A square matrix which has zeros everywhere other than the main diagonal. Entries on the main diagonal may be any number, including 0.

See also
Key Formula
D=d10⋮00d2⋮0⋯⋯⋱⋯00⋮dn
Where:
- D = The diagonal matrix of size n × n
- d1,d2,…,dn = The entries on the main diagonal; each may be any real (or complex) number, including 0
- n = The number of rows and columns (the matrix must be square)
Worked Example
Problem: Let D = diag(3, −1, 5). Compute D² (the matrix multiplied by itself).
Step 1: Write out the diagonal matrix D explicitly.
D=3000−10005
Step 2: Use the key property of diagonal matrices: when you multiply two diagonal matrices, you simply multiply corresponding diagonal entries.
D2=3⋅3000(−1)⋅(−1)0005⋅5
Step 3: Evaluate each diagonal entry.
D2=9000100025
Answer: D² = diag(9, 1, 25). Each diagonal entry is simply squared.
Another Example
This example shows how to find the determinant and inverse of a diagonal matrix, illustrating that both operations reduce to simple arithmetic on the diagonal entries—unlike the general case, which requires cofactor expansion or row reduction.
Problem: Find the determinant and inverse of the diagonal matrix A = diag(2, 4, −3).
Step 1: Write the matrix A.
A=20004000−3
Step 2: The determinant of a diagonal matrix is the product of its diagonal entries.
det(A)=2⋅4⋅(−3)=−24
Step 3: Since the determinant is nonzero, A is invertible. The inverse of a diagonal matrix is formed by taking the reciprocal of each diagonal entry.
A−1=2100041000−31
Step 4: Verify: multiply A by A⁻¹ to confirm the result is the identity matrix.
A⋅A−1=100010001=I3
Answer: det(A) = −24 and A⁻¹ = diag(1/2, 1/4, −1/3).
Frequently Asked Questions
Is the identity matrix a diagonal matrix?
Yes. The identity matrix has 1s on the main diagonal and 0s everywhere else, which satisfies the definition of a diagonal matrix exactly. It is a special case where every diagonal entry equals 1.
Can a diagonal matrix have zeros on the diagonal?
Yes. The definition only requires that all off-diagonal entries are zero. Diagonal entries can be any number, including zero. For example, diag(5, 0, 2) is a valid diagonal matrix. However, if any diagonal entry is zero, the matrix is not invertible.
What is the difference between a diagonal matrix and a symmetric matrix?
Every diagonal matrix is symmetric (it equals its own transpose), but the reverse is not true. A symmetric matrix can have nonzero entries off the main diagonal, as long as the matrix equals its transpose. For example, the matrix [[1, 3], [3, 2]] is symmetric but not diagonal.
Diagonal Matrix vs. Identity Matrix
| Diagonal Matrix | Identity Matrix | |
|---|---|---|
| Definition | Square matrix with zeros everywhere except the main diagonal | Square matrix with 1s on the main diagonal and zeros elsewhere |
| Diagonal entries | Any numbers (including 0) | All equal to 1 |
| Determinant | Product of diagonal entries (can be any value) | Always 1 |
| Inverse | Exists only if no diagonal entry is 0; inverse is diag(1/d₁, …, 1/dₙ) | Always exists; the identity is its own inverse |
| Role | General class of easily computable matrices | Multiplicative identity for matrix multiplication (AI = IA = A) |
Why It Matters
Diagonal matrices appear constantly in linear algebra because they make matrix operations trivial: multiplication, exponentiation, finding determinants, and computing inverses all reduce to simple arithmetic on individual entries. In applications such as principal component analysis and solving systems of differential equations, diagonalizing a matrix (rewriting it as a product involving a diagonal matrix) is a core technique. If you continue to eigenvalues and eigenvectors, you will find that the eigenvalues of a diagonal matrix are exactly its diagonal entries.
Common Mistakes
Mistake: Confusing a diagonal matrix with an upper or lower triangular matrix.
Correction: A triangular matrix can have nonzero entries above (or below) the main diagonal. A diagonal matrix is both upper and lower triangular simultaneously—it has zeros in every off-diagonal position.
Mistake: Assuming a diagonal matrix must have all nonzero diagonal entries.
Correction: Zeros are allowed on the diagonal. The matrix diag(4, 0, 7) is still diagonal. The only requirement is that all off-diagonal entries are zero. A zero on the diagonal simply means the matrix is singular (not invertible).
Related Terms
- Square Matrix — A diagonal matrix must be square
- Main Diagonal of a Matrix — The positions where nonzero entries may appear
- Matrix — General concept that diagonal matrices are a special case of
- Zero of a Function — Zeros appear in all off-diagonal positions
- Identity Matrix — Special diagonal matrix with all 1s on the diagonal
- Scalar Matrix — Diagonal matrix where all diagonal entries are equal
- Triangular Matrix — Diagonal matrices are both upper and lower triangular
