Diagonalization#
Week 9 produced eigenvalues and eigenvectors from . This week assembles those pieces into a factorization of itself.
Suppose is and has linearly independent eigenvectors with eigenvalues . Form the matrix whose columns are those eigenvectors, and the diagonal matrix of the matching eigenvalues:
The eigen-equations stack column by column into a single matrix identity:
Because the columns of are independent, is invertible. Multiply on the right by :
This is the diagonalization (or eigen-decomposition) of . In the eigenbasis, acts as pure scaling: stretches each coordinate axis by its own , and / change coordinates into and out of that basis.
Worked example. Continue with
from Week 9. Eigenvalues were , with eigenvectors and . So
Then , so is invertible. You can check by multiplying both sides, or reconstruct with
When diagonalization fails. Not every matrix has independent eigenvectors. Week 9's defective example
has a repeated eigenvalue of algebraic multiplicity , but only a one-dimensional eigenspace. You cannot form an invertible of eigenvectors, so is not diagonalizable. The precise criterion:
Distinct eigenvalues always give independent eigenvectors (Strang §6.2), so a matrix with different eigenvalues is always diagonalizable. A repeated eigenvalue is the dangerous case: you must check whether the eigenspace is large enough.
Complex eigenvalues. A real matrix can have complex conjugate eigenvalues (and complex eigenvectors). The same algebra still holds over . Real normal forms (block-diagonal with rotation-scaling blocks) exist but are not needed for the Markov applications below.
Powers of a Matrix#
Once , powers of collapse to powers of a diagonal matrix. Compute
By induction,
for every positive integer . And is trivial:
You raise numbers to the -th power — no matrix multiplications of growing size.
Cost contrast. Computing by repeated multiplication (, then , then , …) costs multiplications of matrices, each in naive arithmetic — total . Diagonalization pays a one-time eigen-decomposition cost, after which each power is for the diagonal entries plus for the two multiplications by and . When many powers are needed, or is huge, the eigen route wins.
Negative powers. If is invertible (equivalently, no ), then with , and .
Determinant of a power. Because , we get
That identity is a quick check without forming at all.
Worked power. For the same with , ,
In particular , matching .
A = [[4,1],[2,3]] has eigenvalues 5 and 2. Using det(A^3) = product of the eigenvalues cubed, what is det(A^3)?
Markov Matrices#
A Markov matrix (also called a stochastic matrix or transition matrix) encodes one step of a discrete-time chain on states. The standard linear-algebra convention here is:
- every entry of is nonnegative: ;
- every column sums to : for each .
Entry is the probability of moving from state to state in one step, so column is a probability distribution over the next state given that you start in . A state vector is a column vector of nonnegative entries that sum to ; after one transition the new distribution is .
Why is always an eigenvalue. The column-sum condition is equivalent to
where is the all-ones vector. Taking the transpose, , so has eigenvalue with eigenvector . Eigenvalues of and coincide (transposition leaves the characteristic polynomial unchanged), so also has eigenvalue .
No eigenvalue of a Markov matrix can exceed in magnitude. The max-component argument needs a matrix whose rows sum to , so apply it to (which is row-stochastic, since the columns of sum to ). Write , and for an eigenvalue of with eigenvector , let index the component of largest in absolute value:
because every and row of sums to . Hence for every eigenvalue of , and transposition leaves the characteristic polynomial unchanged, so the same bound holds for . (The 1-norm gives the same result directly: for every , so .) The strict version — that is simple and every other eigenvalue satisfies — needs the chain to be irreducible and aperiodic (“you can eventually reach any state from any other, and periods do not trap you”); it is the Perron–Frobenius theorem (Strang §8.3).
Example.
has nonnegative entries; column sums are and . This is a two-state Markov matrix: state 1 tends to stay put (probability ), and state 2 returns to state 1 with probability .
Steady State#
A steady-state (or stationary) distribution is a probability vector that does not change under the transition:
That is exactly the eigenvector equation for . So find any eigenvector for , then normalize so the components sum to (and are nonnegative — which they will be for a Markov matrix under the conditions above).
Convergence from any start. Suppose is diagonalizable with eigenvalues , and for . Write the initial distribution in the eigenbasis:
with the steady-state eigenvector (or any multiple, before normalization). Then
As , every term with dies: . The limit is , and because each is a probability vector (nonnegative entries summing to ), the limit is the unique steady-state distribution. Diagonalization explains the long-run behavior: repeated multiplication by is dominated by the eigenvalue of largest magnitude, which for a Markov matrix is .
You could iterate 50 times (as the browser lab below does), but diagonalization gives you in closed form — the same reason beats repeated multiplication, now applied to the evolution of the distribution itself.
Worked steady state. For
solve :
The two rows are multiples; the single equation is , so . With ,
Thus . The browser lab below runs 50 steps from and compares the result to this normalized eigenvector.
Link forward. The same eigen-decoupling that turns into reappears in Week 11 for systems of differential equations : solutions are linear combinations of . Diagonalization is the bridge between discrete powers and continuous exponentials.
Knowledge check#
A^k can be computed efficiently as:
Browser lab: Markov chain steady state#
Simulate a Markov chain converging to its steady state, and compare to the eigenvector for .
import numpy as np
A = np.array([[0.9, 0.2],
[0.1, 0.8]])
x0 = np.array([1.0, 0.0])
x = x0.copy()
for _ in range(50):
x = A @ x
eigvals, eigvecs = np.linalg.eig(A)
steady_idx = np.argmin(np.abs(eigvals - 1))
steady_state = eigvecs[:, steady_idx]
steady_state = steady_state / steady_state.sum()
print("x after 50 steps =", x)
print("eigenvector steady state (normalized) =", steady_state.real)
print("Notice: x after 50 steps ≈ [0.667, 0.333] — it has converged to the normalized λ = 1 eigenvector.")
Done when#
You can diagonalize a matrix as , use it to compute , and find a Markov chain's steady state as the eigenvector normalized to sum to 1. Check it against the browser lab: for the x after 50 steps and the normalized eigenvector both converge to [0.667, 0.333] (i.e. and ).
Further Reading#
- Strang, §6.2: Diagonalizing a Matrix — the classic exposition of eigen-decomposition and its use for powers.
- Brin & Page (1998): The Anatomy of a Large-Scale Hypertextual Web Search Engine — the original PageRank paper, which applies Markov chain theory to rank web pages.
- Lay, §5.3: Diagonalization — detailed worked examples with defectiveness checks.
- For the full MDP connection (Markov chains plus decisions and rewards), see Week 3: Markov Decision Processes.