Matrix Diagonalization Calculator: How to Diagonalize a Matrix Step by Step
About the Author

A matrix diagonalization calculator rewrites a square matrix as A = PDP⁻¹, where D is a diagonal matrix of eigenvalues and P holds the matching eigenvectors as its columns. That single factorization is the secret behind computing matrix powers, solving systems of differential equations, and running principal component analysis. Type a 2×2 or 3×3 matrix into the tool above and you get P, D, P⁻¹, the full eigenvalue breakdown, and any power Aᵏ — without grinding through the algebra by hand.
Why Diagonalize at All? The A¹⁰⁰ Problem
Suppose you need A¹⁰⁰. Multiplying a matrix by itself a hundred times is 99 matrix multiplications, and the rounding error piles up fast. Diagonalization collapses the whole job. Because A = PDP⁻¹, the powers telescope:
A² = (PDP⁻¹)(PDP⁻¹) = PD(P⁻¹P)DP⁻¹ = PD²P⁻¹ ⟹ Aᵏ = PDᵏP⁻¹
The middle P⁻¹P cancels to the identity, so all that survives is Dᵏ. And raising a diagonal matrix to a power is trivial — you just raise each diagonal entry to that power. Computing A¹⁰⁰ becomes “raise two or three numbers to the 100th power,” then sandwich the result between P and P⁻¹. That is exactly what the Power k field in the calculator does. If you only need the eigenvalues that fill D, the dedicated eigenvalue calculator isolates that step.
The Four Steps to Diagonalize a Matrix
Every diagonalization follows the same recipe. Here it is applied to A = [[4, 2], [1, 3]]:
- Find the eigenvalues. Solve det(A − λI) = 0. Here (4−λ)(3−λ) − 2 = λ² − 7λ + 10 = 0, giving λ = 5 and λ = 2.
- Find an eigenvector for each. Solve (A − λI)v = 0. For λ = 5 you get v = (2, 1); for λ = 2 you get v = (1, −1). The eigenvector calculator shows this null-space step in detail.
- Build P and D. Place the eigenvectors as columns of P = [[2, 1], [1, −1]] and the eigenvalues on the diagonal of D = [[5, 0], [0, 2]]. Order matters — column 1 of P must pair with entry 1 of D.
- Invert P. Compute P⁻¹ with the matrix inverse calculator, then confirm A = PDP⁻¹.
When a Matrix Refuses to Diagonalize
Not every matrix can be written as PDP⁻¹. A matrix is diagonalizable only when it has n linearly independent eigenvectors. Two situations block that, and the calculator flags both:
| Situation | Example | Outcome |
|---|---|---|
| Complex eigenvalues | [[0, −1], [1, 0]] | Not diagonalizable over ℝ (rotation matrix) |
| Defective (too few eigenvectors) | [[2, 1], [0, 2]] | λ = 2 twice, but only one eigenvector |
| Repeated λ with full eigenspace | [[2, 0], [0, 2]] | Still diagonalizable — already diagonal |
The deciding factor is multiplicity. The algebraic multiplicity counts how many times an eigenvalue is a root of the characteristic polynomial. The geometric multiplicity counts the independent eigenvectors it actually produces. When geometric equals algebraic for every eigenvalue, the matrix diagonalizes. The matrix [[2, 1], [0, 2]] has λ = 2 with algebraic multiplicity 2 but geometric multiplicity 1 — defective, so the tool returns “not diagonalizable” instead of a wrong answer.
Symmetric Matrices Are Always Diagonalizable
Here is a guarantee worth memorizing: every real symmetric matrix (one where aᵢⱼ = aⱼᵢ) is diagonalizable, and its eigenvectors can be chosen orthogonal. This is the Spectral Theorem, and it is why covariance matrices in statistics and inertia tensors in physics always behave. When you enter a symmetric matrix, the calculator adds an “orthogonally diagonalizable” note. That orthogonality means P⁻¹ equals Pᵀ once the columns are normalized — a huge computational shortcut. To verify the symmetry-driven eigenvalues yourself, the matrix determinant calculator confirms the product of eigenvalues matches det(A).
A Full 3×3 Worked Example
Take A = [[2, 0, 0], [0, 3, 1], [0, 1, 3]]. The characteristic polynomial factors as (2 − λ)(λ² − 6λ + 8), so the eigenvalues are λ = 2 (twice) and λ = 4. Because A is symmetric, we expect three independent eigenvectors — and we get them. For λ = 2 the eigenspace is two-dimensional, spanned by (1, 0, 0) and (0, 1, −1); for λ = 4 the eigenvector is (0, 1, 1). Stacking these as columns gives P, and D = diag(2, 2, 4). Now watch the payoff: A¹⁰ would normally be nine matrix multiplications, but D¹⁰ = diag(1024, 1024, 1048576), and one P · D¹⁰ · P⁻¹ sandwich finishes it. The calculator does all of this the instant you enter the matrix and set k = 10.
Common Mistakes to Avoid
- Mismatched P and D order. If eigenvector v₁ goes in column 1 of P, then λ₁ must sit in position (1,1) of D. Swap the order and PDP⁻¹ will not reproduce A.
- Assuming repeated eigenvalues kill diagonalizability. The identity matrix has one eigenvalue repeated n times and is perfectly diagonal. What matters is the eigenvector count, not the eigenvalue count.
- Computing Dᵏ wrong. You raise each diagonal entry to the power k — you do not multiply the whole matrix by k. D² of diag(5, 2) is diag(25, 4), not diag(10, 4).
- Forgetting complex eigenvalues exist. A 90° rotation matrix has eigenvalues ±i. It is diagonalizable over ℂ but not over ℝ, which is why the tool reports it as non-diagonalizable in real arithmetic.
When to Use the Matrix Diagonalization Calculator
- Computing high matrix powers for Markov chains, population models, or recurrence relations like Fibonacci.
- Solving linear systems of differential equations, where decoupling via D turns a tangled system into independent exponentials.
- Checking homework on eigenvalues, eigenvectors, and the PDP⁻¹ factorization with a full step-by-step breakdown.
- Sanity-checking PCA and covariance work, where symmetric matrices guarantee a clean orthogonal diagonalization.
For the deeper theory behind the Spectral Theorem and orthogonal diagonalization, the Wikipedia article on diagonalizable matrices is a solid reference. Pair it with the tool above to move between the concept and concrete numbers.



