Skip to content
Current section
The Quantum Computing Enthusiast’s Hub
Saved
All sections

All sections

Saved
Skip Learn navigation
Encyclopedia
Topic

Density-matrix simulation

Classical numerical evolution of a quantum state's density operator, including mixed states and quantum channels.

Also called mixed-state simulator

Edition released Coverage: Overview · Technical
On this page

Definition and significance

Density-matrix simulation tracks rho rather than one statevector. It can directly represent classical uncertainty, decoherence and the average effect of unobserved measurement outcomes. This generality raises the raw storage requirement from 2^n complex numbers to 4^n.

A density matrix describes the information available about a system. A mixed state need not mean a particular pure state secretly existed and is merely unknown; reduced states of entangled systems are also mixed.

Mechanism and mathematical treatment

Unitary evolution is rho->U rho U dagger. A channel with Kraus operators K_j acts as rho->sum_j K_j rho K_j dagger, with sum_j K_j dagger K_j=I for trace preservation. A valid density matrix is Hermitian, positive semidefinite and has trace one. Numerical implementations should monitor violations rather than merely renormalizing arbitrary errors away.

For complex128 storage, n=15 requires 16 times 4^15 bytes=16 GiB for the dense matrix. Structured noise or low-rank representations can reduce practical cost, but the generic dense scaling remains exponential.

Fully worked reference example

For amplitude damping with probability gamma, take K0=[[1,0],[0,sqrt(1-gamma)]] and K1=[[0,sqrt(gamma)],[0,0]]. Starting from |+><+|=(1/2)[[1,1],[1,1]], the output is (1/2)[[1+gamma,sqrt(1-gamma)],[sqrt(1-gamma),1-gamma]].

At gamma=3/4, this becomes [[7/8,1/4],[1/4,1/8]]. Its trace is one, determinant is 3/64 and purity is 1-2 determinant=29/32. Its Bloch coordinates are (1/2,0,3/4), whose squared norm is 13/16, giving purity (1+13/16)/2=29/32 again. These independent calculations check consistency.

Limitations and common misconceptions

Averaging statevectors is not the same as averaging density operators; amplitudes can cancel in a way that does not represent a statistical mixture. Quantum-trajectory simulation samples channel branches and can save memory, but it introduces Monte Carlo uncertainty in ensemble estimates.

Scientific relationships

A pure-state vector and a general mixed-state operator require different representations.

Sampled pure-state branches can approximate ensemble observables with lower per-trajectory memory.

Damping one half of an entangled pair

Prepare |Phi+>=(|00>+|11>)/sqrt(2), and apply amplitude damping with gamma=2/5 only to q1. The no-jump Kraus branch is [|00>+sqrt(3/5)|11>]/sqrt(2), with squared norm four-fifths. The jump branch is sqrt(1/5)|10>, with squared norm one-fifth. Their density operators add because the environment outcomes are unobserved.

The resulting matrix in q0q1 order is [[1/2,0,0,sqrt(15)/10],[0,0,0,0],[0,0,1/5,0],[sqrt(15)/10,0,0,3/10]]. Its eigenvalues are four-fifths, one-fifth, zero and zero. The purity is therefore 16/25+1/25=17/25. The no-jump and jump state vectors are orthogonal here, which makes the eigenvalue calculation particularly simple.

The reduced state of q0 remains I/2, because a trace-preserving local operation on q1 cannot change q0's unconditional reduced state. The reduced state of q1 becomes diag(7/10,3/10). These marginal checks provide a strong diagnostic for a tensor-indexing error: applying the damping to q0 instead would exchange which marginal changes.

Entanglement can survive a mixed-state channel

Take the partial transpose with respect to q1. The off-diagonal coherence between 00 and 11 moves into the block coupling 01 and 10. That block is [[0,sqrt(15)/10],[sqrt(15)/10,1/5]], whose eigenvalues are one-half and minus three-tenths. The other diagonal entries are one-half and three-tenths. The negative eigenvalue proves that the output remains entangled.

Its negativity, defined as the sum of absolute values of negative partial-transpose eigenvalues, is three-tenths. This quantity is not the purity and not a probability of a jump. The three numbers 17/25,3/10 and 1/5 describe different properties of the same channel output. A density-matrix simulator makes all of them accessible, but an experiment would require specified measurements or assumptions to estimate them.

At gamma=1, the output becomes an equal mixture of |00> and |10>, which is (I/2) tensor |0><0| and is separable. At gamma=0, the original Bell state is recovered. These boundary cases check both the population flow and the coherence factor sqrt(1-gamma). Replacing that square root by 1-gamma would define a different channel and give incorrect entanglement behavior.

Vectorization and tensor ordering

Using column-major vectorization, vec(U rho U dagger)=(U conjugate tensor U)vec(rho). For a Kraus channel, the superoperator matrix is the sum over j of K_j conjugate tensor K_j. This follows from the general identity vec(A X B)=(B transpose tensor A)vec(X). A row-major vectorization convention uses a correspondingly permuted representation.

For one-qubit amplitude damping, writing rho as [[a,b],[c,d]] gives the output [[a+gamma d,sqrt(1-gamma)b],[sqrt(1-gamma)c,(1-gamma)d]]. Column-major vectorization orders entries as (a,c,b,d). The superoperator in that order has rows [1,0,0,gamma], [0,sqrt(1-gamma),0,0], [0,0,sqrt(1-gamma),0], and [0,0,0,1-gamma]. This concrete matrix fixes the convention and can be checked against the Kraus expression.

The trace functional is the row vector (1,0,0,1), which is unchanged when multiplied by this superoperator. That verifies trace preservation algebraically. Positivity for arbitrary inputs follows from the Kraus construction; checking a few sample density matrices would not be an equivalent general proof.

Numerical checks and computational cost

A numerical density matrix should be tested for Hermiticity, trace and smallest eigenvalue within a tolerance tied to arithmetic precision and accumulated error. A tiny negative eigenvalue can arise from rounding, but a substantial negative value indicates that the represented state is not physical. Simply dividing by the trace does not repair negativity. Projecting onto the positive cone changes the state and should be reported as a numerical correction if used.

For local gates, an implementation can update selected tensor indices without multiplying full dense matrices. Nevertheless, storing an arbitrary n-qubit density operator still requires 4^n complex entries. For channel simulations with few stochastic branches and many qubits, trajectories may use much less memory per run at the expense of Monte Carlo uncertainty. For the two-qubit example, the direct Kraus sum gives an exact reference with no trajectory sampling error.

Sources

  • Google Quantum AI / Cirq · Documentation · quantumai.google
    Verification scope

    Recorded source check ·

    Simulation guide retrieved; explicit qubit_order semantics and distinction between state and measurement output inspected.

    Conceptual reference semantics only. No code execution or universal backend support claim.