Diagonalize Matrix Calculator

This calculator diagonalizes a square matrix by finding its eigenvalues and eigenvectors, then assembling the eigenvector matrix P and the diagonal matrix D so that A equals P times D times P inverse. Diagonalizing a matrix is a core linear algebra technique used to simplify repeated matrix multiplication, solve systems of linear differential equations, analyse Markov chains and study the long-term behaviour of dynamical systems, because raising a diagonal matrix to a power just means raising each diagonal entry on its own. To use it, choose whether your matrix A is 2x2 or 3x3, then enter its entries row by row into the grid provided. The calculator instantly returns whether the matrix is diagonalizable over the real numbers, its eigenvalues (the roots of the characteristic polynomial), and the determinant of A. It also displays matrix P, with the eigenvectors as columns, matrix D, with the eigenvalues on its diagonal, and the full working showing how A breaks down into P, D and P inverse. If your matrix has complex eigenvalues, or a repeated eigenvalue without enough independent eigenvectors, the calculator will flag it as not diagonalizable over the reals and explain why. Watch for repeated eigenvalues in particular, as these need checking for independence before you rely on the result, and remember that all values shown are rounded for display.

Calculate.co.nz is proud to be partnered with Premium Homes, a recognised leader in eco-friendly, sustainable, and energy-efficient homebuilding. With a dedicated team and award-winning experience, they create homes that prioritise health, comfort, and long-term performance. Their founders, Andrew and Kelly, set out to raise the standard of residential construction in New Zealand by combining practical building expertise with a clear commitment to doing things better for homeowners.
Premium Homes: warmer, drier, healthier. No condensation, ever.
Advertise on this page
Method verified  Standard linear algebra: characteristic polynomial, eigenvalues and eigenvectors, A = PDP^-1.

1. Matrix Size

2. Matrix Entries

Diagonalization Result

Diagonalizable?
-
Enter a matrix
Eigenvalues
-
Roots of characteristic polynomial
Determinant of A
-
Product of eigenvalues

Matrix P (eigenvectors as columns)

-

Matrix D (eigenvalues on diagonal)

-

Working: A = P D P-1

-
Summary: Enter your matrix to diagonalize it.

How to Diagonalize a Matrix

Diagonalizing a square matrix A means writing it as A = PDP-1, where D is a diagonal matrix holding the eigenvalues of A, and P is a matrix whose columns are the corresponding eigenvectors. This is useful because diagonal matrices are far easier to work with, particularly when raising a matrix to a power or solving systems of linear equations.

Steps to Diagonalize

  1. Find the characteristic polynomial. Solve det(A - λI) = 0 for λ. For a 2x2 matrix this gives a quadratic; for a 3x3 matrix it gives a cubic.
  2. Solve for the eigenvalues. The roots λ1, λ2, ... of the characteristic polynomial are the eigenvalues of A.
  3. Find the eigenvectors. For each eigenvalue λ, solve (A - λI)v = 0 to find a non-zero eigenvector v.
  4. Build P and D. P has the eigenvectors as its columns, in the same order as the eigenvalues are placed on the diagonal of D.
  5. Check A = PDP-1. This only works if P is invertible, which requires n linearly independent eigenvectors for an n by n matrix.

When a Matrix Cannot Be Diagonalized

Not every square matrix can be diagonalized using real numbers. A matrix fails to diagonalize over the reals when its eigenvalues are complex, or when a repeated eigenvalue does not have enough independent eigenvectors to span its full multiplicity (a defective matrix). In these cases you would need complex eigenvalues or a more general Jordan normal form instead of a true diagonal matrix.

Worked Example

Take the 2x2 matrix A = [[2, 1], [1, 2]]. The characteristic equation is (2 - λ)2 - 1 = 0, giving eigenvalues λ1 = 3 and λ2 = 1. Solving (A - 3I)v = 0 gives eigenvector [1, 1], and (A - I)v = 0 gives eigenvector [1, -1]. So P = [[1, 1], [1, -1]] and D = [[3, 0], [0, 1]], and A = PDP-1.

Frequently Asked Questions

What does it mean to diagonalize a matrix? Diagonalizing a square matrix A means finding a diagonal matrix D and an invertible matrix P such that A = PDP-1. The columns of P are the eigenvectors of A, and the entries of D are the corresponding eigenvalues in the same order.

Why do some matrices fail to diagonalize? A matrix fails to diagonalize over the reals when it does not have enough linearly independent eigenvectors, or when its eigenvalues are complex, such as a matrix with a repeated eigenvalue but only one independent eigenvector.

What is diagonalization used for? It simplifies repeated matrix operations. Once A = PDP-1, A raised to the power k becomes PDkP-1, which is used in differential equations, Markov chains and dynamical systems.

Related Calculators

Sources: Standard linear algebra methods for eigenvalues, eigenvectors and matrix diagonalization, as presented in undergraduate linear algebra texts (for example Gilbert Strang, Introduction to Linear Algebra).

This calculator handles real eigenvalues for 2x2 and 3x3 matrices. Results are rounded for display. Matrices with complex eigenvalues or repeated eigenvalues with insufficient independent eigenvectors cannot be diagonalized over the real numbers, and this will be shown in the result.