Linear Algebra: Topic 6 of 8

Matrix Diagonalisation

Diagonalisation transforms a complicated matrix into the simplest possible form, a diagonal matrix where all the action sits on the main diagonal. The payoff is enormous: matrix powers become trivial, differential equations decouple, and hidden structure becomes visible.

P⁻¹AP = D Eigenvalues & eigenvectors Algebraic vs geometric multiplicity Matrix powers When it fails 10 worked examples
Share this page

§ 01What Is Diagonalisation — and Why Does It Matter?

A diagonal matrix is the dream: you can raise it to any power, take its exponential, or invert it simply by operating on each diagonal entry independently. Diagonalisation asks whether a given matrix can be converted into this ideal form.

A square matrix A is called diagonalisable if there exists an invertible matrix P and a diagonal matrix D such that:

The Central Equation
P⁻¹AP = D   equivalently   A = PDP⁻¹

The columns of P are eigenvectors of A, and the corresponding diagonal entries of D are the eigenvalues. This is not an abstract trick: it is the algebraic expression of a fundamental geometric truth: if you choose the right coordinate system (the eigenbasis), the linear transformation A acts like simple scaling on each coordinate axis. That simplicity is what makes diagonalisation so powerful.

Why Should You Care?

The most immediate application is computing matrix powers. If A = PDP⁻¹, then:

Matrix Powers via Diagonalisation
A² = (PDP⁻¹)(PDP⁻¹) = PD²P⁻¹
A³ = PD³P⁻¹
Aⁿ = PDⁿP⁻¹

Raising a diagonal matrix to the n-th power is effortless: each diagonal entry is just raised to the n-th power. This reduces what would otherwise be n−1 costly matrix multiplications to three operations regardless of n. The technique also underlies systems of differential equations, Markov chains, the Fibonacci formula, and the principal component analysis at the heart of machine learning.

StartA
Findλᵢ, vᵢ
BuildP, D
VerifyP⁻¹AP=D
UseAⁿ=PDⁿP⁻¹

§ 02Quick Recap — Eigenvalues and Eigenvectors

Diagonalisation is built entirely on eigenvalues and eigenvectors. Here is the minimum you need before proceeding: see the Eigenvalues & Eigenvectors page for full detail.

A scalar λ is an eigenvalue of A if there exists a non-zero vector v such that Av = λv. The vector v is called an eigenvector associated with λ. The equation Av = λv can be rewritten as (A − λI)v = 0, which has non-zero solutions if and only if:

Characteristic Equation
det(A − λI) = 0

The polynomial det(A − λI) is called the characteristic polynomial of A. Its roots are the eigenvalues. For each eigenvalue λᵢ, the eigenspace E(λᵢ) is the null space of (A − λᵢI), the set of all solutions to (A − λᵢI)v = 0, including the zero vector.

The Multiplicity Distinction — This Is Where Diagonalisability Lives The algebraic multiplicity of an eigenvalue λ is its multiplicity as a root of the characteristic polynomial. The geometric multiplicity is the dimension of its eigenspace — the number of linearly independent eigenvectors with that eigenvalue. For diagonalisability, these must agree for every eigenvalue.
ConceptDefinitionNotationKey fact
Algebraic multiplicity Multiplicity of λ as a root of det(A−λI) AM(λ) AM(λ) ≥ 1 for every eigenvalue
Geometric multiplicity dim(null(A−λI)) = number of free variables GM(λ) 1 ≤ GM(λ) ≤ AM(λ) always
Diagonalisable condition GM(λ) = AM(λ) for every eigenvalue λ Equivalently: n independent eigenvectors exist

§ 03The Diagonalisability Theorem

The existence theorem is clean and precise. It gives you both a necessary and sufficient condition, there is no grey area.

Theorem — Diagonalisation
An n×n matrix A is diagonalisable if and only if it has n linearly independent eigenvectors.

Equivalently: A is diagonalisable if and only if, for each eigenvalue λ, the geometric multiplicity equals the algebraic multiplicity.

When diagonalisable, P is the matrix whose columns are n linearly independent eigenvectors, and D is the diagonal matrix of the corresponding eigenvalues (in the same column order).

Two important special cases guarantee diagonalisability without any multiplicity checks:

