Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools

Diagonal Matrix



Introduction

The diagonal matrix is one of fundamental types of square matrix where all elements outside the main diagonal are zero. This simple structure makes diagonal matrices particularly important in linear algebra computations and applications.
Diagonal matrices form a broader category that includes scalar matrices (where all diagonal entries are equal) and the identity matrix (where all diagonal entries are 1), while simultaneously qualifying as both upper and lower triangular matrices since all elements above and below the main diagonal are zero.
Diagonal matrices are crucial in eigenvalue decomposition, where a matrix is factored into its eigenvalues (which appear on the diagonal) and eigenvectors. They simplify many matrix operations - multiplication becomes element-wise on the diagonal, determinants are products of diagonal entries, and inverses (when they exist) are found by reciprocating each diagonal element.

Definition and Examples

A diagonal matrix is a square matrix where all elements outside the main diagonal are equal to zero.

Mathematically, a diagonal matrix DD is defined as (D)ij={di,if i=j0,if ij (D)_{ij} = \begin{cases} d_i, & \text{if } i = j \\ 0, & \text{if } i \neq j \end{cases} , where did_i represents diagonal elements.

Interesting point: there are practically no requirements whatsoever for the elements on the main diagonal that can be any real or complex numbers.This fact leads to overlappings with several other types of square matrices.

For an n×nn \times n diagonal matrix, we often use notation Dn×nD_{n\times n} (or just DD) where nn is the order of the matrix.

A 2×22 \times 2 diagonal matrix: D2×2=D=(a00b)D_{2\times 2}= D = \begin{pmatrix} a & 0 \\ 0 & b \end{pmatrix}

A 3×33 \times 3 diagonal matrix: D3×3=D=(x000y000z)D_{3\times 3}= D = \begin{pmatrix} x & 0 & 0 \\ 0 & y & 0 \\ 0 & 0 & z \end{pmatrix}

General form for n×nn \times n case: Dn×n=D=(d10000d20000d30000dn)D_{n\times n}= D = \begin{pmatrix} d_1 & 0 & 0 & \cdots & 0 \\ 0 & d_2 & 0 & \cdots & 0 \\ 0 & 0 & d_3 & \cdots & 0 \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & 0 & \cdots & d_n \end{pmatrix}

Relation to Other Special Matrices

The definition of a diagonal matrix - requiring only that all non-diagonal elements be zero - creates a broad category that naturally includes several other matrix types as special cases.
Since it (the definition) sets no special requirements for diagonal elements, diagonal matrices include also:

Zero Matrix: Where all elements (including diagonal) are 0.
Identity Matrix: Where all diagonal elements are 1 and other equal to 0.
Scalar Matrix: When all diagonal elements are equal to some scalar λ and other equal to 0.
Diagonal Matrices (aᵢⱼ = 0 for i ≠ j) Scalar Matrices (all diagonal elements = λ) Identity Zero Note: Identity (λ = 1) and Zero (λ = 0) are special cases of scalar matrices

On the other hand, diagonal matrices, by their definition, belong to both upper and lower triangular matrix categories simultaneously, since they satisfy both conditions: having zeros below the main diagonal (upper triangular) and having zeros above the main diagonal (lower triangular). This makes diagonal matrices a special intersection case of triangular matrices.

Any diagonal matrix (and so identity, zero and scalar matrices as a sub-sets of diagonal) is automatically symmetric, since the condition for symmetry (aᵢⱼ = aⱼᵢ for all i,j) is naturally satisfied when all off-diagonal elements are zero.
However, the opposite is not always true : symmetric matrices form a broader category as they can have non-zero elements anywhere as long as they mirror across the main diagonal.

The relationship between diagonal and skew-symmetric matrices has one special case: the zero matrix is the only matrix that satisfies both definitions, since it's the only matrix that can have all elements equal to zero (including the diagonal) while maintaining the skew-symmetric property aᵢⱼ = -aⱼᵢ.

To learn more about relationships between different types of square matrices, visit this page.

You may also check our matrix types generator tool for visual illustration of different types of square matrices

Basic Properties

A diagonal matrix is a square matrix in which all off-diagonal elements are zero. This special structure leads to several important properties:

1. Structure: A diagonal matrix has nonzero values only on its main diagonal, while all other elements are zero.

2. Multiplication: The product of two diagonal matrices is another diagonal matrix, where each diagonal entry is the product of corresponding diagonal elements.

3. Commutativity: Diagonal matrices commute with each other, meaning if D1D_1 and D2D_2 are diagonal, then D1D2=D2D1D_1 D_2 = D_2 D_1.

4. Determinant: The determinant of a diagonal matrix is the product of its diagonal elements: det(D)=d11d22dnn\det(D) = d_{11} d_{22} \dots d_{nn}.

5. Trace: The trace (sum of diagonal elements) of an n×nn \times n diagonal matrix is given by tr(D)=d11+d22++dnn\text{tr}(D) = d_{11} + d_{22} + \dots + d_{nn}.

6. Inverse: A diagonal matrix is invertible if none of its diagonal elements are zero. Its inverse is also diagonal, with reciprocals of the original diagonal elements: D1=diag(1/d11,1/d22,,1/dnn)D^{-1} = \text{diag}(1/d_{11}, 1/d_{22}, \dots, 1/d_{nn}).

7. Eigenvalues and Eigenvectors: The diagonal entries are the eigenvalues of the matrix, and the standard basis vectors are its eigenvectors.

Closure Properties

A diagonal matrix exhibits specific closure properties under various operations:

1. Closed under Multiplication: The product of two diagonal matrices of the same size is another diagonal matrix: if D1D_1 and D2D_2 are diagonal, then D1D2D_1 D_2 remains diagonal.

2. Closed under Exponentiation: Raising a diagonal matrix to any integer power preserves its diagonal structure: if DD is diagonal, then DkD^k is also diagonal for any integer kk.
This is pretty intuitive as exponentiation is a special case of multiplication. Check this section for more details.

3. Closed under Addition: The sum of two diagonal matrices is also diagonal, where each diagonal entry is the sum of corresponding entries: if D1D_1 and D2D_2 are diagonal, then D1+D2D_1 + D_2 is diagonal as well.

4. Closed under Scalar Multiplication: Multiplying a diagonal matrix by a scalar preserves its diagonal structure: if DD is diagonal, then cDcD is also diagonal for any scalar cc.

Powers of the Identity Matrix

Exponentiating a diagonal matrix is straightforward since diagonal matrices retain their structure under multiplication.

1. Power of a Diagonal Matrix

For any diagonal matrix D=diag(d11,d22,,dnn)D = \text{diag}(d_{11}, d_{22}, \dots, d_{nn}), raising it to the power of kk results in:

Dk=diag(d11k,d22k,,dnnk) D^k = \text{diag}(d_{11}^k, d_{22}^k, \dots, d_{nn}^k) .

This follows from the fact that multiplying diagonal matrices is equivalent to exponentiating each diagonal element individually.

2. Comparison with Identity Matrix

The identity matrix is a special case of a diagonal matrix where all diagonal elements are 1:

In=diag(1,1,,1) I_n = \text{diag}(1,1,\dots,1) .

Applying the same exponentiation rule:

Ink=diag(1k,1k,,1k)=In I_n^k = \text{diag}(1^k, 1^k, \dots, 1^k) = I_n .

Since 1 raised to any power is still 1, the identity matrix remains unchanged under exponentiation.

3. Example Calculation

Consider the diagonal matrix:

D=(2003) D = \begin{pmatrix} 2 & 0 \\ 0 & 3 \end{pmatrix} .

Computing its square:

D2=(220032)=(4009) D^2 = \begin{pmatrix} 2^2 & 0 \\ 0 & 3^2 \end{pmatrix} = \begin{pmatrix} 4 & 0 \\ 0 & 9 \end{pmatrix} .

For a higher power, say k=3 k = 3 :

D3=(230033)=(80027) D^3 = \begin{pmatrix} 2^3 & 0 \\ 0 & 3^3 \end{pmatrix} = \begin{pmatrix} 8 & 0 \\ 0 & 27 \end{pmatrix} .

This confirms that exponentiation of diagonal matrices applies element-wise to the diagonal entries.