Skip to content

Eigendecomposition and Diagonalization

Diagonal matrices are the easy case for everything. Their determinant is the product of the diagonal; their kk-th power raises each diagonal entry to the kk; their inverse takes reciprocals. Nothing about a general matrix is that easy.

Diagonalization asks whether a given square matrix is a diagonal matrix in disguise — the same linear mapping, written in a better basis. When the answer is yes, every easy property of a diagonal matrix becomes available, and the basis that does it is the eigenbasis of §4.2.

  • Definition 4.19: what diagonalizable means, and why it is exactly Chapter 2’s notion of similar.
  • Why AP=PD\mathbf{A}\mathbf{P} = \mathbf{P}\mathbf{D} forces the columns of P\mathbf{P} to be eigenvectors.
  • Theorem 4.20: A=PDP1\mathbf{A} = \mathbf{P}\mathbf{D}\mathbf{P}^{-1} if and only if the eigenvectors form a basis.
  • Theorem 4.21: a symmetric matrix can always be diagonalized, and by an orthogonal P\mathbf{P}, so P1=P\mathbf{P}^{-1} = \mathbf{P}^\top.
  • The geometry: P1\mathbf{P}^{-1} then D\mathbf{D} then P\mathbf{P}, and what each step does to a disc.
  • Equations 4.62 and 4.63: matrix powers and determinants in one line each, with a measured cost crossover.

Intuition: work in the coordinates where the map is simple

Section titled “Intuition: work in the coordinates where the map is simple”

Here is the whole idea in three sentences.

A matrix does something complicated in the standard basis and something trivial in its own eigenbasis: along each eigenvector it just multiplies by a number. So if you first change coordinates into the eigenbasis, then scale each coordinate by its eigenvalue, then change back, you have applied the original matrix — by a route where the only real work is nn independent multiplications.

A=Pchange back Dscale P1change into the eigenbasis\mathbf{A} = \underbrace{\mathbf{P}}_{\text{change back}}\ \underbrace{\mathbf{D}}_{\text{scale}}\ \underbrace{\mathbf{P}^{-1}}_{\text{change into the eigenbasis}}

Read right to left, in the order a vector meets them. And the payoff arrives when you apply the matrix repeatedly: the two changes of basis cancel in the middle of Ak=PDP1PDP1\mathbf{A}^k = \mathbf{P}\mathbf{D}\mathbf{P}^{-1}\mathbf{P}\mathbf{D}\mathbf{P}^{-1}\cdots, leaving PDkP1\mathbf{P}\mathbf{D}^k\mathbf{P}^{-1}.

diagram Diagram mermaid

Diagonal matrices, and why they are the target

Section titled “Diagonal matrices, and why they are the target”

“Similar” is Chapter 2’s Definition 2.22, and §4.1 already told you what it costs: similar matrices share a determinant, a trace and — from §4.2 — a spectrum. So diagonalization does not change any of the quantities that characterise the mapping. It changes only the basis you write it in.

Take any scalars λ1,,λn\lambda_1, \dots, \lambda_n and any vectors p1,,pn\mathbf{p}_1, \dots, \mathbf{p}_n, and set P=[p1,,pn]\mathbf{P} = [\mathbf{p}_1, \dots, \mathbf{p}_n], D=diag(λ1,,λn)\mathbf{D} = \mathrm{diag}(\lambda_1,\dots,\lambda_n). Multiply out both sides of AP=PD\mathbf{A}\mathbf{P} = \mathbf{P}\mathbf{D}:

AP=A[p1,,pn]=[Ap1,,Apn](4.51)\mathbf{A}\mathbf{P} = \mathbf{A}[\mathbf{p}_1,\dots,\mathbf{p}_n] = [\mathbf{A}\mathbf{p}_1,\dots,\mathbf{A}\mathbf{p}_n] \tag{4.51} PD=[p1,,pn][λ100λn]=[λ1p1,,λnpn](4.52)\mathbf{P}\mathbf{D} = [\mathbf{p}_1,\dots,\mathbf{p}_n]\begin{bmatrix}\lambda_1 & & 0\\ & \ddots & \\ 0 & & \lambda_n\end{bmatrix} = [\lambda_1\mathbf{p}_1,\dots,\lambda_n\mathbf{p}_n] \tag{4.52}