Sufficient Condition 1 — Distinct Eigenvalues If an n×n matrix has n distinct (all different) eigenvalues, then it is automatically diagonalisable. This is because eigenvectors from different eigenvalues are always linearly independent.
Sufficient Condition 2 — Symmetric Matrices Every real symmetric matrix (A = Aᵀ) is diagonalisable, with an orthogonal matrix P (so P⁻¹ = Pᵀ). The eigenvectors from distinct eigenspaces are automatically orthogonal. This is the Spectral Theorem, and it is the foundation of principal component analysis.

§ 04The Five-Step Diagonalisation Procedure

Every diagonalisation problem follows the same five steps. Internalise this checklist and no problem will catch you off guard.

How to Diagonalise A
  1. Find all eigenvalues

    Compute det(A − λI) = 0. Solve the characteristic polynomial. List all roots with their algebraic multiplicities.

  2. Test diagonalisability

    For each repeated eigenvalue, find the geometric multiplicity (dim of null space of A − λI). If GM = AM for every eigenvalue, proceed. Otherwise: not diagonalisable.

  3. Find eigenvectors for each eigenvalue

    For each λᵢ, row-reduce (A − λᵢI) and find a basis for the null space. These basis vectors are the eigenvectors.

  4. Assemble P and D

    Place the eigenvectors as columns of P (in any order). Build D with the corresponding eigenvalues on the diagonal in the same column order.

  5. Verify (optional but recommended)

    Check that AP = PD (equivalently, that A times each column of P gives λᵢ times that column). This catches sign errors without fully computing P⁻¹.

§ 05Ten Worked Examples

We cover 2×2 and 3×3 cases, repeated eigenvalues, defective matrices, matrix powers, and symmetric matrices. Each example applies the five-step procedure explicitly.

Example 01 Diagonalise A = [[4, 1], [2, 3]]
Step 1 — Characteristic polynomial
det(A − λI) = (4−λ)(3−λ) − (1)(2) = λ² − 7λ + 10 = (λ−5)(λ−2)

Eigenvalues: λ₁ = 5, λ₂ = 2. Two distinct eigenvalues → automatically diagonalisable.

Step 3 — Eigenvector for λ = 5
(A − 5I)v = 0: [[-1,1],[2,-2]]v = 0 → v₁ = [1, 1]ᵀ
Step 3 — Eigenvector for λ = 2
(A − 2I)v = 0: [[2,1],[2,1]]v = 0 → v₂ = [1, −2]ᵀ
Step 4 — Assemble P and D
P = [[1, 1],[1, −2]]    D = [[5, 0],[0, 2]]
Step 5 — Quick check: AP column 1
A[1,1]ᵀ = [5,5]ᵀ = 5[1,1]ᵀ ✓
P⁻¹AP = [[5,0],[0,2]]
Example 02 Compute A¹⁰ for A = [[4,1],[2,3]] using diagonalisation

From Example 01: A = PDP⁻¹ with P = [[1,1],[1,−2]], D = diag(5, 2).

Raise D to the 10th power — trivial for diagonal matrices
D¹⁰ = [[5¹⁰, 0],[0, 2¹⁰]] = [[9,765,625, 0],[0, 1,024]]
Find P⁻¹ — for 2×2: P⁻¹ = (1/det P) [[−2,−1],[−1,1]]
det P = (1)(−2)−(1)(1) = −3    P⁻¹ = (−1/3)[[−2,−1],[−1,1]]
Assemble A¹⁰ = PD¹⁰P⁻¹
A¹⁰ = (1/3)[[2·5¹⁰+2¹⁰, 5¹⁰−2¹⁰],[2·5¹⁰−2·2¹⁰, 5¹⁰+2·2¹⁰]]
Compare: brute-force would need 9 matrix multiplications. Diagonalisation needs 3 operations regardless of the exponent.
Example 03 Diagonalise A = [[2, 0, 0],[0, 3, 1],[0, 0, 3]] — repeated eigenvalue

The matrix is upper triangular, so the eigenvalues are the diagonal entries.

Eigenvalues (read off diagonal)
λ₁ = 2 (AM = 1),   λ₂ = 3 (AM = 2)
Geometric multiplicity of λ = 3: row-reduce (A − 3I)
A − 3I = [[-1,0,0],[0,0,1],[0,0,0]] → rank 2, nullity = 1

GM(3) = 1 but AM(3) = 2. Since GM ≠ AM, the matrix is not diagonalisable. It is a defective matrix: only 2 linearly independent eigenvectors exist for a 3×3 matrix.

