Simple Algorithm
Quantum Computing · Excited State · 24 min

Density Matrices & Mixed States

Describing uncertainty about a quantum state: the Bloch ball.

A source that flips a coin and sends ∣0⟩\ket0 or ∣1⟩\ket1, and a source that always sends ∣+⟩\ket+, look identical when you measure in the ZZ basis. Yet they are physically different. The density matrix is the one object that captures everything measurable about a quantum system: superposition, classical ignorance, and entanglement with the rest of the world.

What you’ll learn

  • Build the density operator of an ensemble and compute probabilities Tr⁡(Pkρ)\Tr(P_k\rho) and expectation values Tr⁡(Aρ)\Tr(A\rho).
  • Prove that density operators are exactly the positive operators of unit trace.
  • Map any qubit state to its Bloch vector, and read off its purity and entropy from the vector's length.
  • Compute reduced states with the partial trace, and explain why half of a Bell pair is maximally mixed.
  • Explain why different ensembles with the same ρ\rho cannot be told apart by any experiment.

Superposition is not a mixture

Suppose a device flips a fair coin and, depending on the result, prepares ∣0⟩\ket0 or ∣1⟩\ket1, without telling you which. This is an ensemble {(pi,∣ψi⟩)}\{(p_i,\ket{\psi_i})\}: the state ∣ψi⟩\ket{\psi_i} with probability pip_i. Is it the same thing as the superposition ∣+⟩=12(∣0⟩+∣1⟩)\ket+ = \tfrac{1}{\sqrt2}(\ket0+\ket1), which also gives 50/50 in the ZZ basis?

It is not, and in fact no single ket can describe the coin-flip source. Every pure qubit state is an eigenstate of some Pauli observable n^⋅σ⃗\hat n\cdot\vec\sigma, so it gives a certain outcome in that basis. The coin-flip source gives 50/50 in the ZZ, XX and YY bases alike. Test the pure state yourself:

DerivationThe Born rule for an ensemble
  1. P(k)=∑ipi ⟨ψi∣Pk∣ψi⟩P(k) = \sum_i p_i\,\bra{\psi_i}P_k\ket{\psi_i}

    Average the Born rule over your classical uncertainty about which state was prepared:

  2. P(k)=∑ipi Tr⁡(Pk∣ψi⟩ ⁣⟨ψi∣)P(k) = \sum_i p_i\,\Tr\big(P_k\dyad{\psi_i}\big)

    Rewrite each expectation value as a trace, using ⟨ψ∣A∣ψ⟩=Tr⁡(A∣ψ⟩ ⁣⟨ψ∣)\bra\psi A\ket\psi = \Tr\big(A\dyad\psi\big):

  3. P(k)=Tr⁡(Pk∑ipi∣ψi⟩ ⁣⟨ψi∣)=Tr⁡(Pk ρ),ρ:=∑ipi∣ψi⟩ ⁣⟨ψi∣P(k) = \Tr\Big(P_k\sum_i p_i\dyad{\psi_i}\Big) = \Tr\big(P_k\,\rho\big),\qquad \rho := \sum_i p_i\dyad{\psi_i}

    Linearity of the trace pulls the sum inside:

  4. Every outcome probability depends on the preparation only through ρ\rho, the density operator. That makes ρ\rho, not the ensemble, the state.

The density operator

Pure states are the special case ρ=∣ψ⟩ ⁣⟨ψ∣\rho = \dyad\psi, a rank-one projector. Since Tr⁡ρ2=∑kλk2\Tr\rho^2 = \sum_k\lambda_k^2, the purity satisfies 1/d≤Tr⁡ρ2≤11/d\le\Tr\rho^2\le1: it equals 11 exactly for pure states and 1/d1/d exactly for the maximally mixed state I/d\id/d. Everything else is a mixed state. Compare the coin-flip source with ∣+⟩\ket+:

