WhatsApp us
University Maths25 Nov 2026

Diagonalization of a Matrix: The Test, the Method and 6 Worked Examples

How to diagonalise a matrix as A = PDP⁻¹, how to tell quickly whether it can be done, and how to use it for matrix powers, symmetric matrices and differential equations, with checked examples and practice.

Diagonalization of a Matrix: The Test, the Method and 6 Worked Examples

To diagonalise an n×n matrix A, find n linearly independent eigenvectors, put them as the columns of P, and put the matching eigenvalues on the diagonal of D; then A = PDP⁻¹, or equivalently P⁻¹AP = D. If A does not have n independent eigenvectors, it cannot be diagonalised. This guide shows how to test for that in seconds, then works six original examples, from a clean 2×2 to orthogonal diagonalisation and a system of differential equations.

Why A = PDP⁻¹ works

Suppose Av₁ = λ₁v₁, …, Avₙ = λₙvₙ. Put the vᵢ side by side as the columns of P. Multiplying column by column,

AP = [Av₁ … Avₙ] = [λ₁v₁ … λₙvₙ] = PD

If the columns are independent, P is invertible, and multiplying on the right by P⁻¹ gives A = PDP⁻¹. That is the whole diagonalisation theorem: an n×n matrix is diagonalisable exactly when it has n linearly independent eigenvectors.

The point of all this is that D is trivial to work with. Powers become Aᵏ = PDᵏP⁻¹, and Dᵏ just raises each diagonal entry to the k-th power. Many first courses treat this as the payoff of the eigenvalue chapter; Georgia Tech's MATH 1554 "Linear Algebra", for example, lists diagonalisation as one of the topics it adds to the introductory course.

If finding the eigenvalues themselves is still the slow step, start with our eigenvalues and eigenvectors walkthrough. For help applying all of this to your own course, our linear algebra tutoring online page explains how sessions with Ajay Vatsyayan work.

The test: can this matrix be diagonalised?

Run through these in order and stop at the first one that decides it.

SituationVerdict
Real symmetric matrix (A = Aᵀ)Always diagonalisable, and P can be chosen orthogonal
n distinct eigenvaluesAlways diagonalisable
A repeated eigenvalue λCheck n − rank(A − λI); you need it to equal the number of times λ repeats
Triangular with a repeated diagonal entry and nonzero entries above itOften fails: check the rank as above
Real matrix with non-real eigenvaluesNot diagonalisable over the reals; it may be over the complex numbers

Two things the test does not depend on: invertibility (a zero eigenvalue is fine) and the size of the entries. The only question is whether there are enough eigenvectors.

Example 1: a 2×2 with distinct eigenvalues

Let A = [[7, −4], [2, 1]]. Trace 8, determinant 7 + 8 = 15, so

λ² − 8λ + 15 = (λ − 3)(λ − 5) = 0

λ = 5: A − 5I = [[2, −4], [2, −4]] gives x = 2y, eigenvector (2, 1).

λ = 3: A − 3I = [[4, −4], [2, −2]] gives x = y, eigenvector (1, 1).

So P = [[2, 1], [1, 1]] and D = [[5, 0], [0, 3]]. Here det P = 1, so P⁻¹ = [[1, −1], [−1, 2]].

Check by multiplying: P⁻¹AP = [[5, 0], [0, 3]]. Notice the order: the first column of P is the eigenvector for 5, so 5 comes first in D. Swap one and you must swap the other.

Example 2: matrix powers from the diagonal form

Using Example 1, Aⁿ = P Dⁿ P⁻¹ with Dⁿ = [[5ⁿ, 0], [0, 3ⁿ]]. Multiplying out,

Aⁿ = [[2·5ⁿ − 3ⁿ, −2·5ⁿ + 2·3ⁿ], [5ⁿ − 3ⁿ, −5ⁿ + 2·3ⁿ]]