Not diagonalisable — defective matrix
Example 04 Diagonalise A = [[1, 0, 0],[0, 3, −2],[0, 1, 0]] — 3×3 with distinct eigenvalues
Characteristic polynomial
det(A−λI) = (1−λ)[(3−λ)(−λ)−(−2)(1)] = (1−λ)(λ²−3λ+2) = (1−λ)(λ−1)(λ−2)
Factor fully
= −(λ−1)²(λ−2)    Eigenvalues: λ=1 (AM=2), λ=2 (AM=1)
Eigenspace for λ = 1: row-reduce (A−I)
A−I = [[0,0,0],[0,2,−2],[0,1,−1]] → one free variable: v = [1,0,0]ᵀ and [0,1,1]ᵀ

GM(1) = 2 = AM(1) ✓. Eigenspace for λ = 2: GM(2) = 1 = AM(2) ✓. Diagonalisable.

Assemble P and D
P = [[1,0,0],[0,1,0],[0,1,1]]    D = diag(1, 1, 2)
P⁻¹AP = diag(1, 1, 2)
Example 05 Is A = [[5, −1],[1, 3]] diagonalisable? Find P and D.
Characteristic polynomial
det(A−λI) = (5−λ)(3−λ)+1 = λ²−8λ+16 = (λ−4)²

One eigenvalue λ = 4 with AM = 2. Check geometric multiplicity.

Row-reduce (A − 4I) = [[1,−1],[1,−1]]
→ rank 1, nullity = 1    Only one independent eigenvector: v = [1, 1]ᵀ

GM(4) = 1 ≠ AM(4) = 2. This is a defective matrix, not diagonalisable. It would require Jordan normal form (one Jordan block of size 2).

Not diagonalisable — repeated eigenvalue, deficient eigenspace
Example 06 Diagonalise A = [[4, −2],[1, 1]] and compute Aⁿ in closed form
Characteristic polynomial
(4−λ)(1−λ)+2 = λ²−5λ+6 = (λ−3)(λ−2)

Eigenvalues λ₁ = 3, λ₂ = 2. Distinct → diagonalisable.

Eigenvectors
λ=3: v₁=[2,1]ᵀ    λ=2: v₂=[1,1]ᵀ (verify: Av = λv)
P⁻¹ (2×2 formula with det P = 2−1 = 1)
P⁻¹ = [[1,−1],[−1,2]]
Closed-form Aⁿ = PDⁿP⁻¹
Aⁿ = [[2·3ⁿ−2ⁿ, −2·3ⁿ+2·2ⁿ],[3ⁿ−2ⁿ, −3ⁿ+2·2ⁿ]]
Exact formula for every power n — verified: n=1 gives back A ✓
Example 07 Orthogonally diagonalise the symmetric matrix A = [[3, 1],[1, 3]]

A = Aᵀ → diagonalisable by the Spectral Theorem, and eigenvectors from distinct eigenspaces will be orthogonal.

Eigenvalues
(3−λ)²−1 = λ²−6λ+8 = (λ−4)(λ−2)    λ₁=4, λ₂=2
Eigenvectors (unnormalised)
λ=4: v₁=[1,1]ᵀ    λ=2: v₂=[1,−1]ᵀ
Check orthogonality: v₁·v₂ = 1−1 = 0 ✓
Normalise: q₁=[1/√2, 1/√2]ᵀ    q₂=[1/√2, −1/√2]ᵀ
Orthogonal P (columns are unit eigenvectors)
P = (1/√2)[[1,1],[1,−1]]    P⁻¹ = Pᵀ (since P is orthogonal)
PᵀAP = diag(4, 2)    (no matrix inversion needed!)
Example 08 Diagonalise A = [[0, 0, 1],[0, 1, 0],[1, 0, 0]] — permutation matrix

A is symmetric (A = Aᵀ), so guaranteed diagonalisable with orthogonal P.

Characteristic polynomial
det(A−λI) = −λ³+λ²+λ−1 = −(λ−1)²(λ+1)

Eigenvalues: λ=1 (AM=2), λ=−1 (AM=1).