Equate column by column and you get Ap1=λ1p1\mathbf{A}\mathbf{p}_1 = \lambda_1\mathbf{p}_1, …, Apn=λnpn\mathbf{A}\mathbf{p}_n = \lambda_n\mathbf{p}_n (Equations 4.53 and 4.54). So

AP=PD    λ1,,λn are eigenvalues of A and p1,,pn the corresponding eigenvectors(4.50)\mathbf{A}\mathbf{P} = \mathbf{P}\mathbf{D} \iff \lambda_1,\dots,\lambda_n \text{ are eigenvalues of } \mathbf{A} \text{ and } \mathbf{p}_1,\dots,\mathbf{p}_n \text{ the corresponding eigenvectors} \tag{4.50}

The eigenvectors are not chosen for the job; they are the only vectors that can do it.

The hypothesis is where §4.2 earns its keep. Definition 4.19 needs P\mathbf{P} invertible, so P\mathbf{P} needs full rank (§4.1, Theorem 4.3), so its nn columns need to be linearly independent — so there must be nn linearly independent eigenvectors. That is exactly the negation of defective (Definition 4.13).

So: only non-defective matrices can be diagonalized, and the columns of P\mathbf{P} are the nn eigenvectors. A repeated eigenvalue is fine as long as its eigenspace is big enough; a repeated eigenvalue whose geometric multiplicity falls short is fatal.

This follows directly from the spectral theorem (4.15), and it comes with a bonus: the spectral theorem gives an orthonormal basis of eigenvectors, so P\mathbf{P} can be taken orthogonal, and then

D=PAP\mathbf{D} = \mathbf{P}^\top\mathbf{A}\mathbf{P}

with no inverse to compute. That substitution — P1P\mathbf{P}^{-1} \to \mathbf{P}^\top — is why every covariance and kernel matrix in the applied chapters is handled without an inverse anywhere in sight.

The book’s Figure 4.7 reads as a loop, and it is worth walking round it.

stepwhat it does
P1\mathbf{P}^{-1}a change of basis from the standard basis into the eigenbasis: it maps the eigenvectors pi\mathbf{p}_i onto the standard basis vectors ei\mathbf{e}_i
D\mathbf{D}scales along those axes by the eigenvalues λi\lambda_i — a circle becomes an axis-aligned ellipse
P\mathbf{P}undoes the basis change, returning the scaled vectors to the original frame, giving λipi\lambda_i\mathbf{p}_i

For a symmetric matrix the two outer steps are genuine rotations (or reflections), because P\mathbf{P} is orthogonal. For a general non-defective matrix they are not — P\mathbf{P} is invertible but need not be orthogonal, so the “change of basis” also shears. The book draws the symmetric case, which is why its Figure 4.7 looks like rotate-scale-rotate.

The determinant identity is Theorem 4.16 again, arriving by a different route. The power identity is new, and it is the practical reason to diagonalize.

A=[2112]\mathbf{A} = \begin{bmatrix}2 & 1\\ 1 & 2\end{bmatrix}

Step 1 — eigenvalues and eigenvectors.

det(AλI)=2λ112λ=(2λ)21=λ24λ+3=(λ3)(λ1)(4.56b)\det(\mathbf{A}-\lambda\mathbf{I}) = \begin{vmatrix}2-\lambda & 1\\ 1 & 2-\lambda\end{vmatrix} = (2-\lambda)^2 - 1 = \lambda^2 - 4\lambda + 3 = (\lambda-3)(\lambda-1) \tag{4.56b}

so λ1=1\lambda_1 = 1 and λ2=3\lambda_2 = 3. Solving [2112]pi=λipi\begin{bmatrix}2&1\\1&2\end{bmatrix}\mathbf{p}_i = \lambda_i\mathbf{p}_i and normalising:

p1=12[11],p2=12[11](4.58)\mathbf{p}_1 = \frac{1}{\sqrt2}\begin{bmatrix}1\\-1\end{bmatrix}, \qquad \mathbf{p}_2 = \frac{1}{\sqrt2}\begin{bmatrix}1\\1\end{bmatrix} \tag{4.58}

Step 2 — check existence. Two distinct eigenvalues, so by Theorem 4.12 the eigenvectors are independent, so they form a basis of R2\mathbb{R}^2, so Theorem 4.20 applies.

Step 3 — assemble.

