Report

Help us improve this tool

Diagonalize Matrix Calculator

Diagonalize 2x2 and 3x3 square matrices into P D P^-1 with eigenvalues, eigenvectors, inverse matrix, and step-by-step math.

O M T

What is Matrix Diagonalization?

Matrix diagonalization is a fundamental linear algebra process where an $n \times n$ square matrix $A$ is transformed into a diagonal matrix $D$ through a similarity transformation using an invertible modal matrix $P$ formed by its eigenvectors:

$$A = P D P^{-1} \quad \text{or equivalently} \quad D = P^{-1} A P$$

In this decomposition, $D = \text{diag}(\lambda_1, \lambda_2, \dots, \lambda_n)$ is a diagonal matrix containing the eigenvalues of $A$ along its main diagonal, and the columns of matrix $P = [v_1 \quad v_2 \quad \dots \quad v_n]$ are the corresponding linearly independent eigenvectors.

Why Diagonalize a Matrix?

Diagonal matrices are vastly simpler to compute with than full dense matrices. Matrix diagonalization unlocks immense computational benefits:

  • Matrix Powers: Computing $A^k$ directly takes $O(k \cdot n^3)$ matrix multiplications. With diagonalization, $A^k = (P D P^{-1})^k = P D^k P^{-1}$. Because $D^k = \text{diag}(\lambda_1^k, \dots, \lambda_n^k)$, exponentiation becomes instant.
  • Matrix Exponential and Functions: Evaluating functions of matrices such as $e^{At}$, $\sin(A)$, or $\sqrt{A}$ is easily done via $f(A) = P f(D) P^{-1}$.
  • Systems of Differential Equations: Uncouples systems of linear ordinary differential equations $\frac{d\vec{x}}{dt} = A\vec{x}$ into independent single-variable scalar equations.
  • Markov Chains and Quantum Mechanics: Solves stationary distributions and time evolution in quantum states.

Conditions for Diagonalizability

Not all square matrices can be diagonalized over the field of real numbers $\mathbb{R}$. An $n \times n$ matrix $A$ is diagonalizable if and only if it satisfies one of the following equivalent criteria:

  1. $A$ has $n$ linearly independent eigenvectors.
  2. The algebraic multiplicity of each eigenvalue equals its geometric multiplicity (the dimension of the eigenspace $\ker(A - \lambda I)$).
  3. The sum of the dimensions of all distinct eigenspaces is equal to $n$.

A matrix that fails to have $n$ linearly independent eigenvectors is called a defective matrix (e.g. non-trivial Jordan blocks like $\begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix}$).

Step-by-Step Diagonalization Algorithm

To diagonalize an $n \times n$ square matrix $A$:

  1. Formulate the Characteristic Equation: Compute $\det(A - \lambda I) = 0$. For a $2 \times 2$ matrix, $\lambda^2 - \text{tr}(A)\lambda + \det(A) = 0$.
  2. Solve for Eigenvalues: Find the roots $\lambda_1, \lambda_2, \dots$ of the characteristic polynomial.
  3. Find Eigenvectors for Each $\lambda$: For each distinct eigenvalue, solve the homogeneous linear system $(A - \lambda I)\vec{v} = \vec{0}$ by row-reducing $A - \lambda I$ to find a basis for its null space.
  4. Check Eigenspace Dimensions: Ensure the total count of basis eigenvectors equals $n$. If so, assemble modal matrix $P$ where each column is an eigenvector.
  5. Form Diagonal Matrix $D$: Place the corresponding eigenvalues on the diagonal in the same column order as $P$.
  6. Invert $P$: Calculate $P^{-1}$. The diagonalization is verified by $A = P D P^{-1}$.

Related Matrix Tools

For other matrix operations, explore our Matrix Determinant Calculator, Matrix Inverse Calculator, Matrix Power Calculator, Matrix Trace Calculator, and Characteristic Polynomial Calculator.

Frequently Asked Questions

What does it mean for a matrix to be diagonalizable?

A square matrix is diagonalizable if it is similar to a diagonal matrix, meaning there exists an invertible matrix $P$ such that $A = P D P^{-1}$, where $D$ has the eigenvalues on its diagonal and $P$ consists of the eigenvectors.

Can a matrix with repeated eigenvalues still be diagonalized?

Yes, provided that the geometric multiplicity (number of linearly independent eigenvectors) equals the algebraic multiplicity (multiplicity as a root of the characteristic polynomial). For example, the identity matrix $I$ has repeated eigenvalue 1 with multiplicity $n$, and is already diagonal.

Are all symmetric matrices diagonalizable?

Yes. By the Spectral Theorem for real symmetric matrices, any real symmetric matrix ($A = A^T$) is orthogonally diagonalizable with real eigenvalues and orthogonal eigenvectors ($A = Q D Q^T$ where $Q^T = Q^{-1}$).

What happens if a matrix is not diagonalizable?

If a matrix does not have sufficient linearly independent eigenvectors, it is defective. Such matrices cannot be diagonalized, but they can always be converted into their Jordan Normal Form (or Jordan Canonical Form).

How do you calculate matrix powers using diagonalization?

Using the identity $A^k = P D^k P^{-1}$. Since $D$ is diagonal, $D^k$ is simply obtained by raising each diagonal element (eigenvalue) to the power $k$.