Matrix Diagonalization Calculator
Rewrite a square matrix as PDP⁻¹, so its action splits into simple scaling along its eigenvectors. If it can't be done, see exactly why.
Matrix
Enter a square matrix up to 6×6, or start from an example.
Up to 6 rows and 6 columns.
Use integers, decimals, or fractions such as 1/3. Paste rows from a spreadsheet or a Python list into any cell.
Input
Diagonalization
Updates as you type.
Each column of P is an eigenvector, and the entry of D in the same column is its eigenvalue.
Now powers are easy, because only D needs raising: .
Building P and D
Start from the eigenvalues, counting each one's repeats and its independent eigenvectors.
What diagonalizing means
To diagonalize a square matrix is to write it as a product of three matrices:
The columns of are eigenvectors of , and is a diagonal matrix holding their eigenvalues. You can find both with the Eigenvalue and Eigenvector Calculator. Reading right to left, switches to the basis of eigenvectors, scales along each one, and switches back. It's a Change of Basis Calculator in which the matrix becomes as simple as it can be.
When it works
An matrix can be diagonalized exactly when it has independent eigenvectors. That's guaranteed when its eigenvalues are all different, and a real symmetric matrix always qualifies. A repeated eigenvalue may or may not have enough:
Both have the eigenvalue 2 twice, but the second has only one eigen-direction. A matrix like that is called defective. Complex eigenvalues are a separate matter: a rotation can be diagonalized, but only with complex numbers in and .
What it's good for
Powers are the classic use. Each in the middle cancels, which leaves only to raise:
Raising a diagonal matrix to a power just raises each entry, so the Matrix Power Calculator has a closed form for these matrices. That's how the Fibonacci matrix gives a formula for the th Fibonacci number, and why the long-run behavior of a Markov chain depends on its largest eigenvalues. The same idea solves systems of differential equations, since each eigen-direction can be handled alone.
Related calculators
Keep working with matrices.
SVD Calculator
Find the singular value decomposition UΣVᵀ of any matrix up to 6×6, with rank and condition number. Watch a circle turn, stretch into an ellipse, and turn again.
Eigenvalue and Eigenvector Calculator
Find eigenvalues and eigenvectors with exact fractions, square roots, and complex values, plus each multiplicity. Spin a vector until the matrix only stretches it.
Matrix Power Calculator
Raise a square matrix to any whole power, including negative ones, in exact fractions. See repeated squaring step by step and where repeated application leads.
Change of Basis Calculator
Convert coordinates between two bases and find the transition matrix in exact fractions. Drag a point across standard and skewed grids, and learn to read coordinates off a skewed grid.
Matrix Inverse Calculator
Invert a square matrix with exact fractions, step through [A | I] to [I | A⁻¹], and see the inverse undo the transformation.