P=[p1,p2]=12[1111](4.59)\mathbf{P} = [\mathbf{p}_1, \mathbf{p}_2] = \frac{1}{\sqrt2}\begin{bmatrix}1 & 1\\ -1 & 1\end{bmatrix} \tag{4.59} P1AP=[1003]=D(4.60)\mathbf{P}^{-1}\mathbf{A}\mathbf{P} = \begin{bmatrix}1 & 0\\ 0 & 3\end{bmatrix} = \mathbf{D} \tag{4.60}

And because A\mathbf{A} is symmetric, the eigenvectors are already an ONB, so P1=P\mathbf{P}^{-1} = \mathbf{P}^\top and the factorisation can be written without an inverse (Equation 4.61):

[2112]A=12[1111]P[1003]D12[1111]P\underbrace{\begin{bmatrix}2&1\\1&2\end{bmatrix}}_{\mathbf{A}} = \underbrace{\frac{1}{\sqrt2}\begin{bmatrix}1&1\\-1&1\end{bmatrix}}_{\mathbf{P}} \underbrace{\begin{bmatrix}1&0\\0&3\end{bmatrix}}_{\mathbf{D}} \underbrace{\frac{1}{\sqrt2}\begin{bmatrix}1&-1\\1&1\end{bmatrix}}_{\mathbf{P}^\top}

Verified numerically: P1=P\mathbf{P}^{-1} = \mathbf{P}^\top exactly, and PDP\mathbf{P}\mathbf{D}\mathbf{P}^\top reproduces A\mathbf{A} to 4.44×10164.44\times10^{-16}.

Equation 4.62 does something a matrix multiply cannot: it gives an algebraic formula. For this A\mathbf{A},

Ak=P[1k003k]P=12[1+3k1+3k1+3k1+3k]\mathbf{A}^k = \mathbf{P}\begin{bmatrix}1^k & 0\\ 0 & 3^k\end{bmatrix}\mathbf{P}^\top = \frac{1}{2}\begin{bmatrix}1 + 3^k & -1 + 3^k\\ -1 + 3^k & 1 + 3^k\end{bmatrix}

Read off the top-left entry: (Ak)11=12(1+3k)(\mathbf{A}^k)_{11} = \tfrac{1}{2}(1 + 3^k). Check against direct multiplication:

kkdirect Ak\mathbf{A}^k, entry (1,1)(1,1)12(1+3k)\tfrac12(1+3^k)
12222
25555
5122122122122
1029525295252952529525
201743392201174339220117433922011743392201

Every value integer and exact. That is what a diagonalisation gives you that repeated multiplication does not: not a faster loop, a formula.

example_411.py
import numpy as np
 
A = np.array([[2.0, 1.0], [1.0, 2.0]])
 
# The book's P and D (Equations 4.58 to 4.60).
P = np.array([[1.0, 1.0], [-1.0, 1.0]]) / np.sqrt(2)
D = np.diag([1.0, 3.0])
 
print("P^-1 A P ="); print(np.round(np.linalg.inv(P) @ A @ P, 10))
print("P^-1 equals P^T:", np.allclose(np.linalg.inv(P), P.T))
print("P D P^T - A, largest entry:", f"{float(np.abs(P @ D @ P.T - A).max()):.2e}")
 
print()
print("Equation 4.62, against direct multiplication:")
for k in (1, 2, 5, 10, 20):
    direct = np.linalg.matrix_power(A, k)
    via = P @ np.diag([1.0 ** k, 3.0 ** k]) @ P.T
    closed = (1 + 3.0 ** k) / 2
    print(f"  k={k:3}  direct[0,0] {direct[0, 0]:16.1f}  PD^kP^T {via[0, 0]:16.1f}  "
          f"(1+3^k)/2 {closed:16.1f}  gap {float(np.abs(direct - via).max()):.2e}")
 
print()
print("Equation 4.63: det A =", float(np.linalg.det(A)), " product of D's diagonal =", float(np.prod(np.diag(D))))
output
P^-1 A P =
[[ 1.  0.]
 [-0.  3.]]
P^-1 equals P^T: True
P D P^T - A, largest entry: 4.44e-16
 