ρcoin=12∣0⟩ ⁣⟨0∣+12∣1⟩ ⁣⟨1∣=(120012),ρ+=∣+⟩ ⁣⟨+∣=(12121212)\rho_{\text{coin}} = \tfrac12\dyad{0}+\tfrac12\dyad{1} = \begin{pmatrix}\tfrac12 & 0\\ 0 & \tfrac12\end{pmatrix},\qquad \rho_{+} = \dyad{+} = \begin{pmatrix}\tfrac12 & \tfrac12\\ \tfrac12 & \tfrac12\end{pmatrix}
Same diagonal (the populations, i.e. the ZZ-basis probabilities), different off-diagonal entries (the coherences). That is why Tr⁡(Xρcoin)=0\Tr(X\rho_{\text{coin}}) = 0 but Tr⁡(Xρ+)=1\Tr(X\rho_+) = 1.
Check your understanding

Which matrix is a valid density matrix?

  1. (0.70.50.50.3)\begin{pmatrix}0.7 & 0.5\\ 0.5 & 0.3\end{pmatrix}
  2. (0.60.4i0.4i0.4)\begin{pmatrix}0.6 & 0.4i\\ 0.4i & 0.4\end{pmatrix}
  3. (0.80.30.30.2)\begin{pmatrix}0.8 & 0.3\\ 0.3 & 0.2\end{pmatrix}
  4. (0.5000.6)\begin{pmatrix}0.5 & 0\\ 0 & 0.6\end{pmatrix}
Show the answer

C. (0.80.30.30.2)\begin{pmatrix}0.8 & 0.3\\ 0.3 & 0.2\end{pmatrix}

It is Hermitian with unit trace. For a 2×22\times2 Hermitian matrix with positive trace, both eigenvalues are nonnegative exactly when the determinant is: here det⁡=0.16−0.09=0.07≥0\det = 0.16-0.09 = 0.07\ge0.

The Bloch ball

The 2×22\times2 Hermitian matrices form a real four-dimensional vector space with basis {I,X,Y,Z}\{\id,X,Y,Z\}, so every qubit state can be expanded in Pauli matrices. The two constraints Tr⁡ρ=1\Tr\rho = 1 and ρ≥0\rho\ge0 then carve out a familiar shape.

DerivationEvery qubit state is a point in a ball
  1. ρ=12(a0 I+rxX+ryY+rzZ),a0, rj∈R\rho = \tfrac12\big(a_0\,\id + r_xX + r_yY + r_zZ\big),\qquad a_0,\,r_j\in\R

    Hermitian matrices have real coefficients in the Pauli basis.

  2. Tr⁡ρ=a0=1,rj=Tr⁡(ρ σj)=⟨σj⟩\Tr\rho = a_0 = 1,\qquad r_j = \Tr(\rho\,\sigma_j) = \expval{\sigma_j}

    The Paulis are traceless and satisfy Tr⁡(σjσk)=2δjk\Tr(\sigma_j\sigma_k) = 2\delta_{jk}.

  3. ρ=12(I+r⃗⋅σ⃗)=12(1+rzrx−iryrx+iry1−rz)\rho = \tfrac12\big(\id+\vec r\cdot\vec\sigma\big) = \frac12\begin{pmatrix}1+r_z & r_x-ir_y\\ r_x+ir_y & 1-r_z\end{pmatrix}

    The Bloch vector r⃗\vec r is simply the list of Pauli expectation values.

  4. λ±=12(1±∣r⃗∣)≥0  ⟺  ∣r⃗∣≤1\lambda_\pm = \tfrac12\big(1\pm\abs{\vec r}\big)\ge0\iff\abs{\vec r}\le1

    Since (r⃗⋅σ⃗)2=∣r⃗∣2I(\vec r\cdot\vec\sigma)^2 = \abs{\vec r}^2\id, the matrix r⃗⋅σ⃗\vec r\cdot\vec\sigma has eigenvalues ±∣r⃗∣\pm\abs{\vec r}. Positivity is exactly the solid ball.

  5. Tr⁡ρ2=12(1+∣r⃗∣2)\Tr\rho^2 = \tfrac12\big(1+\abs{\vec r}^2\big)

    Pure states form the surface (the Bloch sphere), mixed states fill the inside of the Bloch ball, and its center r⃗=0\vec r = 0 is the maximally mixed state I/2\id/2.

