Find a course

Module 4: Eigenvalues, Orthogonality and Least SquaresLesson 11 of 1214 min

Diagonalization and Applications

Write A = PDP⁻¹, use it to compute matrix powers quickly, and apply eigenvalues to Markov chains and long-run behavior of dynamic systems.

Step 1 of 11Learn

Changing to the eigenvector basis

Computing A¹⁰⁰ by multiplying A by itself a hundred times is slow. For a diagonal matrix it's instant: D = [5 0; 0 2] gives D¹⁰⁰ = [5¹⁰⁰ 0; 0 2¹⁰⁰]. Diagonal matrices just stretch along the axes, and stretching 100 times multiplies each stretch factor by itself 100 times.

Eigenvectors let you turn almost any matrix into a diagonal one by choosing the right coordinate system. If an n × n matrix A has n linearly independent eigenvectors, put them as the columns of P and the matching eigenvalues on the diagonal of D. Then

A = PDP⁻¹.

Read right to left, this says: convert to eigenvector coordinates (P⁻¹), stretch along each axis (D), convert back (P). In the eigenvector basis, A really is just a diagonal stretch.

Example. For A = [4 1; 2 3], we found eigenvalues 5 and 2 with eigenvectors (1, 1) and (1, −2). So

P = [1 1; 1 −2], D = [5 0; 0 2].

Powers. A² = PDP⁻¹PDP⁻¹ = PD²P⁻¹, because the inner P⁻¹P cancels. In general,

Aᵏ = PDᵏP⁻¹.

Computing A¹⁰⁰ becomes: raise two numbers to the 100th power, then do two matrix multiplications. And for large k, the term with the largest |λ| dominates. Here 5ᵏ swamps 2ᵏ, so Aᵏx points closer and closer to the eigenvector (1, 1) for almost any starting vector x. That's the idea behind the power method, the simple algorithm PageRank used to find its dominant eigenvector.

Step 2 of 11Practice · Choose one

For A = PDP⁻¹, which expression equals A³?

Step 3 of 11Diagram

A = PDP⁻¹, read right to left

A = PDP⁻¹, read right to leftProcess diagram: P⁻¹: switch to eigenvector coordinates → D: stretch each axis by its λ → P: switch back.P⁻¹: switch toeigenvectorcoordinatesD: stretch each axisby its λP: switch back

Tap a shape with to see more.

P⁻¹: switch to eigenvector coordinates
D: stretch each axis by its λ

Repeating this k times is just Dᵏ: raise each λ to the k.

P: switch back

The inner P⁻¹P pairs cancel when you multiply A by itself.

Step 4 of 11Learn

When can you diagonalize?

A matrix is diagonalizable when it has enough independent eigenvectors: n of them for an n × n matrix. When does that happen?

  • Distinct eigenvalues guarantee it. Eigenvectors for different eigenvalues are always linearly independent, so an n × n matrix with n different eigenvalues is diagonalizable.
  • Repeated eigenvalues may or may not work. The identity matrix has eigenvalue 1 repeated, but every vector is an eigenvector, so it's (trivially) diagonal. The shear [1 1; 0 1] also has eigenvalue 1 repeated, but its only eigenvectors are multiples of (1, 0). One direction isn't enough for a basis of ℝ², so the shear is not diagonalizable.
  • Symmetric matrices always work, beautifully. The spectral theorem says a real symmetric matrix (Aᵀ = A) has real eigenvalues and eigenvectors that can be chosen orthogonal to each other. So A = QDQᵀ with Q an orthogonal matrix. Covariance matrices in statistics are symmetric, which is why principal component analysis always produces perpendicular principal directions.

Fibonacci in closed form. The Fibonacci numbers satisfy (Fₙ₊₁, Fₙ) = [1 1; 1 0](Fₙ, Fₙ₋₁). That matrix has eigenvalues (1 + √5)/2 ≈ 1.618 (the golden ratio) and (1 − √5)/2 ≈ −0.618. Diagonalizing gives Binet's formula, Fₙ = (φⁿ − ψⁿ)/√5, and explains why the ratio of consecutive Fibonacci numbers approaches the golden ratio: the dominant eigenvalue takes over.