Equation 4.62, against direct multiplication:
  k=  1  direct[0,0]              2.0  PD^kP^T              2.0  (1+3^k)/2              2.0  gap 4.44e-16
  k=  2  direct[0,0]              5.0  PD^kP^T              5.0  (1+3^k)/2              5.0  gap 8.88e-16
  k=  5  direct[0,0]            122.0  PD^kP^T            122.0  (1+3^k)/2            122.0  gap 1.42e-14
  k= 10  direct[0,0]          29525.0  PD^kP^T          29525.0  (1+3^k)/2          29525.0  gap 3.64e-12
  k= 20  direct[0,0]     1743392201.0  PD^kP^T     1743392201.0  (1+3^k)/2     1743392201.0  gap 2.38e-07
 
Equation 4.63: det A = 2.9999999999999996  product of D's diagonal = 3.0

Two things worth noticing. The absolute gap grows to 2.4×1072.4\times10^{-7} by k=20k = 20 — but A20\mathbf{A}^{20} has entries around 1.7×1091.7\times10^{9}, so that is a relative error of about 101610^{-16}, which is machine precision, not degradation. And the last line: detA\det\mathbf{A} from an LU factorisation gives 2.99999999999999962.9999999999999996 where the product of the eigenvalues gives exactly 33.

The first sketch is the three-step loop with a slider that interpolates through it, so you can see which step does what.

sketch P-inverse, then D, then P p5.js
Drag the stage slider to move a disc of points through the three factors. The eigenvectors are marked: P-inverse lands them on the coordinate axes, D stretches along those axes, and P returns everything to the original frame. Edit the matrix — keep it symmetric with the off-diagonal knob, or break symmetry and watch the outer steps stop being rotations.

The second sketch is the payoff: watch Ak\mathbf{A}^k collapse onto the dominant eigendirection.

sketch A to the k collapses onto the dominant eigenvector p5.js
Drag k. The disc is repeatedly transformed by A, computed as P D-to-the-k P-inverse. Because one eigenvalue dominates, everything is squeezed towards a single line — and the readout shows the ratio of the two eigenvalues raised to the k, which is exactly how fast that happens.

And the stepped version on Example 4.11, with the det/trace checks and the diagonalisability verdict:

matrixExample 4.11, step by stepeigen analysis, §4.2
A x (rotated, not just scaled)
A
2112
setupA is 2x2. The eigenvalue equation Ax = Lx asks for directions the matrix only scales — and the only way a nonzero x can satisfy (A - L I)x = 0 is for A - L I to be singular, so det(A - L I) = 0 is where the eigenvalues must come from.
1/7

Symmetric, two distinct eigenvalues, orthogonal eigenvectors — the case Theorem 4.21 guarantees. The final frame confirms the eigenspace dimensions add to 2.

eigendecomposition_from_scratch.py
import numpy as np
 
def eigendecompose(A, tol=1e-8):
    """Theorem 4.20, with its hypothesis actually checked."""
    A = np.asarray(A, dtype=float)
    n = A.shape[0]
    symmetric = bool(np.allclose(A, A.T))
 
    # Theorem 4.21: for symmetric input use eigh, which returns an ONB.
    vals, vecs = (np.linalg.eigh(A) if symmetric else np.linalg.eig(A))
 
    if np.any(np.abs(np.imag(vals)) > 1e-12):
        raise ValueError("complex eigenvalues: not diagonalizable over the reals")
 
    vals = np.real(vals)
    vecs = np.real(vecs)
 
    # The hypothesis: do the eigenvectors form a basis?
    independent = 0
    for lam in np.unique(np.round(vals, 8)):
        independent += n - np.linalg.matrix_rank(A - lam * np.eye(n), tol=tol)
    if independent < n:
        raise ValueError(f"defective: {independent} independent eigenvectors, {n} needed")
 
    P, D = vecs, np.diag(vals)
    Pinv = P.T if symmetric else np.linalg.inv(P)
    return P, D, Pinv, symmetric
 
cases = {
    "Ex 4.11 [[2,1],[1,2]]":  [[2.0, 1], [1, 2]],
    "Ex 4.5  [[4,2],[1,3]]":  [[4.0, 2], [1, 3]],
    "Ex 4.6  [[2,1],[0,2]]":  [[2.0, 1], [0, 2]],
    "Ex 4.8  3x3 symmetric":  [[3.0, 2, 2], [2, 3, 2], [2, 2, 3]],
    "rotation by 30 deg":     [[np.cos(np.pi / 6), -np.sin(np.pi / 6)],
                               [np.sin(np.pi / 6), np.cos(np.pi / 6)]],
}
 
