Where the numbers come from
A quantum computer never shows you its amplitudes. Every run of a circuit ends with a measurement that returns classical bits, and a different run of the same circuit may return different bits. Everything we learn about a state comes from the statistics of many such runs, called shots. This lesson makes three things precise: which probabilities quantum mechanics predicts, what happens to the state when it is measured, and how well a finite number of shots pins those probabilities down. The postulates follow Nielsen and Chuang, Section 2.2.
The Born rule
Let be an orthonormal basis of the state space. A projective measurement in this basis on the state returns outcome with probability
These numbers are non-negative and sum to one, because expanding in an orthonormal basis gives . In the computational basis this is the rule from the first lesson: .
It is often convenient to write the measurement with projectors . They satisfy , for and , and the Born rule reads . (Quantum mechanics also allows more general measurements, described by positive operators that need not be projectors. They are not needed in this course, and any of them can be realised as a projective measurement on a larger system.)
Measuring in another basis
Hardware typically measures only in the computational basis. To measure in a basis , apply the unitary where is the matrix whose columns are the , and then measure in the computational basis. This works because , so
The two most common cases:
- basis : the matrix with these columns is , and , so apply and measure. Outcome 0 means "+", outcome 1 means "−".
- basis : the matrix with these columns is , so . Apply , then , then measure.
On the Bloch sphere, each orthonormal basis is an axis, and measuring along an axis gives the "+" outcome with probability , by the overlap formula of the Bloch-sphere lesson. The basis-change gate simply rotates the chosen axis onto the axis.
What measurement does to the state
State-update rule. If outcome occurs, the state immediately afterwards is
For a basis measurement this is up to a global phase. Three consequences matter in practice.
- Repeatability. Measuring again in the same basis returns with certainty. A second measurement teaches you nothing new.
- Irreversibility. Different input states (for example and ) can both end up as after the outcome 0. No unitary can undo this, because a unitary never maps two different states to the same one. Measurement is the only non-unitary step in the circuits of this course so far.
- Disturbance. Measuring in one basis erases information about the others. Measure in the computational basis, get outcome 0, and the state is now ; a subsequent -basis measurement gives "+" only half the time.
On multi-qubit states, measuring some qubits updates the others as well; the entanglement lesson uses this.
Expectation values
An observable is a Hermitian matrix ; measuring it means measuring in its eigenbasis and reporting the eigenvalue . Its average over many shots is the expectation value
For , the eigenvalues are for and for , so . For , measure in the basis and take the same difference. These are the Bloch-vector components of the previous lessons, and this is how they are measured in an experiment.
Worked example
Let , the Bloch-sphere state with , .
- Computational basis: .
- basis: , so . The two numbers agree because the Bloch vector makes the same angle with the and axes.
- and .
- Suppose the -basis measurement returned "+". The state is now , and a computational-basis measurement would give 0 with probability , not 0.854.
From shots to estimates
A single shot of a two-outcome measurement is a Bernoulli trial: outcome 0 with probability . With independent shots, the number of zeros is binomially distributed, and the natural estimate is
The standard error is the typical size of the statistical error. In practice is unknown and we plug in . For large the binomial distribution is close to a normal distribution, so is an approximate 95% confidence interval. This approximation is poor when or is small (for example when no zeros were seen at all); then use an interval designed for proportions, such as the Wilson score interval.
Two consequences shape every experiment:
- Error shrinks like . Halving the error costs four times the shots. To reach at you need shots; for , a quarter of a million.
- Expectation values inherit shot noise. From counts, , whose standard error is .
Sampling the worked example in the basis with a fixed seed:
import numpy as np
theta = np.pi / 4
psi = np.array([np.cos(theta / 2), np.sin(theta / 2)])
H = np.array([[1, 1], [1, -1]]) / np.sqrt(2)
probs = np.abs(H @ psi) ** 2 # measuring in the X basis = apply H, then measure
shots = 1000
counts = np.random.default_rng(2026).multinomial(shots, probs)
p_hat = counts[0] / shots
se = np.sqrt(p_hat * (1 - p_hat) / shots)
x_hat = (counts[0] - counts[1]) / shots
print(np.round(probs, 4), counts)
print(f"p_hat = {p_hat:.3f} +/- {se:.3f}, <X> estimate = {x_hat:.3f} (exact {np.sin(theta):.3f})")
With NumPy 2.5 this prints counts [861 139], and
against the exact . The estimate is off by
about in , less than one standard error: exactly the size of
deviation shot noise predicts. A different seed gives a different estimate;
the exercise checks over 400 seeds that the SE interval covers the true
value about 95% of the time.
Common mistakes
- Expecting amplitudes from one shot. A single shot returns one outcome. Probabilities, and through them , are learned only from many shots, and phases only by measuring in several bases.
- Forgetting the basis change. "Measure in the basis" means apply first. Applying after a computational-basis measurement does nothing to the recorded bit.
- Confusing and . To measure in the basis given by the columns of , apply ; for the basis that is , i.e. first.
- Reporting without its error. An estimate from 100 shots and one from shots differ in precision by a factor of 100.
- Trusting the normal interval at the edges. With the plug-in standard error is 0, which does not mean .
Summary
- Born rule: for a measurement in the basis .
- To measure in another basis, apply (columns of = basis) and measure in the computational basis.
- After outcome the state becomes ; measurement is repeatable and irreversible.
- ; .
- From shots, with standard error .
The exercise implements measurement in arbitrary bases, the update rule and the estimate with its standard error. Next, Multiple qubits and entanglement moves from one qubit to several.