Test it at n = 1: [[10 − 3, −10 + 6], [5 − 3, −5 + 6]] = [[7, −4], [2, 1]], which is A. At n = 4 the formula gives A⁴ = [[1169, −1088], [544, −463]], which matches direct multiplication.

Checking the general formula at n = 1 (and n = 0, which must give I) costs ten seconds and catches most P⁻¹ errors.

Example 3: a 3×3 with three distinct eigenvalues

Let A = [[4, −3, 3], [2, −1, 3], [2, −2, 4]].

Every row sums to 4, so λ = 4 with eigenvector (1, 1, 1). The trace is 7 and det A = 8, so the other two eigenvalues add to 3 and multiply to 2: they are 1 and 2. Three distinct eigenvalues, so A is diagonalisable before we find another vector.

λ = 1: A − I = [[3, −3, 3], [2, −2, 3], [2, −2, 3]]. Row 1 minus row 2 is (1, −1, 0), so x = y; row 2 then gives 3z = 0. Eigenvector (1, 1, 0).

λ = 2: A − 2I = [[2, −3, 3], [2, −3, 3], [2, −2, 2]]. Row 3 gives x = y − z; row 1 then gives −y + z = 0. Eigenvector (0, 1, 1).

P = [[1, 0, 1], [1, 1, 1], [0, 1, 1]] (columns for 1, 2, 4), D = diag(1, 2, 4).

det P = 1, and P⁻¹ = [[0, 1, −1], [−1, 1, 0], [1, −1, 1]]. Multiplying confirms P⁻¹AP = diag(1, 2, 4).

Example 4: same pattern, opposite verdicts

Repeated eigenvalues are where most marks go. Compare two matrices that look alike.

Matrix B = [[2, 2, 0], [1, 2, 1], [1, 1, 2]]. Rows sum to 4, trace 6, det 4, so the eigenvalues are 4, 1, 1. Now

B − I = [[1, 2, 0], [1, 1, 1], [1, 1, 1]]

has rank 2, so the eigenspace for λ = 1 has dimension 3 − 2 = 1. Eigenvalue 1 repeats twice but gives only one direction, (−2, 1, 1). Total independent eigenvectors: 2, not 3. B is not diagonalisable.

Matrix C = [[1, 2, −2], [−2, 5, −2], [−2, 2, 1]]. Rows sum to 1, trace 7, det 9, so the eigenvalues are 1, 3, 3. Now

C − 3I = [[−2, 2, −2], [−2, 2, −2], [−2, 2, −2]]

All three rows are equal, so the rank is 1. The eigenspace for λ = 3 is two-dimensional, spanned by (1, 1, 0) and (−1, 0, 1). With (1, 1, 1) for λ = 1, that is three independent eigenvectors. C is diagonalisable, with P = [[1, 1, −1], [1, 1, 0], [1, 0, 1]] and D = diag(1, 3, 3).

Misreading a single diagonal entry of C − 3I (writing 1 instead of 1 − 3, say) would make the rank 2 and flip the verdict. Always rewrite A − λI in full before judging its rank.

Example 5: orthogonal diagonalisation of a symmetric matrix

Let S = [[3, 2], [2, 0]]. Trace 3, det −4, so λ² − 3λ − 4 = (λ − 4)(λ + 1).

λ = 4: S − 4I = [[−1, 2], [2, −4]] gives (2, 1).

λ = −1: S + I = [[4, 2], [2, 1]] gives (1, −2).

The dot product (2, 1)·(1, −2) = 0, as the symmetric case promises. Divide each by its length √5 to get an orthonormal set:

Q = (1/√5)[[2, 1], [1, −2]], D = diag(4, −1), S = QDQᵀ

Because Q is orthogonal, Q⁻¹ = Qᵀ and you never compute an inverse. This form is the spectral theorem in action, and it is the version used for quadratic forms, principal axes and principal component analysis.

Example 6: decoupling a system of differential equations

