University Physics V · Mathematical Foundations of Quantum Physics · 1.6
Matrices, eigenvalues, and diagonalisation
Choose a basis and every operator becomes a grid of complex numbers. This lesson is the machinery for interrogating that grid: extract the eigenvalues a measurement can return, build the basis in which the matrix turns diagonal, and know when the characteristic polynomial must give way to numpy.linalg.eigh.
Build the model
Connect the measurement to the mechanism.
Quantum mechanics is written with operators, but calculation happens with numbers, and a basis is the bridge: sandwiching an operator between orthonormal basis vectors, Aᵢⱼ = ⟨i|A|j⟩, turns it into an n×n complex array, and a different basis turns the same operator into a different array with the same trace, determinant and spectrum. The eigenvalue problem A|ψ⟩ = a|ψ⟩ asks for the directions the operator only rescales, and the physical postulates make that the central question: the eigenvalues are the only values a measurement of A can return, and the eigenvectors are the states that return them with certainty. Diagonalisation is nothing more than moving to the eigenvector basis, where the matrix carries its spectrum on the diagonal and any function of the operator acts componentwise.
The costs are equally concrete. Expanding det(A − aI) = 0 is feasible for two or three rows and a numerical trap beyond, so real work goes through unitary transformations inside numpy.linalg.eigh. And nothing guarantees an eigenbasis in general — a defective matrix has n eigenvalues but too few eigenvectors.
Every guarantee this course leans on — real eigenvalues, orthogonal eigenvectors, a complete basis — is bought by one hypothesis, Hermiticity, which is exactly why the postulates demand it of every observable.
- Simple definition
- Diagonalising a matrix means changing to the basis of its eigenvectors, where the operator acts by pure rescaling: U†AU = diag(a₁, …, aₙ); a Hermitian matrix always grants this, with real aₖ and orthonormal columns in U.
- Example
- The Hermitian matrix [[2, i],[−i, 2]] has eigenvalues 2 ± 1 = 3 and 1 — real despite the imaginary entries — with orthonormal eigenvectors (i, 1)/√2 and (−i, 1)/√2; in that basis the same operator reads diag(3, 1).
Same operator, new basis, new numbers: the matrix is the shadow, the operator the object.
orthonormal basis (|i⟩); n² complex numbers stand in for the operator
The measurement statement: a state on which the observable A takes the sharp value a.
a is a scalar eigenvalue; |ψ⟩ a direction A merely rescales
A nonzero null vector of A − aI needs a vanishing determinant; by hand the expansion ends at n = 3.
degree n in a; roots are the eigenvalues, counted with algebraic multiplicity
The square root never drops below |β|, so the two levels stay at least 2|β| apart: the avoided crossing in one line.
H = [[α, β],[β*, γ]]; α, γ real diagonal entries, β the complex coupling
Exists exactly for normal matrices, [A, A†] = 0; Hermitian A adds real aₖ on the diagonal.
columns of U are the orthonormal eigenvectors |k⟩; U†U = I
numpy.linalg.eigh(A)Hermitian input is assumed, not verified: a non-Hermitian array is silently symmetrised, so confirm A = A† first or use eig.
Hermitian input; ascending real eigenvalues in a, orthonormal eigenvector columns in V; cost O(n³)
A matrix is an operator wearing a basis
The operator is the physical object; the matrix is its appearance in a chosen basis. Insert two resolutions of the identity, A = Σᵢⱼ |i⟩⟨i|A|j⟩⟨j|, and the n² numbers Aᵢⱼ = ⟨i|A|j⟩ are everything the basis (|i⟩) can know about A. Move to another orthonormal basis with a unitary U and the array transforms by similarity, A′ = U†AU — different entries, identical trace, determinant and eigenvalues, because those belong to the operator, not to the representation. Concretely: Sz is (ħ/2)⋅diag(1, −1) in its own eigenbasis, but written in the eigenbasis of Sₓ the same operator becomes (ħ/2)[[0, 1],[1, 0]] — nothing physical changed, only the coordinates. Off-diagonal entries are the basis-dependent statement that A maps |j⟩ partly onto |i⟩; a matrix is diagonal precisely in a basis built from its own eigenvectors.
Read A|ψ⟩ = a|ψ⟩ before computing it
An eigenvector is a direction the operator does not rotate, only rescales, and the eigenvalue a is the factor. In quantum mechanics the equation carries the measurement content of the theory: measure A on its eigenstate |ψ⟩ and the result is a with certainty; measure it on anything else and the possible results are still only the eigenvalues. A nonzero solution of (A − aI)|ψ⟩ = 0 exists exactly when A − aI is singular, so the eigenvalues are the roots of det(A − aI) = 0 — degree n, hence n roots over ℂ counted with multiplicity. Two invariants come free and check every hand calculation: the eigenvalues sum to the trace and multiply to the determinant. For any traceless 2×2 with determinant −1 — all three Pauli matrices — that alone forces a₊ + a₋ = 0 and a₊a₋ = −1, so a = ±1 with no polynomial solved at all.
Solve the 2×2 Hermitian once, use it all course
Write the general 2×2 Hermitian matrix as H = [[α, β],[β*, γ]] with α, γ real, and name the half-trace m = (α+γ)/2 and half-gap d = (α−γ)/2. The characteristic polynomial collapses to (a − m)² = d² + |β|², so a± = m ± √(d² + |β|²) — memorise it, because spin-½ in a magnetic field, the two-level atom and every qubit Hamiltonian to come are this line. For real β the eigenvectors are (cos θ, sin θ) and (−sin θ, cos θ) with tan 2θ = 2β/(α−γ). Numbers: H = [[5.0, 1.5],[1.5, 1.0]] has m = 3.0 and d = 2.0, so a± = 3.0 ± √(4.0 + 2.25) = 5.5 and 0.5. The formula also carries a structural lesson: the splitting 2√(d² + |β|²) is at least 2|β|, so as any parameter sweeps the diagonal through resonance the two levels close to 2|β| and repel rather than cross — the avoided crossing drawn in the figure below.
Hermiticity is the guarantee; defective is the failure
The spectral theorem is the payoff for demanding A† = A: every eigenvalue is real, eigenvectors of distinct eigenvalues are automatically orthogonal, and even a degenerate eigenvalue supplies a full eigenspace inside which Gram-Schmidt builds an orthonormal set — so a complete orthonormal eigenbasis always exists and U†AU = diag(a₁,…, aₙ). Drop the hypothesis and diagonalisation can fail outright. Take [[1, 1],[0, 1]]: the characteristic polynomial (1 − a)² promises the eigenvalue 1 twice, but A − I = [[0, 1],[0, 0]] has rank 1, so its null space is the single line through (1, 0). Algebraic multiplicity 2 against geometric multiplicity 1 is the definition of a defective matrix, and no similarity transform will ever make it diagonal. The exact boundary of unitary diagonalisability is normality, [A, A†] = 0, which also admits unitary and anti-Hermitian matrices; observables sit safely inside it by postulate.
Past 3×3, never form the polynomial
By hand the characteristic polynomial ends at 3×3; numerically it should never be formed at all, because polynomial roots respond violently to tiny changes in coefficients — Wilkinson's example perturbs one coefficient of a degree-20 polynomial by 2⁻²³ and scatters its roots across the complex plane. Library routines instead apply a sequence of unitary similarity transforms to the matrix itself, which cannot amplify error because unitaries preserve norms. numpy.linalg.eigh takes a Hermitian matrix and returns ascending real eigenvalues with orthonormal eigenvector columns; numpy.linalg.eig handles the general case, where eigenvalues may be complex, columns need not be orthogonal, and a nearly defective matrix betrays itself through nearly parallel eigenvectors. One trap deserves a label: eigh reads only one triangle of the array and assumes symmetry for the rest, so a matrix that is not actually Hermitian is silently replaced by one that is. Check max|A − A†| before calling, and ‖Av − av‖ after.
What the eigenbasis buys
Diagonalisation is a one-time cost that makes everything after it componentwise. In its eigenbasis A = Σ aₖ|k⟩⟨k|, so powers, inverses (when no aₖ vanishes) and arbitrary functions come by acting on the spectrum alone: f(A) = Σ f(aₖ)|k⟩⟨k| — the identity that will define exp(−iHt/ħ) in Unit 4 without summing a single matrix series. A state expands as |ψ⟩ = Σ cₖ|k⟩ with cₖ = ⟨k|ψ⟩, and |cₖ|² is the probability that a measurement returns aₖ. One honesty clause: a degenerate eigenvalue of multiplicity m fixes an m-dimensional eigenspace, not particular vectors, so any orthonormal frame inside it is equally an answer. When eigh returns eigenvalues [0, 3, 3] for the matrix in the hard example below, its two a = 3 columns are one legitimate choice among a continuum — compare the subspaces they span, never the columns entry by entry.
Change one variable at a time
Make the relationship visible.
Set b = 0.4 and slide d from −4 to +4: θ falls from near 90° through 45° at d = 0 to near 0° as the eigenvectors trade character while the levels repel; then drive b to 0 and the gap closes into a true crossing.
UPPER EIGENVALUE a₊1.89
GAP a₊ − a₋3.77
MIXING ANGLE θ16.0 °
WEIGHT |⟨1|a₊⟩|²0.92
Live interpretationUPPER EIGENVALUE a₊: 1.89. GAP a₊ − a₋: 3.77. MIXING ANGLE θ: 16.0 °. WEIGHT |⟨1|a₊⟩|²: 0.92
Catch the common trap
Explain before calculating.
The Pauli matrix σy = [[0, −i],[i, 0]] has purely imaginary entries. A student is asked for its eigenvalues and eigenvectors. Which analysis is correct?
Choose an answer to test the model.
Practice & worked examples
Reason from the model, then test the result.
EasyDiagonalise the Pauli matrix σₓ = [[0, 1],[1, 0]]: find its eigenvalues and normalised eigenvectors, build the unitary U, and state what the result means for a measurement of Sₓ = (ħ/2)σₓ.
- Characteristic polynomial: det(σₓ − aI) = det[[−a, 1],[1, −a]] = a² − 1 = 0, so a = +1 and a = −1. Check the free invariants: trace 0 = 1 + (−1) ✓ and determinant −1 = (1)(−1) ✓.
- Eigenvector for a = +1: (σₓ − I)v = 0 gives −v₁ + v₂ = 0, so v ∝ (1, 1); normalised, |+⟩ = (1, 1)/√2. For a = −1: v₁ + v₂ = 0 gives |−⟩ = (1, −1)/√2.
- Orthogonality is automatic for a Hermitian matrix: ⟨+|−⟩ = (1⋅1 + 1⋅(−1))/2 = 0. Place the eigenvectors as columns: U = (1/√2)[[1, 1],[1, −1]], unitary since U†U = I.
- Then U†σₓU = diag(+1, −1): the operator rescales each eigendirection and does nothing else. Physically, a measurement of Sₓ = (ħ/2)σₓ can return only ±ħ/2, and returns them with certainty on |±⟩.
Answera = ±1 with eigenvectors (1, ±1)/√2; U = (1/√2)[[1, 1],[1, −1]] gives U†σₓU = diag(+1, −1), so a measurement of Sₓ returns only ±ħ/2.
MediumA two-level system has Hamiltonian H = [[5.0, 1.5],[1.5, 1.0]] eV in the basis (|1⟩, |2⟩). Find the energy eigenvalues and eigenvectors, and the probability that the state |1⟩ = (1, 0) returns the upper energy when H is measured.
- Name the pieces of the closed form: half-trace m = (5.0 + 1.0)/2 = 3.0 eV, half-gap d = (5.0 − 1.0)/2 = 2.0 eV, coupling β = 1.5 eV.
- E± = m ± √(d² + β²) = 3.0 ± √(4.0 + 2.25) = 3.0 ± 2.5, so E₊ = 5.5 eV and E₋ = 0.5 eV.
- Check against the invariants: E₊ + E₋ = 6.0 eV = tr H ✓ and E₊E₋ = 2.75 eV² = det H = 5.0 − 2.25 ✓.
- Eigenvector for 5.5 eV: (5.0 − 5.5)v₁ + 1.5v₂ = 0 gives v₂ = v₁/3, so |E₊⟩ = (3, 1)/√10; its orthogonal partner is |E₋⟩ = (−1, 3)/√10. Verify: H(3, 1)ᵀ = (16.5, 5.5)ᵀ = 5.5⋅(3, 1)ᵀ ✓.
- Born rule: P(E₊) = |⟨E₊|1⟩|² = (3/√10)² = 0.90 and P(E₋) = (−1/√10)² = 0.10 — summing to 1 because the eigenbasis is complete.
AnswerE₊ = 5.5 eV with |E₊⟩ = (3, 1)/√10; E₋ = 0.5 eV with |E₋⟩ = (−1, 3)/√10; P(E₊) = 0.90.
HardDiagonalise A = [[2, −1, −1],[−1, 2, −1],[−1, −1, 2]] without expanding the 3×3 determinant, using structure and invariants. Then say exactly what numpy.linalg.eigh(A) would return, and why its degenerate eigenvectors may differ from yours.
- Every row sums to zero, so A(1, 1, 1)ᵀ = 0: eigenvalue a₁ = 0 with eigenvector |v₁⟩ = (1, 1, 1)/√3. The trace, tr A = 6, then leaves a₂ + a₃ = 6.
- Guess that the cyclic symmetry splits the remainder evenly and test it: A(1, −1, 0)ᵀ = (3, −3, 0)ᵀ = 3⋅(1, −1, 0)ᵀ, so a₂ = 3 and a₃ = 6 − 3 = 3. Spectrum {0, 3, 3}, consistent with det A = 0⋅3⋅3 = 0 for this singular matrix.
- The a = 3 eigenspace is the whole plane orthogonal to (1, 1, 1). Choose one orthonormal pair inside it: |v₂⟩ = (1, −1, 0)/√2 and |v₃⟩ = (1, 1, −2)/√6; check A(1, 1, −2)ᵀ = (3, 3, −6)ᵀ = 3⋅(1, 1, −2)ᵀ ✓.
- Spectral form: A = 0⋅P₀ + 3(I − P₀) = 3(I − |v₁⟩⟨v₁|). Multiply out: diagonal 3(1 − 1/3) = 2 and off-diagonal 3(0 − 1/3) = −1, reproducing A exactly — the matrix is 3 times the projector off the symmetric state.
numpy.linalg.eigh(A) returns eigenvalues [0., 3., 3.] in ascending order, first column ±(1, 1, 1)/√3, then some orthonormal pair spanning the a = 3 plane — an arbitrary rotation of yours, because a degenerate eigenvalue fixes the subspace, not the vectors. Compare spans, or check ‖Av − 3v‖, never columns.
AnswerEigenvalues {0, 3, 3}; eigenbasis (1,1,1)/√3 plus any orthonormal pair in the orthogonal plane, e.g. (1,−1,0)/√2 and (1,1,−2)/√6; spectrally A = 3(I − |v₁⟩⟨v₁|).