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 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 important 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 with probability , where . This ensemble cannot generally be described by a single state vector. Instead, we use the density matrix:
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 ().
A useful measure to distinguish pure from mixed states is the purity, defined as .
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 (), while mixed states (red diamonds) lie within the sphere ().
Calculating the expectation value of an observable (represented by a Hermitian operator) for a system described by is straightforward:
You can verify that if , this reduces to the familiar . For a mixed state , the expectation value is , 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 is given by the Liouville-von Neumann equation:
This 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. For example, take a bipartite system AB described by a joint density matrix acting on the Hilbert space . If we want to describe the state of subsystem A alone, ignoring subsystem B, we use the partial trace operation over B, denoted :
If is an orthonormal basis for , the partial trace is calculated as:
The resulting 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 and 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 features when designing, implementing, and analyzing QML algorithms.
Was this section helpful?
© 2026 ApX Machine LearningAI Ethics & Transparency•