Solve x′ = Ax with A = [[7, −4], [2, 1]] from Example 1 and x(0) = (3, 2).

Substitute x = Py. Then Py′ = APy, so y′ = P⁻¹APy = Dy. The system splits into y₁′ = 5y₁ and y₂′ = 3y₂, so y₁ = c₁e^(5t) and y₂ = c₂e^(3t). Back in the original variables,

x(t) = c₁e^(5t)(2, 1) + c₂e^(3t)(1, 1)

At t = 0, (3, 2) = c₁(2, 1) + c₂(1, 1), so c = P⁻¹(3, 2) = (1, 1). The solution is x(t) = (2e^(5t) + e^(3t), e^(5t) + e^(3t)). Our guide to solving systems of differential equations with eigenvalues takes this further, including the complex and repeated cases.

Where students lose marks

  • P and D out of step. The k-th column of P must be an eigenvector for the k-th diagonal entry of D.
  • Eigenvectors written as rows of P. They are columns. Writing them as rows gives a different (wrong) matrix.
  • A = P⁻¹DP instead of A = PDP⁻¹. Remember AP = PD and you can always rebuild the right version.
  • "Repeated eigenvalue, so not diagonalisable." Matrix C above is the counterexample. Compute n − rank(A − λI).
  • Confusing invertible with diagonalisable. [[1, 0], [0, 0]] is diagonal but not invertible; [[1, 1], [0, 1]] is invertible but not diagonalisable.
  • Forgetting to normalise for an orthogonal P. Orthogonal eigenvectors are not enough; each column needs length 1 for Qᵀ to be the inverse.
  • No check. Multiply out PDP⁻¹ or test Aⁿ at n = 1. It is the cheapest mark you will ever protect.

Practice questions

  1. Diagonalise A = [[−1, 6], [−2, 6]]: give P, D and P⁻¹.
  2. Using Question 1, find a formula for Aⁿ and the value of A⁵.
  3. Is [[2, 1, 0], [0, 2, 0], [0, 0, 3]] diagonalisable? Justify.
  4. For which values of k is [[2, k], [0, 2]] diagonalisable?
  5. Orthogonally diagonalise S = [[4, 3], [3, −4]].
  6. True or false: every invertible matrix is diagonalisable.

Answers.

  1. Eigenvalues 2 and 3 with eigenvectors (2, 1) and (3, 2). P = [[2, 3], [1, 2]], D = diag(2, 3), P⁻¹ = [[2, −3], [−1, 2]].
  2. Aⁿ = [[4·2ⁿ − 3·3ⁿ, −6·2ⁿ + 6·3ⁿ], [2·2ⁿ − 2·3ⁿ, −3·2ⁿ + 4·3ⁿ]], so A⁵ = [[−601, 1266], [−422, 876]].
  3. No. λ = 2 repeats twice but A − 2I has rank 2, so its eigenspace is one-dimensional, spanned by (1, 0, 0).
  4. Only k = 0. For k ≠ 0, A − 2I has rank 1 and there is just one eigenvector direction.
  5. Eigenvalues 5 and −5 with eigenvectors (3, 1) and (1, −3). Q = (1/√10)[[3, 1], [1, −3]], D = diag(5, −5), S = QDQᵀ.
  6. False. [[1, 1], [0, 1]] has determinant 1 but only one eigenvector direction, (1, 0).

Where diagonalisation leads next

Diagonalisation is the bridge from eigenvalues to almost every application. Markov chains use Aⁿ to find long-run behaviour (our Markov chains and matrices guide shows the school-level version). A diagonal matrix is the matrix of a linear map in a basis of eigenvectors, which is the change-of-basis idea in our guide to the matrix of a linear transformation. When there are not enough eigenvectors, courses move on to the Jordan form; when the matrix is not square, the singular value decomposition takes over. The eigenspace dimension counts used in Example 4 are a direct use of the rank–nullity theorem.

