Skip to content

Density matrices

In the last lesson Bob held a qubit that was “in one of four states with equal probability”. And in the lesson before, one qubit of a Bell pair had “no state of its own”. Neither situation can be written as α∣0⟩+β∣1⟩\alpha\ket{0} + \beta\ket{1}. This lesson introduces the description that covers both.

Consider two machines.

  • Machine A outputs the state ∣+⟩=12(∣0⟩+∣1⟩)\ket{+} = \tfrac{1}{\sqrt2}(\ket{0} + \ket{1}) every time.
  • Machine B flips a hidden coin and outputs ∣0⟩\ket{0} or ∣1⟩\ket{1} accordingly.

Measure the output of either and you get 0 or 1 with equal probability. Are they the same? No. Apply HH before measuring. Machine A’s qubit becomes ∣0⟩\ket{0} and gives 0 every time. Machine B’s qubit becomes ∣+⟩\ket{+} or ∣−⟩\ket{-}, and still gives 0 or 1 at random.

Machine A produces a superposition: one definite state, whose amplitudes can interfere. Machine B produces a mixture: ordinary ignorance about which state was made. No single ket describes Machine B’s output, so we need a more general object.

First, a little notation. For every ket there is a bra, written ⟨ψ∣\bra{\psi}, which is the conjugate transpose of the ket: a row vector instead of a column.

∣ψ⟩=(αβ)⟹⟨ψ∣=(α∗β∗).\ket{\psi} = \begin{pmatrix}\alpha\\ \beta\end{pmatrix} \quad\Longrightarrow\quad \bra{\psi} = \begin{pmatrix}\alpha^* & \beta^*\end{pmatrix}.

A bra times a ket is a number, the inner product ⟨φ∣ψ⟩\langle\varphi|\psi\rangle. Its squared magnitude ∣⟨φ∣ψ⟩∣2|\langle\varphi|\psi\rangle|^2 is called the overlap of the two states: it is 1 when they are the same state and 0 when they are orthogonal.

A ket times a bra, in that order, is a matrix, the outer product:

∣ψ⟩⟨ψ∣=(αβ)(α∗β∗)=(∣α∣2αβ∗α∗β∣β∣2).\ket{\psi}\bra{\psi} = \begin{pmatrix}\alpha\\ \beta\end{pmatrix}\begin{pmatrix}\alpha^* & \beta^*\end{pmatrix} = \begin{pmatrix}|\alpha|^2 & \alpha\beta^*\\ \alpha^*\beta & |\beta|^2\end{pmatrix}.

If a source emits the state ∣ψi⟩\ket{\psi_i} with probability pip_i, its density matrix is

ρ=∑ipi ∣ψi⟩⟨ψi∣.\rho = \sum_i p_i\,\ket{\psi_i}\bra{\psi_i}.

For the two machines:

ρA=∣+⟩⟨+∣=(12121212),ρB=12∣0⟩⟨0∣+12∣1⟩⟨1∣=(120012).\rho_A = \ket{+}\bra{+} = \begin{pmatrix}\tfrac12 & \tfrac12\\[2pt] \tfrac12 & \tfrac12\end{pmatrix}, \qquad \rho_B = \tfrac12\ket{0}\bra{0} + \tfrac12\ket{1}\bra{1} = \begin{pmatrix}\tfrac12 & 0\\[2pt] 0 & \tfrac12\end{pmatrix}.

Now the difference is visible.

  • The diagonal entries are the probabilities of measuring 0 and 1. They are the same for both machines.
  • The off-diagonal entries are called coherences. They are what makes interference possible. Machine A has them and Machine B does not.

Everything you can predict about a qubit follows from its density matrix. The rules you know carry over:

  • Measurement. The probability of outcome 0 is the top-left entry ρ00\rho_{00}, and of outcome 1 is ρ11\rho_{11}.
  • Gates. A gate UU changes the state to Uρ U†U\rho\,U^\dagger.

A matrix is a valid density matrix exactly when it is Hermitian (equal to its own conjugate transpose), has trace 1, and has no negative eigenvalues. The trace condition is normalisation again: the probabilities on the diagonal sum to one.

Check

Which of these is not a valid density matrix?

A state that can be written as a single ket, ρ=∣ψ⟩⟨ψ∣\rho = \ket{\psi}\bra{\psi}, is called pure. Anything else is mixed. A convenient test is the purity,

Tr(ρ2),\mathrm{Tr}(\rho^2),

which equals 1 for a pure state and is smaller for a mixed one. For a qubit its lowest value is 12\tfrac12, reached by ρB=I/2\rho_B = I/2. That state is called maximally mixed: every measurement on it, in any basis, gives a fair coin flip.