Step 5 of 11Practice · Sort into groups

Is each matrix guaranteed to be diagonalizable?

Tap an item, then tap its group (or drag it there).

Step 6 of 11Learn

Markov chains and steady states

A bike-share city has two stations, Downtown and Campus. Each day, 90% of the bikes at Downtown stay there and 10% move to Campus; at Campus, 80% stay and 20% move Downtown. If x = (d, c) gives the fractions of bikes at each station today, then tomorrow's fractions are Mx, with

M = [0.9 0.2; 0.1 0.8].

Each column describes where one station's bikes go, and each column sums to 1. A matrix like this is a Markov matrix (or stochastic matrix).

Start with all bikes Downtown, x₀ = (1, 0). Day 1: (0.9, 0.1). Day 2: (0.83, 0.17). The distribution keeps shifting, but it settles down. Where?

A steady state satisfies Mx = x: it's an eigenvector with eigenvalue 1. Solve (M − I)x = 0: −0.1d + 0.2c = 0, so d = 2c. With d + c = 1, the steady state is (2/3, 1/3).

Every Markov matrix has eigenvalue 1. The other eigenvalue here is 0.7 (the trace 1.7 minus 1). After k days, the deviation from steady state shrinks by a factor of 0.7ᵏ: after 10 days it's below 3% of the starting gap. That's diagonalization at work: the λ = 1 part stays, and the λ = 0.7 part fades.

The operator now knows to keep about two-thirds of the bike docks Downtown. Markov chains model customer loyalty, weather, genetics, and text prediction; PageRank is a Markov chain of a random web surfer.

Step 7 of 11Explore

Two-state Markov chain approaching steady state

Each day a fraction a of Downtown bikes moves to Campus and a fraction b of Campus bikes moves Downtown. The curve shows the Downtown share after x days, starting from p₀. It approaches the steady state b/(a + b) at a rate set by the second eigenvalue, 1 − a − b.

00.20.40.60.81 0102030
Steady-state Downtown share b/(a + b)
0.6667
Second eigenvalue 1 − a − b
0.7
Downtown share after 10 days
0.6761

Step 8 of 11Practice · Work it out

A Markov matrix is M = [0.7 0.4; 0.3 0.6]. What fraction of the population is in state 1 at steady state? Give a decimal to three places.

Step 9 of 11Chart

Bike share at Downtown, day by day

Both starts close in on 2/3, the steady state for the 90% / 80% bike-share matrix. The gap shrinks by the second eigenvalue, 0.7, each day.

Bike share at Downtown, day by dayLine chart with 9 categories: 0: Start: all at Downtown 1, Start: all at Campus 0; 1: Start: all at Downtown 0.9, Start: all at Campus 0.2; 2: Start: all at Downtown 0.83, Start: all at Campus 0.34; 3: Start: all at Downtown 0.781, Start: all at Campus 0.438; 4: Start: all at Downtown 0.747, Start: all at Campus 0.507; 5: Start: all at Downtown 0.723, Start: all at Campus 0.555; 6: Start: all at Downtown 0.706, Start: all at Campus 0.588; 7: Start: all at Downtown 0.694, Start: all at Campus 0.612; 8: Start: all at Downtown 0.686, Start: all at Campus 0.628.00.20.40.60.81Downtown share012345678Day
Bike share at Downtown, day by day
DayStart: all at DowntownStart: all at Campus
010
10.90.2
20.830.34
30.7810.438
40.7470.507
50.7230.555
60.7060.588
70.6940.612
80.6860.628

Step 10 of 11Note

Step 11 of 11Practice · True or false

Every Markov matrix (columns of nonnegative entries summing to 1) has 1 as an eigenvalue.