Linear Algebra, Live
Strang §6.2 · Diagonalizing a matrix

Diagonalizing a matrix: A = XΛX⁻¹

Slide 2 found that A = 4123 stretches 11 by 5 and 1−2 by 2. Now use those two arrows as your units of measure. Think of a city whose streets run at a slant: directions get easy once you say "3 blocks along this street, 2 blocks along that one". Describe any vector as so many steps of x₁ plus so many steps of x₂. Then A is simple: it multiplies the first count by 5 and the second count by 2, and nothing mixes. Writing this down as matrices is called diagonalizing: the eigenvectors go in the columns of X, the eigenvalues go on the diagonal of Λ, and A = XΛX⁻¹.

Lesson 7 · slide 3A = XΛX⁻¹
A = XΛX⁻¹    Aᵏ = XΛᵏX⁻¹
Key ideas
  1. X has the eigenvectors as columns; Λ (capital lambda) is diagonal with the eigenvalues, in the same order.
  2. AX = XΛ says Axᵢ = λᵢxᵢ for every column at once.
  3. If A is n by n and has n independent eigenvectors, X is invertible and A = XΛX⁻¹.
  4. Powers become easy: Aᵏ = XΛᵏX⁻¹, and Λᵏ just raises each diagonal entry to the power k.

Counting in eigenvector steps

Take x = 30. It is 2 steps of x₁ = 11 plus 1 step of x₂ = 1−2, because 2·11 + 1·1−2 = 30. Now A acts on each part by itself:

A30 = 2·5·11 + 1·2·1−2 = 1010 + 2−4 = 126
Direct check: A30 = 4·3 + 1·02·3 + 3·0 = 126 ✓

The counts 2 and 1 became 10 and 2: each was multiplied by its own λ. That is all A does, once you measure in eigenvector steps.

A stretches along its two eigenvector lines: x₁ = 11 grows 5 times, x₂ = 1−2 grows 2 times. The two lines don't have to meet at a right angle.

All eigenvectors at once: AX = XΛ

Put x₁ and x₂ side by side as the columns of X. Column by column, AX holds Ax₁ = 5x₁ and Ax₂ = 2x₂. That is the same as X times the diagonal matrix Λ, which multiplies column 1 by 5 and column 2 by 2:

AX = 4123111−2 = 525−4
XΛ = 111−25002 = 525−4 ✓
A times X, entry by entry. Column 1 of the answer is 55 = 5x₁, and column 2 is 2−4 = 2x₂.

Building X and Λ

The recipe has one rule about order: the eigenvalue in position i of Λ goes with column i of X. Swap one, and you must swap the other.

Build X from the eigenvectors and Λ from the eigenvalues. Multiplying X by Λ stretches each column of X by its own λ, which is exactly what A does.

A = XΛX⁻¹, checked

Different eigenvalues always give independent eigenvectors, so X has an inverse. Multiply AX = XΛ on the right by X⁻¹ to get A = XΛX⁻¹. With the 2 by 2 inverse from lesson 3 (det X = −2 − 1 = −3):

Swap the diagonal of X, change the signs of the other two entries, divide by det X:
X⁻¹ = −⅓−2−1−11 = ⅓211−1
XΛX⁻¹ = 525−4 · ⅓211−1 = ⅓12369 = 4123 ✓

Read XΛX⁻¹x from right to left, and it is the street-counting idea. X⁻¹ finds the counts, Λ stretches each count, and X turns the counts back into a vector:

X⁻¹(3, 0) = ⅓63 = 21:   2 steps of x₁, 1 step of x₂
Λ21 = 102,   then X102 = 10·11 + 2·1−2 = 126 ✓

Powers for free

A² = XΛX⁻¹XΛX⁻¹ = XΛ²X⁻¹, since X⁻¹X = I in the middle. Likewise Aᵏ = XΛᵏX⁻¹, and Λᵏ just raises each diagonal entry to the power k:

XΛ² = 111−225004 = 25425−8
A² = XΛ²X⁻¹ = ⅓54214233 = 1871411
Direct check: AA = 16 + 24 + 38 + 62 + 9 = 1871411 ✓

A¹⁰⁰ is no harder: Λ¹⁰⁰ has 5¹⁰⁰ and 2¹⁰⁰ on its diagonal.

Keep reading with the full course

Finish lesson 7 and you will be able to: tell whether a system settles down or blows up.

Still locked here:

  • The rest of this explanation
  • 4 more examples with step-by-step solutions
  • Five extra members-only problems with worked solutions

$20 once, lifetime access. Lessons 1 to 3 stay free.

Examples

Example 1 · A diagonal matrix is already done

A = 3007: X = I and Λ = A. The axes are the eigenvectors.

Exercise Put the eigenvalues into Lam in the same order as the eigenvectors in X, so that X Lam X⁻¹ gives back A. Edit the code and press Run.
slide_3.py Loading Python…
1
Output · Ctrl+Enter runs
Press Run to execute this slide's code. Ctrl+Enter works too.

Questions and comments

Stuck on something, or found a mistake? Ask here and I'll answer. You sign in with GitHub.

The full course

From Ax = b to PCA, by running it

Lessons 1 to 3 are free. Finish all eight and you will be able to:

You get: all 8 lessons with Python labs · every worked example and solution · 5 extra problems per lesson · your progress tracked · answers to your questions · every future update.

$20 once · lifetime access
Continue to checkout →

Already a member? Log in to the course