Matrix Diagonalization Calculator
Determine whether a square matrix can be expressed in diagonalized form A = PDP−1, where D is diagonal and P contains linearly independent eigenvectors. Diagonalization can simplify matrix powers and the analysis of linear transformations.
A
Learn About Matrix Diagonalization
Matrix diagonalization is the process of factoring a square matrix $\mathbf{A} \in \mathbb{R}^{n \times n}$ into a product of three matrices:
where $\mathbf{D} = \operatorname{diag}(\lambda_1, \lambda_2, \dots, \lambda_n)$ is a diagonal matrix containing the eigenvalues of $\mathbf{A}$, and $\mathbf{P} = \begin{bmatrix} \mathbf{v}_1 & \mathbf{v}_2 & \cdots & \mathbf{v}_n \end{bmatrix}$ is an invertible modal matrix whose columns are linearly independent eigenvectors corresponding to those eigenvalues.
Geometrically, diagonalization represents a change of basis to an eigenspace coordinate system where the linear transformation acts simply by stretching or reflecting along coordinate axes without shearing or mixing dimensions.
The Diagonalization Theorem
An $n \times n$ matrix $\mathbf{A}$ is diagonalizable over a field if and only if it possesses $n$ linearly independent eigenvectors. This fundamental condition can be evaluated through two multiplicities for each distinct eigenvalue $\lambda_i$:
- Algebraic Multiplicity ($AM$): The multiplicity of $\lambda_i$ as a root of the characteristic polynomial $p(\lambda) = \det(\mathbf{A} - \lambda \mathbf{I}) = 0$.
- Geometric Multiplicity ($GM$): The dimension of the eigenspace corresponding to $\lambda_i$, defined as the nullity of the characteristic matrix:
For any eigenvalue, $1 \le GM(\lambda_i) \le AM(\lambda_i)$. A matrix is diagonalizable if and only if:
When an $n \times n$ matrix has $n$ distinct eigenvalues, $AM(\lambda_i) = 1$ for all $i$, automatically guaranteeing diagonalizability.
Defective Matrices
If an eigenvalue has $GM(\lambda_i) < AM(\lambda_i)$, the matrix lacks enough linearly independent eigenvectors to span $\mathbb{R}^n$. Such a matrix is termed defective (or non-diagonalizable). Defective matrices cannot be factored into $\mathbf{P}\mathbf{D}\mathbf{P}^{-1}$; instead, they require generalized eigenvectors and the Jordan canonical form $\mathbf{A} = \mathbf{P}\mathbf{J}\mathbf{P}^{-1}$.
Application to Matrix Powers
Diagonalization transforms complex matrix multiplication into elementary scalar arithmetic:
This property enables rapid computation of large matrix powers, matrix exponentials $e^{\mathbf{A}} = \mathbf{P}e^{\mathbf{D}}\mathbf{P}^{-1}$, and closed-form solutions for linear dynamical systems and Markov chains.
Worked Numerical Example
Diagonalize the $2 \times 2$ matrix:
- Find the Eigenvalues:
Solve the characteristic equation $\det(\mathbf{A} - \lambda \mathbf{I}) = 0$:
Factoring gives $(\lambda - 5)(\lambda - 2) = 0$, yielding two distinct eigenvalues:
Because both eigenvalues are distinct, $\mathbf{A}$ is guaranteed to be diagonalizable.
- Find Eigenvectors for $\lambda_1 = 5$:
- Find Eigenvectors for $\lambda_2 = 2$:
- Construct Modal Matrix $\mathbf{P}$ and Diagonal Matrix $\mathbf{D}$:
- Invert $\mathbf{P}$:
- Verify the Factorization $\mathbf{P}\mathbf{D}\mathbf{P}^{-1} = \mathbf{A}$:
What makes a matrix non-diagonalizable?
A matrix is non-diagonalizable when it has repeated eigenvalues whose geometric multiplicity is strictly less than their algebraic multiplicity ($GM < AM$). For example, the shear matrix $\begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix}$ has eigenvalue $\lambda = 1$ with $AM = 2$, but its eigenspace is only 1-dimensional ($GM = 1$). It lacks a second linearly independent eigenvector, making it defective.
Can an invertible matrix be non-diagonalizable?
Yes. Invertibility depends solely on whether zero is an eigenvalue ($\det(\mathbf{A}) \ne 0$), whereas diagonalizability depends on having a complete set of linearly independent eigenvectors. The matrix $\begin{bmatrix} 2 & 1 \\ 0 & 2 \end{bmatrix}$ is invertible ($\det = 4 \ne 0$) but non-diagonalizable because $\lambda = 2$ has $GM = 1 < AM = 2$.
Are the matrices P and D unique?
No. The diagonal matrix $\mathbf{D}$ is unique only up to the ordering of its eigenvalues. If the order of eigenvalues in $\mathbf{D}$ changes, the columns of $\mathbf{P}$ must be permuted correspondingly. Furthermore, any non-zero scalar multiple of an eigenvector is also an eigenvector, so individual columns of $\mathbf{P}$ can be scaled arbitrarily.
When is a matrix orthogonally diagonalizable?
By the Real Spectral Theorem, an $n \times n$ real matrix $\mathbf{A}$ is orthogonally diagonalizable ($\mathbf{A} = \mathbf{Q}\mathbf{D}\mathbf{Q}^T$ with orthogonal $\mathbf{Q}$) if and only if $\mathbf{A}$ is symmetric ($\mathbf{A} = \mathbf{A}^T$). Symmetric matrices always possess real eigenvalues and a complete orthonormal set of eigenvectors.
- The Spectral Theorem: In finite dimensions, symmetric matrices represent the cleanest class of linear operators. Their eigenvectors corresponding to distinct eigenvalues are mutually orthogonal, allowing complete decomposition into mutually orthogonal 1-dimensional projection subspaces: $\mathbf{A} = \sum_{i=1}^n \lambda_i \mathbf{q}_i \mathbf{q}_i^T$.
- Decoupling Differential Equations: Diagonalization transforms coupled systems of linear ordinary differential equations $\mathbf{x}'(t) = \mathbf{A}\mathbf{x}(t)$ into $n$ completely independent scalar equations $\mathbf{y}'(t) = \mathbf{D}\mathbf{y}(t)$ via the substitution $\mathbf{x} = \mathbf{P}\mathbf{y}$, yielding instantaneous solutions $y_i(t) = c_i e^{\lambda_i t}$.