Level 5 · Advanced Topics

Density Matrices & Mixed States

About 4,827 words · roughly 22 minute read · sources checked December 2, 2026

State vectors describe a qubit that is perfectly isolated and perfectly known. Real qubits are neither. They are prepared imperfectly, they leak information into their surroundings, and they are usually entangled with something else. To describe them honestly we need a bigger object than the state vector: the density matrix.

The density matrix handles three situations in one framework. It describes ordinary quantum states, it describes classical uncertainty about which state you have, and it describes a part of an entangled system whose partner you are ignoring. It is also the language of noise: every decoherence process, from T₁ decay to the errors that quantum error correction fights, is a map from density matrices to density matrices.

You need the linear algebra and tensor-product lessons from Level 0 and the Level 2 lessons on superposition, entanglement and gates. Every number in this lesson was computed by direct matrix calculation.

What you will learn

  • The definition of a density matrix and its three defining properties.
  • Why different ensembles can give exactly the same state, and what that means physically.
  • How to compute measurement probabilities and expectation values with the trace.
  • Purity, the Bloch ball and eigenvalues of a qubit density matrix.
  • Partial trace, and why half of a Bell pair is maximally mixed.
  • Von Neumann entropy and entanglement entropy.
  • Noise as channels: Kraus operators, dephasing, amplitude damping and depolarising, with T₁ and T₂.

Helpful first: Linear Algebra for Quantum Computing, Entanglement, Quantum Gates.

Why a state vector is not enough

A state vector |ψ⟩ describes a pure state: the system is in one definite quantum state, and any uncertainty is the intrinsic uncertainty of quantum measurement. But two common situations do not fit.

  1. Classical ignorance. A source prepares |0⟩ half the time and |1⟩ half the time, and you do not know which. There is no state vector for ‘one or the other, I don’t know which’. A superposition (|0⟩ + |1⟩)/√2 is something different: it gives certain results when measured in another basis.
  2. Part of an entangled system. Two qubits are in a Bell state. Neither qubit alone has a state vector, even though the pair does. Yet you can measure one of them and get sensible statistics. What describes that single qubit?
  3. Noise. A qubit interacts with its environment in ways you cannot track. After a while its behaviour is a blend of many possible evolutions.

All three are handled by the density matrix, also called the density operator, written ρ (rho). It is a single matrix that encodes every statistic you can ever extract from the system. In the tutorial I opened (arXiv 1110.6815), a density operator is defined as a positive operator with unit trace, and the next section shows what that means.

Definition and the three properties

For a pure state |ψ⟩, the density matrix is the outer product ρ = |ψ⟩⟨ψ|. For a qubit with |ψ⟩ = α|0⟩ + β|1⟩ this is the 2 × 2 matrix

ρ = [ |α|²    αβ* ]
    [ α*β    |β|² ]
The diagonal entries are the probabilities of 0 and 1. The off-diagonal entries are the coherences.

For an ensemble, where the system is in state |ψᵢ⟩ with probability pᵢ, the density matrix is the weighted sum

ρ = Σᵢ pᵢ |ψᵢ⟩⟨ψᵢ|

Any valid density matrix has three properties, and any matrix with all three is the density matrix of some physical state.

  • Hermitian: ρ† = ρ. So its eigenvalues are real.
  • Positive semidefinite: all eigenvalues are at least 0. They can be read as probabilities.
  • Unit trace: Tr ρ = 1. The probabilities sum to 1.

The diagonal entries in a chosen basis are the probabilities of the outcomes in that basis. The off-diagonal entries record how much quantum coherence, that is, superposition, the state has between the basis states. A classical mixture has zero off-diagonals in some basis. A pure superposition has the largest off-diagonals allowed.

Worked example

