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.
Welcome back!
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
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.
- 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.
| Day | Start: all at Downtown | Start: all at Campus |
|---|---|---|
| 0 | 1 | 0 |
| 1 | 0.9 | 0.2 |
| 2 | 0.83 | 0.34 |
| 3 | 0.781 | 0.438 |
| 4 | 0.747 | 0.507 |
| 5 | 0.723 | 0.555 |
| 6 | 0.706 | 0.588 |
| 7 | 0.694 | 0.612 |
| 8 | 0.686 | 0.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.
Lesson complete!