Want a Custom tool for Yourself?

Need a Custom Tool? We build custom tools that can save hours per employee per day.

Diagonalize Matrix Calculator

Diagonalize a matrix when possible and get the diagonal form with the transformation matrix. Helpful for eigenvalues and powers of matrices.

Enter the Details


Result will appear here...


Last updated: April 16, 2026

Created by: Eon Tools Dev Team

Reviewed by: Okan Atalay



What this calculator does

Diagonalizing a matrix means rewriting it in its simplest possible form, a diagonal matrix with numbers only down the middle and zeros everywhere else. To get there you find the matrix's eigenvalues and eigenvectors. This does it for 2 by 2 and 3 by 3 matrices.

Enter the matrix and it returns the eigenvalues and the diagonal form. It runs right here in the browser.

Using the calculator

  1. Choose the matrix size, 2x2 or 3x3.
  2. Enter the matrix's numbers.
  3. Press Calculate.

It returns the eigenvalues and the diagonalized form. Reset clears the boxes.

The key idea: eigenvectors and eigenvalues

Everything here rests on two linked ideas. A matrix usually rotates and stretches the vectors it acts on, sending them off in new directions. But for most matrices there are a few special directions that only get stretched, not turned, staying on their own line. Those special directions are the eigenvectors. The amount each one is stretched by is its eigenvalue. In symbols, an eigenvector v and its eigenvalue λ satisfy A times v equals λ times v: applying the matrix is the same as just scaling by a number.

These are the natural axes of the matrix. Along them, the complicated business of a matrix collapses into simple multiplication.

What diagonalizing means

Diagonalizing is writing the matrix as:

A = P D P-1

Here D is the diagonal matrix holding the eigenvalues along its diagonal, and P is the matrix whose columns are the matching eigenvectors. The inverse P-1 undoes the change of viewpoint. Read from right to left, this expression says: switch into the natural axes of the matrix (P-1), do the simple stretching there (D), then switch back (P). It is the same transformation as A, just seen in the coordinates where it is at its plainest.

Why anyone bothers

A diagonal matrix is wonderfully easy to work with, and that is the whole point. The clearest payoff is powers. Raising A to a high power the direct way means multiplying it by itself again and again, but with the diagonal form it becomes A to the power n equals P times D to the power n times P-1, and raising a diagonal matrix to a power is trivial: you just raise each eigenvalue on the diagonal to that power. This turns hard repeated multiplication into simple arithmetic, which is exactly what is needed to solve systems of differential equations, to study how a system evolves over many steps, and in techniques like principal component analysis that sit behind a lot of data science.

When a matrix can be diagonalized

Not every matrix can be diagonalized, and it is worth being honest about that. It works only when the matrix has enough independent eigenvectors to fill the columns of P, one for every dimension. Most matrices you meet do, but some fall short, with eigenvectors that pile up along the same directions and leave gaps. Those cannot be written in this clean diagonal form and need other tools instead. When you enter a matrix here, having a full set of distinct eigenvalues is the comfortable case that always works.

A worked example

Take the matrix [[2, 1], [1, 2]]. Working through its eigenvalues gives 3 and 1, with eigenvectors (1, 1) for the eigenvalue 3 and (1, -1) for the eigenvalue 1.

So the diagonal matrix is D = [[3, 0], [0, 1]], carrying the two eigenvalues, and P = [[1, 1], [1, -1]], whose columns are the two eigenvectors. Together they give A = P D P-1. You can read the geometry straight off: this matrix stretches by a factor of 3 along the (1, 1) direction and leaves the (1, -1) direction unchanged, since its eigenvalue there is 1.

Questions people ask

What does it mean to diagonalize a matrix?

To write it as A = P D P-1, where D is a diagonal matrix of its eigenvalues and P holds its eigenvectors. It is the matrix in its simplest form.

What are eigenvalues and eigenvectors?

An eigenvector is a direction the matrix only stretches without rotating. Its eigenvalue is how much it stretches by. They satisfy A times v equals λ times v.

Why is diagonalization useful?

Because diagonal matrices are easy to work with. Powers of the matrix, and problems like differential equations and principal component analysis, become simple once it is diagonalized.

Can every matrix be diagonalized?

No. Only matrices with enough independent eigenvectors to fill P can be. Some matrices fall short and need other methods.

What are P and D?

D is the diagonal matrix of eigenvalues, and P is the matrix whose columns are the corresponding eigenvectors. P-1 is the inverse of P.

References

A note on where this comes from. Diagonalization writes a square matrix as A = P D P-1 using its eigenvalues and eigenvectors, and is possible when the matrix has a full set of independent eigenvectors. The eigenvalues and eigenvectors here are computed with the math.js library. For further reading, see Diagonalizable matrix.

  1. Diagonalization, A = P D P-1, with eigenvalues on the diagonal of D and eigenvectors as the columns of P.
  2. math.js, a JavaScript mathematics library, used here to compute the eigenvalues and eigenvectors.


Okan Atalay

Okan Atalay is a results driven senior operations manager and a graduate of Industrial Engineering from Bilkent University. With over 22 years of experience in textile manufacturing and integrated operations, he has led large scale business process improvements and strategic planning initiatives. Currently, he serves as a top mathematics expert for a global ed tech platform, where he applies his analytical expertise to solve complex mathematical problems. At Eon Tools, he reviews converter and maths tools.