Four density matrices

  1. |0⟩⟨0| = [[1, 0], [0, 0]]. Definite 0, pure.
  2. |+⟩⟨+| = [[1/2, 1/2], [1/2, 1/2]]. Equal superposition. Diagonals say 50/50, off-diagonals 1/2 say the superposition is fully coherent. Pure.
  3. A 50/50 mixture of |0⟩ and |1⟩: ½|0⟩⟨0| + ½|1⟩⟨1| = [[1/2, 0], [0, 1/2]] = I/2. Diagonals also say 50/50 but the off-diagonals are 0: no coherence. This is the maximally mixed state.
  4. A 70/30 mixture of |0⟩ and |1⟩: [[0.7, 0], [0, 0.3]]. Mixed, with a bias towards 0.
  5. The first test of understanding: |+⟩⟨+| and I/2 both give 50/50 for a measurement in the 0/1 basis. They differ only in the off-diagonals, and the difference shows up when you measure in the ± basis: the first always gives +, the second gives + or − at random.

Different ensembles, the same state

A striking fact: many different ensembles produce exactly the same density matrix, and therefore exactly the same statistics for every possible measurement. So the ensemble is not physically meaningful by itself; only ρ is.

Worked example

Two recipes for the same state

  1. Recipe A: prepare |0⟩ or |1⟩, each with probability 1/2. Density matrix ½|0⟩⟨0| + ½|1⟩⟨1| = I/2.
  2. Recipe B: prepare |+⟩ or |−⟩, each with probability 1/2. ½|+⟩⟨+| + ½|−⟩⟨−| = ½[[1/2, 1/2], [1/2, 1/2]] + ½[[1/2, −1/2], [−1/2, 1/2]] = [[1/2, 0], [0, 1/2]] = I/2.
  3. I checked both by matrix arithmetic. They give the identical matrix I/2.
  4. So no experiment can tell whether the source was preparing 0 and 1 or + and −. Whatever you measure, in any basis, the two recipes give identical statistics.
  5. This has an important consequence for communication: you cannot use a mixed state to send information about which ensemble it came from. It is one reason that entanglement cannot be used to signal faster than light, which we use again below.

Mathematically, the freedom comes from the eigendecomposition. A density matrix has a unique spectral decomposition into orthogonal eigenvectors with eigenvalue weights, but infinitely many other decompositions into non-orthogonal states. All of them are valid recipes for the same ρ.

Measurement, expectation values and evolution

Everything observable is computed with the trace. If a measurement outcome corresponds to a projector P, the probability of that outcome is Tr(Pρ). The expected value of an observable O is Tr(Oρ). For a pure state these reduce to the familiar |⟨φ|ψ⟩|² and ⟨ψ|O|ψ⟩.

Worked example

A mixed state measured in two bases

  1. Take ρ = ½|0⟩⟨0| + ½|+⟩⟨+|. Compute: ρ = ½[[1, 0], [0, 0]] + ½[[1/2, 1/2], [1/2, 1/2]] = [[3/4, 1/4], [1/4, 1/4]].
  2. Check the three properties: it is symmetric, its trace is 3/4 + 1/4 = 1, and its eigenvalues are about 0.854 and 0.146, both positive. ✓
  3. Probability of measuring 0: the (0, 0) entry, 3/4. Probability of 1: 1/4.
  4. Probability of measuring + (projector |+⟩⟨+|): ⟨+|ρ|+⟩ = ½(3/4 + 1/4 + 1/4 + 1/4) = 3/4. Probability of − is 1/4.
  5. Expectation values: ⟨Z⟩ = Tr(Zρ) = 3/4 − 1/4 = 1/2. ⟨X⟩ = Tr(Xρ) = 1/4 + 1/4 = 1/2. ⟨Y⟩ = 0.
  6. These three numbers, (1/2, 0, 1/2) for (X, Y, Z), are the Bloch vector of the state, used in the next section.

Evolution and measurement update

A unitary gate U acts on a density matrix as ρ → UρU†. For a pure state this is the familiar |ψ⟩ → U|ψ⟩. After a measurement with outcome corresponding to projector P, and you learn the outcome, the state updates to PρP / Tr(Pρ). If you do not learn the outcome, it becomes the mixture Σ PₖρPₖ over outcomes k, which is exactly the dephasing in the measurement basis.