Mixedness can also be measured in bits, by the von Neumann entropy S(ρ)=−Tr⁡ρlog⁡2ρ=−∑±λ±log⁡2λ±S(\rho) = -\Tr\rho\log_2\rho = -\sum_\pm\lambda_\pm\log_2\lambda_\pm. It is 00 on the surface and 11 bit at the center.

Predict before you look

What is the purity Tr⁡ρ2\Tr\rho^2 of ρ=34∣0⟩ ⁣⟨0∣+14∣1⟩ ⁣⟨1∣\rho = \tfrac34\dyad0+\tfrac14\dyad1?

Show the answer

0.625

Tr⁡ρ2=∑kλk2=916+116=1016=0.625\Tr\rho^2 = \sum_k\lambda_k^2 = \tfrac{9}{16}+\tfrac{1}{16} = \tfrac{10}{16} = 0.625. Equivalently, r⃗=(0,0,12)\vec r = (0,0,\tfrac12) and 12(1+14)=0.625\tfrac12\big(1+\tfrac14\big) = 0.625.

So far, mixedness came from a coin flip. The next step shows a deeper source that needs no coin at all.

Mixed states from entanglement

Two qubits in the Bell state ∣Φ+⟩=12(∣00⟩+∣11⟩)\ket{\Phi^+} = \tfrac{1}{\sqrt2}(\ket{00}+\ket{11}) are in a pure state. But what is the state of qubit AA alone? The answer is the partial trace ρA=Tr⁡B∣Φ+⟩ ⁣⟨Φ+∣\rho_A = \Tr_B\dyad{\Phi^+}, defined on product operators by

Tr⁡B(∣a⟩ ⁣⟨a′∣⊗∣b⟩ ⁣⟨b′∣)=∣a⟩ ⁣⟨a′∣ ⟨b′∣b⟩\Tr_B\big(\ketbra{a}{a'}\otimes\ketbra{b}{b'}\big) = \ketbra{a}{a'}\,\braket{b'|b}

and extended linearly.

DerivationHalf of a Bell pair
  1. ∣Φ+⟩ ⁣⟨Φ+∣=12(∣00⟩ ⁣⟨00∣+∣00⟩ ⁣⟨11∣+∣11⟩ ⁣⟨00∣+∣11⟩ ⁣⟨11∣)\dyad{\Phi^+} = \tfrac12\big(\ketbra{00}{00}+\ketbra{00}{11}+\ketbra{11}{00}+\ketbra{11}{11}\big)

    Expand the projector.

  2. Tr⁡B∣Φ+⟩ ⁣⟨Φ+∣=12(∣0⟩ ⁣⟨0∣⟨0∣0⟩+∣0⟩ ⁣⟨1∣⟨1∣0⟩+∣1⟩ ⁣⟨0∣⟨0∣1⟩+∣1⟩ ⁣⟨1∣⟨1∣1⟩)\Tr_B\dyad{\Phi^+} = \tfrac12\big(\dyad{0}\braket{0|0}+\ketbra{0}{1}\braket{1|0}+\ketbra{1}{0}\braket{0|1}+\dyad{1}\braket{1|1}\big)

    Trace out the second factor term by term. For example ∣00⟩ ⁣⟨11∣=∣0⟩ ⁣⟨1∣⊗∣0⟩ ⁣⟨1∣\ketbra{00}{11} = \ketbra{0}{1}\otimes\ketbra{0}{1} contributes ∣0⟩ ⁣⟨1∣⟨1∣0⟩=0\ketbra{0}{1}\braket{1|0} = 0.

  3. ρA=12(∣0⟩ ⁣⟨0∣+∣1⟩ ⁣⟨1∣)=I2\rho_A = \tfrac12\big(\dyad{0}+\dyad{1}\big) = \frac{\id}{2}

    The cross terms vanish. Qubit AA alone is maximally mixed, although the pair is pure.

