🧮
🧮 Math & statistics

Diagonalize Matrix Calculator (A = P·D·P⁻¹ with eigenvalues and eigenvectors)

Results update as you type.

Your numbers

Understanding the matrix diagonalization calculator — concept and principle

This calculator diagonalizes a square matrix, writing it as A = P·D·P⁻¹ with the eigenvalues on the diagonal of D and the eigenvectors as the columns of P. It reports P, D, P⁻¹ and the algebraic and geometric multiplicity of each eigenvalue, or explains why the matrix cannot be diagonalized. Use it for linear algebra homework, matrix powers and systems of differential equations.

DiagonalizationA = P · D · P⁻¹P1−1−1−110101D1000−2000−2P⁻¹111121−1−10λ = 1vector (1, −1, 1)λ = −2 (twice)2 independent vectorsDiagonalizable: yes
It works because the repeated eigenvalue −2 still has two independent eigenvectors.

How it is calculated

  1. Find the eigenvalues as the roots of the characteristic polynomial det(A − λI) = 0.
  2. For each eigenvalue λ, solve (A − λI)v = 0 for a basis of its eigenspace.
  3. Compare the eigenspace dimension (geometric multiplicity) with the number of times λ is a root (algebraic multiplicity).
  4. If all eigenvalues are real and the two multiplicities agree for each, put the eigenvectors in P and the matching eigenvalues in D.

The principle

A diagonal matrix just stretches each coordinate axis. Diagonalizing A means finding a set of axes, the eigenvectors, along which A acts as pure stretching by the eigenvalues. P changes into those axes, D does the stretching, and P⁻¹ changes back. This needs n independent eigenvectors; a repeated eigenvalue with too few eigenvectors (a "shear") breaks it. Diagonal form makes powers easy: Aᵏ = P·Dᵏ·P⁻¹.

Worked example

Default input: A = [1 3 3; −3 −5 −3; 3 3 1].

  1. Characteristic polynomial: (λ − 1)(λ + 2)², so eigenvalues 1 and −2 (twice).
  2. λ = 1: eigenvector (1, −1, 1); multiplicity 1 / 1.
  3. λ = −2: A + 2I has rank 1, giving two eigenvectors (−1, 1, 0) and (−1, 0, 1); multiplicity 2 / 2.
  4. Diagonalizable? Yes — A = P·D·P⁻¹, with D = [1 0 0; 0 −2 0; 0 0 −2] and P = [1 −1 −1; −1 1 0; 1 0 1].
  5. P⁻¹ = [1 1 1; 1 2 1; −1 −1 0].

How to read the result

Each column of P is paired with the entry of D in the same position. You can check one pair directly: A × (1, −1, 1) = (1, −1, 1), so it is stretched by 1. Any non-zero multiple of an eigenvector, or any other basis of the same eigenspace, gives an equally valid P.

Common mistakes

Keep in mind: Eigenvalues are found numerically. Matrices with nearly equal eigenvalues can be sensitive to rounding, so check A·P = P·D.

Frequently asked questions

When is a matrix diagonalizable?

When it has n linearly independent eigenvectors; n distinct eigenvalues guarantee this.

What do algebraic and geometric multiplicity mean?

How often λ is a root of the characteristic polynomial, and how many independent eigenvectors it has.

Why diagonalize a matrix?

To compute powers and functions of A easily and to decouple linear systems.

Sources: A. Davis, P. Zachlin et al., Coordinated Linear Algebra (University of Nebraska–Lincoln), §6.1–6.2

Checked 9 Nov 2026. Coordinated Linear Algebra (University of Nebraska–Lincoln), §6.2 Similar and Diagonalizable Matrices — Definition 6.2.11 (P⁻¹AP = D), Theorem 6.2.12 (diagonalizable iff n linearly independent eigenvectors, columns of P in the same order as the eigenvalues in D), Corollary 6.2.17 (n distinct eigenvalues), Lemma 6.2.22 and Theorem 6.2.23 (geometric ≤ algebraic multiplicity; equality for every eigenvalue); §6.1 (characteristic equation).

🧮 All math & statistics tools →🌍 Calculators by country →