Notice that unitary evolution never changes the eigenvalues of ρ, because UρU† has the same eigenvalues as ρ. A mixed state stays mixed and a pure state stays pure under gates. Only measurement without readout, coupling to an environment, or discarding part of the system changes how mixed a state is.

Purity and the Bloch ball

How mixed is a state? The standard measure is the purity, Tr(ρ²), which equals the sum of the squared eigenvalues. The tutorial I opened states that purity ranges from 1/d to 1 for a d-dimensional system, with 1 exactly for pure states.

  • Pure state: eigenvalues (1, 0, …), purity 1.
  • Maximally mixed qubit I/2: eigenvalues (1/2, 1/2), purity 1/2.
  • Anything else for a qubit: purity strictly between 1/2 and 1.

Every qubit density matrix can be written in terms of the Pauli matrices as

ρ = ½ (I + r_x X + r_y Y + r_z Z) = ½ (I + r · σ)
The Bloch vector r = (⟨X⟩, ⟨Y⟩, ⟨Z⟩). The source I opened gives this form and states the bound |r| ≤ 1.

The three numbers (r_x, r_y, r_z) are the expectation values of X, Y and Z. The requirement that eigenvalues be non-negative translates into |r| ≤ 1. Pure states have |r| = 1 and lie on the surface of the Bloch sphere. Mixed states lie strictly inside the ball. The centre, r = 0, is the maximally mixed state I/2.

Superposition |+⟩50/50 mixture of |0⟩ and |1⟩Z basisX basisoutcomes 0 / 100.510.5outcomes 0 / 100.510.5outcomes + / −+1−0outcomes + / −+0.5−0.5
Pure states on the surface, mixed states inside, the maximally mixed state at the centre.

Two useful formulas for a qubit follow directly. The eigenvalues are (1 ± |r|)/2, and the purity is (1 + |r|²)/2.

Worked example

From the earlier example

  1. The state ρ = [[3/4, 1/4], [1/4, 1/4]] has Bloch vector r = (1/2, 0, 1/2), so |r|² = 1/4 + 1/4 = 1/2 and |r| = 0.707.
  2. Eigenvalues: (1 ± 0.707)/2 = 0.854 and 0.146, matching the direct computation.
  3. Purity: (1 + 1/2)/2 = 0.75. Direct check: Tr(ρ²) = (3/4)² + 2(1/4)² + (1/4)² = 9/16 + 2/16 + 1/16 = 12/16 = 0.75. ✓
  4. This state is neither pure nor maximally mixed. It sits at distance 0.707 from the centre, partway to the surface along the direction between +z and +x.
pure, |r| = 1mixed, |r| < 1centre: I/2Noise shortens the Bloch vector toward the centre.
Noise shrinks the Bloch vector. The length of r measures how much coherent information is left.

Composite systems and the partial trace

Suppose two qubits A and B are in a joint state ρ_AB, and you can only access A. What is A’s state? The answer is the reduced density matrix, obtained by the partial trace over B, written ρ_A = Tr_B(ρ_AB). The tutorial states this is the unique operation that preserves the Born rule for the subsystem, which means that every statistic of A computed from ρ_A matches the statistic computed from the joint state.

Concretely, you sum over the basis states of B: the entry (i, j) of ρ_A is Σ_k ⟨i k|ρ_AB|j k⟩.

Worked example

Half of a Bell pair

  1. The Bell state is |Φ⁺⟩ = (|00⟩ + |11⟩)/√2. Its density matrix is ½(|00⟩⟨00| + |00⟩⟨11| + |11⟩⟨00| + |11⟩⟨11|).
  2. Trace out B. The terms with different B values, |00⟩⟨11| and |11⟩⟨00|, give ⟨k|k′⟩ with k ≠ k′, which is 0. They vanish.
  3. The surviving terms are ½|0⟩⟨0| (from B = 0) and ½|1⟩⟨1| (from B = 1). So ρ_A = ½|0⟩⟨0| + ½|1⟩⟨1| = I/2. I verified this by computing the partial trace numerically.
  4. The reduced state is maximally mixed, with purity 1/2 and Bloch vector 0, although the pair as a whole is pure.
  5. This is the signature of entanglement: the whole is in a definite pure state, while each part is as random as it can be. All the information is in the correlations between the parts.

