Skip to main content

Physics V course sequence · Interactive lesson

Discretised states and matrix operators

Nothing in this unit is computable until |ψ⟩ becomes a column of numbers. Sample it on a uniform grid and the integrals turn into dot products, the operators into matrices, and numpy.linalg.eigh into a legitimate method. The price is a box, a spacing, and a boundary condition you now have to defend.

UPV-03.09 · Lesson 9 of 9 in this unit. Position is not a completion score.
Starting model: Discretised states and matrix operatorsKinetic energy against wavenumber for an electron on a grid of spacing Δx: dashed is the exact ħ²k²/2m, solid the three-point Laplacian band 4sin²(kΔx/2)⋅ħ²/2mΔx², faint the P⋅P band sin²(kΔx)⋅ħ²/2mΔx². At Δx = 0.20 nm the exact 0.610 eV at k = 4.00 nm⁻¹ falls to 0.578 eV, and Nyquist sits at 15.7 nm⁻¹.Δx = 0.20 nm kΔx = 0.80Nyquist π/Δx = 15.7 nm⁻¹at k = 4.00: 3-point 5.2% low, P⋅P 19.6% lowE / eVdashed exact ħ²k²/2mk / nm⁻¹ (0 to 8)solid three-point Laplacian faint P⋅P
Start with a picture. Change the model in the lab below.
1

Build the model

Every integral in this unit is a matrix product waiting for a grid.

The key idea

Discretisation replaces the state |ψ⟩ by its samples on a uniform grid, turning the Hilbert space into CN with inner product Δx ψ†φ, so every observable becomes an N×N Hermitian matrix and every expectation value a vector-matrix-vector product.

Example. An electron in a 1.00 nm box with N = 4 interior points has Δx = 0.20 nm, X = diag(0.20, 0.40, 0.60, 0.80) nm, and kinetic matrix (ħ²/2mΔx²)⋅tridiag(−1, 2, −1) whose prefactor is 0.952 eV.

The complete physical model and assumptions

Discretisation is a change of Hilbert space, not a numerical shortcut. Choose a box and N sample points a distance Δx apart, replace the vector |ψ⟩ by the column ψⱼ = ψ(xⱼ), and the L² inner product ∫φ*ψ dx becomes the trapezoidal sum Δx φ†ψ: CN under that weight is the space you are now working in. Every operator inherits a matrix. X is diagonal because multiplying by x acts pointwise, and its eigenvectors — the grid unit vectors — are this space's stand-in for the |x⟩ that never belonged to L². P has no pointwise action, so it becomes a stencil: the centred difference gives a Hermitian tridiagonal matrix, the FFT gives exact multiplication by ħk in the transformed basis. Expectation values collapse to ⟨A⟩ = Δx ψ†Aψ and eigenvalue problems to numpy.linalg.eigh. What it costs is everything the continuum kept in its boundary conditions. Truncating at N rows silently imposes ψ = 0 outside the box, or periodicity if you used the FFT; the spacing caps representable momentum at πħ/Δx and biases every kinetic eigenvalue low by (kΔx)²/12; and since Tr[A, B] = 0 for any two N×N matrices while Tr(iħI) = iħN, the canonical commutator cannot hold exactly at any N. In finite dimensions Hermitian and self-adjoint coincide, so the grid does not answer the domain question that made −iħ d/dx delicate on a half-line — it decides it for you, and you have to know which answer you wanted.

1The grid is a quadrature rule, and it changes the space

Fix a box of length L and N interior points xⱼ = jΔx with Δx = L/(N+1). Sampling replaces |ψ⟩ by the column (ψ₁ … ψN), and ∫φ*ψ dx by the sum Δx Σⱼ φⱼ*ψⱼ = Δx φ†ψ, which is the trapezoidal rule with the wall samples set to zero. That weight is not decoration: ψ carries units of m(−1/2), so ψ†ψ has units of m⁻¹ and only Δx ψ†ψ is dimensionless. Normalisation becomes Δx Σⱼ |ψⱼ|² = 1, and Born's rule for an interval becomes P(a < x < b) = Δx Σ |ψⱼ|² over the samples inside it. Two independent errors have already entered. The quadrature error in the inner product is O(Δx²) for a smooth ψ, and far smaller than that for one vanishing at both ends. The error in the operators, which is what the rest of this topic is about, is a separate account entirely. For L = 1.00 nm and N = 4, Δx = 0.20 nm and the samples sit at 0.20, 0.40, 0.60 and 0.80 nm: four complex numbers standing in for a function.