This is why density operators are unavoidable: a subsystem of an entangled pure state has no ket of its own. It is also why ρA\rho_A is complete: for any measurement on AA alone, Tr⁡[(Pk⊗I)∣Φ+⟩ ⁣⟨Φ+∣]=Tr⁡(PkρA)\Tr\big[(P_k\otimes\id)\dyad{\Phi^+}\big] = \Tr(P_k\rho_A), and the partial trace is the unique linear map with this property for all PkP_k.

Check your understanding

Alice and Bob share ∣Φ+⟩\ket{\Phi^+}. Bob measures his qubit in the XX basis but tells no one the result. What state should Alice assign to her qubit?

  1. I/2\id/2, exactly as before Bob measured
  2. ∣+⟩\ket+, because Bob's measurement collapsed the pair
  3. ∣0⟩\ket0, because ∣Φ+⟩\ket{\Phi^+} correlates ZZ values
  4. None: her state is undefined until Bob sends his result
Show the answer

A. I/2\id/2, exactly as before Bob measured

Averaged over Bob's unknown outcome, Alice holds ∣+⟩\ket+ or ∣−⟩\ket- with probability ½ each, and 12∣+⟩ ⁣⟨+∣+12∣−⟩ ⁣⟨−∣=I/2\tfrac12\dyad{+}+\tfrac12\dyad{-} = \id/2. Bob's choice of measurement changes the ensemble but not ρA\rho_A, which is why entanglement alone cannot send a signal.

Same density matrix, different stories

The coin-flip source, a source that flips between ∣+⟩\ket+ and ∣−⟩\ket-, and half of a Bell pair all produce ρ=I/2\rho = \id/2. Since every probability is Tr⁡(Pkρ)\Tr(P_k\rho), no experiment whatsoever can tell these preparations apart, not even one using many copies: nn independent emissions give (I/2)⊗n(\id/2)^{\otimes n} in every case.

Think first A box emits qubits drawn either from {∣0⟩,∣1⟩}\{\ket0,\ket1\} or from {∣+⟩,∣−⟩}\{\ket+,\ket-\}, each chosen by a fair coin. You may measure as many qubits as you like, in any bases, even jointly. Can you tell which box you have?

No. Both boxes emit ρ=I/2\rho = \id/2 on every run, so every outcome distribution, for every measurement on any number of emitted qubits, is identical. The ensemble is a story about the preparation; only ρ\rho is physical.

Key takeaways

  • A density operator ρ=∑ipi∣ψi⟩ ⁣⟨ψi∣\rho = \sum_ip_i\dyad{\psi_i} is exactly a positive, unit-trace operator. It predicts every probability via Tr⁡(Pkρ)\Tr(P_k\rho) and every expectation value via Tr⁡(Aρ)\Tr(A\rho).
  • Qubit states fill the Bloch ball: ρ=12(I+r⃗⋅σ⃗)\rho = \tfrac12(\id+\vec r\cdot\vec\sigma) with r⃗=⟨σ⃗⟩\vec r = \expval{\vec\sigma}, ∣r⃗∣≤1\abs{\vec r}\le1, and purity 12(1+∣r⃗∣2)\tfrac12(1+\abs{\vec r}^2).
  • Off-diagonal elements (coherences) distinguish a superposition from a classical mixture with the same populations.
  • Subsystems of entangled states are mixed; the partial trace is the unique consistent way to describe them.
  • Different ensembles with the same ρ\rho are physically indistinguishable; they are related by a unitary matrix.

Check yourself

