Measurement¶
A measurement turns a state into an ordinary result. It gives one outcome, drawn from the state's probabilities, and afterwards the state matches it.
From Probabilities to Results¶
On the previous page, the Bell circuit ended in two meters. The trace showed what a measurement there would give, as probabilities. It did not show a result.
What does a measurement give, and what happens to the state afterwards?
You have seen measurements before. The first page of this module drew outcomes from a prepared state, and Module 01 repeated trials and played the CHSH game. This page adds four things: predicted results set beside sampled ones, what a measurement does to the state, a phase made visible by an H, and a pair of qubits measured together.
A measurement in the computational basis means: read the qubit as 0 or 1. It is the step that turns a state into an ordinary result. It is not another gate.
One Measurement: A Result, Then an Update¶
A result¶
The probability of each outcome is the square of its amplitude. With real amplitudes, that is the number times itself:
One measurement returns one outcome, with those chances. Keep three things apart, as on the first page:
- State — what the preparation produced.
- Probability — how likely each outcome is, set by the state.
- Outcome — what one measurement returned.
Can one measurement tell you the state?
No. It gives one result, and many different states could have given it.
An update¶
In the ideal model, a measurement does something to the state as well. After it, the state matches the outcome that was seen. If a qubit gave 1, it is now in |1⟩, so measuring it again gives 1 again, every time.
This is the rule of the ideal textbook model. It is not a description of how a particular device works.
Is a measurement a gate?
No. A gate moves a state and can be undone, as on the gates page. A measurement gives a result, and no later gate undoes it.
Many Shots¶
A shot is one prepare-and-measure. To see the probabilities, prepare the same state again and again and count the results.
A probability describes the state. A frequency describes one finite run. The counts of a run rarely match the prediction exactly, and a larger number of shots tends to look closer to it. A gap between the counts and the prediction is not an error.
One shot cannot reveal the amplitudes. A single 1 is what a 50% state gives half the time, and it is also what a 75% state gives three times in four.
How many shots would you need to tell a 50% state from a 55% state?
Try it in the lab below.
Measurement Lab¶
Choose a state, predict what a measurement will show, and then measure it once or many times. Every result is simulated: ideal and noiseless, not from a real device.
1. Choose what to measure
q₀ starts in |0⟩, then is prepared by
Measure in the
The Bell circuit: H on q₀, then CNOT, then both measured. Measure first:
2. The circuit
3. Predict, then measure
4. Measure once, step by step
The spread of the shots (Intermediate)
Repeat the whole experiment 50 times with the same number of shots, and see how far the frequency of the first outcome moves around the prediction. Do it for several shot counts.
5. Mystery state (a challenge)
The prediction, the sampled counts, and the single outcomes each sit in their own place. The predicted bars describe the state. The sampled bars describe the run you just did.
Check your understanding. First, the update:
Then predict a run:
Phase Shows Up After an H¶
Two states can look the same to one measurement and different to another.
A direct Z-basis measurement : |+⟩ and |−⟩ both give 50% and 50%, so it cannot tell them apart.
A Z-basis measurement after an H : H turns |+⟩ into a certain 0 and |−⟩ into a certain 1.
Predict each row before reading the numbers:
A phase difference is invisible to a direct Z-basis measurement, and an H turns it into a probability difference. This is the idea from Z and the hidden phase, now seen through measurement. The reason is interference: the two paths through H add for |+⟩ and cancel for |−⟩.
So the same counts do not mean the same state. In the lab, choose H, then Z (|−⟩) and H (|+⟩), measure each directly, and then add an H.
A Pair of Measurements¶
Switch the lab to A Bell pair and measure it. You should see:
- The joint counts appear only at 00 and 11.
- Each qubit on its own looks like a fair coin.
- Measure one qubit, and the other result is then certain, and equal to the first.
The order of the two measurements does not change the statistics. Here are the exact joint probabilities for the Bell state measured in either order:
This is about what the two lists of results look like side by side. The agreement shows up when the lists are compared. Neither measurement sends anything to the other, so the result at one end is a fair coin whatever happens at the other end, and nobody can use the pair to send a message. Whether you call the pair entangled is a statement about the state, not about a signal.
This page does not explain how the correlation arises, and it does not say the results were decided in advance. The ideal model gives the probabilities, and that is all it claims.
In this module, q₀ is the left digit of a result such as 01. Other tools may print the bits the other way round. The Bell outcomes 00 and 11 look the same either way.
Beyond the Core¶
The Born rule and projection¶
At this level, amplitudes can be complex. A state \(\alpha|0\rangle + \beta|1\rangle\) gives
the Born rule. The squares are of the modulus, so a phase does not change them: \(|+i\rangle = (|0\rangle + i|1\rangle)/\sqrt 2\) gives \(|i/\sqrt 2|^2 = 1/2\), the same 50% as \(|+\rangle\).
Measurement as projection. Measuring 0 applies the projector \(P_0 = |0\rangle\langle 0|\), which keeps the amplitude on \(|0\rangle\) and removes the rest. The state after is the projected state divided by \(\sqrt p\), where \(p\) is the probability of the outcome, so that it is normalized again:
For the mostly-0 state \(0.866|0\rangle + 0.5|1\rangle\), the outcome 0 has \(p = 0.75\). Then \(P_0|\psi\rangle = 0.866|0\rangle\), and dividing by \(\sqrt{0.75} = 0.866\) gives \(|0\rangle\), as the lab's stepper shows.
Expectation values. Score the outcome 0 as +1 and the outcome 1 as −1. The average score over many shots is the expectation value
It is 0.5 for the mostly-0 state and 0 for \(|+\rangle\). For the Bell pair, scoring a result +1 when the two digits agree and −1 when they differ gives \(\langle Z\otimes Z\rangle = 1\), the agreement as a single number. The lab shows the predicted value and the value estimated from your shots.
Other bases and the spread of shots¶
Measuring in the X or Y basis. A Z-basis measurement is the only readout, so another basis is read by adding gates before it. For X, add an H. For Y, add S† and then H. The lab's basis selector draws these gates in the circuit. The outcome 0 then means the first state of the basis, \(|+\rangle\) for X and \(|+i\rangle\) for Y, and 1 means the second.
This is the same idea as "add an H before measuring" above: a Z-basis measurement after an H is an X-basis measurement.
How much the shots vary. With probability \(p\) for an outcome and \(N\) shots, the sampled frequency varies from run to run by about
For \(p = 0.5\), that is 5% at \(N = 100\) and 0.5% at \(N = 10000\). A hundred times more shots makes the spread ten times smaller, which is the \(1/\sqrt N\) rule. The lab's spread view repeats the experiment 50 times at the shot count you choose, so you can watch the band narrow.
Naming the formalism¶
Measuring in an arbitrary direction on the Bloch sphere is a general measurement basis. Measurements that are not projections onto a basis at all are generalized measurements, described by sets of operators called POVMs. And a mid-circuit measurement, taken partway through a circuit with later operations depending on the result, is the tool behind error correction and many algorithms. Later material makes these ideas precise.
From Measurement to Programming¶
That is the end of Module 02. Here is the path it took:
Everything on this page was an ideal, noiseless model. Real devices have imperfect readout, noise, and calibration, which Module 04 and Module 05 cover. Measurements that check for errors are the subject of Module 07.
One more caution. This module writes q₀ on the left. Tools such as Qiskit may print the bits the other way round, so 01 in their output can mean the opposite qubit. Module 03 will address that when it shows code.
We can now describe, trace, and measure circuits on paper and in a simulator. We have not yet written one as code, or run one.
Takeaway¶
A measurement gives one result, drawn from the state's probabilities, and afterwards the state matches the result. Only many shots show the probabilities, and a direct measurement cannot see a phase that an H can reveal.
How do we write these circuits and run them?