4. Superposition and measurement

Why this layer exists

This chapter is where the Born rule earns its keep, and where the single most important fact of quantum measurement gets installed: measurement collapses the state, and the collapse is irreversible. Get it now, before you have built up the habit of thinking of the state as a probability distribution, and you will apply it everywhere — you will build interference before you measure, because once you measure the superposition is gone. Get it only later, after you have memorised the circuit model, and you will be fighting the habit of thinking that the superposition “is there all along, you just don’t know which.” That habit is wrong, and it is the single most common misconception in the field.

What breaks without this chapter is the circuit model. Chapter 5 is interference, and interference is built on the superposition that measurement destroys. Chapter 6 is entanglement, and entanglement is a superposition of a composite system that measurement collapses. Every algorithm in Part III is a circuit that builds a superposition, interferes it, and measures it; if you do not understand what measurement does to the superposition, you do not understand the circuit model.

Superposition

A superposition is a quantum state written as a linear combination of basis states:

∣ψ⟩=∑xax∣x⟩. |\psi\rangle = \sum_x a_x |x\rangle .

The word “superposition” is just “linear combination” in the qubit dialect, and it is the first thing to say clearly, because the word carries a lifetime of wrong pictures. A superposition is not a coin spinning in the air, caught between heads and tails. It is not “both at once” in the sense of the coin being both faces simultaneously. It is a vector written in a basis, and the basis vectors are the only things that are real; the superposition is the vector, and the vector is the state.

The reason the coin picture is wrong is that a coin spinning in the air is a probability distribution: it is heads with probability $p$ and tails with probability $1-p$, and you just don’t know which. A superposition is not a probability distribution: it is a list of amplitudes, and the amplitudes have phases, and the phases interfere. A probability distribution has no phase; a superposition does. That is the difference, and it is the whole difference.

In tqp a superposition is just a state vector, and the “combination” is the explicit sum:

import numpy as np
# superposition of |0> and |1>
psi = np.array([0.6, 0.8])          # amplitudes, |0.6|^2 + |0.8|^2 = 1
# superposition of |00>, |01>, |10>, |11>
phi = np.array([0.5, 0.5, 0.5, 0.5]) # equal superposition of all 2-qubit states

The state is the vector; the superposition is the vector written as a sum of basis vectors. There is nothing more to it, and nothing less.

The measurement

A measurement is a set of operators ${M_m}$ satisfying the completeness relation $\sum_m M_m^\dagger M_m = I$. The probability of outcome $m$ is the Born rule, $p(m) = \langle\psi|M_m^\dagger M_m|\psi\rangle$, and the state after the measurement, given outcome $m$, is

∣ψ′⟩=Mm∣ψ⟩∥Mm∣ψ⟩∥. |\psi'\rangle = \frac{M_m|\psi\rangle}{\|M_m|\psi\rangle\|} .

The projective measurement in the computational basis is the special case $M_m = |m\rangle\langle m|$: the probability of outcome $|m\rangle$ is $p(m) = |\langle m|\psi\rangle|^2$, and the state after the measurement is $|m\rangle$. This is the collapse: the superposition $|\psi\rangle$ becomes the single basis state $|m\rangle$, and the collapse is irreversible.

The reason the collapse is irreversible is that you cannot recover $|\psi\rangle$ from $|m\rangle$: many states collapse to the same outcome. If $|\psi\rangle = a|0\rangle + b|1\rangle$ and you measure and get $|0\rangle$, the state is now $|0\rangle$, and you cannot recover $a$ and $b$ from $|0\rangle$ alone. The information is gone, and it is gone forever. This is the single most important fact about measurement, and it shapes everything after it.

Why collapse matters

The reason collapse matters is that it is the one operation you cannot undo, and so it is the one operation you must be careful about. A gate is a unitary, and a unitary is reversible: apply $U^\dagger$ and you recover the original state. A measurement is not reversible: apply it and you collapse the state, and you cannot recover the superposition. This is the difference between the two kinds of operation, and it is the reason a quantum computer is built the way it is.

The way a quantum computer is built is that it builds interference before it measures. A circuit is a unitary built from gates, applied to a state, read out by a measurement. The unitary builds interference among the amplitudes, and the measurement reads out the result of the interference. If you measure before the interference is built, you destroy the superposition and the interference is lost. If you measure after the interference is built, you read out the answer. The whole point of the circuit is to build the interference before you measure.

In tqp the collapse is explicit in collapse, and the measurement is projective:

import numpy as np
from tqp import measurement
psi = np.array([0.6, 0.8])
# probabilities of measuring |0> and |1>
p0, p1 = measurement.probability(psi, np.array([1, 0])), measurement.probability(psi, np.array([0, 1]))
# collapse: if you measure and get |0>, the state is now |0>
collapsed = np.array([1, 0])
# you cannot recover psi from collapsed

The collapsed state is $|0\rangle$, and you cannot recover psi from it. That is the collapse, and it is irreversible.

The measurement basis

