Matrix Diagonalization Calculator

Enter a square matrix to get its characteristic polynomial, eigenvalues, eigenvectors, a diagonalizability verdict, P, D and P⁻¹, and exact powers.

Runs in your browser. Your files never leave your device. See how to check

…

How to do it

  1. 1
    Enter a square matrix

    Use the grid or paste rows; up to 6×6.

  2. 2
    Read the polynomial

    See det(λI − A) and its roots with multiplicities.

  3. 3
    Check the eigenspaces

    Compare algebraic and geometric counts in the table.

  4. 4
    Get P and D

    Read P, D and P⁻¹ and the multiplication check.

  5. 5
    Raise to a power

    Set k to see A^k and D^k.

  6. 6
    Export

    Copy the result, copy P and D as LaTeX, or print.

About this tool

Diagonalizing a matrix means finding an invertible P and a diagonal D with A = PDP⁻¹. When that works, the columns of P are eigenvectors, the diagonal of D holds the eigenvalues, and hard questions about A become easy ones about numbers: A^k is P·D^k·P⁻¹, so a Markov chain after twenty steps or the hundredth Fibonacci number needs only powers of the eigenvalues. Not every matrix can be diagonalized, and the reason is always the same: some eigenvalue has fewer independent eigenvectors than its multiplicity. This calculator computes the characteristic polynomial det(λI − A) exactly with the Faddeev–LeVerrier recursion, finds every rational eigenvalue exactly with its algebraic multiplicity, and writes a leftover quadratic factor in square-root form, as with the Fibonacci matrix. For each rational eigenvalue it row-reduces A − λI and reads a basis of the eigenspace, whose size is the geometric multiplicity. If the two multiplicities agree for every eigenvalue, the tool assembles P and D, inverts P by row reduction and multiplies P·D·P⁻¹ to confirm it equals A. Symmetric matrices also get an orthonormal Q with A = QDQᵀ, and the power panel gives A^k exactly, including negative k when A is invertible.

The verdict, explained

For every eigenvalue the table shows two counts. The algebraic multiplicity is how often λ is a root of the characteristic polynomial. The geometric multiplicity is the dimension of the eigenspace, the number of free variables when you solve (A − λI)v = 0. A matrix is diagonalizable over the real numbers exactly when all eigenvalues are real and the two counts match for each of them. If the counts match but some eigenvalues are complex, the matrix can be diagonalized only with complex numbers, as for a rotation. If a geometric count is smaller, the matrix is defective; the shear matrix with rows 1 1 and 0 1 is the standard example.

Irrational and complex eigenvalues

A rational eigenvalue is found exactly. When the leftover factor is a quadratic, its roots are written as a ± √b form, for example 1/2 + √5/2, and P is then shown in decimals with each column scaled so its first non-zero entry is 1. Complex roots appear with their real and imaginary parts.

Powers

The power panel computes A^k by repeated squaring in exact arithmetic. When the matrix is diagonalizable it also lists D^k, so you can see that A^k = P·D^k·P⁻¹ gives the same entries. Negative powers use the inverse.

Worked example

Enter rows 4 1 and 2 3. The characteristic polynomial is λ² − 7λ + 10, so the eigenvalues are 5 and 2, each with multiplicity 1. Solving (A − 5I)v = 0 gives v = (1, 1), and (A − 2I)v = 0 gives v = (−1, 2). So P has rows 1 −1 and 1 2, D = diag(5, 2), and P⁻¹ has rows 2/3 1/3 and −1/3 1/3. The check P·D·P⁻¹ = A passes exactly. With k = 5, D⁵ = diag(3125, 32) and A⁵ has rows 2094 1031 and 2062 1063. The trace 7 equals 5 + 2 and the determinant 10 equals 5 × 2.

Limits

Square matrices up to 6×6 are accepted. Eigenvalues that are roots of an irreducible cubic or higher factor are found numerically only. The tool does not compute Jordan forms for defective matrices, and it is not designed for symbolic entries.

Worked example

Rows 4 1 / 2 3: λ = 5, 2; P rows 1 −1 / 1 2; D = diag(5, 2); A⁵ rows 2094 1031 / 2062 1063.

Quick facts

Frequently asked questions

When is a matrix diagonalizable?

When it has n independent eigenvectors. In practice, check that for every eigenvalue the geometric multiplicity equals the algebraic multiplicity. Distinct eigenvalues are always enough.

What makes a matrix defective?

An eigenvalue that repeats but has too few eigenvectors. The tool marks the geometric multiplicity in red when it is smaller than the algebraic one.

Why does the order of eigenvalues in D matter?

Column j of P must be an eigenvector for the jth diagonal entry of D. Any order works as long as the two match, so your book may list them differently.

What happens with a symmetric matrix?

Its eigenvalues are real and its eigenvectors can be chosen orthonormal. The tool runs Gram-Schmidt inside each eigenspace and shows Q in square-root form, so A = QDQᵀ.

How are powers computed?

By repeated squaring with exact fractions, which is exact for any power up to 60. For a diagonalizable matrix the tool also shows D^k so you can connect the two methods.

Can it handle complex eigenvalues?

It finds and lists them, and it says whether the matrix is diagonalizable over the complex numbers, but it does not build a complex P.

Guides for this tool

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages