Matrix diagonalization calculator
Finds eigenvalues and eigenvectors, then builds P, D and P⁻¹ with A = PDP⁻¹.
INPUT
Integers, fractions (1/3) and decimals (0.25) are accepted. Empty cells count as 0. Paste a block of numbers from a spreadsheet or textbook into the first cell to fill the whole matrix.
RESULT
LaTeX is the math code you can paste into Overleaf, Notion equation blocks or Word's equation editor.
Steps
What is diagonalization?
A square matrix A is diagonalizable when there is an invertible P and a diagonal D with A = PDP⁻¹. The columns of P are eigenvectors and the diagonal of D holds the eigenvalues in the same order.
P is invertible only if there are n linearly independent eigenvectors. Distinct eigenvalues guarantee this; repeated eigenvalues need their geometric multiplicity checked.
Full explanation with examples: Matrix Diagonalization and Powers Aⁿ, Step by Step (2×2 Example)
Exam tipOnce diagonalized, Aᵏ = PDᵏP⁻¹, and Dᵏ just raises each diagonal entry to the k-th power.
How to do it by hand
- Find the eigenvalues and eigenvectors first. An n×n matrix is diagonalizable only if it has n independent eigenvectors.
- P has the eigenvectors as its columns; D has the matching eigenvalues on its diagonal in the same order. Matching the order is essential.
- Compute P⁻¹. Then A = PDP⁻¹.
- Check: multiply PD, then by P⁻¹, and confirm you get A. Or, more simply, check that AP = PD.
A = [2 1; 1 2] has eigenvalues 1, 3 with eigenvectors (1, −1), (1, 1).
P = [1 1; −1 1], D = [1 0; 0 3], P⁻¹ = ½[1 −1; 1 1]
PD = [1 3; −1 3], (PD)P⁻¹ = ½[1+3 −1+3; −1+3 1+3] = [2 1; 1 2] = A ✓
Now A¹⁰ = PD¹⁰P⁻¹ with D¹⁰ = [1 0; 0 3¹⁰], which is immediate.
Where is it used?
- Computing powers Aⁿ = PDⁿP⁻¹ in one step. Long-run Markov distributions and the closed form of Fibonacci come from this.
- Decoupling the system x' = Ax into n independent equations; after a change of variables each becomes y' = λy.
- Simplifying a quadratic form xᵀAx by rotating the axes. Finding the principal axes of an ellipse or hyperbola is diagonalization.
Common mistakes
- Mismatching the column order of P and the diagonal order of D. The eigenvector in column 1 must pair with the eigenvalue in position (1,1).
- Assuming a repeated eigenvalue prevents diagonalization. It only needs as many independent eigenvectors as its multiplicity; the identity has all eigenvalues 1 and is diagonal already.
- Writing A = P⁻¹DP. With eigenvectors as the columns of P, it is A = PDP⁻¹.
How to use
- Set the matrix size with the row and column buttons. Up to 6×6 is supported.
- Type numbers into the cells and the result updates instantly. Enter fractions as
1/3and negatives as-2. - Enter moves to the next cell; the ← → ↑ ↓ arrow keys move between cells.
- Open ‘Steps’ to see the full working. ‘Copy LaTeX’ copies the result as math code you can paste into Overleaf, a Notion equation block or Word's equation editor.
FAQ
- Why does it say not diagonalizable?
- Two reasons: the eigenvalues are not rational, so this calculator cannot write P exactly, or a repeated eigenvalue has fewer eigenvectors than its multiplicity (a defective matrix). The second case cannot be diagonalized by any method.
- My textbook orders the columns of P differently. Is that fine?
- Yes. Any order works as long as D uses the same order. Eigenvectors may also be scaled by any nonzero number.
- Is a symmetric matrix always diagonalizable?
- Yes. A real symmetric matrix is always orthogonally diagonalizable; with normalized eigenvectors, P⁻¹ = Pᵀ.
Related guides
- Matrix Diagonalization and Powers Aⁿ, Step by StepDiagonalize A = PDP⁻¹ and turn it into a formula for Aⁿ = PDⁿP⁻¹.
- How to Find Eigenvalues and Eigenvectors (2×2 Matrix Example)Follow a worked example: eigenvalues from the characteristic equation, eigenvectors from (A − λI)v = 0.
- How to Test Vectors for Linear Independence (Using Rank)Test linear independence by putting the vectors in columns and finding the rank, with worked examples.