No signalling

Whatever Bob does to his half of a Bell pair, Alice’s reduced state stays I/2, because partial trace over B of any operation on B alone leaves ρ_A unchanged. That is why entanglement cannot send messages by itself. Compare the earlier point that two ensembles with the same ρ cannot be told apart.

Purification

The Bell example runs backwards as well. Any mixed state can be seen as one half of a pure state on a larger system, called a purification. Noise in a qubit can be thought of as entanglement with an environment that we are not tracking. This viewpoint is what turns decoherence from a mystery into ordinary quantum mechanics: the qubit and environment together obey a unitary evolution, and the density matrix of the qubit alone is what is left when the environment is traced out.

Von Neumann entropy and entanglement entropy

Entropy measures uncertainty. For a density matrix with eigenvalues λᵢ, the von Neumann entropy is

S(ρ) = − Σᵢ λᵢ log₂ λᵢ = − Tr(ρ log₂ ρ)
In bits when the logarithm is base 2.

It reduces to the Shannon entropy of the eigenvalue distribution. It is 0 for a pure state and reaches its maximum log₂ d for the maximally mixed state of dimension d.

Worked example

Entropies of the states so far

  1. Pure state: eigenvalues (1, 0), S = 0 bits.
  2. Maximally mixed qubit: eigenvalues (1/2, 1/2), S = 1 bit.
  3. The 70/30 mixture: S = −0.7 log₂ 0.7 − 0.3 log₂ 0.3 = 0.881 bits.
  4. The mixed state with eigenvalues 0.854 and 0.146 from the previous section: S = 0.601 bits.
  5. Half of a Bell pair: S = 1 bit. For a pure two-party state, this entropy of one half is a measure of how entangled the two parts are, called the entanglement entropy. A Bell pair has one bit of entanglement, which is why it is called an ebit.
  6. A product state has entanglement entropy 0.

Entanglement entropy is a clean way to say how much entanglement a state has when the whole is pure. It is also one way to see why large entangled states are hard to simulate classically: states with high entanglement entropy across a cut need many parameters to describe.

Classical correlation versus entanglement

A good test of the formalism is to compare two states that look alike in the 0/1 basis. State C is a classical mixture: with probability 1/2 both qubits are 0, with probability 1/2 both are 1, so ρ_C = ½|00⟩⟨00| + ½|11⟩⟨11|. State B is the Bell state (|00⟩ + |11⟩)/√2. Measured in the 0/1 basis, both give 00 or 11 with equal probability and never 01 or 10.

Worked example

Telling them apart

  1. Measure the observable X⊗X, which asks whether the two qubits agree in the ± basis. For the Bell state, ⟨X⊗X⟩ = 1: the answer is always yes. For the classical mixture, ⟨X⊗X⟩ = 0: the outcome is random. I computed both traces numerically.
  2. Measure Z⊗Z: both states give ⟨Z⊗Z⟩ = 1, so this measurement cannot tell them apart.
  3. Purity: the Bell state has Tr(ρ²) = 1 (pure). The classical mixture has Tr(ρ²) = 0.5.
  4. Reduced states: tracing out either qubit gives I/2 for both. So looking at one qubit alone also fails to distinguish them.
  5. The difference lives entirely in the off-diagonal coherence between |00⟩ and |11⟩, which the Bell state has and the mixture lacks. It is detected only by joint measurements in a different basis. This is the same structure that CHSH tests exploit in the entanglement lesson.

Partial entanglement and mixed reduced states

A product state has a pure reduced state, a Bell state has a maximally mixed one, and in between lies a continuum. Take |ψ⟩ = cos θ |00⟩ + sin θ |11⟩. Tracing out B gives ρ_A = diag(cos²θ, sin²θ).

Worked example

