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, 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. Column is therefore 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, so also has eigenvalue . We state without full spectral proof that for a nonnegative matrix with column sums , every eigenvalue satisfies , and is always present. Under mild extra conditions (the chain is irreducible and aperiodic — “you can eventually reach any state from any other, and periods do not trap you”), is simple and every other eigenvalue obeys .
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 .
Worked steady state. For
solve :
The two rows are multiples; the single equation is , so . With ,
Thus . Starting from any initial probability vector and iterating drives the state toward this same pair. The browser lab below runs 50 steps and compares the result to the normalized eigenvector for .
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#
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)