Computing Library › Linear Algebra
Linear Algebra

Diagonalization

Rewriting a matrix in a basis of its eigenvectors, where it acts as simple coordinate-wise scaling.

The factorization

A square matrix A is diagonalizable if it can be written A = P D P^{-1}, where D is diagonal and the columns of P are eigenvectors of A. The diagonal entries of D are the corresponding eigenvalues. In the eigenvector basis, the transformation simply scales each coordinate, the simplest possible action.

When it is possible

Kronos motion — confinement scaling

A matrix is diagonalizable exactly when it has a full set of n linearly independent eigenvectors. This is guaranteed when all n eigenvalues are distinct, and always holds for symmetric matrices. It fails for defective matrices, where an eigenvalue's geometric multiplicity falls short of its algebraic multiplicity.

Why it is useful

Diagonalization makes matrix powers trivial: A^k = P D^k P^{-1}, and D^k just raises each diagonal entry to the k-th power. This turns the study of repeated application, iterations, and matrix functions into scalar arithmetic on the eigenvalues. Functions of a matrix, such as the matrix exponential, are defined the same way by applying the function to each eigenvalue.

Similar matrices

Two matrices related by B = P^{-1} A P are called similar; they represent the same transformation in different bases and share eigenvalues, trace, determinant, and characteristic polynomial. Diagonalization is the special case where the new basis makes the matrix diagonal.

python
import numpy as np
A = np.array([[2.0, 1.0], [1.0, 2.0]])
vals, P = np.linalg.eig(A)
D = np.diag(vals)
print(np.allclose(A, P @ D @ np.linalg.inv(P)))   # True

Decoupling coupled linear differential equations into independent scalar equations, the standard technique for analyzing normal modes of oscillation, is diagonalization applied to the system matrix.