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.
Describing Quantum States: State Vectors
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 important properties:
- Hermiticity: ρ†=ρ.
- Unit Trace: Tr(ρ)=1. This reflects the normalization of the state vector, ⟨ψ∣ψ⟩=1.
- Positive Semi-definiteness: ⟨ϕ∣ρ∣ϕ⟩≥0 for any vector ∣ϕ⟩.
- Idempotence (for pure states): ρ2=ρ. This follows directly from the normalization: (∣ψ⟩⟨ψ∣)(∣ψ⟩⟨ψ∣)=∣ψ⟩(⟨ψ∣ψ⟩)⟨ψ∣=∣ψ⟩(1)⟨ψ∣=ρ.
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 pure state ρ=∣ψ⟩⟨ψ∣, Tr(ρ2)=Tr(∣ψ⟩⟨ψ∣∣ψ⟩⟨ψ∣)=Tr(∣ψ⟩⟨ψ∣)=1.
- For a mixed state, it can be shown that Tr(ρ2)<1. The minimum value depends on the dimension of the Hilbert space. A maximally mixed state (e.g., equal probability of being in any basis state) has the lowest purity.
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).
Expectation Values and Dynamics
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ρ−ρH
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.
Subsystems and the Partial Trace
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.
Relevance in Quantum Machine Learning
Density matrices are indispensable in QML for several reasons:
- Noise Modeling: Near-term quantum computers are noisy. Decoherence, gate imperfections, and measurement errors cause pure states to evolve into mixed states. Density matrix simulations are often required to realistically predict how QML algorithms will perform on actual hardware. Concepts like depolarizing noise or amplitude damping are naturally expressed using operations on density matrices.
- Algorithm Specification: Some QML algorithms might inherently involve mixed states. For example, the output of a quantum generative model might be a mixed state representing uncertainty, or input data derived from noisy physical processes might be best represented by density matrices.
- Theoretical Analysis: Analyzing the properties of QML models, such as their expressive power or trainability, often requires the full density matrix formalism, especially when considering noise or entanglement between different parts of a quantum circuit.
- Information Geometry: The set of all valid density matrices for a given system forms a geometric space. Tools from information geometry, like the quantum Fisher information metric, operate on density matrices and provide insights into the parameter space of variational quantum algorithms (VQAs), helping us understand optimization challenges like barren plateaus (covered in Chapter 4).
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.