Quantum Mechanics

From postulates to Hilbert space, Schrödinger's equation to uncertainty — with proofs, GNU Octave code, and live interactives. A complete, hands-on guide.

Five Postulates

Quantum mechanics rests on five operational postulates. Everything else — operators, spectra, uncertainty — follows from linear algebra in a complex Hilbert space.

  1. State: System described by normalized $|\psi\rangle$ in complex Hilbert space $\mathcal H$, $\langle\psi|\psi\rangle=1$
  2. Observables: Physical quantities are linear Hermitian operators $\hat A^\dagger=\hat A$
  3. Measurement: Outcome is eigenvalue $a_n$ of $\hat A$, probability $|\langle a_n|\psi\rangle|^2$ (Born rule)
  4. Collapse: After measurement, state becomes $|a_n\rangle$
  5. Evolution: $i\hbar\frac{d}{dt}|\psi(t)\rangle = \hat H |\psi(t)\rangle$ with unitary $\hat U(t)=e^{-i\hat H t/\hbar}$
Intuition: $|\psi\rangle$ is a direction. Hermitian operators are real-axis rulers. Unitary evolution is rotation — length (probability) never changes.

Mathematics — Hilbert Space

States are vectors. Observables are matrices (in a basis). The inner product $\langle\phi|\psi\rangle = \int \phi^*(x)\psi(x)\,dx$ gives probability amplitudes.

  • Hermitian: $\hat A^\dagger = \hat A$ → real eigenvalues, orthogonal eigenvectors
  • Unitary: $\hat U^\dagger \hat U = I$ → preserves norm, describes time evolution and symmetries
  • Commutator: $[\hat A,\hat B] = \hat A\hat B - \hat B\hat A$ measures incompatibility
  • Spectral theorem: $\hat A = \sum_n a_n |a_n\rangle\langle a_n|$
ObjectPosition rep.Meaning
$\hat x$$x\cdot$multiply by x
$\hat p$$-i\hbar\partial_x$generator of translations
$[\hat x,\hat p]$$i\hbar$canonical
$\hat H$$-\frac{\hbar^2}{2m}\partial_x^2+V(x)$energy

Schrödinger Equation

The Schrödinger equation is the eigenvalue problem for energy, derived from de Broglie $p=\hbar k$, $E=\hbar\omega$.

Time-dependent

$$i\hbar\frac{\partial\Psi(x,t)}{\partial t} = \left[-\frac{\hbar^2}{2m}\nabla^2 + V(x)\right]\Psi(x,t)$$

Time-independent

$$\hat H\psi_n(x) = E_n\psi_n(x),\quad \Psi_n(x,t)=\psi_n(x)e^{-iE_n t/\hbar}$$

Solutions form a complete basis. Any state evolves as $|\psi(t)\rangle = \sum_n c_n e^{-iE_n t/\hbar}|n\rangle$.

Key Proofs

1. General Uncertainty Principle

Define $\Delta A^2 = \langle(\hat A-\langle A\rangle)^2\rangle$. Let $|\alpha\rangle=(\hat A-\langle A\rangle)|\psi\rangle$, $|\beta\rangle=(\hat B-\langle B\rangle)|\psi\rangle$. By Cauchy–Schwarz, $|\langle\alpha|\beta\rangle|^2 \le \langle\alpha|\alpha\rangle\langle\beta|\beta\rangle = \Delta A^2\Delta B^2$.

Write $\langle\alpha|\beta\rangle = \tfrac12\langle\{\tilde A,\tilde B\}\rangle + \tfrac12\langle[\tilde A,\tilde B]\rangle$. Imaginary part gives:

$$\Delta A\,\Delta B \ge \frac12|\langle[\hat A,\hat B]\rangle|$$

For $[\hat x,\hat p]=i\hbar$: $\Delta x\,\Delta p \ge \hbar/2$. Not about measurement disturbance — it's about Fourier breadth.

2. Ehrenfest Theorem

$$\frac{d}{dt}\langle\hat A\rangle = \frac{i}{\hbar}\langle[\hat H,\hat A]\rangle + \langle\partial_t\hat A\rangle$$

Proof: differentiate $\langle\psi|\hat A|\psi\rangle$, use $i\hbar|\dot\psi\rangle=\hat H|\psi\rangle$ and Hermitian conjugate. For $\hat H=\hat p^2/2m+V(\hat x)$:

$$\frac{d}{dt}\langle x\rangle = \frac{\langle p\rangle}{m},\quad \frac{d}{dt}\langle p\rangle = -\langle V'(x)\rangle$$

Expectation values follow classical equations on average.

3. Normalization Conservation

$$\frac{d}{dt}\langle\psi|\psi\rangle = \frac{i}{\hbar}\langle\psi|\hat H^\dagger-\hat H|\psi\rangle =0$$ Since $\hat H^\dagger=\hat H$, evolution is unitary.

4. No-Cloning Theorem