for name, A in cases.items():
    A = np.asarray(A, dtype=float)
    try:
        P, D, Pinv, sym = eigendecompose(A)
        gap = float(np.abs(P @ D @ Pinv - A).max())
        orth = float(np.abs(P.T @ P - np.eye(A.shape[0])).max())
        print(f"{name:24} OK   symmetric {str(sym):5} "
              f"|P D P^-1 - A| {gap:.1e}  |P^T P - I| {orth:.1e}  "
              f"det from D {float(np.prod(np.diag(D))):+.4f}")
    except ValueError as e:
        print(f"{name:24} NO   {e}")
output
Ex 4.11 [[2,1],[1,2]]    OK   symmetric True  |P D P^-1 - A| 4.4e-16  |P^T P - I| 2.2e-16  det from D +3.0000
Ex 4.5  [[4,2],[1,3]]    OK   symmetric False |P D P^-1 - A| 8.9e-16  |P^T P - I| 3.2e-01  det from D +10.0000
Ex 4.6  [[2,1],[0,2]]    NO   defective: 1 independent eigenvectors, 2 needed
Ex 4.8  3x3 symmetric    OK   symmetric True  |P D P^-1 - A| 3.6e-15  |P^T P - I| 5.6e-16  det from D +7.0000
rotation by 30 deg       NO   complex eigenvalues: not diagonalizable over the reals

The column to read is PPI\lVert\mathbf{P}^\top\mathbf{P} - \mathbf{I}\rVert. For the two symmetric matrices it is at machine precision — P\mathbf{P} is orthogonal, exactly as Theorem 4.21 promises. For the non-symmetric Example 4.5 it is 0.31620.3162: P\mathbf{P} is perfectly invertible and the decomposition is perfectly valid, but the change of basis is not a rotation — the two eigendirections meet at 71.6°71.6° rather than 90°90°, so their inner product is 0.3162-0.3162 instead of 00. That is the difference between Theorem 4.20 and Theorem 4.21, visible as one number.

figure The book's Figure 4.7, rebuilt matplotlib
Four panels of a coloured disc of points: the original with two eigenvector arrows, the same disc after P-inverse with the arrows on the coordinate axes, the disc stretched into an axis-aligned ellipse by D, and the ellipse rotated back by P. Four panels of a coloured disc of points: the original with two eigenvector arrows, the same disc after P-inverse with the arrows on the coordinate axes, the disc stretched into an axis-aligned ellipse by D, and the ellipse rotated back by P.
Eigenvalues 3 and 1. Measured over 900 points, the largest gap between the direct product A x and the three-step chain is 4.44e-16, and P-transpose P differs from the identity by 2.22e-16 — so here the two outer steps really are rotations.
figure Equation 4.62, measured matplotlib
Left, a log-log plot of the relative disagreement between repeated multiplication and the eigen route, flat at machine precision across a thousand powers. Right, log-log multiplication counts for both routes with a marked crossover. Left, a log-log plot of the relative disagreement between repeated multiplication and the eigen route, flat at machine precision across a thousand powers. Right, log-log multiplication counts for both routes with a marked crossover.
Over powers up to 1000 the two routes never disagree by more than 9.66e-15 relative. On the right, for n = 6 the eigen route becomes cheaper at k = 14 — one decomposition plus k scalar powers against k matrix products.
figure Theorem 4.20's hypothesis, quantified matplotlib
A bar chart of percent defective across four constructions of 4 by 4 matrices: zero for Gaussian entries, about three percent for small integers, zero for a constructed repeated eigenvalue, and over ninety-nine percent for a Jordan block. A bar chart of percent defective across four constructions of 4 by 4 matrices: zero for Gaussian entries, about three percent for small integers, zero for a constructed repeated eigenvalue, and over ninety-nine percent for a Jordan block.
Four thousand 4x4 matrices attempted per construction. Random Gaussian entries are never defective; small integer entries are 2.675% of the time, because exact repeats become possible; a deliberately repeated eigenvalue is still never defective; only a Jordan block is, at 99.37%.

From the three-step figure. The eigenvector arrows are the thing to follow. In the first panel they point in two oblique directions; in the second they lie on the coordinate axes, which is what “change into the eigenbasis” means; in the third they have been stretched by 33 and 11; in the fourth they are back where they started, longer. The disc becomes an ellipse whose axes are the eigenvectors — and it becomes axis-aligned only in the middle two panels.