How Maths Bodhi helps

Diagonalisation questions reward a fixed routine and a habit of checking. In online sessions we go through your own course problems, have you explain each verdict, and review your attempts so you know why a matrix passes or fails the test. We teach and practise; we don't complete graded work. Students taking linear algebra alongside a US calculus sequence can see our college maths support.

Home tuition is available in Gurgaon (Gurugram). Students elsewhere in India and abroad learn with us online. You can book a free demo class.

Written and checked by the Maths Bodhi team (November 2026).

Frequently asked questions

How do you know if a matrix is diagonalizable?
It is diagonalisable exactly when it has n linearly independent eigenvectors; distinct eigenvalues or a symmetric matrix guarantee this.
What is the diagonalization theorem?
An n×n matrix A equals PDP⁻¹ with D diagonal if and only if A has n linearly independent eigenvectors, which form the columns of P.
Is a matrix with a repeated eigenvalue diagonalizable?
Sometimes; it is if each repeated eigenvalue has as many independent eigenvectors as its multiplicity.
Can a matrix with a zero eigenvalue be diagonalized?
Yes; a zero eigenvalue only means the matrix is not invertible, which is a separate question.
What is the difference between diagonalization and orthogonal diagonalization?
Orthogonal diagonalisation uses an orthogonal P, so A = QDQᵀ, and it is possible exactly for real symmetric matrices.
Why is diagonalization useful?
It turns powers, exponentials and coupled systems into separate one-variable problems, since Dᵏ only needs the diagonal entries raised to k.
diagonalizationlinear algebraeigenvaluesmatrix powersuniversity maths

Related guides

Keep exploring this maths topic

University Maths18 Nov 2026

Eigenvalues and Eigenvectors Step by Step, with 6 Worked Examples

How to find eigenvalues and eigenvectors of 2×2 and 3×3 matrices, step by step: repeated and complex eigenvalues, trace and determinant checks, common mistakes and practice with answers.

eigenvalueseigenvectorslinear algebracharacteristic polynomial

By Maths Bodhi Team

Read guide

University Maths25 Nov 2026

Singular Value Decomposition Explained, with Step-by-Step Examples

What the singular value decomposition A = UΣVᵀ means, how to compute it by hand for square and rectangular matrices, and how it gives low-rank approximations and the pseudo-inverse, with checked examples and practice.

singular value decompositionSVDlinear algebrapseudo-inverse

By Maths Bodhi Team

Read guide

University Maths25 Nov 2026

How to Find the Matrix of a Linear Transformation: Examples and Solutions

How to build the matrix of a linear transformation from a formula, from images of other vectors, from a geometric description, on polynomial and function spaces, and in a new basis, with six checked examples and practice.

linear transformationslinear algebrachange of basisstandard matrix

By Maths Bodhi Team

Read guide

University Maths25 Nov 2026

The Rank–Nullity Theorem Explained, with Examples for Matrices and Linear Transformations

What the rank–nullity theorem says, why it is true, and how to use it on matrices, polynomial maps and matrix spaces, with six checked examples, common mistakes and practice.

rank nullity theoremlinear algebranull spacelinear transformations

By Maths Bodhi Team

Read guide

University Maths25 Nov 2026

Linear Algebra for Machine Learning: What You Actually Need, with Small Worked Examples

The linear algebra that computer science and data science students really use in machine learning, mapped to the topics of a standard course, with a small worked example for each idea.

linear algebramachine learningdata sciencePCA

By Maths Bodhi Team

Read guide

University Maths25 Nov 2026

The Gram–Schmidt Process and Least Squares, Step by Step

How the Gram–Schmidt process builds an orthogonal basis, how it gives the QR factorisation, and how both solve least squares problems such as fitting a line, with six checked examples and practice.

Gram-Schmidtleast squaresQR factorisationlinear algebra

By Maths Bodhi Team

Read guide