Eigenspace for λ=1: null(A−I)
A−I = [[-1,0,1],[0,0,0],[1,0,-1]] → null space: span{[0,1,0]ᵀ, [1,0,1]ᵀ}   GM=2 ✓
Eigenspace for λ=−1: null(A+I)
A+I = [[1,0,1],[0,2,0],[1,0,1]] → null: [1,0,−1]ᵀ
Normalise all three eigenvectors for orthogonal P
q₁=[0,1,0]ᵀ, q₂=[1/√2,0,1/√2]ᵀ, q₃=[1/√2,0,−1/√2]ᵀ
PᵀAP = diag(1, 1, −1)
Example 09 Use diagonalisation to find the Fibonacci closed form

The Fibonacci recurrence Fₙ = Fₙ₋₁ + Fₙ₋₂ is encoded in the matrix equation:

Matrix form
[[Fₙ₊₁],[Fₙ]] = A [[Fₙ],[Fₙ₋₁]]   where A = [[1,1],[1,0]]
Eigenvalues of A (characteristic polynomial λ²−λ−1 = 0)
φ = (1+√5)/2 ≈ 1.618    ψ = (1−√5)/2 ≈ −0.618

Since eigenvalues are distinct, A is diagonalisable. After computing Aⁿ = PDⁿP⁻¹ and extracting Fₙ:

Binet's Formula
Fₙ = (φⁿ − ψⁿ) / √5

This exact formula produces any Fibonacci number in O(1) operations: a direct consequence of diagonalising a 2×2 matrix.

F₁₀ = (φ¹⁰ − ψ¹⁰)/√5 = 55 ✓
Example 10 Determine if A = [[2, 1, 0],[0, 2, 0],[0, 0, 2]] is diagonalisable

A scalar multiple of the identity with one off-diagonal entry, a Jordan-like matrix.

Eigenvalues
det(A−λI) = (2−λ)³    Single eigenvalue λ=2 with AM=3
Geometric multiplicity: row-reduce (A−2I)
A−2I = [[0,1,0],[0,0,0],[0,0,0]] → rank 1, nullity = 2    GM=2

GM(2) = 2 ≠ AM(2) = 3. Not diagonalisable. The matrix has a 2×2 Jordan block and a 1×1 Jordan block, it can only be brought to Jordan normal form, not to a fully diagonal form.

Not diagonalisable — GM < AM for λ = 2

§ 06Common Mistakes

Mistake 1 — Assuming distinct eigenvalues are necessary, not just sufficient A matrix with a repeated eigenvalue can still be diagonalisable — provided the geometric multiplicity equals the algebraic multiplicity for that eigenvalue. The identity matrix has eigenvalue 1 with AM = n and GM = n: it is already diagonal and perfectly diagonalisable.
Mistake 2 — Wrong column order between P and D The diagonal entries of D must correspond to the columns of P in the exact same order. If v₁ (eigenvector for λ₁) is column 1 of P, then λ₁ must be the (1,1) entry of D. Swapping columns of P without updating D makes P⁻¹AP ≠ D.
Mistake 3 — Confusing algebraic and geometric multiplicity Algebraic multiplicity is found from the characteristic polynomial — count the repeated roots. Geometric multiplicity is found by row-reducing (A − λI) and computing the nullity. You must check both for every repeated eigenvalue.
Mistake 4 — Using AP = PD to check instead of P⁻¹AP = D Actually, checking AP = PD is the right shortcut! It avoids computing P⁻¹ and catches errors: multiply A by each column of P and check it equals the eigenvalue times that column. This is faster and less error-prone than fully computing P⁻¹AP.

§ 07Practice Quiz — 10 Questions

Test your understanding of diagonalisation: theory, multiplicity, matrix powers, and computations.

Score: 0 / 10
Question 1 of 10 — Multiple Choice

An n×n matrix A is diagonalisable if and only if:

B. The correct necessary and sufficient condition is n linearly independent eigenvectors. Option A (distinct eigenvalues) is only sufficient, not necessary — a matrix with repeated eigenvalues can still be diagonalisable if GM = AM for each repeated eigenvalue. Option D (symmetric) is also only sufficient.
Question 2 of 10 — Multiple Choice

If A = PDP⁻¹, what is A⁵?

B — PD⁵P⁻¹. When you expand (PDP⁻¹)⁵, the middle P⁻¹P pairs cancel: (PDP⁻¹)(PDP⁻¹)(PDP⁻¹)(PDP⁻¹)(PDP⁻¹) = PD·(P⁻¹P)·D·(P⁻¹P)·D·(P⁻¹P)·D·(P⁻¹P)·DP⁻¹ = PD⁵P⁻¹. This is the whole point of diagonalisation for computing powers.
Question 3 of 10 — Fill in the Blank

