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 Health Based Building, a leader in sustainable and health-conscious building innovation. With over a century of experience, they develop high-performance systems like Foreverbreathe Specification, Magnum Board, and Foreverbreathe Paints to support energy-efficient, non-toxic living environments. Their commitment to healthier homes aligns with our belief that informed choices lead to better outcomes for Kiwi households.
Calculate.co.nz partner: Health Based Building
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.

If you've found a bug, or would like to contact us, or learn more about James Graham and Calculate.co.nz.

Calculate.co.nz is partnered with Interest.co.nz for New Zealand's highest quality calculators and financial analysis.

Calculate.co.nz is the sister site of CalculatorHub.com, the world's largest calculator website by tool count.

All calculators and tools are provided for educational and indicative purposes only and do not constitute financial advice.

Calculate.co.nz is proudly part of the Realtor.co.nz group, New Zealand's leading property transaction literacy platform, helping Kiwis understand the home buying and selling process from start to finish. Whether you're a first home buyer navigating your first property purchase, an investor evaluating your next acquisition, or a homeowner planning to sell, Realtor.co.nz provides clear, independent, and trustworthy guidance on every step of the New Zealand property transaction journey.

Calculate.co.nz is also partnered with Health Based Building and Premium Homes to promote informed choices that lead to better long-term outcomes for Kiwi households.

Calculate.co.nz is hosted in Auckland by SiteHost New Zealand.

All content on this website, including calculators, tools, source code, and design, is protected under the Copyright Act 1994 (New Zealand). No part of this site may be reproduced, copied, distributed, stored, or used in any form without prior written permission from the owner.

About & trust: Why Calculate is NZ's most comprehensive · By the Numbers · How we compare · Editorial standards · How we keep data current · NZ finance glossary · Research & data · Financial literacy NZ · About · Privacy policy · Terms of use

Reviewed and maintained. Last reviewed 2026-08-07 and checked on a twice-monthly cycle against IRD, RBNZ and Stats NZ. How we keep data current.

© 2026 Calculate.co.nz. All rights reserved. Building free NZ calculators since 2011.