A partially entangled pair

  1. Take θ = π/8 (22.5°). Then cos²θ = 0.854 and sin²θ = 0.146, so ρ_A = diag(0.854, 0.146).
  2. These are exactly the eigenvalues of the mixed state found earlier in this lesson from the 50/50 mixture of |0⟩ and |+⟩. That state is therefore the reduced state of a partially entangled pair: any mixed state is half of some pure state on a larger system.
  3. Entanglement entropy: S = −0.854 log₂ 0.854 − 0.146 log₂ 0.146 = 0.601 bits, between 0 for a product state (θ = 0) and 1 for a Bell state (θ = π/4).
  4. So the same density matrix can be read two ways: as ignorance about a preparation, or as a trace of entanglement with a partner. The mathematics does not distinguish them, and this is the point of the formalism.

Noise as quantum channels

Noise, measurement without readout and everything else that happens to a qubit in an environment can be described by a quantum channel, a map from density matrices to density matrices. The standard way to write one is with Kraus operators:

ε(ρ) = Σₖ Mₖ ρ Mₖ†,     Σₖ Mₖ† Mₖ = I
The second condition keeps the trace equal to 1. The tutorial I opened states this form as its theorem on quantum operations.

A unitary gate is the special case with a single operator M = U. A channel with several operators describes a random or environment-driven change: the state is ‘sent through’ operator M₁ with some weight, M₂ with another, and so on. Three channels cover most of what one needs for a qubit.

Dephasing (phase flip)

With probability p a Z is applied: ε(ρ) = (1 − p)ρ + p ZρZ. The Kraus operators are √(1 − p)·I and √p·Z, and I checked that Σ M†M = I. The diagonal entries do not change. The off-diagonal entries are multiplied by (1 − 2p).

Worked example

Dephasing a superposition

  1. Start with |+⟩, ρ = [[1/2, 1/2], [1/2, 1/2]], purity 1.
  2. p = 0.1: off-diagonals become 0.5 × 0.8 = 0.4, and purity falls to 0.82.
  3. p = 0.25: off-diagonals 0.25, purity 0.625.
  4. p = 0.5: off-diagonals 0, the state is I/2, purity 0.5. All superposition is gone.
  5. The Bloch vector of |+⟩ is along x. Dephasing shrinks the x and y components by the factor (1 − 2p) and leaves z alone, squeezing the Bloch ball into a thin ellipsoid. This destroys phase information but leaves the 0/1 probabilities alone.

Amplitude damping (energy loss, T₁ decay)

The excited state |1⟩ decays to |0⟩ with probability γ. The Kraus operators are M₀ = [[1, 0], [0, √(1 − γ)]] and M₁ = [[0, √γ], [0, 0]]. Population in |1⟩ is multiplied by (1 − γ), and the coherences by √(1 − γ). For a decay with time constant T₁, γ = 1 − e^(−t/T₁).

Worked example

Decay with T₁ = 100 µs

  1. Start in |1⟩. After t = 50 µs, γ = 1 − e^(−0.5) = 0.393, so the population in |1⟩ is 0.607 and in |0⟩ is 0.393.
  2. After t = 100 µs = T₁: γ = 0.632, population in |1⟩ is e^(−1) = 0.368.
  3. After t = 200 µs: γ = 0.865, population in |1⟩ is 0.135.
  4. Now start in |+⟩ and wait t = T₁. The off-diagonal element falls from 0.5 to 0.5 × √(1 − γ) = 0.5 × e^(−1/2) = 0.303. The state ends up with density matrix [[0.816, 0.303], [0.303, 0.184]]: more weight on |0⟩ and less coherence.
  5. In the Bloch picture the whole ball shrinks and is dragged toward the ground state |0⟩, shown below.

Depolarising

With probability q the qubit is replaced by the maximally mixed state: ε(ρ) = (1 − q)ρ + q I/2. The tutorial I opened gives the depolarising channel in this form, with equivalent Kraus operators built from the Pauli matrices. Every component of the Bloch vector shrinks by the same factor (1 − q).

Worked example

Depolarising |0⟩

  1. Take q = 0.3. ρ = 0.7 |0⟩⟨0| + 0.3 I/2 = [[0.85, 0], [0, 0.15]].
  2. Bloch vector (0, 0, 0.7), purity 0.745, eigenvalues 0.85 and 0.15.
  3. The qubit reads 0 with probability 0.85 and 1 with 0.15. An error of 15%, from a depolarising probability of 30%, because half the time the replacement state returns the correct 0 anyway.