The measured numbers close the loop: the largest disagreement between Ax\mathbf{A}\mathbf{x} and the three-step chain, over 900900 points, is 4.44×10164.44\times10^{-16}. And PPI=2.22×1016\lVert\mathbf{P}^\top\mathbf{P} - \mathbf{I}\rVert = 2.22\times10^{-16}, confirming the matrix is symmetric enough for P1=P\mathbf{P}^{-1} = \mathbf{P}^\top to be used.

From the matrix-power figure. Two separate claims.

Accuracy. Over a thousand powers the two routes agree to 9.66×10159.66\times10^{-15} relative. There is no drift: repeated multiplication accumulates rounding error and the eigen route accumulates a different rounding error, and both stay at machine precision because this matrix has spectral radius 0.990.99 and its powers decay rather than grow.

Cost. The crossover for n=6n = 6 is k=14k = 14, and it is worth reading the counts rather than the curves: at k=13k = 13 repeated multiplication needs 25922592 multiplications against the eigen route’s 26052605; at k=14k = 14 it is 28082808 against 26062606. The eigen route pays a large fixed cost — about 12n312n^3 for the decomposition plus reassembly — and then almost nothing per power.

But the real argument for Equation 4.62 is not the flop count. It is that the eigen route gives an algebraic answer: (Ak)11=12(1+3k)(\mathbf{A}^k)_{11} = \tfrac12(1+3^k) for the worked example, valid for every kk at once, which no amount of matrix multiplication produces.

From the defectiveness figure. This is the figure that recalibrates the hypothesis. Textbooks introduce “non-defective” as a condition to worry about, and the measurement says:

constructionpercent defective
random Gaussian entries0.000%0.000\% (00 of 40004000)
small integer entries2.675%2.675\% (107107 of 40004000)
built with a repeated eigenvalue, diagonalizable by construction0.000%0.000\% (00 of 38113811)
a Jordan block, defective by construction99.37%99.37\% (37803780 of 38043804)

The last two denominators are smaller because those two families conjugate a diagonal matrix by a random S\mathbf{S} and skip the draw when detSvert<0.1\lvert\det\mathbf{S} vert < 0.1 rather than test through a near-singular conjugation. Counting a skipped draw as non-defective would have shown the last bar at 94.5%94.5\% and made a missing sample look like a numerical effect.

Defectiveness is not something random matrices do. It requires an exactly repeated eigenvalue, which requires exact arithmetic coincidences — so it happens for small-integer matrices 2.7%2.7\% of the time and essentially never for continuous entries. What it is common in is structured matrices, which is where your data actually comes from.

Even so the last bar falls 2424 short of its 38043804. That residue is not a counterexample — it is the tolerance. A badly conditioned conjugation makes the deficient eigenspace look full at any fixed threshold, which is the pitfall below.

eigendecomposition PDP1\mathbf{P}\mathbf{D}\mathbf{P}^{-1}SVD UΣV\mathbf{U}\boldsymbol{\Sigma}\mathbf{V}^\top
exists forsquare and non-defectiveevery matrix
shapeone space to itselfdomain to codomain, possibly different dimensions
outer factorsinvertible, generally not orthogonalboth orthogonal, so both are rotations
are the outer factors inverse to each other?yes, P\mathbf{P} and P1\mathbf{P}^{-1}no — different spaces
middle factoreigenvalues, possibly negative or complexsingular values, real and non-negative
for a symmetric positive definite matrixthe same thingthe same thing
gives matrix powers?yes, PDkP1\mathbf{P}\mathbf{D}^k\mathbf{P}^{-1}not directly
gives best low-rank approximation?noyes, §4.6

The last two rows are why both exist. §4.5 takes up the right-hand column.

