|q⟩ Bad Qubits

intermediate · Physics · Density Matrices & Mixed States

The Density Operator

The density operator ρ\rho is the single object that represents any quantum state — pure or mixed — on equal footing. It replaces the state vector as the most general description of a system.

From a pure state to its density operator

Given a pure state ψ|\psi\rangle, its density operator is the outer product

ρ=ψψ.\rho = |\psi\rangle\langle\psi|.

For a qubit ψ=α0+β1|\psi\rangle = \alpha|0\rangle + \beta|1\rangle, this is a 2×22\times 2 matrix:

ρ=(αβ)(αβ)=(α2αβαββ2).\rho = \begin{pmatrix}\alpha\\\beta\end{pmatrix} \begin{pmatrix}\alpha^* & \beta^*\end{pmatrix} = \begin{pmatrix} |\alpha|^2 & \alpha\beta^* \\ \alpha^*\beta & |\beta|^2 \end{pmatrix}.

The diagonal entries α2|\alpha|^2 and β2|\beta|^2 are the populations — the probabilities of measuring 00 and 11. The off-diagonal entries are the coherences; they encode the phase relationship that distinguishes a superposition from a mixture.

The density operator of a mixture

For an ensemble {(pi,ψi)}\{(p_i, |\psi_i\rangle)\} the density operator is the probability-weighted average of the individual pure-state operators:

ρ=ipiψiψi.\rho = \sum_i p_i\, |\psi_i\rangle\langle\psi_i|.

This is a convex combination of pure-state density operators. Every physically distinct preparation maps to exactly one ρ\rho, and any two ensembles with the same ρ\rho are physically indistinguishable — which is precisely the ambiguity we wanted the formalism to absorb.

A worked example

Take the equal superposition +=12(0+1)|+\rangle = \tfrac{1}{\sqrt2}(|0\rangle + |1\rangle), so α=β=12\alpha = \beta = \tfrac{1}{\sqrt2}. Then

ρ+=12(1111).\rho_+ = \frac{1}{2}\begin{pmatrix} 1 & 1 \\ 1 & 1 \end{pmatrix}.

Contrast this with the 50/50 mixture of 0|0\rangle and 1|1\rangle:

ρmix=1200+1211=12(1001).\rho_{\text{mix}} = \frac12|0\rangle\langle 0| + \frac12|1\rangle\langle 1| = \frac12\begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}.

Same diagonal (same measurement statistics in the zz-basis), but the superposition has nonzero off-diagonal coherences while the mixture has none. The matrix makes the distinction from the previous lesson explicit.

Try it

Build the density matrix ρ=ψψ\rho = |\psi\rangle\langle\psi| for the parametrized real qubit state ψ=cos(θ/2)0+sin(θ/2)1|\psi\rangle = \cos(\theta/2)|0\rangle + \sin(\theta/2)|1\rangle at θ=π/3\theta = \pi/3, and return the top-left population ρ00=cos2(θ/2)\rho_{00} = \cos^2(\theta/2). Compute it from the outer product — do not just type the number.

Run your code to see the quantum state.

Sign in on the full site to ask questions and join the discussion.