Dephasingxzx squeezed, z keptAmplitude dampingxzt = T₁: drifts to |0⟩Depolarisingxzshrinks by 0.7Dashed circle: all pure states. Shaded: states reachable from the full ball after the channel.
Three channels act on the Bloch ball. Dephasing squeezes it sideways, amplitude damping shrinks it and moves it to |0⟩, depolarising shrinks it evenly.

T₁, T₂ and what the numbers on a datasheet mean

Hardware papers quote coherence times T₁ and T₂. They are exactly the time constants of the two channels above.

  • T₁ is the energy relaxation time: the population of |1⟩ decays as e^(−t/T₁). It is amplitude damping.
  • T₂ is the dephasing or coherence time: the off-diagonal elements of ρ decay as e^(−t/T₂). It includes the dephasing from the previous channel plus the contribution from T₁ decay.
  • In the standard theory T₂ cannot exceed 2T₁, because T₁ decay by itself already reduces coherences by e^(−t/2T₁), the factor √(1 − γ) found above. I give this as a standard result that I did not reopen.

Worked example

From a coherence time to an error per gate

  1. Take T₂ = 100 µs and a gate that takes 50 ns, which are illustrative values, not those of a particular device.
  2. During one gate the off-diagonal elements shrink by e^(−0.05/100) = e^(−0.0005) ≈ 0.9995. In the Bloch picture, the ball shrinks in x and y by 0.05%.
  3. The resulting error per gate from decoherence is of order 0.05%, or 5 × 10⁻⁴, matching what one expects from the ratio (gate time)/(coherence time).
  4. After 2,000 gates (100 µs of operation) the coherences have shrunk to e^(−1) ≈ 0.37 of their starting size.
  5. This is the link between the physics of decoherence and the fidelity numbers that appear in the hardware lesson.

Why density matrices are the language of error correction

In the error-correction lesson a physical error was a random Pauli applied with some probability. From the point of view of someone who does not know which error occurred, the qubit is in a mixed state, a weighted sum of the correct state and the errored states. Syndrome measurement projects that mixture onto one branch, which is why correction can work.

A complete example: measuring dephasing with a Ramsey sequence

Here is how the pieces combine in a real experiment. A Ramsey sequence measures T₂: prepare |0⟩, apply a Hadamard to make |+⟩, wait, apply a second Hadamard, and measure. Without noise, the second Hadamard returns the qubit exactly to |0⟩. With dephasing during the wait, the coherence has shrunk and the qubit comes back only partly.

Worked example

Following the density matrix through the circuit

  1. Start with ρ = |0⟩⟨0|. After the first H: ρ = |+⟩⟨+| = [[1/2, 1/2], [1/2, 1/2]].
  2. Wait, with dephasing probability p during the delay. The off-diagonals become (1 − 2p)/2. For p = 0.1 that is 0.4, as in the earlier example.
  3. Apply the second H and compute the probability of 0. The result is P(0) = 1 − p. For p = 0.1, P(0) = 0.9, which I confirmed by multiplying the matrices.
  4. In terms of the coherence factor c = 1 − 2p, the probability is P(0) = (1 + c)/2. With c = 1 (no noise) P(0) = 1. With c = 0 (fully dephased) P(0) = 0.5.
  5. If the coherence decays as c = e^(−t/T₂), then P(0) = (1 + e^(−t/T₂))/2. At t = T₂ it is 0.684. At t = 2T₂ it is 0.568. At t = 0.5 T₂ it is 0.803.
  6. Measuring P(0) for several waiting times and fitting this curve gives T₂. Experiments do exactly this, and the number it returns is the T₂ quoted in hardware papers.

The same experiment with the qubit prepared in |1⟩ and no Hadamards, measuring the probability of 1 after a delay, gives e^(−t/T₁) and so measures T₁. Together the two experiments determine the main decoherence numbers of a qubit.

