Skip to main content
Sandbox Physics

Q047 · Mark / reflect / stop

Grover Amplitude Amplification

Can one extra round make the answer harder to find? Past the optimal number of rounds, yes. Each oracle call plus reflection turns the state a fixed step toward the targets. Once it gets there, another round turns it beyond them and the chance of success falls, so knowing when to stop matters.

Pick a small search space, mark the target entries and step through the rounds. Follow the phase oracle and the reflection as probability flows toward the targets and then back out again. Sample the readout and use the measured success rates to choose when to stop.

Interactive modelGrover Amplitude Amplification
Ideal marked probability before readout—\text{—}
Circuit oracle calls per trial—\text{—}
Evidence and query counts

Simulated measurement record

Find the stopping point

Acquire a record to begin.

Colored bars and points come from records; thin gray marks are the model with the configured errors. Whiskers are pointwise 95% Wilson intervals for output or success fractions. They are not phase confidence intervals, simultaneous bands or guarantees after optional stopping.

Recorded success, 95% Wilson range

—\text{—}

Round with the highest observed success among those sampled

—\text{—}

All circuit / verification queries

—\text{—}

The best observed round is a descriptive choice from this finite scan, not a certified optimum. Every output is checked against the known teaching oracle; that adds one verification query. No real-data oracle construction or hardware advantage is demonstrated.

Recomputed from the exported trials
RoundsTrialsSuccessesCircuit / verification queries
Latest 12 trials; CSV retains all trials
TrialSettingReported bitsIntegerCircuit queries

Physics tutorial

Amplification has a stopping point

BackgroundThe state starts with equal amplitudes on every entry of a small search space. An oracle changes the phase of the marked entries. A second unitary then reflects the amplitudes about the uniform state.

Why it mattersThe algorithm moves probability around; it does not create any. Once the state has turned past the best direction, repeating the same operations can lower the chance of success.

Start with the essentials

Focus question
Which of the tested rounds gave the highest measured success, and how many queries did the scan use?
One-sentence intuition
The oracle by itself does not change any probability; interference in the reflection does. Together the two steps keep rotating the ideal state, so when you stop matters.

Core mathematical model

Uniform preparation

∣s⟩=1N∑x=0N−1∣x⟩,N=2n|s\rangle=\frac{1}{\sqrt N}\sum_{x=0}^{N-1}|x\rangle,\quad N=2^n

The targets are consecutive entries starting at the selected index, wrapping around at the end. The simulator knows them in advance.

Phase oracle

OϵO∣x⟩={ei(π+ϵO)∣x⟩x∈M∣x⟩x∉MO_{\epsilon_O}|x\rangle=\begin{cases}e^{i(\pi+\epsilon_O)}|x\rangle&x\in\mathcal M\\|x\rangle&x\notin\mathcal M\end{cases}

You enter the phase offset in degrees, and it is converted to radians. This coherent error is different from a random bit flip.

Reflection with phase error

DϵD=−I+(1−ei(π+ϵD))∣s⟩⟨s∣D_{\epsilon_D}=-I+\bigl(1-e^{i(\pi+\epsilon_D)}\bigr)|s\rangle\langle s|

The overall minus sign in front makes the error-free operator the usual inversion about the mean. With an error, the operator is still unitary.

The complete circuit

∣ψk⟩=(DϵDOϵO)k∣s⟩|\psi_k\rangle=(D_{\epsilon_D}O_{\epsilon_O})^k|s\rangle

Every complex amplitude is updated step by step. You can view the state right after any oracle or reflection step.

Ideal rotation formula

PM(k)=sin⁡2((2k+1)α),sin⁡2α=M/NP_{\mathcal M}(k)=\sin^2((2k+1)\alpha),\quad\sin^2\alpha=M/N

This rotation formula holds for ideal phases, before any readout error. It serves as an independent check; the state vector is not computed from it.

Measured success and circuit cost

P^M(k)=Nsuccess,k/Nshots,k,CO=kNshots,k\widehat P_{\mathcal M}(k)=N_{\mathrm{success},k}/N_{\mathrm{shots},k},\quad C_O=kN_{\mathrm{shots},k}

Each reported output is also checked once against the target set. That extra query is counted separately as a verification query.

Common difficulties

The oracle is given the targets

Typical misconceptionThe simulator discovers a secret in a real database.

Better mental modelThe target set is handed to the teaching oracle in advance. Building a real oracle can be expensive, and this model leaves that cost out.

A negative amplitude is not a negative chance

Typical misconceptionAn arrow pointing the negative way means a negative chance.

Better mental modelThe arrow's direction is the complex phase and its length is the size of the amplitude. Probability is that size squared, so it is never negative.

Fast animation is not quantum advantage

Typical misconceptionThe browser animation runs fast, so it proves quantum advantage.

Better mental modelThis is a small simulation on a classical computer. The query counts describe this model; they are not measurements on quantum hardware or a complete comparison with classical search.

Run the experiment

  1. 01

    Watch phase before probability

    Choose Before amplification, set one round and inspect its oracle step.

    What to observe: The marked amplitude changes sign but its probability does not yet increase.
  2. 02

    Stop at the peak, then overshoot

    Compare Stop near the peak with Go too far.

    What to observe: After a few extra rounds, the same targets can become much less likely.
  3. 03

    Choose a round from the data

    Acquire the full round scan.

    What to observe: The measured success fractions fluctuate. The round with the highest observed success describes this finite data set; it is not guaranteed to be the best round.
  4. 04

    Add errors

    Try an imperfect oracle and readout flips separately.

    What to observe: Coherent phase errors change the amplitudes during the evolution. Readout flips corrupt the reported bit strings after the evolution is over.
FeedbackSomething broken, confusing, or missing on this page?Tell us
What kind of feedback?

Sent with this page’s address, its Lab ID, the site language and your device type. Please leave out personal details. Feedback is kept for up to 12 months.Privacy policy