Matrix Diagonalization Calculator With Steps
Use this matrix diagonalization calculator to find the eigenvalues, eigenvectors, diagonal matrix D, eigenvector matrix P, and P⁻¹ of a real 2 × 2 matrix. It also explains when diagonalization is impossible over the real numbers.
Written and checked by TheToolNet Editorial Team · Last reviewed: August 22, 2026 · How we check math tools
D contains the eigenvalues on its main diagonal. The matching eigenvectors form the columns of P.
Diagonalize a 2 × 2 Matrix
Use integers or decimals. Results use normalized real eigenvectors and include a numerical reconstruction check.
What does it mean to diagonalize a matrix?
Diagonalizing A means finding an invertible matrix P and a diagonal matrix D such that A = PDP⁻¹. This is a change of basis: P moves coordinates into an eigenvector basis, D applies simple scaling along those eigenvector directions, and P⁻¹ changes coordinates back.
A diagonal matrix has zeros everywhere except possibly along its main diagonal. For a diagonalizable 2 × 2 matrix, those two diagonal entries are its eigenvalues.
How the diagonalization calculator works
1. Form the characteristic equation
For A = [[a, b], [c, d]], calculate det(A − λI) = 0. This becomes λ² − tr(A)λ + det(A) = 0, where tr(A) = a + d and det(A) = ad − bc.
2. Find the eigenvalues
Solve the quadratic equation. Its discriminant is tr(A)² − 4det(A). A negative discriminant produces a complex-conjugate pair, so a real diagonal decomposition is unavailable.
3. Find an eigenvector for each eigenvalue
For each λ, solve (A − λI)v = 0. Distinct eigenvalues always provide independent eigenvectors. A repeated eigenvalue requires a separate independence check.
4. Build and verify P and D
Place eigenvectors in the columns of P in the same order that their eigenvalues appear in D. The tool computes P⁻¹ and reconstructs PDP⁻¹ to check the answer numerically.
Worked diagonalization example
Take A = [[4, 1], [2, 3]]. Its trace is 7 and determinant is 10, so the characteristic equation is λ² − 7λ + 10 = 0. Factoring gives (λ − 5)(λ − 2) = 0, so the eigenvalues are 5 and 2.
One eigenvector for λ = 5 is (1, 1), and one for λ = 2 is (1, −2). Using these as columns gives P = [[1, 1], [1, −2]], while D = [[5, 0], [0, 2]]. Different non-zero scalar multiples of the eigenvectors produce a different-looking P but the same valid diagonalization.
When is a matrix not diagonalizable?
An n × n matrix needs n linearly independent eigenvectors. For a real 2 × 2 matrix, the important cases are:
| Eigenvalue situation | Conclusion |
|---|---|
| Two distinct real eigenvalues | Diagonalizable over the real numbers. |
| One repeated eigenvalue and A = λI | Already diagonal; every non-zero direction is an eigenvector. |
| One repeated eigenvalue and A ≠ λI | Not diagonalizable; there is only one independent eigenvector. |
| Complex-conjugate eigenvalues | Not diagonalizable over R, though distinct complex eigenvalues allow diagonalization over C. |
A common mistake is to put eigenvalues into D without checking whether P has enough independent eigenvectors. If P is singular, P⁻¹ does not exist and the proposed decomposition is invalid.
Why diagonal matrices are useful
Powers of a diagonal matrix are easy: raise each diagonal entry to the power. Therefore Aⁿ = PDⁿP⁻¹ can replace repeated matrix multiplication. The same idea simplifies matrix exponentials, linear recurrence relations, systems of differential equations, long-term dynamical behavior, and principal-axis interpretations.
Diagonalization is not the same as row reduction. Row operations change a matrix through left multiplication and help solve systems; diagonalization uses a similarity transformation and preserves eigenvalues.
Frequently asked questions
What does this diagonal matrix calculator return?
For a real 2 × 2 input, it returns the characteristic equation, eigenvalues, normalized eigenvectors, P, D, P⁻¹, and a reconstruction check. It also identifies defective and complex-eigenvalue cases.
Is P unique?
No. Eigenvectors may be multiplied by any non-zero scalar, and eigenvalue/eigenvector pairs may be reordered. These changes alter P and D while keeping A = PDP⁻¹ valid.
Can a singular matrix be diagonalizable?
Yes. A zero eigenvalue makes the matrix singular, but it may still have enough independent eigenvectors. Singularity and diagonalizability answer different questions.
Does this calculator support 3 × 3 matrices?
This release intentionally supports real 2 × 2 matrices so every result can be explained and verified clearly. It does not silently approximate a general 3 × 3 eigendecomposition.
Related matrix tool and references
Need cofactors or the classical adjoint instead? Use the adjoint of a matrix calculator. For further study, see the Matrix Diagonalization reference at Wolfram MathWorld and the MIT OpenCourseWare Linear Algebra materials.