2X is diagonal, and that is all the position basis ever meant

Multiplication by x acts pointwise, so on the grid it is X = diag(x₁ … xN) and ⟨x⟩ = Δx Σⱼ xⱼ|ψⱼ|². Nothing is approximated: X is the position operator restricted to the sample points. Its eigenvectors are the unit columns eⱼ, and once rescaled by 1/√Δx they are this space's stand-in for |x⟩ — which is a genuine gain, because the continuum's position eigenkets are δ-normalised distributions outside L² while eⱼ is an honest vector in CN with an honest eigenvalue xⱼ. It is also a genuine loss. The grid has quietly declared the resolution of a position measurement to be Δx: structure in |ψ|² finer than 0.20 nm is simply not represented, and X² = diag(xⱼ²) inherits the same blindness, so ⟨x²⟩ is a four-term sum rather than an integral.

3P is a stencil, and only the centred one is Hermitian

p̂ = −iħ d/dx has no pointwise action, so it must be built from neighbours. The centred difference gives (Pψ)ⱼ = −iħ(ψⱼ₊₁ − ψⱼ₋₁)/2Δx, so Pⱼₖ = −iħ/2Δx for k = j + 1 and +iħ/2Δx for k = j − 1. Check the adjoint: (P†)ₖⱼ = (Pⱼₖ)*, which for k = j + 1 is (−iħ/2Δx)* = +iħ/2Δx, exactly the entry Pₖⱼ. Hermitian — and it is the centring that does it. Build P from the forward difference (ψⱼ₊₁ − ψⱼ)/Δx instead and the matrix carries entries above the diagonal and nothing below, so ‖P − P†‖ is of order ħ/Δx and grows as the grid is refined. On a real ψ that matrix returns a pure-imaginary ⟨p⟩, which is the fastest way to find the bug. The FFT route differs in kind: P = F†diag(ħkₙ)F with kₙ = 2πn/(NΔx) is exactly Hermitian and spectrally accurate, but it imposes periodic walls, so it solves a ring rather than a box.

4Every expectation is a sandwich; P⋅P is not the kinetic matrix

With matrices in hand, every question in this unit is linear algebra: ⟨A⟩ = Δx ψ†Aψ, Var(A) = Δx ψ†A²ψ − (Δx ψ†Aψ)², and H|n⟩ = Eₙ|n⟩ is one call to numpy.linalg.eigh. One trap deserves naming. The product P@P is not the three-point kinetic matrix. Applying the centred difference twice reaches out to 2Δx, and its plane-wave symbol is (ħ sin(kΔx)/Δx)², while the three-point Laplacian gives (2ħ sin(kΔx/2)/Δx)². Expand both: the three-point form is low by (kΔx)²/12, P⋅P by (kΔx)²/3, four times worse. At Δx = 0.20 nm and k = 4.0 nm⁻¹, the exact ħ²k²/2m is 0.610 eV, the three-point matrix returns 0.578 eV and P⋅P returns 0.490 eV. Worse still, sin(kΔx) vanishes at kΔx = π, so P⋅P assigns zero kinetic energy to the alternating vector (+1, −1, +1, −1, …) — the odd-even decoupling that makes the three-point second derivative the right choice inside a Hamiltonian.

5The wall and the spacing are two errors pointing opposite ways