In the interactive lesson these are scored with your confidence, and what you miss comes back for review.

Question 1

A qubit has Bloch vector r⃗=(0.6, 0, 0)\vec r = (0.6,\,0,\,0). What is the probability of outcome ++ when it is measured in the XX basis?

  1. 0.60.6
  2. 0.80.8
  3. 0.50.5
  4. 0.360.36
Show the answer

B. 0.80.8

∣+⟩ ⁣⟨+∣=12(I+X)\dyad{+} = \tfrac12(\id+X), so P(+)=Tr⁡(∣+⟩ ⁣⟨+∣ρ)=12(1+rx)=0.8P(+) = \Tr\big(\dyad{+}\rho\big) = \tfrac12(1+r_x) = 0.8.

Question 2

A qubit has purity Tr⁡ρ2=0.82\Tr\rho^2 = 0.82. What is the length of its Bloch vector?

  1. 0.820.82
  2. 0.640.64
  3. 0.80.8
  4. 0.90.9
Show the answer

C. 0.80.8

12(1+∣r⃗∣2)=0.82\tfrac12\big(1+\abs{\vec r}^2\big) = 0.82 gives ∣r⃗∣2=0.64\abs{\vec r}^2 = 0.64, so ∣r⃗∣=0.8\abs{\vec r} = 0.8.

Question 3

Which property of a qubit state can a unitary gate change?

  1. Its purity Tr⁡ρ2\Tr\rho^2
  2. Its eigenvalues
  3. Its von Neumann entropy
  4. The direction of its Bloch vector
Show the answer

D. The direction of its Bloch vector

ρ↦UρU†\rho\mapsto U\rho U^\dagger is a similarity transformation, so the eigenvalues, and with them purity and entropy, are unchanged. On the Bloch ball a unitary acts as a rotation: it turns r⃗\vec r but preserves ∣r⃗∣\abs{\vec r}.

Question 4

Two qubits are in the state 12(∣01⟩−∣10⟩)\tfrac{1}{\sqrt2}(\ket{01}-\ket{10}). What is the reduced state of the first qubit?

  1. ∣0⟩ ⁣⟨0∣\dyad0
  2. I/2\id/2
  3. ∣−⟩ ⁣⟨−∣\dyad{-}
  4. It has no state, because it is entangled
Show the answer

B. I/2\id/2

Tracing out the second qubit kills the cross terms, leaving ρA=12(∣0⟩ ⁣⟨0∣+∣1⟩ ⁣⟨1∣)=I/2\rho_A = \tfrac12\big(\dyad0+\dyad1\big) = \id/2. Every Bell state has maximally mixed marginals.

Question 5

Which statement is true?

  1. Two ensembles with the same density matrix give identical statistics for every measurement
  2. Measuring in the XX basis distinguishes {12:∣0⟩, 12:∣1⟩}\{\tfrac12:\ket0,\ \tfrac12:\ket1\} from {12:∣+⟩, 12:∣−⟩}\{\tfrac12:\ket+,\ \tfrac12:\ket-\}
  3. An equal mixture of ∣0⟩\ket0 and ∣+⟩\ket+ is pure, because the two states overlap
  4. The diagonal of ρ\rho in the ZZ basis determines all measurement statistics
Show the answer

A. Two ensembles with the same density matrix give identical statistics for every measurement

Every probability is Tr⁡(Pkρ)\Tr(P_k\rho), so it depends on the preparation only through ρ\rho.

Go deeper

Further reading

  • M. A. Nielsen & I. L. Chuang, Quantum Computation and Quantum Information, §2.4 (the density operator) and §2.5 (Cambridge, 10th anniv. ed., 2010).
  • J. Preskill, Lecture Notes for Ph219/CS219: Quantum Information and Computation, Ch. 2, "Foundations I: States and Ensembles" (Caltech).
  • M. M. Wilde, Quantum Information Theory, 2nd ed., Ch. 4 (Cambridge, 2017).