The Density Operator
The Density Operator
A pure state is the most you can know about a quantum system — but it is not the most general thing you can have. The moment there is classical uncertainty about which state was prepared, or the moment you look at one half of an entangled pair, the ket description breaks down. The density operator repairs it: a single Hermitian, positive, unit-trace matrix that encodes every statistical prediction, pure or mixed. It is the true state object of quantum mechanics, and from Term 4 onward (noise, channels, error correction) it is the only one we use.
Learning Objectives
After this lesson you will be able to:
- Motivate the density operator from classical ensembles and from subsystems of entangled states.
- Define and prove it is Hermitian, positive semidefinite, and unit-trace — and that these three properties characterize valid states.
- Distinguish pure (, ) from mixed () states and compute the purity.
- Derive the expectation-value formula and the evolution rule .
- Explain ensemble ambiguity: different ensembles can yield the same , and only is physically meaningful.
Intuition
Two genuinely different kinds of uncertainty live inside quantum mechanics, and the ket handles only one of them.
Quantum uncertainty (already in the ket). A pure state $|+\rangle = \tfrac1{\sqrt2}(|0\rangle + |1\rangle)Z0$ or with probability each. That randomness is intrinsic — the Born rule — and the ket captures it perfectly.
Classical uncertainty (the ket cannot hold it). Now suppose a (sloppy) lab sends you a qubit that is with probability and with probability — an honest coin flip deciding which state was prepared. This is not the same as : there is no single ket that means " or , I forget which." You cannot average kets ( is not normalized, and choosing relative phases would smuggle in coherence that isn't there). We need an object that mixes probabilities of states, not amplitudes.
There is a second, deeper reason the ket fails — and it is not about a careless experimenter at all. Take the Bell state , a perfectly definite pure state of two qubits. Ask: what is the state of qubit alone? It has no ket — qubit is not in any definite state, because its identity is entangled with . Yet still has well-defined measurement statistics (we will find they are completely random). Describing "one subsystem of an entangled whole" forces the same machinery as classical mixing.
The fix in both cases is to package an ensemble into one operator,
by averaging the projectors (which carry no spurious phases) with the classical probabilities . Everything you can measure will turn out to depend on the ensemble only through this — which is exactly why it, and not the list of kets, is the state.
Theory
Definition
Definition (density operator). Let be an ensemble: normalized states (not necessarily orthogonal) prepared with probabilities , . The associated density operator is
The notation matches Appendix C: each is the rank-1 projector of 0.1.3, and is their probability-weighted convex combination. A pure state is the special case of a single term, ; any other case is mixed.
The three defining properties (and their proofs)
Three properties hold for every density operator, and — as we show afterward — they are also sufficient: any operator with these properties is the density operator of some ensemble. They are the density-matrix analog of "normalized ket."
Property 1 — Hermitian, .
We used from 0.1.3 E4 and the fact that is real, so . ∎ Hermiticity guarantees a real spectrum and an orthonormal eigenbasis (spectral theorem, 0.1.5).
Property 2 — Positive semidefinite, .
For any ,
since each and each . By the characterization in 0.1.6, , so all its eigenvalues are . ∎ Physically these eigenvalues will be probabilities.
Property 3 — Unit trace, .
Using linearity and cyclicity of the trace (Appendix E §4), for each normalized , so
Theorem (these properties characterize states). An operator on is the density operator of some ensemble iff , , and .
Proof of sufficiency. Suppose has the three properties. By the spectral theorem it has an orthonormal eigenbasis with real eigenvalues : . Positivity forces , and unit trace forces . Hence is a valid ensemble (probabilities , orthonormal states), and it manifestly reproduces . ∎
The set of all such is convex: if are states then so is for (each property is preserved under convex combination — check trace and positivity termwise). The pure states are precisely the extreme points of this convex set: those that cannot be written as a nontrivial mixture. We make this precise next.
Pure vs. mixed
Definition. is pure if for some normalized ; otherwise it is mixed.
The idempotence test. A density operator is pure iff .
Proof. () If with , then . () If , then is a Hermitian projector (0.1.6), so its eigenvalues are or . Unit trace means exactly one eigenvalue is and the rest are , i.e. for that eigenvector — pure. ∎
The purity functional. Define the purity
where are the eigenvalues of . Because the form a probability distribution (), purity is a measure of how peaked that distribution is:
Purity bounds. For a state on a -dimensional space,
with iff is pure, and iff is maximally mixed.
Proof. Among probability distributions on outcomes, is maximized when all weight sits on one outcome (giving ) and minimized by the uniform distribution (giving ). The maximum together with and forces a single — exactly the pure case, matching . The minimum forces uniform eigenvalues, i.e. . (Formally, by Cauchy–Schwarz / Jensen, .) ∎
So purity slides from (a sharp ket) down to (total ignorance). It is the workhorse scalar diagnostic for "how mixed is this state," and in Lesson 3 we will see it is a clean quadratic in the Bloch vector for a qubit.
Expectation values from
The whole point of is that it predicts measurement statistics. Recall (1.1.2) that for a pure state the expectation of an observable is $\langle A\rangle = \langle\psi|A|\psi\rangle$. For an ensemble, average over the classical uncertainty:
Now convert each term to a trace using the "trace trick" of 0.1.3 E5, :
(the two forms agree by cyclicity of the trace). This single formula subsumes the pure-state Born rule and is the computational definition of measurement in the density-matrix formalism. In particular, the probability of a projective outcome with projector is , since is itself an observable with eigenvalue on its subspace.
Notice the formula depends on the ensemble only through the combination $\rho = \sum_i p_i|\psi_i\rangle\langle\psi_i|\rho$ are operationally indistinguishable — there is no measurement that tells them apart. This is not a deficiency of our tools; it is a statement about nature, and it has a name.
Ensemble ambiguity
Different ensembles can give the same . The map (ensemble) is many-to-one, and only is observable.
The cleanest example is the maximally mixed qubit . It arises from at least two physically distinct preparation stories:
One lab flipped a coin and prepared or ; another flipped a coin and prepared or . No experiment can distinguish their qubits, because $\langle A\rangle = \operatorname{Tr}(\rho A)\rho = \tfrac12 I$. The list of kets is, in this sense, more information than physics provides — the density operator is the right, gauge-invariant object.
When do two ensembles give the same ? The precise answer is the unitary freedom of ensembles (the Hughston–Jozsa–Wootters / Schrödinger theorem, [NC §2.4]): ensembles and generate the same iff their (sub-normalized) vectors are related by a unitary (padding the shorter list with zero vectors). We state it here and prove the qubit case in the exercises; the general proof rides on the partial trace and purification of Lesson 2.
Evolution:
Closed-system (unitary) evolution of a ket is (0.1.6). Push this through the ensemble. Each pure component evolves as
and the classical probabilities are untouched (unitary evolution does not alter which state was prepared), so by linearity
This is the von Neumann picture of evolution. Differentiating (Appendix E §3, ) gives the von Neumann equation — the density-matrix form of Schrödinger's equation, developed in Term 1.6. Two sanity checks: this map preserves the three defining properties (Hermiticity, positivity, trace — since $\operatorname{Tr}(U\rho U^\dagger) = \operatorname{Tr}(\rho U^\dagger U) = \operatorname{Tr}\rho$ by cyclicity), and it preserves purity ($\operatorname{Tr}((U\rho U^\dagger)^2) = \operatorname{Tr}(U\rho^2 U^\dagger) = \operatorname{Tr}\rho^2$). Unitary evolution can never turn a pure state mixed — that requires the non-unitary channels of Term 4.
Worked Examples
Example 1 — Pure vs. a 50/50 classical mix: same diagonal, different state
Build both density matrices and separate them with purity and an -measurement.
Pure state :
Classical 50/50 mix of and :
Both have the same diagonal (): a -measurement gives or equally for each, so alone cannot tell them apart. The off-diagonal coherences differ, and that is where the physics hides.
Purity. $\operatorname{Tr}(\rho_+^2) = \operatorname{Tr}!\big(\tfrac14\begin{psmallmatrix}2&2\2&2\end{psmallmatrix}\big) = \tfrac14(2+2) = 1\operatorname{Tr}(\rho_{\text{mix}}^2) = \operatorname{Tr}(\tfrac14 I) = \tfrac12 = 1/d$ — maximally mixed.
An -measurement separates them. With X = \begin{psmallmatrix}0&1\\1&0\end{psmallmatrix},
The pure is a definite eigenstate of (); the mix is utterly random in every basis (). The coherence in is physically real and measurable — it just doesn't show up in the basis.
Example 2 — Expectation and purity of a biased single-basis mix
Let \rho = \tfrac34|0\rangle\langle0| + \tfrac14|1\rangle\langle1| = \begin{psmallmatrix}3/4 & 0\\ 0 & 1/4\end{psmallmatrix} (diagonal, so already in its eigenbasis with ).
Trace check: . ✓ Positivity: eigenvalues . ✓
Expectation of :
(Equivalently, .)
Expectation of : $\rho X = \begin{psmallmatrix}3/4&0\0&1/4\end{psmallmatrix}\begin{psmallmatrix}0&1\1&0\end{psmallmatrix} = \begin{psmallmatrix}0&3/4\1/4&0\end{psmallmatrix}\langle X\rangle = 0$.
Purity: $\operatorname{Tr}(\rho^2) = (\tfrac34)^2 + (\tfrac14)^2 = \tfrac{9}{16} + \tfrac1{16} = \tfrac{10}{16} = \tfrac58 = 0.6251/2 < 0.625 < 1$, this is a genuinely mixed state — more ordered than maximally mixed, less than pure. We will read this same number off the Bloch vector via $\operatorname{Tr}\rho^2 = \tfrac12(1 + |\vec r|^2) = \tfrac12(1 + \tfrac14) = \tfrac58$ in Lesson 3.
Hands-on (Python)
We build pure and mixed density matrices, verify the defining properties, compute expectations via , measure purity, and exhibit ensemble ambiguity. NumPy is the natural home for density matrices — they are just Hermitian arrays.
import numpy as np
# --- Pauli matrices and computational basis (Appendix E) ---
I = np.eye(2, dtype=complex)
X = np.array([[0, 1], [1, 0]], dtype=complex)
Y = np.array([[0, -1j], [1j, 0]], dtype=complex)
Z = np.array([[1, 0], [0, -1]], dtype=complex)
ket0 = np.array([[1], [0]], dtype=complex)
ket1 = np.array([[0], [1]], dtype=complex)
def proj(ket):
"""Rank-1 projector |ψ⟩⟨ψ| from a column ket (assumed normalized)."""
return ket @ ket.conj().T
def density_from_ensemble(probs, kets):
"""ρ = Σ_i p_i |ψ_i⟩⟨ψ_i| for probabilities `probs` and column kets `kets`."""
return sum(p * proj(k) for p, k in zip(probs, kets))
# Pure |+⟩ vs. classical 50/50 mix of |0⟩,|1⟩ (Worked Example 1)
plus = (ket0 + ket1) / np.sqrt(2)
rho_pure = proj(plus)
rho_mix = density_from_ensemble([0.5, 0.5], [ket0, ket1])
print("rho_pure =\n", np.round(rho_pure, 3))
print("rho_mix =\n", np.round(rho_mix, 3))
# rho_pure has off-diagonal 0.5 coherences; rho_mix is diag(0.5, 0.5) = I/2.def is_valid_state(rho, tol=1e-9):
"""Check the three defining properties: Hermitian, PSD, unit trace."""
hermitian = np.allclose(rho, rho.conj().T, atol=tol)
eigs = np.linalg.eigvalsh((rho + rho.conj().T) / 2) # symmetrize for safety
psd = np.all(eigs >= -tol)
unit_trace = np.isclose(np.trace(rho).real, 1.0, atol=tol)
return hermitian and psd and unit_trace
for name, rho in [("pure", rho_pure), ("mix", rho_mix)]:
print(name, "valid state?", is_valid_state(rho)) # both True
def expectation(rho, A):
"""⟨A⟩ = Tr(ρ A); real for Hermitian A."""
return np.trace(rho @ A).real
def purity(rho):
"""Tr(ρ²) ∈ [1/d, 1]; equals 1 iff pure."""
return np.trace(rho @ rho).real
# ⟨X⟩ separates the two states even though ⟨Z⟩ does not:
print("⟨Z⟩ pure/mix:", expectation(rho_pure, Z), expectation(rho_mix, Z)) # 0.0 0.0
print("⟨X⟩ pure/mix:", expectation(rho_pure, X), expectation(rho_mix, X)) # 1.0 0.0
print("purity pure/mix:", purity(rho_pure), purity(rho_mix)) # 1.0 0.5# Ensemble ambiguity: two different ensembles, identical ρ = I/2.
plus = (ket0 + ket1) / np.sqrt(2)
minus = (ket0 - ket1) / np.sqrt(2)
rho_Z = density_from_ensemble([0.5, 0.5], [ket0, ket1]) # Z-basis coin flip
rho_X = density_from_ensemble([0.5, 0.5], [plus, minus]) # X-basis coin flip
print("Same operator?", np.allclose(rho_Z, rho_X)) # True -> indistinguishable
print(np.round(rho_X, 3)) # I/2
# Unitary evolution ρ → U ρ U†: a pure state stays pure, a mix stays mixed.
from scipy.linalg import expm
H_gate = np.array([[1, 1], [1, -1]], dtype=complex) / np.sqrt(2) # Hadamard (a unitary)
print("purity after H (pure):", purity(H_gate @ rho_pure @ H_gate.conj().T)) # 1.0
print("purity after H (mix): ", purity(H_gate @ rho_mix @ H_gate.conj().T)) # 0.5
# H rotates |+⟩ to |0⟩ (still pure); I/2 is invariant under any unitary.Numerical note. Density matrices accumulate tiny imaginary parts and sub-zero eigenvalues from floating-point error. Take
.realof expectations/purities (the exact values are real), and symmetrize with(ρ + ρ†)/2before callingeigvalsh, asis_valid_statedoes. This is the same hygiene Term 4's noise simulations rely on.
Exercises
E1 (easy). Write the density matrix for the ensemble " with probability , with probability " as an explicit matrix, and verify .
Solution
|0\rangle\langle0| = \begin{psmallmatrix}1&0\\0&0\end{psmallmatrix} and $|+\rangle\langle+| = \tfrac12\begin{psmallmatrix}1&1\1&1\end{psmallmatrix}$. So
Trace . ✓ (Hermitian and, since both diagonal entries are the off-diagonal in the right way, one checks with positive trace, so PSD — it is a valid state.)
E2 (easy). Show directly from the matrices that satisfies $\rho^2 = \rho\rho = \tfrac12 I$ does not. What does each conclude about purity?
Solution
|+\rangle\langle+| = \tfrac12\begin{psmallmatrix}1&1\\1&1\end{psmallmatrix}, and $\big(\tfrac12\begin{psmallmatrix}1&1\1&1\end{psmallmatrix}\big)^2 = \tfrac14\begin{psmallmatrix}2&2\2&2\end{psmallmatrix} = \tfrac12\begin{psmallmatrix}1&1\1&1\end{psmallmatrix}\rho^2 = \rho$: pure. For , : not idempotent, so mixed. Purities: vs. .
E3 (medium). Prove that is real whenever is Hermitian, directly from properties of and (do not assume is pure).
Solution
$\overline{\operatorname{Tr}(\rho A)} = \operatorname{Tr}\big((\rho A)^\dagger\big) = \operatorname{Tr}(A^\dagger\rho^\dagger) = \operatorname{Tr}(A\rho) = \operatorname{Tr}(\rho A)\overline{\operatorname{Tr}(M)} = \operatorname{Tr}(M^\dagger)A^\dagger = A\rho^\dagger = \rho$, and cyclicity of the trace. A number equal to its own conjugate is real. ∎
E4 (medium). Let for . Compute as a function of , find where it is minimized and maximized, and interpret.
Solution
, so $\operatorname{Tr}(\rho^2) = p^2 + (1-p)^2 = 1 - 2p(1-p) = 2p^2 - 2p + 1\frac{d}{dp}(2p^2 - 2p + 1) = 4p - 2 = 0 \Rightarrow p = \tfrac12$, giving purity — the maximally mixed qubit. Maxima at the endpoints or , giving purity — the pure states or . Purity is a downward parabola in : most mixed at the fair coin, pure at the certain outcomes.
E5 (hard). Prove that a density operator is pure iff (closing the loop with the test).
Solution
Diagonalize with , . Then . Since we have $\lambda_k^2\le \lambda_k\sum_k\lambda_k^2 \le \sum_k\lambda_k = 1\lambda_k^2 = \lambda_k$ for every , i.e. each . Combined with , exactly one and the rest vanish, so is pure. Conversely a pure has eigenvalues giving . ∎
E6 (hard). (Unitary freedom, qubit case.) Two qubit ensembles and both give . Exhibit a unitary relating the (sub-normalized) state vectors of the two ensembles, confirming the HJW theorem in this case.
Solution
The sub-normalized vectors are , $|\tilde a_1\rangle = \tfrac1{\sqrt2}|1\rangle|\tilde b_0\rangle = \tfrac1{\sqrt2}|+\rangle$, for the second. HJW asks for unitary with . Writing $|+\rangle = \tfrac1{\sqrt2}(|0\rangle + |1\rangle)|-\rangle = \tfrac1{\sqrt2}(|0\rangle - |1\rangle)\tfrac1{\sqrt2}|+\rangle = \tfrac1{\sqrt2}\big(\tfrac1{\sqrt2}|0\rangle + \tfrac1{\sqrt2}|1\rangle\big) = \tfrac1{\sqrt2}|\tilde a_0\rangle
- \tfrac1{\sqrt2}|\tilde a_1\rangle|-\rangle$. Sothe Hadamard, which is unitary. The same Hadamard that maps the basis to the basis maps one ensemble's vectors to the other's — making from either. ∎
Checkpoint
- Give two physically distinct situations that require a density operator rather than a ket.
- State the three properties that characterize a valid density operator, and which one encodes "probabilities sum to 1."
- How do you test whether is pure, two different ways?
- Derive from the ensemble average. Why does it imply ensemble ambiguity?
- Write the evolution rule for under a unitary , and argue it preserves purity.
Answers
- (i) Classical uncertainty about which pure state was prepared (an ensemble / "noisy preparation"); (ii) a subsystem of an entangled pure state, which has no ket of its own (Lesson 2).
- (Hermitian, real spectrum), (positive, eigenvalues are probabilities), — the last encodes "probabilities sum to 1."
- (idempotent ⇔ pure), or equivalently (purity ).
- $\langle A\rangle = \sum_i p_i\langle\psi_i|A|\psi_i\rangle = \sum_i p_i\operatorname{Tr}(A|\psi_i\rangle\langle\psi_i|) = \operatorname{Tr}(A\rho)\rho$, two ensembles with the same produce identical statistics for all — indistinguishable.
- . Purity is invariant: $\operatorname{Tr}((U\rho U^\dagger)^2) = \operatorname{Tr}(U\rho^2U^\dagger) = \operatorname{Tr}(\rho^2)$ by cyclicity, so pure stays pure and mixing requires non-unitary dynamics (Term 4).
Further Reading
- [NC] Nielsen & Chuang, §2.4 — the density operator, ensembles, and the unitary-freedom theorem (their §2.4.3 is the HJW result used in E6).
- [Pre] Preskill, Ph219, Ch. 2–3 — density operators and the physics of mixed states.
- [Wat] Watrous, Theory of Quantum Information, Ch. 2 — density operators as the state objects of quantum information, with full rigor.
- Appendix E §1, §4 — Pauli/trace identities used throughout.
← Prev: Schmidt Decomposition · Up: Term 1 · Next: Partial Trace & Reduced States →