Cutting the matrix off at N rows is the statement ψ₀ = ψN₊₁ = 0: a Dirichlet wall you never wrote down, which raises the energy of any state with amplitude beyond the box. The spacing pushes the other way. The eigenvalues of (ħ²/2mΔx²)tridiag(−1,2,−1) are exactly (2ħ²/mΔx²)sin²(nπΔx/2L), always below ħ²kₙ²/2m, by the factor 1 − (kₙΔx)²/12 to leading order. For an electron in a 1.00 nm box with N = 4, the prefactor ħ²/2mΔx² is 0.952 eV, and the ground level comes out at 0.364 eV against the exact 0.376 eV — 3.2% low, matching the predicted −(πΔx/L)²/12 = −3.3%. The fourth level is 3.45 eV against 6.02 eV, 43% low. That is the general shape: the bottom of a grid spectrum is trustworthy and the top is not, so keep kΔx well under 1 for every level you intend to quote. Beyond the Nyquist cut |k| ≤ π/Δx — 15.7 nm⁻¹, or 9.40 eV of kinetic energy, at Δx = 0.20 nm — the grid cannot represent the state at all.

6Finite dimensions hide the domain and cannot hold [x, p] = iħ

In CN, Hermitian and self-adjoint are one condition: a matrix equal to its conjugate transpose, no domain to state, no boundary term to check. That reads as a simplification and is really a concealment. The continuum question — which self-adjoint extension of −(ħ²/2m)d²/dx² you meant, whether −iħ d/dx has one at all on a half-line — has not been answered; the discretisation answered it for you when you chose a stencil and a truncation. The sharpest symptom is the canonical commutator. Since P is nonzero only on the first off-diagonals, [X, P]ⱼₖ = (xⱼ − xₖ)Pⱼₖ gives [X, P] = (iħ/2)(S₊ + S₋), a matrix with no diagonal at all, eigenvalues iħcos(nπ/(N+1)) and trace zero. It cannot equal iħI at any N, because Tr[A, B] = 0 for any two finite matrices while Tr(iħIN) = iħN. What does converge is the expectation on states the grid resolves: ⟨[X, P]⟩ = iħ[1 − Δx²⟨p²⟩/2ħ²].

2

Key equations

Read the units, assumptions and limits before substituting.

Grid samples and the discrete inner product

xⱼ = x₀ + jΔx · ⟨φ|ψ⟩ → Δx Σⱼ φⱼ* ψⱼ

Turns every integral in this unit into one weighted dot product.

ψⱼ = ψ(xⱼ) in m(−1/2), Δx in m; normalisation is Δx ψ†ψ = 1

Position operator, exactly diagonal

X = diag(x₁ … xN) · ⟨x⟩ = Δx Σⱼ xⱼ |ψⱼ|²

Its eigenvectors eⱼ are the grid's normalisable stand-in for the δ-normalised |x⟩.

entries in m and real, so X = X† with no work; X² = diag(xⱼ²)

Momentum from the centred difference

(Pψ)ⱼ = −iħ(ψⱼ₊₁ − ψⱼ₋₁)/2Δx, Pⱼₖ = ∓iħ/2Δx for k = j ± 1

A forward difference leaves ‖P − P†‖ ~ ħ/Δx and returns an imaginary ⟨p⟩ on a real ψ.

entries in kg m s⁻¹; P = P† only because the stencil is centred

Momentum by FFT on a periodic grid

P = F† diag(ħkₙ) F, kₙ = 2πn/(NΔx), |k| ≤ π/Δx

Exactly Hermitian and spectrally accurate, but it wires in periodic walls, not a box.

F the unitary DFT matrix; n from −N/2 to N/2 − 1; ħkₙ in kg m s⁻¹

Kinetic matrix and its dispersion

T = (ħ²/2mΔx²)tridiag(−1,2,−1), E(k) = (2ħ²/mΔx²)sin²(kΔx/2)

Expands to (ħ²k²/2m)[1 − (kΔx)²/12], so a grid always biases levels low.

for an electron at Δx = 0.20 nm, ħ²/2mΔx² = 0.952 eV; band top 4× that

The commutator no finite grid can hold

[X, P] = (iħ/2)(S₊ + S₋), Tr[X, P] = 0 ≠ iħN = Tr(iħIN)

⟨[X, P]⟩ → iħ[1 − Δx²⟨p²⟩/2ħ²] on smooth states, but the operator identity never holds.

S± shift by one site; eigenvalues of [X, P] are iħcos(nπ/(N+1))
3

Interactive lab

Predict first. Explore the model. Compare the result.

Explore the model

0.20 nm
0.1 to 0.38 nm; steps of 0.02.
4.00 nm⁻¹
0.5 to 7.5 nm⁻¹; steps of 0.25.