pch.quizTag Check your understanding
  1. Why must the columns of P be eigenvectors, rather than merely some convenient basis?

    pch.quizShowAnswer

    B — Because multiplying out AP = PD column by column gives A p-i = lambda-i p-i for every i — the equation itself forces it, and nothing else satisfies it — Equations 4.51 and 4.52 do the multiplication. AP has columns A p-i and PD has columns lambda-i p-i, so equating them is the eigenvalue equation n times over.

  2. Theorem 4.20's hypothesis is that the eigenvectors form a basis. Where does that requirement come from?

    pch.quizShowAnswer

    B — From needing P to be invertible: Definition 4.19 requires an invertible P, invertible means full rank, and full rank for an n by n matrix means n linearly independent columns — which are the eigenvectors — So the hypothesis is exactly the negation of Definition 4.13's 'defective'. Distinct eigenvalues are sufficient by Theorem 4.12 but not necessary; what matters is that the eigenspace dimensions add to n.

  3. For Example 4.5, [[4,2],[1,3]], the decomposition works but P-transpose P differs from the identity by 0.3162. What does that mean?

    pch.quizShowAnswer

    B — P is invertible, so Theorem 4.20 holds, but the matrix is not symmetric so Theorem 4.21 does not apply and P is not orthogonal — meaning P-inverse is not P-transpose and the change of basis shears as well as turns — The reconstruction gap is 8.9e-16, so the factorisation is fine. Only the symmetric cases in that table have P-transpose P at machine precision, which is Theorem 4.21 being the stronger statement.

  4. Random 4x4 Gaussian matrices were never defective in 4000 trials; small-integer ones were 2.7% of the time. Why the difference?

    pch.quizShowAnswer

    B — Defectiveness needs an exactly repeated eigenvalue, which needs an exact arithmetic coincidence — impossible for continuous entries and merely uncommon for a small integer range — Which recalibrates the hypothesis: defectiveness is not a hazard of random data, it is a hazard of structured data, and structured is where real matrices come from.

  5. The eigen route to A-to-the-k becomes cheaper than repeated multiplication at k = 14 for n = 6. Is that the main argument for Equation 4.62?

    pch.quizShowAnswer

    B — No. The stronger argument is that it gives an algebraic formula — for the worked example the (1,1) entry of A-to-the-k is exactly one half of one plus three to the k, valid for every k at once, which no number of matrix multiplications produces — The measured values confirm the formula: 2, 5, 122, 29525 and 1743392201 at k = 1, 2, 5, 10 and 20. The flop crossover is real but secondary.

Exercise 1 – Example 4.11 in three steps

Section titled “Exercise 1 – Example 4.11 in three steps”

Exercise 2 – A closed form for the k-th power

Section titled “Exercise 2 – A closed form for the k-th power”

Exercise 3 – Check the hypothesis before trusting the factorisation

Section titled “Exercise 3 – Check the hypothesis before trusting the factorisation”

Exercise 4 – What numpy does with a defective matrix

Section titled “Exercise 4 – What numpy does with a defective matrix”

Exercise 5 – Powers collapse onto the dominant eigenvector

Section titled “Exercise 5 – Powers collapse onto the dominant eigenvector”
  • Diagonalizable means similar to a diagonal matrix: there is an invertible P with D equal to P-inverse A P, and similar matrices share their determinant, trace and spectrum.
  • The columns of P must be eigenvectors, because multiplying out A P = P D column by column gives the eigenvalue equation n times over.
  • Theorem 4.20 is an if and only if: the factorisation exists exactly when the eigenvectors form a basis — that is, exactly when the matrix is not defective.
  • Theorem 4.21: a symmetric matrix can always be diagonalized, and the spectral theorem makes P orthogonal, so P-inverse becomes P-transpose and no inverse is ever computed.
  • The geometry is three steps: P-inverse changes into the eigenbasis, D scales along those axes, P changes back. Only for a symmetric matrix are the two outer steps rotations.
  • A to the k equals P D-to-the-k P-inverse, because the inner pairs cancel — and that gives an algebraic formula, not merely a faster loop.
  • The determinant is the product of D’s diagonal, which is Theorem 4.16 arriving by another route.
  • Defectiveness is rare in random matrices and common in structured ones: zero of four thousand Gaussian matrices, 2.675 percent of small-integer ones, and 99.37 percent of Jordan blocks — and it is not numerically decidable, since a badly conditioned conjugation makes a deficient eigenspace look full at any fixed tolerance.
  • P orthogonal follows from symmetry, not from diagonalizability. For the non-symmetric Example 4.5, P-transpose P differs from the identity by 0.3162, because its two eigendirections meet at 71.6 degrees rather than 90.
  • Repeated eigenvalues make P non-unique up to a rotation within the eigenspace, which is a reproducibility hazard for anything reading individual eigenvector components.

Next: Singular Value Decomposition — the same idea with both hypotheses dropped.

pch.coffeeTagline

pch.coffeeCta

pch.feedbackHeading

pch.feedbackSubheading