30. Density Matrices
30.1Pure states revisited
The state vector |ψ⟩ of Part III encodes maximal knowledge of an isolated system. To let it degrade, rewrite it as an object: ρ = |ψ⟩⟨ψ|, the outer product of the state with itself. Check its properties: Hermitian, positive semidefinite, trace 1, and idempotent — ρ² = ρ, rank one. Every prediction you already know transfers unchanged: the probability of measurement outcome m is Tr(|m⟩⟨m|ρ) = |⟨m|ψ⟩|², and evolution is ρ → UρU†. Nothing changes for pure states. The point is that ρ is a larger language: it describes situations the state vector cannot — and noise is precisely those situations.
30.2Mixed states
A mixed state is classical uncertainty: with probabilities pₖ the system is in state |ψₖ⟩, and ρ = Σₖ pₖ|ψₖ⟩⟨ψₖ|. Keep the distinction sharp: α|0⟩ + β|1⟩ is one pure state whose amplitudes can interfere; a 50/50 mixture of |0⟩ and |1⟩ is ρ = ½(|0⟩⟨0| + |1⟩⟨1|) = I/2 — maximum ignorance, no phase, no interference, nothing recoverable. The test is purity Tr(ρ²): it equals 1 if and only if the state is pure, and I/2 scores ½. Decoherence (29.1) is exactly the conversion of pure states into mixed ones — this chapter is where that sentence becomes computable.
30.3Density operators
The three axioms: ρ is Hermitian (ρ† = ρ), positive semidefinite (⟨φ|ρ|φ⟩ ≥ 0 for all |φ⟩), and has unit trace. Closed-system evolution is ρ → UρU†; the expectation of any observable is ⟨M⟩ = Tr(Mρ). Why this is the state object you can actually simulate noise with: a noisy process maps valid density matrices to valid density matrices, and a state vector simply cannot express "half the coherence is left" — the concept does not exist for it. The price is memory: an n-qubit ρ is a 2ⁿ×2ⁿ matrix, so cost grows as 4ⁿ. One and two qubits simulate instantly; about 12–14 qubits strain a laptop; beyond that you need tensor networks (Part V).
30.4Bloch representation
For a single qubit, ρ = ½(I + x·X + y·Y + z·Z), with a real Bloch vector r = (x, y, z). Pure states are the sphere's surface (|r| = 1), mixed states the interior, I/2 the exact center. Noise becomes geometry: amplitude damping drags z toward −1 (29.2), dephasing shrinks x and y toward 0 (29.3), depolarizing shrinks the whole vector toward the center (31.4). The vector's length is a purity measure, Tr(ρ²) = ½(1 + |r|²), so "how mixed is this state" becomes "how long is this vector" — and the experiment at the end of this chapter implements that decay directly.
30.5Reduced density matrices
For a composite system, the reduced density matrix ρ_A is "everything observable about subsystem A alone". Take the Bell state (|00⟩ + |11⟩)/√2: the joint state is pure and completely known, yet each qubit individually has ρ = I/2 — maximally mixed. That gap between joint purity and subsystem purity is entanglement, made quantitative. It is also the precise formal statement of decoherence: the system entangles with the environment, the environment is unobserved, so the system's reduced state is mixed. Nothing collapsed; you simply stopped tracking correlations — and correlations are exactly what a reduced state discards.
30.6Partial trace
The mechanics: ρ_A = Tr_B(ρ), computed by summing over the basis of B — element (i, j) is Σₖ ⟨i,k|ρ|j,k⟩. In numpy the idiom is to reshape the state vector into a tensor with one dimension of size 2 per qubit, then contract (trace) over the indices belonging to B. Do the Bell state by hand once: partial trace over either qubit returns I/2, confirming 30.5. Get this operation fluent — every noise simulation, every entropy calculation, and every "what does this qubit actually know" question runs through it, and implementing it correctly on a reshaped tensor is a rite of passage worth one focused hour.
30.7Entropy
The von Neumann entropy of ρ is S(ρ) = −Tr(ρ log₂ ρ) = −Σₖ λₖ log₂ λₖ, over the eigenvalues λₖ. A pure state has S = 0 — one eigenvalue 1, the rest 0 — regardless of how complicated the state vector looks. The maximally mixed n-qubit state has S = n bits, the maximum. With log₂ the unit is bits and the quantum generalization is exact: for a diagonal ρ, this is the Shannon entropy of the diagonal entries. Entropy answers "how much information is missing about the actual state" — zero for pure states, however elaborate; n for total ignorance.
30.8Von Neumann entropy
What the entropy buys you. Entanglement measure: for a pure joint state, S(ρ_A) quantifies how entangled A is with the rest, and it is basis-independent — a property of the state, not of its description. Thermodynamics: thermal (Gibbs) states are exactly the states minimizing S at fixed energy, and noise increases S — the second law reappears as a statement about channels (31.9). Practice: computing S requires eigenvalues, an O(d³) operation, so simulators often track the cheap alternative purity Tr(ρ²) instead. Research hook: the rapid growth of entanglement entropy under generic dynamics is precisely what makes large quantum systems classically intractable — entropy is the boundary of simulability.