Matrix Diagonalization Calculator - Diagonalize Matrices Online

Matrix Diagonalization Calculator

Factor A into P · D · P⁻¹

Enter matrix A (2×2)

Diagonalizable — A = P D P⁻¹

Symmetric matrix — also orthogonally diagonalizable.

Eigenvalues & multiplicity

Eigenvalue λAlgebraicGeometric
311
111

Check: sum of eigenvalues = trace = 4 · product of eigenvalues = det(A) = 3

P (eigenvectors)

1
-1
1
1

D (eigenvalues)

3
0
0
1

P⁻¹

0.5
0.5
-0.5
0.5

A5 = P · D5 · P⁻¹

Diagonalization turns a 5-fold matrix multiplication into raising 2 numbers to the power 5.

122
121
121
122

How to Use This Calculator

  1. Pick the Matrix size (2×2 or 3×3), or tap an example chip to autofill one.
  2. Type each entry of matrix A into the grid — decimals and negatives are fine.
  3. Read the verdict banner: it tells you instantly whether A is diagonalizable and why.
  4. Check the eigenvalue table — when any geometric count is lower than algebraic, the matrix is defective.
  5. Set Power k to compute Aᵏ the fast way, through P · Dᵏ · P⁻¹.

Share this calculator

Help others solve their calculations

Found this calculator helpful? Share it with your friends, students, or colleagues who might need it!

Matrix Diagonalization Calculator: How to Diagonalize a Matrix Step by Step

About the Author

Marko Šinko - Co-Founder & Lead Developer

Marko Šinko

Co-Founder & Lead Developer, AI Math Calculator

Lepoglava, Croatia
Advanced Algorithm Expert

Croatian developer with a Computer Science degree from University of Zagreb and expertise in advanced algorithms. Co-founder of award-winning projects, ensuring precise mathematical computations and reliable calculator tools.

📅 Published:
Matrix diagonalization calculator showing the A = PDP⁻¹ decomposition with eigenvalue diagonal matrix D and eigenvector matrix P.

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]]:

  1. Find the eigenvalues. Solve det(A − λI) = 0. Here (4−λ)(3−λ) − 2 = λ² − 7λ + 10 = 0, giving λ = 5 and λ = 2.
  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.
  3. 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.
  4. 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:

SituationExampleOutcome
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.

Frequently Asked Questions

Still Have Questions?

The detailed content on this page provides comprehensive explanations and examples to help you understand better.