While pure state vectors ∣ψ⟩ provide a fundamental description of isolated quantum systems, they represent an idealized scenario. In practice, especially when dealing with quantum computation influenced by environmental interactions or when we only have partial knowledge about a system's preparation, we need a more general tool: the density matrix. Understanding density matrices is essential for accurately modeling noise in QML algorithms and interpreting their results on real hardware.
A pure quantum state ∣ψ⟩ in a Hilbert space H can be described by a density operator (or density matrix) ρ defined as the outer product:
ρ=∣ψ⟩⟨ψ∣This operator projects onto the subspace spanned by ∣ψ⟩. It has several key properties:
The real power of the density matrix formalism becomes apparent when dealing with mixed states. A mixed state represents a statistical ensemble of pure states. Imagine a source preparing a quantum state that is ∣ψi⟩ with probability pi, where ∑ipi=1. This ensemble cannot generally be described by a single state vector. Instead, we use the density matrix:
ρ=i∑pi∣ψi⟩⟨ψi∣This is a convex combination of pure state density matrices. This more general density matrix still satisfies properties 1, 2, and 3 (Hermiticity, Unit Trace, Positive Semi-definiteness). However, it is not generally idempotent (ρ2=ρ).
A useful measure to distinguish pure from mixed states is the purity, defined as Tr(ρ2).
For a single qubit, the state can be visualized on the Bloch sphere. Pure states lie on the surface, while mixed states occupy the interior.
Pure states (blue circles) reside on the surface of the Bloch sphere (Tr(ρ2)=1), while mixed states (red diamonds) lie within the sphere (Tr(ρ2)<1).
Calculating the expectation value of an observable M (represented by a Hermitian operator) for a system described by ρ is straightforward:
⟨M⟩=Tr(ρM)You can verify that if ρ=∣ψ⟩⟨ψ∣, this reduces to the familiar Tr(∣ψ⟩⟨ψ∣M)=⟨ψ∣M∣ψ⟩. For a mixed state ρ=∑ipi∣ψi⟩⟨ψi∣, the expectation value is Tr(∑ipi∣ψi⟩⟨ψi∣M)=∑ipiTr(∣ψi⟩⟨ψi∣M)=∑ipi⟨ψi∣M∣ψi⟩, which is simply the weighted average of the expectation values for each pure state in the ensemble, as expected.
The time evolution of a density matrix for a closed system governed by Hamiltonian H is given by the Liouville-von Neumann equation:
iℏdtdρ=[H,ρ]=Hρ−ρHThis is the density matrix equivalent of the Schrödinger equation. For open quantum systems interacting with an environment (which introduces noise and decoherence), more complex master equations, like the Lindblad equation, are needed to describe the evolution of ρ. We will encounter these when discussing hardware noise and error mitigation in Chapter 7.
Often in quantum computation and QML, we deal with composite systems (multiple qubits) but are only interested in a part of the system. Consider a bipartite system AB described by a joint density matrix ρAB acting on the Hilbert space HA⊗HB. If we want to describe the state of subsystem A alone, ignoring subsystem B, we use the partial trace operation over B, denoted TrB:
ρA=TrB(ρAB)If {∣bj⟩B} is an orthonormal basis for HB, the partial trace is calculated as:
ρA=j∑(B⟨bj∣)ρAB(∣bj⟩B)The resulting ρA is the reduced density matrix for subsystem A. Importantly, even if the composite system AB was in a pure entangled state, the reduced density matrices ρA and ρB will generally represent mixed states. This highlights how entanglement leads to correlations where the state of a subsystem cannot be described independently as a pure state. The partial trace is fundamental for describing measurement outcomes on subsets of qubits or the effects of losing qubits to the environment.
Density matrices are indispensable in QML for several reasons:
In summary, while state vectors provide the initial intuition, mastering the density matrix formalism is necessary for advancing into the practicalities and theoretical depths of QML. It provides the language to handle statistical uncertainty, environmental noise, and subsystems, all of which are common considerations when designing, implementing, and analyzing QML algorithms.
© 2025 ApX Machine Learning