There is a subtlety here that surprises most people. Take a third machine that outputs ∣+⟩\ket{+} or ∣−⟩\ket{-} at random. Its density matrix is

12∣+⟩⟨+∣+12∣−⟩⟨−∣=(120012),\tfrac12\ket{+}\bra{+} + \tfrac12\ket{-}\bra{-} = \begin{pmatrix}\tfrac12 & 0\\[2pt] 0 & \tfrac12\end{pmatrix},

the same as Machine B’s. Since all predictions come from ρ\rho, no experiment can tell these two machines apart, even though they were described differently. A density matrix does not record which mixture produced it. That information is not merely hidden. It has no physical meaning.

The second use of density matrices is the more important one. Suppose two qubits are in a pure state and you only have access to the first. What state is it in?

The answer is its reduced density matrix, found by an operation called the partial trace. For a two-qubit state ∑cij∣i⟩∣j⟩\sum c_{ij}\ket{i}\ket{j}, the reduced state of the first qubit has entries

(ρ1)ii′=∑jcij ci′j∗.(\rho_1)_{ii'} = \sum_j c_{ij}\,c_{i'j}^*.

It is the unique matrix that gives the right probabilities for every measurement on the first qubit alone.

For a product state ∣a⟩∣b⟩\ket{a}\ket{b} this just gives back ∣a⟩⟨a∣\ket{a}\bra{a}, as it should. For a Bell state, c00=c11=12c_{00} = c_{11} = \tfrac{1}{\sqrt2} and the other two are zero, so

ρ1=(120012).\rho_1 = \begin{pmatrix}\tfrac12 & 0\\[2pt] 0 & \tfrac12\end{pmatrix}.

One half of a Bell pair is maximally mixed. The pair as a whole is in a definite, pure state, about which we know everything there is to know. Yet each part on its own is as random as a qubit can be. This is the precise meaning of “neither qubit has a state of its own”.

In the next puzzles the panel beside the state shows the reduced density matrix of the top qubit. Only that matrix is checked.

PuzzlePure whole, mixed part

Starting from ∣00⟩\ket{00}, make the top qubit maximally mixed. Watch its coherences after each gate.

This puzzle needs JavaScript.

After the HH alone, the top qubit was pure with coherences of 12\tfrac12. The CNOT did nothing to the top qubit directly, since it was the control. All it did was let the bottom qubit record the top one’s value. That was enough to erase the coherences.

PuzzleUndo it

The two qubits are in a Bell state, so the top one is maximally mixed. Make it pure again, in the state ∣+⟩\ket{+}.

This puzzle needs JavaScript.

The mixedness was reversible, but only because you could act on both qubits.

Check

Alice holds one qubit of a Bell pair, and Bob’s is out of reach. Can Alice make her qubit pure using gates on it alone?

This is the mechanism behind noise in real devices, and the subject of the next lesson. A qubit that becomes entangled with something you cannot control behaves, for all practical purposes, as if it had been randomised.

Every single-qubit density matrix can be written as

ρ=12(1+zx−iyx+iy1−z)\rho = \tfrac12\begin{pmatrix}1 + z & x - iy\\ x + iy & 1 - z\end{pmatrix}

for three real numbers with x2+y2+z2≤1x^2 + y^2 + z^2 \le 1. So qubit states correspond to points of a solid ball, the Bloch ball. Pure states are the points on its surface, with ∣0⟩\ket{0} and ∣1⟩\ket{1} at the north and south poles and ∣+⟩\ket{+} and ∣−⟩\ket{-} on the equator. Mixed states are inside, and the maximally mixed state is the centre. The distance from the centre measures purity.

Exercise. A source emits ∣0⟩\ket{0} with probability 34\tfrac34 and ∣+⟩\ket{+} with probability 14\tfrac14. Find its density matrix, the probability of measuring 0, and the purity.

Solutionρ=34(1000)+14(12121212)=(78181818).\rho = \tfrac34\begin{pmatrix}1&0\\0&0\end{pmatrix} + \tfrac14\begin{pmatrix}\tfrac12&\tfrac12\\ \tfrac12&\tfrac12\end{pmatrix} = \begin{pmatrix}\tfrac78&\tfrac18\\[2pt] \tfrac18&\tfrac18\end{pmatrix}.

The probability of measuring 0 is 78\tfrac78. For a real symmetric 2×22\times2 matrix the purity is the sum of the squares of all four entries: 49+1+1+164=1316\tfrac{49 + 1 + 1 + 1}{64} = \tfrac{13}{16}, which is below 1, so the state is mixed.

RecallAnswer from memory, then check
LessonFinish this lesson