The matrix A = [[3,0],[0,7]] has eigenvalues 3 and 7. How many linearly independent eigenvectors does it have?

Answer:

A diagonal matrix already is diagonalised. The standard basis vectors e₁ and e₂ are the eigenvectors.
A diagonal matrix always has n linearly independent eigenvectors — the standard basis vectors. Here e₁=[1,0]ᵀ is the eigenvector for λ=3, and e₂=[0,1]ᵀ for λ=7. Answer: 2.
Question 4 of 10 — Multiple Choice

A 3×3 matrix has characteristic polynomial −(λ−1)²(λ−5). Which situation guarantees it is diagonalisable?

B. AM(1)=2, so we need GM(1)=2 for the repeated eigenvalue. GM(5)=1=AM(5) is automatically satisfied. With GM=AM for every eigenvalue, we get 2+1=3 independent eigenvectors — exactly n=3. Option A fails because GM(1)=1 < AM(1)=2.
Question 5 of 10 — Multiple Choice

What is the relationship between geometric and algebraic multiplicity for any eigenvalue?

C — 1 ≤ GM ≤ AM. GM ≥ 1 because every eigenvalue has at least one eigenvector. GM ≤ AM is a theorem: the eigenspace dimension can never exceed the multiplicity of the root. The gap (AM − GM) measures how "defective" the eigenvalue is. Diagonalisation requires this gap to be zero for every eigenvalue.
Question 6 of 10 — Fill in the Blank

If D = diag(2, −1, 3), what is the (1,1) entry of D⁴?

Answer:

Raising a diagonal matrix to a power just raises each diagonal entry to that power.
D⁴ = diag(2⁴, (−1)⁴, 3⁴) = diag(16, 1, 81). The (1,1) entry is 16.
Question 7 of 10 — Multiple Choice

For a real symmetric matrix, which statement is always true?

B. The Spectral Theorem guarantees that every real symmetric matrix is diagonalisable by an orthogonal matrix P (so P⁻¹ = Pᵀ). All eigenvalues are real. But they need not be positive (A may be indefinite) and they can certainly repeat. Option D describes orthogonal matrices, not symmetric ones.
Question 8 of 10 — Fill in the Blank

Matrix A has eigenvalues 2, 2, 5 with corresponding eigenvectors [1,0,0]ᵀ, [0,1,0]ᵀ, [0,0,1]ᵀ. What is the (2,2) entry of D (where P is formed from these eigenvectors in order)?

Answer:

The diagonal entries of D are the eigenvalues in the same order as the columns of P. Column 2 of P is [0,1,0]ᵀ, which has eigenvalue…
Column 2 of P is the eigenvector [0,1,0]ᵀ with eigenvalue 2. So D = diag(2, 2, 5) and the (2,2) entry is 2.
Question 9 of 10 — Multiple Choice

A 2×2 matrix has a single eigenvalue λ=4 with only one linearly independent eigenvector. This matrix is:

C — defective. AM(4) = 2 (it's the only eigenvalue of a 2×2 matrix) but GM(4) = 1. Since GM < AM, we cannot assemble 2 independent eigenvectors, so P cannot be built. The matrix is defective and requires a Jordan block [[4,1],[0,4]] as its normal form.
Question 10 of 10 — Multiple Choice

Which of the following is the most efficient way to verify P⁻¹AP = D, without computing P⁻¹?

B. P⁻¹AP = D is equivalent to AP = PD (multiply both sides on the left by P). The j-th column of AP is A times the j-th column of P (i.e. Avⱼ), and the j-th column of PD is λⱼvⱼ. So checking Avⱼ = λⱼvⱼ for each column is both the definition of an eigenvector and the fastest way to verify the diagonalisation. Options A and C are necessary but not sufficient; option D only confirms P is invertible, not that the construction is correct.

Next StepsContinue the Linear Algebra Series

Diagonalisation sits at the heart of applied linear algebra. The natural follow-on topics are:

  • Orthogonality, the geometry of perpendicular vectors, Gram-Schmidt, and why symmetric matrices have orthogonal eigenvectors.
  • Eigenvalues & Eigenvectors, go deeper on the characteristic polynomial, complex eigenvalues, and the trace/determinant relationships.
  • Linear Transformations: diagonalisation in a basis-free language, and how change of basis connects to P⁻¹AP.

Cookie Settings