How quantum algorithms use interference
A marked phase becomes a larger probability only through a carefully designed transformation.
- Trace one exact two-qubit Grover iteration.
- Explain why too many amplification iterations reduce success.
A complete four-item example
Section titled “A complete four-item example”Prepare the uniform state with amplitudes . Suppose item 11 is marked. Its phase oracle produces .
The mean amplitude is now . Diffusion reflects each amplitude a about the mean: . The first three become 0 and the marked amplitude becomes 1. One ideal iteration therefore finds 11 with certainty in this special four-item case.
The general pattern
Section titled “The general pattern”For one marked item among N, let . After k Grover iterations, success probability is
This oscillates. Increasing k forever does not improve the result. A useful iteration count is near , with rounding and marked-set assumptions handled carefully.
What the lab verifies
Section titled “What the lab verifies”The model uses one marked basis state, exact phase marking and exact diffusion. It counts one oracle query per iteration but excludes the cost of constructing that oracle, preparing application data and executing fault-tolerant gates.
A classical simulator calculates all these amplitudes explicitly. Its wall-clock time is not a measurement of a quantum device’s runtime.
Challenge: for eight items, calculate the probabilities at k = 0, 1, 2 and 3. Compare them with the bars, then explain the drop after the best point using the angle formula.
Track the signed amplitudes, not just the marked bar
Section titled “Track the signed amplitudes, not just the marked bar”The three panels show the initial uniform state, the phase-marked state and the state after diffusion. The oracle changes a sign without changing probabilities. Diffusion then converts that phase pattern into a different probability distribution. The algorithm needs both transformations. Stopping after the oracle would leave the chance of reading the marked label unchanged.
The reflection formula is linear in the amplitude vector, even though it refers to the vector’s mean. The mean is itself a linear function of the entries. Diffusion can also be written as a reflection about the uniform state. This perspective connects the arithmetic example with the two-dimensional rotation analysis used for larger search spaces.
Worked example: eight items
Section titled “Worked example: eight items”With one marked item among eight, every initial amplitude is one over the square root of eight, approximately 0.353553. The oracle negates the marked entry. The new mean is three quarters of the original amplitude. Diffusion therefore maps each unmarked amplitude to half its original value and the marked amplitude to two and a half times its original value.
The marked probability after one iteration is consequently 25 thirty-seconds, or 78.125 percent. Each unmarked probability is one thirty-second. The eight probabilities sum to one. This is a useful independent calculation: it checks both the amplification and where the remaining probability goes, instead of checking only that the marked bar got taller.
After two iterations, the success probability is 121 one-hundred-twenty-eighths, approximately 94.53 percent. More iterations do not keep improving it. The state rotates in a plane spanned by the marked direction and the uniform unmarked direction. Continuing the rotation carries it past the marked direction and reduces success again.
Understand the rotation angle
Section titled “Understand the rotation angle”The initial marked component has magnitude one over the square root of N. Define an angle whose sine is that magnitude. Each Grover iteration adds twice that angle, giving a marked probability determined by the sine squared of an odd multiple. Choosing the iteration count means stopping near a probability peak, not repeatedly measuring until the amplitude has “filled up.”
For several marked items, replace the initial marked probability with their fraction of the space. The rotation occurs between the uniform good and bad subspaces. If that fraction is unknown, a fixed schedule may overshoot. Counting, estimation and search variants address this uncertainty with different resource and success guarantees. The single-marked-item lab deliberately keeps that assumption explicit.
Verification and practical use
Section titled “Verification and practical use”After measuring a candidate, evaluate the predicate classically to check whether it is marked. A failed candidate can trigger another independent run according to a planned strategy. This verification does not reveal the amplitudes, and it should not be confused with intermediate observation inside the amplification circuit.
The oracle and diffusion are abstractly simple in a tiny register. In a practical problem, reversible predicate evaluation, state preparation, workspace cleanup, precision and error correction may dominate. A quadratic query improvement is valuable only after those costs are compared with the best relevant classical method. Structure that makes a predicate easy to solve classically can also change the appropriate baseline from blind exhaustive search.
Predict an entire iteration table
Section titled “Predict an entire iteration table”For two qubits and marked 11, predict results at zero, one and two iterations before revealing each setting. At zero iterations the marked probability is one quarter. At one it is one. At two it returns to one quarter, with a phase pattern that differs from the initial uniform vector. Equal success probabilities do not guarantee equal full states.
Grover search explorer
A phase oracle marks one item; diffusion reflects amplitudes about their mean. Amplification can overshoot. Oracle construction and hardware costs are excluded.
Prepare your experiment using the controls. Record a prediction, then reveal the statevector or run the experiment.
Changing the preparation or circuit starts a new prediction.
Take it further
For four items, trace all amplitudes through one iteration. For eight, compare iterations 0–6 and explain the oscillation.
Initial setup · reference state
Marked item probability 100.0%
| Basis | Amplitude a + bi | Magnitude | Phase (rad) | Probability |
|---|---|---|---|---|
| |00⟩ | 0 + 0i | 0.000000 | undefined | 0.0% |
| |01⟩ | 0 + 0i | 0.000000 | undefined | 0.0% |
| |10⟩ | 0 + 0i | 0.000000 | undefined | 0.0% |
| |11⟩ | 1 + 0i | 1.000000 | 0.000000 | 100.0% |
Signs and complex phases are part of the state. Phase is undefined for a zero amplitude. A shared global phase changes no probabilities; relative phases can affect a later operation. Values are rounded to six decimal places.
Prediction to try: Predict the marked item’s success probability at this register size and iteration count. Explain an expected increase or decrease.
Challenge: For four items, trace all amplitudes through one iteration. For eight, compare iterations 0–6 and explain the oscillation.
Open the live experiment studioThen select three input qubits. Predict one iteration using the eight-item calculation, and compare two and three iterations with the rotation formula. Record both the marked probability and at least one unmarked amplitude. Changing the shot count affects sampling precision, while changing the iteration count changes the ideal state itself.
Practice: identify a premature measurement
Section titled “Practice: identify a premature measurement”A proposed search procedure measures immediately after every phase oracle, then applies diffusion to the measured basis state. Explain why it is not the same algorithm and why the first oracle measurement cannot preferentially return the marked label.
Check your reasoning
The phase oracle preserves every basis probability, so the immediate measurement is still uniform on the first iteration. It also removes the coherent superposition that diffusion was designed to reflect. The later operation acts on a collapsed basis state rather than the phase-marked uniform state. Grover amplification requires the coherent oracle-and-diffusion sequence before the final measurement.
Check your understanding
Section titled “Check your understanding”Among eight items with one marked, what is success after one ideal Grover iteration?
Answer: 25/32. The marked amplitude becomes 2.5/√8, giving 25/32. Each of the seven other outcomes has probability 1/32.
Reference: IBM Quantum — Fundamentals of quantum algorithms.
Ready for the next step?
Your progress stays in this browser.