Composing noise and choosing the right picture

Errors accumulate, and channels compose by applying one after the other. For the three channels above the composition rules are simple, because each acts as a scaling of the Bloch vector.

Worked example

Two doses of noise

  1. Dephasing twice, each with p = 0.1. Each step multiplies the coherence by (1 − 2p) = 0.8, so after two steps the factor is 0.64. That equals a single dephasing with p = (1 − 0.64)/2 = 0.18, not 0.2. Errors of this kind compound slightly less than they add.
  2. Depolarising twice with q = 0.3. Each step shrinks the Bloch vector by 0.7, so after two steps by 0.49, equivalent to a single depolarising with q = 0.51.
  3. Amplitude damping for 50 µs twice with T₁ = 100 µs. Each step has 1 − γ = e^(−0.5), and two steps give e^(−1), the same as one wait of 100 µs. Exponential decay composes cleanly in time.
  4. The lesson: errors from successive gates multiply in the surviving signal, not add. This is the density-matrix version of the (1 − ε)ⁿ budget in the hardware lesson.
PictureBest forLimits
State vector |ψ⟩Ideal, isolated, pure states; reasoning about algorithmsCannot describe noise, subsystems of entangled states or classical uncertainty.
Bloch vector rA single qubit; building geometric intuition for gates and noiseDoes not extend to many qubits in a simple way.
Density matrix ρNoise, subsystems, mixed states, entropy, any number of qubitsMemory grows as 4ⁿ; the ensemble behind ρ is not unique.

Use the simplest picture that handles the question.

How close are two states? Fidelity

Experiments constantly ask whether the state that was made is the state that was wanted. For a target pure state |φ⟩ and an actual state ρ, the fidelity is F = ⟨φ|ρ|φ⟩, the probability that a measurement checking for |φ⟩ finds it. F = 1 means a perfect match.

Worked example

Fidelity of a noisy preparation

  1. Target: |0⟩. Actual state after depolarising with q = 0.3: ρ = [[0.85, 0], [0, 0.15]]. Then F = ⟨0|ρ|0⟩ = 0.85.
  2. Actual state after dephasing a |+⟩ target with p = 0.1: ρ = [[1/2, 0.4], [0.4, 1/2]]. F = ⟨+|ρ|+⟩ = ½(0.5 + 0.4 + 0.4 + 0.5) = 0.9.
  3. In the second case the fidelity is 0.9, which equals 1 − p. This is the sense in which the fidelities quoted for gates and state preparation are measures of how far ρ is from the ideal.

Gate fidelities such as the 99.843% in the hardware lesson are averages of this kind over input states. They are a compressed summary of the channel that the real gate applies instead of the ideal unitary.

The cost of using density matrices in simulation

State vectors for n qubits have 2ⁿ complex entries. A density matrix has 2ⁿ × 2ⁿ = 4ⁿ entries, which squares the memory. Simulating noise exactly with density matrices therefore reaches fewer qubits than noiseless simulation with state vectors.

Worked example

Memory for exact simulation

  1. Assume 16 bytes per complex number (two 64-bit floats).
  2. 10 qubits: a state vector has 1,024 entries, 16 kilobytes. A density matrix has 4¹⁰ = 1,048,576 entries, about 16.8 megabytes.
  3. 20 qubits: a state vector has about a million entries, 16.8 megabytes. A density matrix has 2⁴⁰ ≈ 1.1 × 10¹² entries, about 17.6 terabytes.
  4. 30 qubits: a state vector is 2³⁰ × 16 bytes, about 17 gigabytes. A density matrix is out of any computer’s reach.
  5. So noisy simulation of more than about 15 qubits usually uses a different method: random sampling of noisy circuits (trajectories), where each run is a state vector with randomly chosen errors, and the average over many runs reproduces the density matrix. I give this as a standard technique and did not open a source on it.

Common simulators offer density-matrix classes for small noisy systems, and noise models built from the channels in this lesson. The reason these three channels (dephasing, amplitude damping, depolarising) appear everywhere in simulation toolkits is that they match the main physical processes and are simple to write in Kraus form.

