Interference: split, turn, recombine
Measuring a qubit gives one answer, and the chance of each answer comes from squaring amplitudes. This experiment shows the step that makes quantum computing different: amplitudes are added before they're squared, so they can reinforce or cancel. You'll split a qubit with a Hadamard gate, turn the phase of one part, recombine and measure. It goes with Superposition without the hype (the worked example with two H gates) and the quick answer What is interference?.
The experiment
Split a qubit into a blend, turn the phase of one part, then recombine and measure. Predict what you'll read before you measure.
- Start at 0
- Split (H)
- Turn
- Recombine (H)
- Measure
Predict first
Prediction 1 of 4
No turn, no middle measurement.
Predictions aren't scored or saved.
The controls are yours: try any turn, with or without the middle measurement.
Turns the phase of the 1 part around the globe's north–south axis, in steps of 15°. Marked: an eighth of a turn (the T gate), a quarter (S) and a half (Z).
The controls unlock when you check your prediction, or skip.
The contributions, the predicted chances and the explanation are hidden until you check your prediction.
The contributions
Arrows are a picture of amplitudes (numbers with a size and a direction), not anything moving in space. Thin arrows are the two contributions, head to tail, the one from the 0 part first; the thick arrow is their sum. Dashed: carries a minus sign. Square the sum's length to get the chance.
Before a copy is measured in the middle, either result is possible. Each possibility is shown below, with its chance; neither has happened yet.
If the middle result is 0 (chance ½)
to 0
to 1
One contribution to each final result, 0.71 each.
If the middle result is 1 (chance ½)
to 0
to 1
One contribution to each final result, 0.71 each.
Overall: an average over both possible middle results, 50/50 at every turn.
Predicted chances
Observed measurements
Latest result –
- Last run
- –
- Total at this setting
- 0
Each measurement uses a freshly prepared copy and gives one answer, 0 or 1.
Why the counts don't match exactly
Each measurement gives either 0 or 1 and ends the blend, so every measurement uses a freshly prepared copy. Where the chance is 50%, 100 copies won't necessarily give exactly 50 of each; the more copies you measure, the closer the observed share usually gets to the prediction. Where the chance is 100% or 0%, as with no turn or a half turn, every copy gives the same answer in this ideal experiment.
Results add up until you change the turn, switch the middle measurement or press Reset; then they're cleared, so results from different settings are never mixed.
The maths, step by step: check your prediction to unlock the maths.
The maths, step by step
- Add, then square. Each result's amplitude is the sum of its two contributions. Its chance is the size of that sum, squared.
- What the turn does. The turn rotates the contribution from the 1 part by the turn angle φ. The contribution from the 0 part stays put.
- The formula. Into 0, two arrows of length ½ sit an angle φ apart, so they combine to a length of |cos(φ/2)|. Into 1, the second arrow is reversed, so the length is |sin(φ/2)|. So: chance of 0 = cos²(φ/2), chance of 1 = sin²(φ/2), and the two always add to 1.
- Middle measurement. After it, the qubit is definitely 0 or definitely 1. Either way each final result gets one contribution of size 1/√2 ≈ 0.71, so each chance is ½.
Technical view
Start in |0⟩. The Hadamard gate H = (1/√2)[[1, 1], [1, −1]] gives (|0⟩ + |1⟩)/√2. The turn is the phase gate P(φ) = [[1, 0], [0, eiφ]], giving (|0⟩ + eiφ|1⟩)/√2. A second H gives ½[(1 + eiφ)|0⟩ + (1 − eiφ)|1⟩], so P(0) = cos²(φ/2).
Named turns: P(π) = Z, P(π/2) = S, P(π/4) = T. The rotation Rz(φ) = e−iφ/2P(φ) differs only by an overall (global) phase, which changes no probability: only the relative phase between the 0 part and the 1 part is observable. That's why the drawings keep the contribution from the 0 part pointing right.
With the middle measurement, the state before the turn is no longer the superposition but a 50/50 mixture of |0⟩ and |1⟩ (density matrix diag(½, ½), with no off-diagonal coherence). Each branch then gives P(0) = ½, so the average is ½ at every φ.
Try again: three challenges
- Find a turn that always gives 1.
Answer
A half turn (180°, the Z gate), with the middle measurement off. - Find a turn that gives 0 three times out of four.
Answer
60° or 300°: cos²(30°) = 0.75. - Find a turn where the middle measurement seems to change nothing, and say why the two situations are still different.
Answer
A quarter turn (90°) or three quarters (270°): both modes give 50/50. Without the middle measurement the qubit is still one definite blend with its phase, which another quarter turn in the same direction and a recombine step would reveal at 90°; with it, the qubit was left definitely 0 or 1, and nothing can cancel at any turn.
What the experiment shows
- Phase changes results only when amplitudes combine. Measured straight after the turn, the qubit would give 50/50 at every setting. After recombining, the same turn can make one result certain.
- Add, then square. Each result gets two contributions. Pointing the same way they reinforce; pointing opposite ways they cancel. Adding chances instead of amplitudes could never produce a certain result here.
- A superposition isn't a hidden 0 or 1. Measuring in the middle gives a definite 0 or 1 and leaves the qubit there, and the effect disappears: 50/50 at every turn, which is what a qubit that was secretly 0 or 1 would give. Without that measurement, no turn gives 0 every time and a half turn gives 1 every time.
- The Z gate does something. On its own it changes no odds; between two H gates it decides the result.
What it leaves out
- Noise. The simulation is ideal: perfect gates and perfect measurements. Real interferometers and quantum computers show reduced contrast because of noise, which Why qubits are so fragile explains.
- Space. The arrows are a picture of amplitudes, numbers with a size and a direction. Nothing travels along them.
- More qubits. One qubit and one turn. Algorithms combine many such steps across many qubits; How a quantum algorithm works shows how.
- Hardware. This is a calculation in your browser, not a run on a quantum computer.
Check yourself
The Superposition lesson has short recall questions on what lets amplitudes cancel, on two H gates in a row, and on a blend versus a qubit prepared as 0 or 1 at random. What is a qubit, really? has one on what measurement does.
The experiment runs entirely in your browser. Your turn setting, predictions and results aren't stored and aren't sent anywhere. As on every Plain Quantum page, Cloudflare's page-view analytics records the visit itself, not what you do in the experiment, and the typefaces load from Google; see Privacy. The model is tested automatically: the amplitudes, the chances, the middle measurement and the sampling are checked against the formulas on this page.
Sources and further reading
Tags show what kind of source each one is (how this site is made). Spotted an error? Email hello@plainquantum.com.
- BookQuantum Computation and Quantum Information (10th anniversary edition)Michael Nielsen and Isaac Chuang, Cambridge University Press, 2010
- CourseBasics of quantum information (free course)IBM Quantum Learning
- Vendor documentationPhaseGate (Qiskit API reference): the phase gate P(θ), with P(π) = Z, P(π/2) = S, P(π/4) = TIBM Quantum documentation