The measurement basis is the basis you measure in, and it is not always the computational basis. The projective measurement in the computational basis is the special case $M_m = |m\rangle\langle m|$; the projective measurement in a different basis ${|v\rangle}$ is $M_m = |v\rangle\langle v|$, and the collapse is onto $|v\rangle$.

The reason the measurement basis matters is that the collapse is onto the basis state you measure, and different bases collapse to different states. The state $|+\rangle = (|0\rangle + |1\rangle)/\sqrt{2}$ is the basis state $|+\rangle$ in the Hadamard basis, and it is a superposition in the computational basis. If you measure $|+\rangle$ in the Hadamard basis, you get $|+\rangle$ with probability one; if you measure it in the computational basis, you get $|0\rangle$ and $|1\rangle$ each with probability one. The state is the same; the measurement basis is different, and the outcome is different.

In tqp the measurement basis is the basis you pass to probability and collapse:

import numpy as np
from tqp import measurement
# |+> measured in the Hadamard basis
plus = np.array([1, 0])
p_plus = measurement.probability(plus, np.array([1, 0]))   # |<+|+>|^2 = 1
# |+> measured in the computational basis
p0 = measurement.probability(plus, np.array([1, 0]))
p1 = measurement.probability(plus, np.array([0, 1]))
# both are 1/2: |+> is a superposition in the computational basis

The plus state is $|+\rangle$ in the Hadamard basis and a superposition in the computational basis, and the measurement basis determines the outcome.

Exercises

(a) Why is the superposition not a probability distribution?

Answer

A probability distribution is a list of non-negative numbers that sum to one, and it describes a system that is in one of the basis states with a certain probability, you just don’t know which. A superposition is a list of amplitudes, and the amplitudes are complex and have phases, and the phases interfere. A probability distribution has no phase; a superposition does. That is the difference: the superposition can interfere, and the probability distribution cannot. The superposition is the state; the probability distribution is what you get after you measure.

(b) Why is the collapse irreversible?

Answer

The collapse is irreversible because you cannot recover the superposition from the collapsed state. If $|\psi\rangle = a|0\rangle + b|1\rangle$ and you measure and get $|0\rangle$, the state is now $|0\rangle$, and you cannot recover $a$ and $b$ from $|0\rangle$ alone: many states collapse to the same outcome. The information is gone, and it is gone forever. This is the difference between a gate, which is reversible, and a measurement, which is not.

(c) What is the difference between measuring $|+\rangle$ in the Hadamard basis and in the computational basis?

Answer

The state $|+\rangle$ is the basis state $|+\rangle$ in the Hadamard basis, and it is a superposition in the computational basis. If you measure it in the Hadamard basis, you get $|+\rangle$ with probability one; if you measure it in the computational basis, you get $|0\rangle$ and $|1\rangle$ each with probability one. The state is the same; the measurement basis is different, and the outcome is different. The measurement basis determines the outcome, because the collapse is onto the basis state you measure.

(d) Write the superposition $\frac{1}{2}(|00\rangle + |01\rangle + |10\rangle + |11\rangle)$ as a tensor product, and show it is a product state.

Answer

The superposition factors as $\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) \otimes \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle) = |+\rangle \otimes |+\rangle$, the vector $(\tfrac12, \tfrac12, \tfrac12, \tfrac12)$. It is a product state because it factors into a vector from qubit one times a vector from qubit two; it is not entangled. The Bell state $(|00\rangle + |11\rangle)/\sqrt{2}$, by contrast, does not factor, and that is what makes it entangled.

Lab: measurement in tqp

The first circuit that runs is chapter 14’s, but this lab runs measurement directly, in tqp, so you can see the collapse and the measurement basis.

Build labs/ch04/ from the repository root:

mkdir -p labs/ch04

Write a script that does four things:

  1. Build the state $|+\rangle = (|0\rangle + |1\rangle)/\sqrt{2}$ and check the probabilities of measuring $|0\rangle$ and $|1\rangle$ are each $\tfrac12$.
  2. Measure $|+\rangle$ in the Hadamard basis and check you get $|+\rangle$ with probability one.
  3. Collapse $|+\rangle$ by measuring in the computational basis and check the state is now $|0\rangle$ or $|1\rangle$.
  4. Build the two-qubit state $|+\rangle \otimes |+\rangle$ and check the probabilities of measuring $|00\rangle$, $|01\rangle$, $|10\rangle$, $|11\rangle$ are each $\tfrac14$.

Run it:

make lab CH=04

The acceptance test checks that the collapse is irreversible, that the measurement basis determines the outcome, and that the tensor product has four entries.

make test

should be green.

Further reading

The three documents this book keeps open:

  • Quantum measurement — the collapse, the irreversibility, the measurement basis. The why behind the Born rule.
  • The Born rule — the probability as the squared modulus of the amplitude.
  • Projection operator — the projective measurement $M_m = |m\rangle\langle m|$.

And the paper behind the cloud QPU, read in Part III:

results matching ""

    No results matching ""