Try this. Hold k at 4 nm⁻¹ and drag Δx from 0.10 to 0.38 nm: the exact parabola never moves while both grid bands sag away from it, the three-point band by (kΔx)²/12 and the P⋅P band by (kΔx)²/3. Watch the faint P⋅P curve dive back towards zero as kΔx approaches π.

Live results

EXACT ħ²k²/2m
0.610 eV
THREE-POINT LAPLACIAN
0.578 eV
P⋅P, CENTRED STENCIL
0.490 eV
NYQUIST k = π/Δx
15.7 nm⁻¹

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

Interactive Physics V modelKinetic energy against wavenumber for an electron on a grid of spacing Δx: dashed is the exact ħ²k²/2m, solid the three-point Laplacian band 4sin²(kΔx/2)⋅ħ²/2mΔx², faint the P⋅P band sin²(kΔx)⋅ħ²/2mΔx². At Δx = 0.20 nm the exact 0.610 eV at k = 4.00 nm⁻¹ falls to 0.578 eV, and Nyquist sits at 15.7 nm⁻¹.Δx = 0.20 nm kΔx = 0.80Nyquist π/Δx = 15.7 nm⁻¹at k = 4.00: 3-point 5.2% low, P⋅P 19.6% lowE / eVdashed exact ħ²k²/2mk / nm⁻¹ (0 to 8)solid three-point Laplacian faint P⋅P
Kinetic energy against wavenumber for an electron on a grid of spacing Δx: dashed is the exact ħ²k²/2m, solid the three-point Laplacian band 4sin²(kΔx/2)⋅ħ²/2mΔx², faint the P⋅P band sin²(kΔx)⋅ħ²/2mΔx². At Δx = 0.20 nm the exact 0.610 eV at k = 4.00 nm⁻¹ falls to 0.578 eV, and Nyquist sits at 15.7 nm⁻¹.

Predict → change one variable → check

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

Saved baseline. Grid spacing Δx: 0.20 nm; Wavenumber k: 4.00 nm⁻¹

Baseline 0.20; choose 0.1 to 0.38, in steps of 0.02.
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

The tempting reading is that the grid matrices are the operators merely truncated, so that refining Δx must drive [X, P] towards iħI. It cannot. Tr[A, B] = 0 for any two N×N matrices while Tr(iħIN) = iħN, so no spacing and no N ever produce the canonical commutator: the failure is structural, not a truncation error. What converges is ⟨ψ|[X, P]|ψ⟩, and only on states smooth over Δx, where it equals iħ[1 − Δx²⟨p²⟩/2ħ²]; on the most oscillatory grid vector it comes out near −iħ, the wrong sign. The same confusion produces the everyday version of the mistake — treating P@P as the kinetic matrix, when P⋅P is a stencil on j − 2, j and j + 2 that skips the nearest neighbours, is four times less accurate and hands the alternating vector zero energy.

5

Practice & worked examples

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

EasyExample 1

An electron sits in a 1.00 nm infinite box. Discretise it with N = 4 interior points: write down X and the kinetic matrix, then get the lowest grid eigenvalue and compare it with the exact ground state.

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

On a grid of spacing Δx = 0.20 nm an electron state is close to a plane wave with k = 4.0 nm⁻¹. Find the kinetic energy returned by the exact operator, by the three-point Laplacian, and by P⋅P built from the centred difference. Rank them and say why.

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

An electron is sampled at spacing Δx = 0.20 nm in a minimum-uncertainty Gaussian with ⟨p⟩ = 0 and position width σ = 0.50 nm. (a) Evaluate ⟨[X, P]⟩ for the centred-difference matrices. (b) What spacing would cut the shortfall to 0.1%? (c) Show that no spacing removes it from the operator itself.

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.

On an N-point grid with X = diag(xⱼ) and P built from the centred difference, you form the matrix [X, P] and then refine the spacing Δx. What happens?
7

Review & continue

Discretisation replaces the state |ψ⟩ by its samples on a uniform grid, turning the Hilbert space into CN with inner product Δx ψ†φ, so every observable becomes an N×N Hermitian matrix and every expectation value a vector-matrix-vector product.

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