Assume linear unitary $\hat U$ clones: $\hat U|\psi\rangle|0\rangle = |\psi\rangle|\psi\rangle$. For $|\phi\rangle$, same. By linearity on $|\psi\rangle+|\phi\rangle$, we get cross terms → contradiction unless $|\psi\rangle=|\phi\rangle$. Hence no universal cloner.

GNU Octave — Worked Examples

Copy-paste into Octave (set $\hbar=m=1$ unless noted). These are production-ready minimal scripts.

1. Particle in 1D box — eigenstates (finite-difference)

% box.m — Dirichlet boundaries
L=1; N=500; x=linspace(0,L,N)'; dx=L/(N-1);
e=ones(N,1); Lap = spdiags([e -2*e e], -1:1, N, N)/dx^2;
Lap(1,:)=0; Lap(1,1)=1; Lap(N,:)=0; Lap(N,N)=1;
H = -0.5*Lap; % hbar=m=1
[psi,E] = eigs(H,5,'sm'); E=diag(E);
plot(x,psi); legend('n=1','n=2','n=3','n=4','n=5');
title('Box eigenstates'); xlabel('x');
% Analytic: E_n = n^2*pi^2/(2 L^2)

2. Harmonic oscillator — ladder operators

% ho.m
N=80; a = diag(sqrt(1:N-1),1); ad = a';
x = (a+ad)/sqrt(2); p = 1i*(ad-a)/sqrt(2);
H = 0.5*(p*p + x*x);
[V,D]=eig(H); energies=diag(D)(1:7)'
% ≈ 0.5, 1.5, 2.5, ...

3. Free Gaussian wave packet — dispersion

% wavepacket.m — split-step Fourier
N=1024; L=40; x=linspace(-L/2,L/2,N)'; dx=x(2)-x(1);
k0=5; sigma=1; x0=-8;
psi = exp(-(x-x0).^2/(2*sigma^2)).*exp(1i*k0*x);
psi = psi/norm(psi)/sqrt(dx);
k = 2*pi*[0:N/2-1 -N/2:-1]'/L;
dt=0.005;
for t=0:dt:1.5
  psi = ifft(exp(-1i*0.5*k.^2*dt).*fft(psi));
endfor
plot(x,abs(psi).^2); title('|\psi(x,t)|^2 after dispersion');

4. Tunneling — rectangular barrier

% tunnel.m
hbar=1; m=1; V0=1; a=1; E=0.5;
k=sqrt(2*m*E)/hbar; kappa=sqrt(2*m*(V0-E))/hbar;
T = 1/(1 + (V0^2 * sinh(kappa*a)^2)/(4*E*(V0-E)));
printf('T = %.4f\n', T);

5. Numerical uncertainty product (ground state box)

% uncertainty.m — uses psi from box.m
psi1 = psi(:,1); psi1 = psi1/sqrt(trapz(x,abs(psi1).^2));
x1 = trapz(x, conj(psi1).*x.*psi1);
x2 = trapz(x, conj(psi1).*(x.^2).*psi1);
dx = sqrt(x2 - x1^2);
% momentum via FFT
dk = 2*pi/L; kgrid = (-N/2:N/2-1)'*dk; shift = N/2+1;
psik = fftshift(fft(psi1))*dx/sqrt(2*pi);
psik = psik/norm(psik)/sqrt(dk);
p1 = trapz(kgrid, conj(psik).*kgrid.*psik);
p2 = trapz(kgrid, conj(psik).*(kgrid.^2).*psik);
dp = sqrt(p2 - p1^2);
printf('dx*dp = %.4f >= 0.5\n', dx*dp);

6. Two-level system — Rabi oscillations

% rabi.m
Omega=1; Delta=0.2; t=linspace(0,20,1000);
H = [-Delta/2, Omega/2; Omega/2, Delta/2];
psi0=[1;0]; P2=[];
for ti=t
  U = expm(-1i*H*ti);
  psi = U*psi0; P2(end+1)=abs(psi(2))^2;
endfor
plot(t,P2); xlabel('t'); ylabel('P_{excited}');
title('Rabi flopping');

Interactive Demos

1. Gaussian wave packet — free dispersion

Drag momentum. Higher $k_0$ → faster translation; packet spreads as $\sigma(t)=\sqrt{\sigma_0^2+(\hbar t/2m\sigma_0)^2}$.

2. Particle in a box — eigenstate viewer

Purple = $\psi_n(x)=\sqrt{2/L}\sin(n\pi x/L)$, green = $|\psi_n|^2$. Energy $E_n\propto n^2$.

3. Bloch sphere — qubit state

State $|\psi\rangle=\cos(\theta/2)|0\rangle + e^{i\phi}\sin(\theta/2)|1\rangle$. Rotate with sliders.

How to use this

Start with the postulates, run the Octave box script to see $E_n=n^2\pi^2\hbar^2/2mL^2$ emerge numerically. Then evolve the Gaussian packet — notice position spreads while momentum distribution stays constant (free particle). Verify Ehrenfest by computing $\langle x\rangle(t)$ — it moves like a classical particle.

Core insight: Quantum mechanics is linear algebra + probability. Unitarity conserves information; measurement is projection. Uncertainty, tunneling, and entanglement all follow.