Advertisement

Diagonalize matrix calculator

Choose the size and enter the matrix row by row. Diagonalization writes A as P D P inverse, where D holds the eigenvalues and the columns of P are independent eigenvectors.

Calculator

Result
Diagonalizable: P inverse times A times P equals D, because the columns of P are independent eigenvectors.
Eigenvalues
2; 5
Matrix P, eigenvectors as columns
1, 1; -2, 1
Diagonal matrix D
2, 0; 0, 5

Advertisement

How this calculator works

A matrix is diagonalizable when it has a basis of eigenvectors. Placing those eigenvectors as the columns of P gives P inverse A P = D, where D is diagonal with the matching eigenvalues. The columns must be linearly independent, which fails when a repeated eigenvalue has too few independent eigenvectors. This calculator builds the full eigenbasis, so a repeated eigenvalue with a complete null space still produces a valid diagonalization. Complex eigenvalues and eigenvectors are shown with i.

Formula

A = P D P inverse, where D = diag(λ1, ..., λn) and the columns of P are independent eigenvectors.

Worked example

The matrix with rows 4, 1 and 2, 3 has eigenvalues 2 and 5 with eigenvectors 1, -2 and 1, 1. Taking P with rows 1, 1 and -2, 1 and D with diagonal 2, 5 gives P inverse A P = D. The 3 by 3 diagonal matrix with diagonal 2, 3, 4 is already diagonal with P equal to the identity.

Advertisement

Frequently asked questions

Is diagonalization always possible?

No. A defective matrix, such as rows 2, 1 and 0, 2, has a repeated eigenvalue with only one independent eigenvector, so no diagonal P exists.

Does the order of the columns matter?

The order of eigenvectors in P must match the order of eigenvalues on the diagonal of D. Any matching order is valid.

Can a real matrix need complex P?

Yes. A rotation matrix has complex eigenvalues, so its diagonalization uses complex entries even though the original matrix is real.

Sources

Advertisement