Diagonalize Matrix Calculator

Diagonalize a 2x2 or 3x3 square matrix. This tool finds the eigenvalues and eigenvectors of your matrix A, then builds the eigenvector matrix P and diagonal matrix D so that A = PDP-1.

Enter your matrix entries below. If the matrix does not have enough independent real eigenvectors, the calculator will tell you it cannot be diagonalized over the reals.

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.
Calculate.co.nz partner: Premium Homes
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 via 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-07-02 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.