Type at least 2 letters. Enter opens the first result, Esc closes.

    Linear Algebra · Lesson 5 · Eigenvalues and the spectral theorem

    Eigenvalues, eigenvectors, power iteration, diagonalization and Jordan form

    Intermediate 80 min 4 interactive figures 5 videos Colab notebook

    Before this lesson: lesson 03 (determinants, singular matrices) and lesson 04 (similarity B=M−1AMB = M^{-1}AM). Time: about 80 minutes, plus the notebook.


    Why this matters #

    Most vectors change direction when you apply a matrix. An eigenvector does not: AA only scales it. In a basis of eigenvectors the map becomes nn independent scalings, and AkA^k scales each eigen-direction by λk\lambda^k. So eigenvalues decide the long-run behaviour of every linear dynamical system: a Markov chain (PageRank), gradient descent on a quadratic, a linear RNN, a time-stepper for a PDE, a climate model linearized near an equilibrium. Power iteration, the simplest eigenvalue algorithm, still estimates Hessian sharpness and the spectral norm in spectral normalization. Matrices without enough eigenvectors (defective ones) explain the teλtt e^{\lambda t} terms of critically damped systems.

    1. Predict first #

    2. The picture #

    Start with D=diag⁡(3,0.5)D = \operatorname{diag}(3, 0.5). It stretches e1e_1 by 3 and shrinks e2e_2 by half. These two axes keep their direction. Every other vector turns toward e1e_1, because its e1e_1 part grows faster.

    Hunting for eigenvectors. Take a unit vector xx and split AxAx into a part along xx and a sideways part. xx is an eigenvector exactly when the sideways part is zero; then Ax=λxAx = \lambda x, and the part along xx is λ=x⋅Ax\lambda = x \cdot Ax.

    Interactive figure: loading…

    Drag xx around the circle. The violet arrow is AxAx; the dashed magenta piece is its sideways part, and the chart below plots that part for every direction of xx. Its zeros are the eigenvector directions: for the default matrix there are two, with λ=2\lambda = 2 and λ=−1\lambda = -1 (there AxAx points backwards). Then try the rotation (the curve never crosses 0) and the shear (it only touches 0 once).

    Now take A=(1423)A = \begin{pmatrix} 1 & 4 \\ 2 & 3 \end{pmatrix}. Two lines are kept: v1=(1,1)↦(5,5)=5v1v_1 = (1, 1) \mapsto (5, 5) = 5v_1 and v2=(2,−1)↦(−2,1)=−v2v_2 = (2, -1) \mapsto (-2, 1) = -v_2. In the basis (v1,v2)(v_1, v_2), AA acts like diag⁡(5,−1)\operatorname{diag}(5, -1). For any x=c1v1+c2v2x = c_1 v_1 + c_2 v_2,

    Akx=c15kv1+c2(−1)kv2,A^k x = c_1 5^k v_1 + c_2 (-1)^k v_2 ,

    so the v1v_1 part wins and AkxA^k x soon points almost along v1v_1. This is power iteration.

    Two things can go wrong. The 90°90° rotation (0−110)\begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix} keeps no real line: it turns every vector by 90°90°. The shear keeps too few lines (only the horizontal axis): it is defective, and no basis of eigenvectors exists.

    Quick check

    R=(0−110)R = \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix} rotates the plane by 90°90°. How many real eigenvector lines does it have?

    3. Definitions and main results #

    Eigenpairs and the characteristic polynomial #

    For a square n×nn \times n matrix AA, a number λ\lambda and a vector v≠0v \ne 0 with Av=λvAv = \lambda v are an eigenvalue and an eigenvector; together they are an eigenpair. The eigenspace Eλ=N(A−λI)E_\lambda = N(A - \lambda I) holds all eigenvectors for λ\lambda, plus 00.

    From Av=λvAv = \lambda v to a polynomial, step by step.

    1. Write λv=λIv\lambda v = \lambda I v. Then Av=λvAv = \lambda v is the same as (A−λI)v=0(A - \lambda I)v = 0.
    2. So an eigenvector is a nonzero vector in the null space of A−λIA - \lambda I.
    3. A square matrix has a nonzero null vector exactly when it is singular, and a matrix is singular exactly when its determinant is 0 (lesson 03).
    4. So λ\lambda is an eigenvalue   ⟺  \iff det⁡(A−λI)=0\det(A - \lambda I) = 0.

    The characteristic polynomial p(λ)=det⁡(A−λI)p(\lambda) = \det(A - \lambda I) has degree nn, so over C\mathbb{C} it has exactly nn roots, counted with multiplicity. First find the roots, then find each eigenvector by solving (A−λI)v=0(A - \lambda I)v = 0.

    2×22 \times 2 case. With τ=tr⁡A\tau = \operatorname{tr} A (sum of the diagonal) and δ=det⁡A\delta = \det A:

    det⁡(a−λbcd−λ)=(a−λ)(d−λ)−bc=λ2−τλ+δ,λ=τ±τ2−4δ2.\begin{aligned} \det\begin{pmatrix} a - \lambda & b \\ c & d - \lambda \end{pmatrix} &= (a - \lambda)(d - \lambda) - bc = \lambda^2 - \tau\lambda + \delta, \\ \lambda &= \frac{\tau \pm \sqrt{\tau^2 - 4\delta}}{2}. \end{aligned}

    In every size, ∑iλi=tr⁡A\sum_i \lambda_i = \operatorname{tr} A and ∏iλi=det⁡A\prod_i \lambda_i = \det A (complex eigenvalues and repeats included).

    Interactive figure: loading…

    Slide the entry a21a_{21} and watch the roots. The violet curve is p(λ)=λ2−τλ+δp(\lambda) = \lambda^2 - \tau\lambda + \delta; its crossings with the λ\lambda-axis are the eigenvalues (orange and blue dots). The lower panel shows the same two roots in the complex plane. Move a21a_{21} from 2 down to −2-2: the crossings move together, meet at the lowest point (τ2=4δ\tau^2 = 4\delta), and then leave the real line as a complex pair a±bia \pm bi. Try rotation 90° and rotate and scale.

    Quick check

    A=(4−211)A = \begin{pmatrix} 4 & -2 \\ 1 & 1 \end{pmatrix}. Use the trace and the determinant: what are its eigenvalues?

    Complex eigenvalues of a real matrix #

    The rotation R=(0−110)R = \begin{pmatrix} 0 & -1 \\ 1 & 0 \end{pmatrix} has τ=0\tau = 0 and δ=1\delta = 1, so p(λ)=λ2+1p(\lambda) = \lambda^2 + 1. The parabola never touches the axis, and the roots are ±i\pm i. With complex vectors there are eigenvectors: R(1,−i)=(i,1)=i (1,−i)R(1, -i) = (i, 1) = i\,(1, -i). But no real vector is an eigenvector.

    What a complex pair means. Let AA be a real 2×22 \times 2 matrix with τ2<4δ\tau^2 < 4\delta.

    1. The polynomial has real coefficients, so the roots are a conjugate pair λ=a±bi\lambda = a \pm bi with b≠0b \ne 0: a=τ/2a = \tau/2 and b=δ−τ2/4b = \sqrt{\delta - \tau^2/4}.
    2. Write λ=r(cos⁡θ+isin⁡θ)\lambda = r(\cos\theta + i\sin\theta) with r=∣λ∣=a2+b2=δr = |\lambda| = \sqrt{a^2 + b^2} = \sqrt{\delta} and the angle θ\theta.
    3. There is a real basis in which AA has the matrix (a−bba)=r(cos⁡θ−sin⁡θsin⁡θcos⁡θ)\begin{pmatrix} a & -b \\ b & a \end{pmatrix} = r\begin{pmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{pmatrix}: a rotation by θ\theta and a scaling by rr (proof in the box below).
    4. So, in the coordinates of that basis, each application of AA turns every vector by θ\theta and multiplies its length by rr. No real line is kept.

    Example. A=(1−111)A = \begin{pmatrix} 1 & -1 \\ 1 & 1 \end{pmatrix} has τ=2\tau = 2, δ=2\delta = 2 and λ=1±i\lambda = 1 \pm i. Here r=2r = \sqrt2 and θ=45°\theta = 45°, and indeed A=2 R45°A = \sqrt2\, R_{45°} already in the standard basis. Then A2=(0−220)A^2 = \begin{pmatrix} 0 & -2 \\ 2 & 0 \end{pmatrix} (rotate by 90°90°, scale by 2) and A8=16IA^8 = 16I (rotate by 360°360°, scale by (2)8=16(\sqrt2)^8 = 16). In a linear dynamical system xk+1=Axkx_{k+1} = Ax_k, a complex pair gives a spiral: inward if r<1r < 1, outward if r>1r > 1.

    The real form of a complex pair

    Let v=u+iwv = u + iw (with u,wu, w real) be an eigenvector for λ=a+bi\lambda = a + bi, b≠0b \ne 0. Then A(u+iw)=(a+bi)(u+iw)A(u + iw) = (a + bi)(u + iw), and the right side is (au−bw)+i(bu+aw)(au - bw) + i(bu + aw). AA is real, so the real and imaginary parts must match: Au=au−bwAu = au - bw and Aw=bu+awAw = bu + aw. In the basis (w,u)(w, u) the first column of the matrix holds the coordinates of AwAw, which are (a,b)(a, b), and the second column holds the coordinates of AuAu, which are (−b,a)(-b, a). So AA has the matrix (a−bba)\begin{pmatrix} a & -b \\ b & a \end{pmatrix} in this basis. It remains to check that ww and uu are independent, so that they form a basis. If they were dependent, both would be multiples of one real vector z≠0z \ne 0, so v=αzv = \alpha z for a complex α≠0\alpha \ne 0. Then Az=λzAz = \lambda z. But AzAz is real and λz\lambda z is not (because b≠0b \ne 0): a contradiction.

    Similarity keeps eigenvalues: det⁡(M−1AM−λI)=det⁡(M−1(A−λI)M)\det(M^{-1}AM - \lambda I) = \det\big(M^{-1}(A - \lambda I)M\big), which is det⁡(A−λI)\det(A - \lambda I), and an eigenvector vv of AA becomes M−1vM^{-1}v (lesson 04). Row operations are not a similarity, so elimination changes eigenvalues.

    Diagonalization #

    Theorem. A=XΛX−1A = X\Lambda X^{-1} with Λ\Lambda diagonal   ⟺  \iff AA has nn independent eigenvectors. The columns of XX are the eigenvectors; Λ\Lambda holds their eigenvalues in the same order.

    Proof.

    1. AX=XΛAX = X\Lambda, read column by column, says Axi=λixiAx_i = \lambda_i x_i.
    2. XX is invertible   ⟺  \iff its columns are independent. Then AX=XΛAX = X\Lambda is the same as A=XΛX−1A = X\Lambda X^{-1}. ■\blacksquare

    Diagonalization is a change of basis. Compare with lesson 04: A=MBM−1A = MBM^{-1} with M=XM = X and B=ΛB = \Lambda. So Λ=X−1AX\Lambda = X^{-1}AX is the matrix of the same map in the basis of eigenvectors. In that basis the map only stretches each coordinate.

    Powers, step by step.

    1. A2=(XΛX−1)(XΛX−1)A^2 = (X\Lambda X^{-1})(X\Lambda X^{-1}), which is XΛ(X−1X)ΛX−1X\Lambda (X^{-1}X) \Lambda X^{-1}. The middle X−1XX^{-1}X is II, so A2=XΛ2X−1A^2 = X\Lambda^2X^{-1}.
    2. Repeat: Ak=XΛkX−1A^k = X\Lambda^kX^{-1}, and Λk=diag⁡(λ1k,…,λnk)\Lambda^k = \operatorname{diag}(\lambda_1^k, \dots, \lambda_n^k).
    3. In words: go to eigen-coordinates (X−1X^{-1}), stretch coordinate ii by λi\lambda_i, kk times (Λk\Lambda^k), and go back (XX).

    Example. A=(4−211)A = \begin{pmatrix} 4 & -2 \\ 1 & 1 \end{pmatrix} (the map of lesson 04) has eigenvalues 3 and 2 (quiz above).

    • A−3I=(1−21−2)A - 3I = \begin{pmatrix} 1 & -2 \\ 1 & -2 \end{pmatrix}, so v1=(2,1)v_1 = (2, 1). A−2I=(2−21−1)A - 2I = \begin{pmatrix} 2 & -2 \\ 1 & -1 \end{pmatrix}, so v2=(1,1)v_2 = (1, 1).
    • X=(2111)X = \begin{pmatrix} 2 & 1 \\ 1 & 1 \end{pmatrix}, det⁡X=1\det X = 1, X−1=(1−1−12)X^{-1} = \begin{pmatrix} 1 & -1 \\ -1 & 2 \end{pmatrix}, Λk=diag⁡(3k,2k)\Lambda^k = \operatorname{diag}(3^k, 2^k).
    • XΛk=(2⋅3k2k3k2k)X\Lambda^k = \begin{pmatrix} 2 \cdot 3^k & 2^k \\ 3^k & 2^k \end{pmatrix} (column ii times λik\lambda_i^k).
    • Multiply by X−1X^{-1}:
    Ak=(2⋅3k−2k−2⋅3k+2⋅2k3k−2k−3k+2⋅2k).A^k = \begin{pmatrix} 2 \cdot 3^k - 2^k & -2 \cdot 3^k + 2 \cdot 2^k \\ 3^k - 2^k & -3^k + 2 \cdot 2^k \end{pmatrix}.

    Check with k=1k = 1: (6−2−6+43−2−3+4)=A\begin{pmatrix} 6 - 2 & -6 + 4 \\ 3 - 2 & -3 + 4 \end{pmatrix} = A ✓. For k=3k = 3: A3=(46−3819−11)A^3 = \begin{pmatrix} 46 & -38 \\ 19 & -11 \end{pmatrix}. For large kk the 3k3^k terms win: Ak≈3k(2−21−1)A^k \approx 3^k \begin{pmatrix} 2 & -2 \\ 1 & -1 \end{pmatrix}, and every column points along v1=(2,1)v_1 = (2, 1). That is power iteration again.

    Consequences: Ak=XΛkX−1A^k = X\Lambda^k X^{-1}, A−1=XΛ−1X−1A^{-1} = X\Lambda^{-1}X^{-1} when no λi=0\lambda_i = 0, and x′=Axx' = Ax is solved by x(t)=XeΛtX−1x(0)x(t) = X e^{\Lambda t} X^{-1} x(0).

    Theorem. Eigenvectors for distinct eigenvalues are independent. So nn distinct eigenvalues imply diagonalizable.

    Proof.

    1. Suppose not. Take a dependence ∑i∈Icivi=0\sum_{i \in I} c_i v_i = 0 with all ci≠0c_i \ne 0 and the fewest terms. It has at least two terms, because each vi≠0v_i \ne 0.
    2. Pick j∈Ij \in I and apply A−λjIA - \lambda_j I: ∑i∈Ici(λi−λj)vi=0\sum_{i \in I} c_i(\lambda_i - \lambda_j)v_i = 0.
    3. The jj term is gone and the other coefficients stay nonzero: a shorter dependence. Contradiction. ■\blacksquare

    Power iteration #

    Repeat xk+1=Axk/∥Axk∥x_{k+1} = Ax_k / \|Ax_k\|, and estimate the eigenvalue with the Rayleigh quotient xk⊤Axkx_k^\top A x_k (here ∥xk∥=1\|x_k\| = 1).

    Theorem. Let AA be diagonalizable with eigenpairs (λi,vi)(\lambda_i, v_i), ∣λ1∣>∣λ2∣≥⋯≥∣λn∣|\lambda_1| > |\lambda_2| \ge \dots \ge |\lambda_n|, and x0=∑icivix_0 = \sum_i c_i v_i with c1≠0c_1 \ne 0. Then the line of xkx_k converges to the line of v1v_1, with error of order ∣λ2/λ1∣k|\lambda_2/\lambda_1|^k.

    Proof.

    1. Normalizing only rescales, so xkx_k is a multiple of Akx0A^k x_0.
    2. Akx0=∑iciλikviA^k x_0 = \sum_i c_i \lambda_i^k v_i. Take out the factor c1λ1kc_1 \lambda_1^k:
    Akx0=c1λ1k(v1+∑i≥2cic1(λiλ1)kvi).A^k x_0 = c_1 \lambda_1^k \Big( v_1 + \sum_{i \ge 2} \tfrac{c_i}{c_1} \big(\tfrac{\lambda_i}{\lambda_1}\big)^k v_i \Big).
    1. Every ∣λi/λ1∣≤∣λ2/λ1∣<1|\lambda_i / \lambda_1| \le |\lambda_2/\lambda_1| < 1, so the sum has norm at most C ∣λ2/λ1∣kC\,|\lambda_2/\lambda_1|^k, with C=∑i≥2∣ci/c1∣ ∥vi∥C = \sum_{i\ge2} |c_i/c_1|\,\|v_i\|.
    2. The scalar c1λ1kc_1\lambda_1^k changes only length and sign (the sign alternates when λ1<0\lambda_1 < 0), so the line of xkx_k tends to the line of v1v_1. ■\blacksquare
    Interactive figure: loading…

    Press Step and watch the dots line up. AA has the eigenvectors v1=(1,1)v_1 = (1, 1) and v2=(2,−1)v_2 = (2, -1) of the example in section 2, with eigenvalues you set. The chart shows the sine of the angle between xkx_k and the dominant eigenvector on a log scale: close to a straight line, because each step multiplies it by about ∣λ2/λ1∣|\lambda_2/\lambda_1| (the dashed reference line). Try 1 and 0.9: about 0.05 digits per step. Try the tie 1,−11, -1: no convergence. Make the dominant λ\lambda negative: xkx_k flips sign every step, but its line converges.

    In practice:

    • Linear convergence. Each step gains about log⁡10∣λ1/λ2∣\log_{10}|\lambda_1/\lambda_2| digits and costs one product x↦Axx \mapsto Ax, so it works for huge sparse matrices and for Hessian-vector products.
    • Eigenvalue estimate. For symmetric AA the Rayleigh-quotient error is O(∣λ2/λ1∣2k)O(|\lambda_2/\lambda_1|^{2k}) (lesson 06 shows why); for non-symmetric AA only O(∣λ2/λ1∣k)O(|\lambda_2/\lambda_1|^k).
    • Failure. ∣λ1∣=∣λ2∣|\lambda_1| = |\lambda_2| with λ1≠λ2\lambda_1 \ne \lambda_2 (eigenvalues 11 and −1-1, or a complex-conjugate pair): no convergence. Ratio near 1: very slow. c1=0c_1 = 0: in exact arithmetic v1v_1 never appears; in floating point, rounding usually adds a little of it.
    • Stopping. Use the residual ∥Axk−λxk∥\|Ax_k - \lambda x_k\|; the test ∥xk−xk−1∥\|x_k - x_{k-1}\| fails when λ1<0\lambda_1 < 0. Shifts and inverse iteration change the ratio (lesson 14, eigenvalue algorithms).
    Quick check

    A diagonalizable matrix has eigenvalues 44, −2-2 and 11. By what factor does the power-iteration error shrink in each step (for a typical start vector)?

    Algebraic and geometric multiplicity #

    The algebraic multiplicity a(λ)a(\lambda) is the multiplicity of λ\lambda as a root of pp. The geometric multiplicity g(λ)=dim⁡N(A−λI)=n−rank⁡(A−λI)g(\lambda) = \dim N(A - \lambda I) = n - \operatorname{rank}(A - \lambda I) is the number of independent eigenvectors for λ\lambda.

    Theorem. 1≤g(λ)≤a(λ)1 \le g(\lambda) \le a(\lambda), and AA is diagonalizable (over C\mathbb{C})   ⟺  \iff g(λ)=a(λ)g(\lambda) = a(\lambda) for every eigenvalue. If g(λ)<a(λ)g(\lambda) < a(\lambda) for some λ\lambda, AA is defective.

    In words: a root that appears twice in pp may give two independent eigenvectors (like II) or only one (like the shear). Diagonalization needs the full number for every eigenvalue.

    Proof of the multiplicity theorem
    1. Let g=g(λ0)g = g(\lambda_0). Extend a basis v1,…,vgv_1, \dots, v_g of N(A−λ0I)N(A - \lambda_0 I) to a basis of Cn\mathbb{C}^n, the columns of MM.
    2. The first gg columns of AMAM are λ0vi\lambda_0 v_i, so M−1AM=(λ0IgB0C)M^{-1}AM = \begin{pmatrix} \lambda_0 I_g & B \\ 0 & C \end{pmatrix}, with characteristic polynomial (λ0−λ)gdet⁡(C−λI)(\lambda_0 - \lambda)^g \det(C - \lambda I). Similarity keeps pp, so a(λ0)≥ga(\lambda_0) \ge g.
    3. Bases of different eigenspaces together stay independent (apply the previous theorem to the parts of a dependence that lie in each eigenspace). So there are ∑λg(λ)\sum_\lambda g(\lambda) independent eigenvectors, and no more: every eigenvector lies in one eigenspace, so all eigenvectors span a space of dimension ∑λg(λ)\sum_\lambda g(\lambda). Also ∑λa(λ)=n\sum_\lambda a(\lambda) = n. With each g≤ag \le a, the count reaches nn exactly when g=ag = a for every λ\lambda. ■\blacksquare

    Defective example. (2102)\begin{pmatrix} 2 & 1 \\ 0 & 2 \end{pmatrix}: p=(λ−2)2p = (\lambda - 2)^2, so a(2)=2a(2) = 2, but A−2I=(0100)A - 2I = \begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix} has rank 1, so g(2)=1g(2) = 1. A repeated eigenvalue alone is not defective: II has a(1)=g(1)=na(1) = g(1) = n.

    Quick check

    A 3×33 \times 3 matrix has eigenvalues 1,2,21, 2, 2 and rank⁡(A−2I)=2\operatorname{rank}(A - 2I) = 2. Is it diagonalizable?

    Jordan form #

    A defective matrix cannot be made diagonal. The best it can do is the Jordan form: diagonal blocks with ones just above the diagonal. A Jordan block is Jm(λ)=λIm+NJ_m(\lambda) = \lambda I_m + N, where NN has ones on the superdiagonal:

    J2(λ)=(λ10λ),J3(λ)=(λ100λ100λ).J_2(\lambda) = \begin{pmatrix} \lambda & 1 \\ 0 & \lambda \end{pmatrix}, \qquad J_3(\lambda) = \begin{pmatrix} \lambda & 1 & 0 \\ 0 & \lambda & 1 \\ 0 & 0 & \lambda \end{pmatrix}.

    NN is nilpotent: Ne1=0Ne_1 = 0, Nej=ej−1Ne_j = e_{j-1}, Nm=0N^m = 0. So the block has a=ma = m and g=1g = 1 (J−λI=NJ - \lambda I = N has rank m−1m - 1). Its basis is a chain: e1e_1 is an eigenvector, and (J−λI)ej=ej−1(J - \lambda I)e_j = e_{j-1} makes e2,…,eme_2, \dots, e_m generalized eigenvectors. The shear is J2(1)J_2(1): e1e_1 is its only eigenvector line, and e2e_2 completes the chain.

    Powers and exponentials. For a 2×22\times 2 block, N2=0N^2 = 0 and NN commutes with λI\lambda I, so the binomial formula has two terms:

    Jk=λkI+kλk−1N=(λkkλk−10λk),eJt=eλt(I+tN)=eλt(1t01).J^k = \lambda^k I + k\lambda^{k-1}N = \begin{pmatrix} \lambda^k & k\lambda^{k-1} \\ 0 & \lambda^k \end{pmatrix}, \qquad e^{Jt} = e^{\lambda t}(I + tN) = e^{\lambda t}\begin{pmatrix} 1 & t \\ 0 & 1 \end{pmatrix}.

    The extra kk (or tt) comes from the nilpotent part: it is the teλtt e^{\lambda t} of ODEs with a repeated root. Even with ∣λ∣<1|\lambda| < 1, the entry kλk−1k\lambda^{k-1} can grow before it decays.

    The Jordan normal form theorem

    Theorem (Jordan normal form). Every A∈Cn×nA \in \mathbb{C}^{n\times n} can be written A=XJX−1A = XJX^{-1} with J=diag⁡(Jm1(μ1),…,Jms(μs))J = \operatorname{diag}\big(J_{m_1}(\mu_1), \dots, J_{m_s}(\mu_s)\big), unique up to the order of the blocks. For each eigenvalue λ\lambda, the number of its blocks is g(λ)g(\lambda) and their total size is a(λ)a(\lambda). The columns of XX are chains: (A−λI)v=0(A - \lambda I)v = 0, (A−λI)w1=v(A - \lambda I)w_1 = v, (A−λI)w2=w1(A - \lambda I)w_2 = w_1, … . AA is diagonalizable   ⟺  \iff every block is 1×11\times1.

    Why JJ is the closest to diagonal.

    1. Similarity keeps every number dj(λ)=dim⁡N((A−λI)j)d_j(\lambda) = \dim N\big((A - \lambda I)^j\big), because M−1(A−λI)jM=(M−1AM−λI)jM^{-1}(A - \lambda I)^j M = (M^{-1}AM - \lambda I)^j.
    2. In JJ, dj−dj−1d_j - d_{j-1} = number of blocks for λ\lambda of size ≥j\ge j. So the block sizes are fixed by AA.
    3. If a block has size ≥2\ge 2, then d1=g(λ)<a(λ)d_1 = g(\lambda) < a(\lambda), and no similar matrix is diagonal: the off-diagonal entries cannot be removed.
    4. They can be made small, not zero: with D=diag⁡(1,ε,ε2,… )D = \operatorname{diag}(1, \varepsilon, \varepsilon^2, \dots), D−1Jm(λ)DD^{-1}J_m(\lambda)D has ε\varepsilon on the superdiagonal. Only the pattern of nonzeros is fixed.

    So two matrices are similar exactly when they have the same Jordan form. This answers the question of lesson 04: the shear J2(1)J_2(1) and I=J1(1)⊕J1(1)I = J_1(1) \oplus J_1(1) have the same eigenvalues but different blocks.

    Numerics. The Jordan form is not continuous in AA. (21ε2)\begin{pmatrix} 2 & 1 \\ \varepsilon & 2 \end{pmatrix} has eigenvalues 2±ε2 \pm \sqrt{\varepsilon}: diagonalizable for every ε>0\varepsilon > 0, one Jordan block at ε=0\varepsilon = 0. A change of size ε\varepsilon moves the eigenvalues by ε\sqrt{\varepsilon}, and the eigenvector matrix has κ(X)≈1/ε\kappa(X) \approx 1/\sqrt{\varepsilon}. Libraries use the Schur form A=QTQ∗A = QTQ^* (QQ unitary, TT upper triangular) instead: it always exists and is computed stably.

    Interactive figure: loading…

    Slide ε\varepsilon toward 0. The two eigenvector lines of A(ε)A(\varepsilon) close up like scissors, and at ε=0\varepsilon = 0 only one is left: the Jordan block. The right panel shows the eigenvalues 2±ε2 \pm \sqrt{\varepsilon}: they meet at 2 and, for ε<0\varepsilon < 0, turn into a complex pair. Press ε=10−6\varepsilon = 10^{-6}: the matrix barely changed, yet the eigenvalues moved by 10−310^{-3} and κ(X)=1000\kappa(X) = 1000.

    "Near-defective" means that the eigenvector matrix XX is ill-conditioned (nearly parallel eigenvectors), not that AA is: (21ε2)\begin{pmatrix} 2 & 1 \\ \varepsilon & 2 \end{pmatrix} has κ(A)≈1.64\kappa(A) \approx 1.64 but κ(X)≈1/ε\kappa(X) \approx 1/\sqrt{\varepsilon}.

    Where are the eigenvalues? Gershgorin discs

    Theorem (Gershgorin). Let AA be n×nn \times n (real or complex), and let Ri=∑j≠i∣aij∣R_i = \sum_{j \ne i} |a_{ij}| be the sum of the absolute values of row ii without the diagonal entry. Every eigenvalue of AA lies in at least one disc Di={z∈C:∣z−aii∣≤Ri}D_i = \{z \in \mathbb{C} : |z - a_{ii}| \le R_i\}.

    Proof. Let Av=λvAv = \lambda v, v≠0v \ne 0, and pick ii with the largest ∣vi∣|v_i|. Row ii of Av=λvAv = \lambda v gives (λ−aii)vi=∑j≠iaijvj(\lambda - a_{ii})v_i = \sum_{j \ne i} a_{ij}v_j. Divide by viv_i and use ∣vj/vi∣≤1|v_j / v_i| \le 1: ∣λ−aii∣≤∑j≠i∣aij∣=Ri|\lambda - a_{ii}| \le \sum_{j \ne i} |a_{ij}| = R_i. ■\blacksquare

    A stronger form (by continuity in the off-diagonal entries): if kk discs form a connected group that does not touch the other discs, the group contains exactly kk eigenvalues.

    Example. G=(510.50.510.501−3)G = \begin{pmatrix} 5 & 1 & 0.5 \\ 0.5 & 1 & 0.5 \\ 0 & 1 & -3 \end{pmatrix} has the discs D(5,1.5)D(5, 1.5), D(1,1)D(1, 1) and D(−3,1)D(-3, 1). They do not touch, so each holds exactly one eigenvalue. Complex eigenvalues of a real matrix come in conjugate pairs, and each disc is symmetric about the real axis, so the single eigenvalue in each disc is real. NumPy gives 5.1305.130, 0.9850.985 and −3.116-3.116.

    D(5, 1.5) D(1, 1) D(−3, 1) −4 −2 0 2 4 6 Re

    The three discs of GG (coloured) with their centres aiia_{ii} on the real axis, and the three eigenvalues (black dots). One use: if every disc misses 0, then 0 is not an eigenvalue and AA is invertible. This is the case for a strictly diagonally dominant matrix (∣aii∣>Ri|a_{ii}| > R_i for every row). For a graph Laplacian L=D−WL = D - W, disc ii has centre and radius equal to the degree did_i, so every eigenvalue lies in [0,2dmax⁡][0, 2d_{\max}].

    Perron–Frobenius in two sentences

    If all entries of a square matrix are positive, then the eigenvalue of largest absolute value is real, positive and simple, and its eigenvector can be chosen with all entries positive (the Perron–Frobenius theorem; it extends to nonnegative irreducible matrices). This is why a Markov chain with a positive transition matrix (and the damped PageRank matrix) has a unique stationary distribution, which power iteration finds. A softmax attention matrix is positive and row-stochastic, so A1=1A\mathbf{1} = \mathbf{1}, and the theorem says that this eigenvalue 1 is simple and larger in absolute value than all the others.

    Answers to section 1. (1) One. The shear has λ=1\lambda = 1 twice (a=2a = 2), but A−I=(0100)A - I = \begin{pmatrix} 0 & 1 \\ 0 & 0 \end{pmatrix} has rank 1, so g=1g = 1: defective. (2) The error after kk steps is about rkr^k with r=∣λ2/λ1∣r = |\lambda_2/\lambda_1|, so k≈10/log⁡10(1/r)k \approx 10 / \log_{10}(1/r): about 33 steps for PP (r=0.5r = 0.5) and about 2,300 for QQ (r=0.99r = 0.99).

    4. Worked example #

    Eigenpairs. A=(1423)A = \begin{pmatrix} 1 & 4 \\ 2 & 3 \end{pmatrix}: τ=1+3=4\tau = 1 + 3 = 4, δ=1⋅3−4⋅2=−5\delta = 1 \cdot 3 - 4 \cdot 2 = -5, and p(λ)=λ2−4λ−5=(λ−5)(λ+1)p(\lambda) = \lambda^2 - 4\lambda - 5 = (\lambda - 5)(\lambda + 1). Check: 5+(−1)=τ5 + (-1) = \tau, 5⋅(−1)=δ5 \cdot (-1) = \delta.

    • λ=5\lambda = 5: A−5I=(−442−2)A - 5I = \begin{pmatrix} -4 & 4 \\ 2 & -2 \end{pmatrix}. Row 1 says −4v1+4v2=0-4v_1 + 4v_2 = 0, so v1=(1,1)v_1 = (1, 1).
    • λ=−1\lambda = -1: A+I=(2424)A + I = \begin{pmatrix} 2 & 4 \\ 2 & 4 \end{pmatrix}. Row 1 says 2x+4y=02x + 4y = 0, so v2=(2,−1)v_2 = (2, -1).

    v1⋅v2=1≠0v_1 \cdot v_2 = 1 \ne 0: AA is not symmetric, and its eigenvectors are not orthogonal.

    Diagonalize. X=(121−1)X = \begin{pmatrix} 1 & 2 \\ 1 & -1 \end{pmatrix}, Λ=diag⁡(5,−1)\Lambda = \operatorname{diag}(5, -1), det⁡X=−1−2=−3\det X = -1 - 2 = -3, X−1=1−3(−1−2−11)=13(121−1)X^{-1} = \tfrac{1}{-3}\begin{pmatrix} -1 & -2 \\ -1 & 1 \end{pmatrix} = \tfrac13 \begin{pmatrix} 1 & 2 \\ 1 & -1 \end{pmatrix}, and

    A3=Xdiag⁡(125,−1)X−1=(125−21251)⋅13(121−1)=13(123252126249)=(41844283).A^3 = X \operatorname{diag}(125, -1) X^{-1} = \begin{pmatrix} 125 & -2 \\ 125 & 1 \end{pmatrix} \cdot \frac13\begin{pmatrix} 1 & 2 \\ 1 & -1 \end{pmatrix} = \frac13\begin{pmatrix} 123 & 252 \\ 126 & 249 \end{pmatrix} = \begin{pmatrix} 41 & 84 \\ 42 & 83 \end{pmatrix}.

    Power iteration by hand from x0=(1,0)x_0 = (1, 0), without normalizing (it does not change directions): (1,2)(1, 2), (9,8)(9, 8), (41,42)(41, 42), (209,208)(209, 208). Since x0=13(v1+v2)x_0 = \tfrac13 (v_1 + v_2), Akx0=13(5kv1+(−1)kv2)A^k x_0 = \tfrac13\big(5^k v_1 + (-1)^k v_2\big): the v2v_2 coefficient relative to the v1v_1 coefficient is (−1/5)k(-1/5)^k. The sine of the angle to v1v_1 is 0.32,0.059,0.012,0.00240.32, 0.059, 0.012, 0.0024: about ×0.2\times 0.2 per step. The Rayleigh quotient at (209,208)(209, 208) is 4.99524.9952; its error 0.00480.0048 is of order 0.240.2^4, not 0.280.2^8, because AA is not symmetric. (The figure in section 3 starts with these numbers.)

    Quick check

    Use the formula for AkA^k from section 3 ("Powers, step by step") for A=(4−211)A = \begin{pmatrix} 4 & -2 \\ 1 & 1 \end{pmatrix}, whose eigenvalues are 3 and 2. What is A2A^2?

    A defective matrix. B=(11−13)B = \begin{pmatrix} 1 & 1 \\ -1 & 3 \end{pmatrix}: τ=4\tau = 4, δ=3+1=4\delta = 3 + 1 = 4, p(λ)=λ2−4λ+4=(λ−2)2p(\lambda) = \lambda^2 - 4\lambda + 4 = (\lambda - 2)^2, so a(2)=2a(2) = 2. B−2I=(−11−11)B - 2I = \begin{pmatrix} -1 & 1 \\ -1 & 1 \end{pmatrix} has rank 1, so g(2)=1g(2) = 1.

    • Eigenvector v=(1,1)v = (1, 1). Generalized eigenvector: (B−2I)w=v(B - 2I)w = v means −w1+w2=1-w_1 + w_2 = 1; take w=(0,1)w = (0, 1).
    • X=[v w]=(1011)X = [v\ w] = \begin{pmatrix} 1 & 0 \\ 1 & 1 \end{pmatrix}, X−1=(10−11)X^{-1} = \begin{pmatrix} 1 & 0 \\ -1 & 1 \end{pmatrix}, J=(2102)J = \begin{pmatrix} 2 & 1 \\ 0 & 2 \end{pmatrix}, and XJX−1=BXJX^{-1} = B.
    • J3=(81208)J^3 = \begin{pmatrix} 8 & 12 \\ 0 & 8 \end{pmatrix} (12=3⋅2212 = 3 \cdot 2^2), so B3=XJ3X−1=(−412−1220)B^3 = XJ^3X^{-1} = \begin{pmatrix} -4 & 12 \\ -12 & 20 \end{pmatrix}.

    5. In code #

    NumPy checks the hand computations above. The notebook for this lesson has these cells and the exercises.

    import numpy as np
    
    A = np.array([[1., 4.], [2., 3.]])
    lam, X = np.linalg.eig(A)                        # columns of X: unit eigenvectors
    lam, X = lam.real, X.real    # real here; np.linalg.eig may return complex dtype
    print(lam)                                       # [-1.  5.]  (no fixed order)
    print(np.allclose(X @ np.diag(lam) @ np.linalg.inv(X), A))   # True
    print(round(lam.sum(), 10), round(lam.prod(), 10))           # 4.0 -5.0  (= trace, det)
    
    # Powers through the eigenbasis: A4 = [[4,-2],[1,1]], eigenvalues 3 and 2
    A4 = np.array([[4., -2.], [1., 1.]])
    X4 = np.array([[2., 1.], [1., 1.]])              # v1 = (2, 1), v2 = (1, 1)
    A4_3 = X4 @ np.diag([3.**3, 2.**3]) @ np.linalg.inv(X4)
    print(np.round(A4_3, 10), np.allclose(A4_3, np.linalg.matrix_power(A4, 3)))
    # [[ 46. -38.] [ 19. -11.]] True
    
    # A complex pair: [[1,-1],[1,1]] = sqrt(2) times a rotation by 45 degrees
    R = np.array([[1., -1.], [1., 1.]])
    w = np.linalg.eigvals(R)
    print(w, np.abs(w), np.degrees(np.angle(w)))
    # [1.+1.j 1.-1.j] [1.41421356 1.41421356] [ 45. -45.]
    print(np.linalg.matrix_power(R, 8))              # [[16. 0.] [0. 16.]]
    
    # The theory behind power iteration: coordinates of A^k x0 in the basis (v1, v2)
    V = np.array([[1., 2.], [1., -1.]])              # v1 = (1, 1), v2 = (2, -1)
    x0 = np.array([1., 0.])
    for k in (1, 2, 3, 4):
        c = np.linalg.solve(V, np.linalg.matrix_power(A, k) @ x0)
        print(k, round(c[1] / c[0], 4))              # (-0.2)^k: -0.2, 0.04, -0.008, 0.0016
    
    # Multiplicities and the Jordan form of the defective example
    B = np.array([[1., 1.], [-1., 3.]])
    print(np.poly(B))                                # [ 1. -4.  4.]: p = (λ - 2)^2, a(2) = 2
    print(2 - np.linalg.matrix_rank(B - 2 * np.eye(2)))   # 1 = g(2): defective
    Xj = np.array([[1., 0.], [1., 1.]])              # columns: v = (1, 1), w = (0, 1)
    J = np.array([[2., 1.], [0., 2.]])
    print(np.allclose(Xj @ J @ np.linalg.inv(Xj), B))     # True
    print(Xj @ np.linalg.matrix_power(J, 3) @ np.linalg.inv(Xj))   # [[-4. 12.] [-12. 20.]]
    
    # Near-defective: eigenvalues move like sqrt(eps), the eigenvector matrix degrades
    for eps in (1e-6, 1e-10):
        w, Xe = np.linalg.eig(np.array([[2., 1.], [eps, 2.]]))
        print(eps, np.round(w.real, 6), f"{np.linalg.cond(Xe):.0f}")
        # 1e-06 [2.001 1.999] 1000      then      1e-10 [2.00001 1.99999] 100000
    

    np.poly gives the coefficients of the characteristic polynomial, and matrix_rank uses a tolerance on the singular values. The exact Jordan form needs exact arithmetic (for example SymPy's Matrix.jordan_form); in floating point it is ill-posed, as the last loop shows.

    6. Where it shows up #

    • PageRank and Markov chains. The stationary distribution is the eigenvector for the eigenvalue 11 of the column-stochastic Google matrix. With damping d=0.85d = 0.85, every other eigenvalue has ∣λ∣≤d|\lambda| \le d, so power iteration converges like 0.85k0.85^k, whatever the size of the graph.
    • Sharpness and spectral normalization. Power iteration needs only products: v↦Hvv \mapsto Hv (Hessian-vector products by autodiff) or v↦W⊤Wvv \mapsto W^\top W v. Spectral normalization runs one power-iteration step per training step to track σmax⁡(W)\sigma_{\max}(W).
    • RNNs and linear recurrences. hk=Wkh0h_k = W^k h_0 grows or shrinks like ∣λi∣k|\lambda_i|^k: exploding or vanishing signals and gradients. A complex pair makes the state rotate (oscillate) while it grows or decays. A defective or non-normal WW can still grow first.
    • ML for science: stability and modes. Near an equilibrium, x˙≈Jfx\dot x \approx J_f x (JfJ_f the Jacobian) is stable when every Re⁡λ<0\operatorname{Re}\lambda < 0; a time-stepper uk+1=Guku_{k+1} = Gu_k needs spectral radius ρ(G)≤1\rho(G) \le 1. Dynamic mode decomposition fits a linear operator to snapshots of a flow or climate field; its eigenvalues are the growth rates and frequencies of the modes. The critically damped oscillator x¨+2ωx˙+ω2x=0\ddot x + 2\omega\dot x + \omega^2 x = 0 has the matrix (01−ω2−2ω)\begin{pmatrix} 0 & 1 \\ -\omega^2 & -2\omega \end{pmatrix}, a double eigenvalue −ω-\omega with one eigenvector, and the solution (c1+c2t)e−ωt(c_1 + c_2 t)e^{-\omega t}.

    7. Common mistakes #

    • Row reducing before finding eigenvalues. Elimination is not a similarity; it changes them.
    • Reading eigenvalues from the diagonal of a full matrix. This works only for triangular (or diagonal) matrices: (4−211)\begin{pmatrix} 4 & -2 \\ 1 & 1 \end{pmatrix} has eigenvalues 3 and 2, not 4 and 1.
    • "Repeated eigenvalue ⇒ not diagonalizable." False: II is diagonal. Defective means g<ag < a. Distinct eigenvalues imply diagonalizable, not the other way round.
    • Mixing up diagonalizable and invertible. diag⁡(1,0)\operatorname{diag}(1, 0) is diagonalizable and singular; the shear is invertible and defective.
    • Expecting real eigenvalues and orthogonal eigenvectors from any real matrix. Only symmetric matrices guarantee that (lesson 06). A rotation has complex eigenvalues.
    • Power iteration details. Not normalizing (overflow or underflow); stopping on ∥xk−xk−1∥\|x_k - x_{k-1}\| when λ1<0\lambda_1 < 0; running it when ∣λ1∣=∣λ2∣|\lambda_1| = |\lambda_2|.
    • Comparing eigenvectors with a library without fixing scale and sign. Eigenvectors are defined only up to a nonzero factor (and up to a basis choice in an eigenspace of dimension >1> 1).
    • Computing a Jordan form in floating point. It is ill-posed; use the Schur form or the SVD.

    8. Check yourself #

    1. Find the eigenpairs of (01−2−3)\begin{pmatrix} 0 & 1 \\ -2 & -3 \end{pmatrix} and check them.
      Answerp(λ)=λ2+3λ+2=(λ+1)(λ+2)p(\lambda) = \lambda^2 + 3\lambda + 2 = (\lambda + 1)(\lambda + 2). λ=−1\lambda = -1 with (1,−1)(1, -1); λ=−2\lambda = -2 with (1,−2)(1, -2). Sum −3-3 = trace, product 22 = det.
    2. AA has eigenvalues 1,−1,0.51, -1, 0.5. Does power iteration converge? How can you fix it?
      AnswerNo: ∣λ1∣=∣λ2∣=1|\lambda_1| = |\lambda_2| = 1, so the iterate keeps a part (−1)kc2v2(-1)^k c_2 v_2 and alternates between two directions. Shift: A+IA + I has the same eigenvectors and eigenvalues 2,0,1.52, 0, 1.5, so 22 is strictly dominant with ratio 0.750.75.
    3. ∣λ2/λ1∣=0.9|\lambda_2/\lambda_1| = 0.9. About how many iterations shrink the eigenvector error by 10610^6? And the Rayleigh-quotient error of a symmetric matrix?
      Answerk≈6/log⁡10(1/0.9)≈131k \approx 6/\log_{10}(1/0.9) \approx 131. The symmetric Rayleigh-quotient error behaves like 0.81k0.81^k, so about 66 iterations.
    4. A 3×33\times3 matrix has the single eigenvalue 2 and rank⁡(A−2I)=1\operatorname{rank}(A - 2I) = 1. What is its Jordan form?
      Answerg(2)=3−1=2g(2) = 3 - 1 = 2 blocks with total size 3: J2(2)⊕J1(2)J_2(2) \oplus J_1(2). (Rank 0 would give 2I2I; rank 2 would give one block J3(2)J_3(2).)
    5. Why is (2703)\begin{pmatrix} 2 & 7 \\ 0 & 3 \end{pmatrix} diagonalizable, without computing eigenvectors?
      AnswerIt is triangular, so its eigenvalues are the diagonal entries 2 and 3. They are distinct, so the eigenvectors are independent.
    6. J=(0.9100.9)J = \begin{pmatrix} 0.9 & 1 \\ 0 & 0.9 \end{pmatrix}. What happens to the (1,2) entry of JkJ^k?
      AnswerIt is k⋅0.9k−1k \cdot 0.9^{k-1}. It grows to about 3.873.87 at k=9k = 9 and 1010, then decays to 0. ∣λ∣<1|\lambda| < 1 guarantees decay only in the long run.
    7. The real matrix (0−220)\begin{pmatrix} 0 & -2 \\ 2 & 0 \end{pmatrix} has which eigenvalues? What does it do to the plane?
      Answerτ=0\tau = 0, δ=4\delta = 4, so λ2+4=0\lambda^2 + 4 = 0 and λ=±2i\lambda = \pm 2i. ∣λ∣=2|\lambda| = 2 and θ=90°\theta = 90°: it rotates every vector by 90°90° and doubles its length. It is 2R90°2R_{90°}.
    Recall cardsAnswer in your head first, then reveal. Add the cards to your review deck to see them again just before you would forget.
    1. Define an eigenvalue and an eigenvector of AA.

    2. Why is λ\lambda an eigenvalue exactly when det⁡(A−λI)=0\det(A - \lambda I) = 0?

    3. Write the characteristic polynomial of a 2×22 \times 2 matrix with trace τ\tau and determinant δ\delta.

    4. How are the eigenvalues related to the trace and the determinant?

    5. What does a complex pair a±bia \pm bi mean for a real 2×22 \times 2 matrix?

    6. When is AA diagonalizable, and what is AkA^k then?

    7. Compute the eigenvalues of (4−211)\begin{pmatrix} 4 & -2 \\ 1 & 1 \end{pmatrix}.

    8. At what rate does power iteration converge?

    9. Define algebraic and geometric multiplicity.

    10. Give a defective 2×22 \times 2 matrix and its multiplicities.

    Open the review →

    9. Interview angle #

    • "Top eigenvalue of a 109×10910^9 \times 10^9 sparse matrix?" — power iteration (or Lanczos/Arnoldi) with matrix-vector products only; rate ∣λ2/λ1∣|\lambda_2/\lambda_1|; one sparse product per step.
    • "Why does PageRank converge, and how fast?" — damping makes the eigenvalue 1 dominant, with ∣λ2∣≤d=0.85|\lambda_2| \le d = 0.85.
    • "Is every matrix diagonalizable?" — no, (1101)\begin{pmatrix} 1 & 1 \\ 0 & 1 \end{pmatrix}. Sufficient: nn distinct eigenvalues, or a symmetric matrix.
    • "Where does teλtt e^{\lambda t} come from?" — a Jordan block: eJt=eλt(I+tN)e^{Jt} = e^{\lambda t}(I + tN).
    • "Why don't libraries return the Jordan form?" — it jumps under tiny perturbations; they use the Schur form.

    10. Practice #

    The notebook for this lesson runs in Colab. It has five exercises, each with a check cell and a folded solution:

    1. Eigenvalues of a 2×22 \times 2 matrix from the trace and the determinant, real or complex.
    2. Write power_iteration with normalization and a residual stopping test (a demo before it plots the error against ∣λ2/λ1∣k|\lambda_2/\lambda_1|^k).
    3. PageRank: build the damped Google matrix of a small link graph and rank the pages with your power iteration.
    4. Algebraic and geometric multiplicity, and an is_diagonalizable test, on diagonalizable and defective examples.
    5. Powers of a Jordan block: the closed form Jk=λkI+kλk−1NJ^k = \lambda^k I + k\lambda^{k-1}N and the transient growth of kλk−1k\lambda^{k-1}.

    11. Watch and read #

    Watch for the vectors that stay on their own line, and for the rotation that has none.
    Open on YouTube · the player loads from youtube-nocookie.com when you press play
    Open on YouTube · the player loads from youtube-nocookie.com when you press play
    Open on YouTube · the player loads from youtube-nocookie.com when you press play
    Open on YouTube · the player loads from youtube-nocookie.com when you press play
    Open on YouTube · the player loads from youtube-nocookie.com when you press play