Common misunderstandings

MisunderstandingCorrection
A mixed state is a superpositionA superposition is pure and has coherences. A mixed state is classical uncertainty over states, or a part of an entangled whole. |+⟩ and I/2 differ in the off-diagonals.
The ensemble tells you what the state isDifferent ensembles can give the same ρ, as with {|0⟩, |1⟩} and {|+⟩, |−⟩}. Only ρ has physical content.
Half of an entangled pair has no stateIt has a perfectly good state, the reduced density matrix, which for a Bell pair is I/2.
Unitary gates can make a pure state mixedUnitaries preserve eigenvalues. Mixedness comes from noise, discarding part of a system, or measurement without readout.
Off-diagonal elements are small correctionsThey are the quantum coherence. A pure superposition has off-diagonals as large as the diagonals allow.
T₁ and T₂ are the same thingT₁ is population decay. T₂ is coherence decay, and is at most 2T₁.
Density matrices are only needed for noiseThey are also the correct way to describe subsystems of entangled states, which matters in every multi-qubit algorithm.

Practice problems

Check yourself

Is [[0.6, 0.5], [0.5, 0.4]] a valid density matrix?

It is symmetric with trace 1. Its determinant is 0.24 − 0.25 = −0.01 < 0, so one eigenvalue is negative. Not valid.

Find the purity of ρ = diag(0.9, 0.1).

0.81 + 0.01 = 0.82.

Find the Bloch vector of ρ = ½[[1, 1], [1, 1]] and of ρ = I/2.

|+⟩⟨+| has Bloch vector (1, 0, 0). I/2 has (0, 0, 0).

A qubit has Bloch vector (0, 0, 0.6). What are its eigenvalues and purity?

Eigenvalues (1 ± 0.6)/2 = 0.8 and 0.2. Purity (1 + 0.36)/2 = 0.68.

Compute the entropy of the state with eigenvalues 0.8 and 0.2.

−0.8 log₂ 0.8 − 0.2 log₂ 0.2 = 0.258 + 0.464 = 0.722 bits.

Trace out qubit B from the state (|00⟩ + |11⟩)/√2. What is ρ_A?

I/2, maximally mixed, with entropy 1 bit.

Apply dephasing with p = 0.2 to |+⟩. What are the off-diagonal elements and the purity?

Off-diagonals 0.5 × (1 − 0.4) = 0.3. Purity = 0.25 + 0.25 + 2(0.09) = 0.68.

A qubit starts in |1⟩ with T₁ = 50 µs. What is the population in |1⟩ after 75 µs?

e^(−1.5) = 0.223.

Why does the same maximally mixed state arise from preparing {|0⟩, |1⟩} and from {|+⟩, |−⟩}?

Both ensembles average to I/2. Only the density matrix is physical, so no measurement can tell them apart.

How much memory does an exact 12-qubit density matrix need at 16 bytes per entry?

4¹² = 16,777,216 entries × 16 bytes ≈ 268 megabytes.

References and further reading

I opened the tutorial “The modern tools of quantum mechanics” (arXiv 1110.6815) and confirmed its statements on density operators, purity, the Bloch representation, partial trace, Kraus operators and the depolarising channel. It does not cover amplitude damping or dephasing, so those two channels are written from standard textbook knowledge and checked here by direct calculation. Every matrix, eigenvalue, entropy and channel output in this lesson was computed with numerical linear algebra. The relation T₂ ≤ 2T₁ is a standard result that I did not reopen.

  1. The modern tools of quantum mechanics: a tutorial on quantum states, measurements, and operations (arXiv 1110.6815) Opened. Density operators, purity, Bloch representation, partial trace, Kraus operators, the depolarising channel. Amplitude damping and dephasing are not covered there.
  2. Physics 219 Quantum Computation: lecture notes (John Preskill, Caltech) Free notes with a full treatment of density operators, channels and decoherence. Not reopened for this page.
  3. Quantum error correction below the surface code threshold (arXiv 2408.13687, Google Quantum AI, 2024) Opened earlier in this course; context for the error and lifetime figures.