Skip to main content

Physics V course sequence · Interactive lesson

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.

UPV-01.06 · Lesson 6 of 9 in this unit. Position is not a completion score.
Starting model: Matrices, eigenvalues, and diagonalisationSpectrum of the real symmetric matrix H = [[d, b], [b, −d]] — half-trace zero, half-gap d, coupling b — as the detuning d sweeps left to right. Dashed lines are the uncoupled levels a = ±d; solid curves the eigenvalues a± = ±√(d² + b²), holding a minimum gap 2b = 2.0 at d = 0. At the marker, d = 1.6: gap 3.77 and mixing angle θ = 16.0°, defined by tan 2θ = b/d with |a₊⟩ = (cos θ, sin θ) in the basis |1⟩, |2⟩.H = [[d, b], [b, −d]]a± = ±√(d² + b²)energy adetuning dd = −4d = +4dashed: b = 0, a = ±d crosssolid: b > 0, levels repel
Start with a picture. Change the model in the lab below.
1

Build the model

The eigenvalue problem is the measurement question written in matrix form.

The key idea

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).

The complete physical model and assumptions

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.

1A 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.

2Read 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.

3Solve 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.

4Hermiticity 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.

5Past 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.

6What 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.

2

Key equations

Read the units, assumptions and limits before substituting.

Operator to matrix

Aᵢⱼ = ⟨i|A|j⟩

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

Eigenvalue equation

A|ψ⟩ = a|ψ⟩, |ψ⟩ ≠ 0

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

Characteristic polynomial

det(A − aI) = 0

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

2×2 Hermitian spectrum

a± = (α+γ)/2 ± √[(α−γ)²/4 + |β|²]

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

Unitary diagonalisation

U†AU = diag(a₁,…, aₙ) ⇔ A = Σₖ aₖ|k⟩⟨k|

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

Numerical route

a, V = 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³)
3

Interactive lab

Predict first. Explore the model. Compare the result.

Explore the model

1.6
−4 to 4; steps of 0.2.
1.0
0 to 3; steps of 0.1.

Try this. 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.

Live results

UPPER EIGENVALUE a₊
1.89
GAP a₊ − a₋
3.77
MIXING ANGLE θ
16.0 °
WEIGHT |⟨1|a₊⟩|²
0.92

Results follow this lesson’s model and assumptions. Displayed values are rounded.

Interactive Physics V modelSpectrum of the real symmetric matrix H = [[d, b], [b, −d]] — half-trace zero, half-gap d, coupling b — as the detuning d sweeps left to right. Dashed lines are the uncoupled levels a = ±d; solid curves the eigenvalues a± = ±√(d² + b²), holding a minimum gap 2b = 2.0 at d = 0. At the marker, d = 1.6: gap 3.77 and mixing angle θ = 16.0°, defined by tan 2θ = b/d with |a₊⟩ = (cos θ, sin θ) in the basis |1⟩, |2⟩.H = [[d, b], [b, −d]]a± = ±√(d² + b²)energy adetuning dd = −4d = +4dashed: b = 0, a = ±d crosssolid: b > 0, levels repel
Spectrum of the real symmetric matrix H = [[d, b], [b, −d]] — half-trace zero, half-gap d, coupling b — as the detuning d sweeps left to right. Dashed lines are the uncoupled levels a = ±d; solid curves the eigenvalues a± = ±√(d² + b²), holding a minimum gap 2b = 2.0 at d = 0. At the marker, d = 1.6: gap 3.77 and mixing angle θ = 16.0°, defined by tan 2θ = b/d with |a₊⟩ = (cos θ, sin θ) in the basis |1⟩, |2⟩.

Predict → change one variable → check

Plan a change before running it. Every other input stays at the saved baseline.

Saved baseline. Detuning d (diagonal): 1.6; Coupling b (off-diagonal): 1.0

Baseline 1.6; choose −4 to 4, in steps of 0.2.
4. Compared with the saved baseline, this result will…

This experiment is kept only while this page is open. It does not change saved course progress.

4

Catch the common trap

Having n eigenvalues does not mean having n eigenvectors. The characteristic polynomial of any n×n matrix always delivers n roots over ℂ counted with multiplicity, and students slide from that to "every matrix can be diagonalised". The two counts are different things: a root's algebraic multiplicity can exceed the dimension of its eigenspace, the geometric multiplicity. The double root 1 of [[1, 1],[0, 1]] comes with a one-dimensional eigenspace, so its eigenvectors cannot span ℂ² and there is no basis in which the matrix is diagonal. What protects quantum mechanics is not luck but the postulate that observables are Hermitian: the spectral theorem then forces the two multiplicities to agree and hands over a complete orthonormal eigenbasis. The guarantee is bought by Hermiticity, not by the existence of eigenvalues.

5

Practice & worked examples

3 authored examples. Make an attempt, then reveal the reasoning one step at a time.

EasyExample 1

Diagonalise 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)σₓ.

Sketch your answer or reasoning, then compare it with the authored solution. Your writing is not automatically graded or saved.

0 of 4 steps revealed.

MediumExample 2

A 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.

Sketch your answer or reasoning, then compare it with the authored solution. Your writing is not automatically graded or saved.

0 of 5 steps revealed.

HardExample 3

Diagonalise 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.

Sketch your answer or reasoning, then compare it with the authored solution. Your writing is not automatically graded or saved.

0 of 5 steps revealed.

6

Quick check

Select an answer and explain it before checking.

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?
7

Review & continue

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.

  • Explain the relationship without looking at the equation.
  • Check a sign, a unit and a model assumption in your working.
  • Return to the lab or worked example if a step is still unclear.

Extra challenging questions

Connect several ideas, explore supplied data, and compare your reasoning with a worked solution.