SESAME · Day 2 · Module 06
Grover search
and amplitude amplification
We have a rule that checks a candidate.
We want to find a candidate that passes.
Four possible candidates
00011011One candidate at a time
Checking rule
Result of the check
Pass or fail
How many calls to the checking rule do we need?
N = 4 candidates; exactly one passes. We assume no additional structure that helps us locate it.
One call to the checking rule is a query.
Phase mark / Changed amplitudes / Repetitions and cost
Grover search uses interference to find a solution with fewer calls to a checking rule.
01 A phase mark preserves probabilities in the computational basis.
02 Interference can make a marked solution more likely to appear.
03 For one solution, Grover needs order √N calls to the checking rule.
Our main case: one solution among N candidates, with no additional search structure.
01 / The phase mark · 1.1
The checking rule defines which candidates are solutions.
f(x) = 1: candidate x passes.
f(x) = 0: candidate x fails.
For the calculation, let's use a rule that accepts 10.
An oracle implements access to this checking rule as a quantum operation.
| Candidate x | f(x) |
|---|---|
| 00 | 0 |
| 01 | 0 |
| 10 | 1 |
| 11 | 0 |
Candidate labels use q₀q₁. Candidate 10 means q₀ = 1 and q₁ = 0.
The accepted label is supplied so we can follow the arithmetic.
01 / The phase mark · 1.2
Two Hadamards give the four candidates equal amplitudes.
00
Amplitude ½
01
Amplitude ½
10
Amplitude ½
11
Amplitude ½
Direct measurement would give each candidate with probability ¼.
01 / The phase mark · 1.3
The phase oracle reverses the accepted candidate’s amplitude.
f(x) = 0 leaves the sign unchanged. f(x) = 1 reverses it.
Amplitudes before the oracle
Amplitudes after the oracle
The candidate labels stay in place. The amplitude of 10 changes sign.
01 / The phase mark · 1.3 / Prediction
Does the phase mark make 10 more likely to appear?
Amplitudes after the phase mark
All four probabilities are still ¼.
Changing the sign leaves the squared magnitude unchanged.
02 / Changed amplitudes · 2.1
Reflection places an amplitude equally far across the mean.
Mean of the four amplitudes
Reflected amplitude
The diffuser, D, applies this rule to each amplitude.
The mean is taken over signed amplitudes.
02 / Changed amplitudes · 2.1
The diffuser is one fixed matrix.
Basis order: 00, 01, 10, 11
One row of the matrix multiplication
The same D works whichever candidate is marked.
\(D^T D=I\): the operation is unitary and preserves normalization.
D acts on the qubits. The mean describes what this fixed matrix does.
02 / Changed amplitudes · 2.2
After our phase mark, the mean amplitude is ¼.
Amplitudes after the oracle
Mean amplitude
The sign change lowers the mean from ½ to ¼.
02 / Changed amplitudes · 2.2
The reflection cancels three amplitudes and reinforces one.
| Candidate | After the oracle | After D: \(a_i'=2(\frac14)-a_i\) |
|---|---|---|
| 00 | ½ | \(2(\frac14)-\frac12=0\) |
| 01 | ½ | \(2(\frac14)-\frac12=0\) |
| 10 | −½ | \(2(\frac14)-(-\frac12)=1\) |
| 11 | ½ | \(2(\frac14)-\frac12=0\) |
The squared magnitudes still sum to one.
02 / Changed amplitudes · 2.2
One iteration gives 10 with certainty in this example.
State before measurement
Measurement prediction
q₀ = 1, q₁ = 0. The other candidates have probability zero.
This is amplitude amplification: the accepted outcome becomes more likely.
Certainty here is specific to four candidates, one solution and one ideal iteration.
02 / Changed amplitudes · 2.3 / Prediction
Would the diffuser alone give the same improvement?
The mean stays ½.
Every amplitude is unchanged.
| After uniform preparation | P(10) |
|---|---|
| Oracle only | ¼ |
| Diffuser only | ¼ |
| Oracle, then diffuser | 1 |
The phase mark and the diffuser have different jobs. This amplification needs both.
03 / Repetitions and cost · 3.1 / Prediction
Does a second iteration keep the result certain?
We keep the state from the first iteration and apply the pair again.
Another iteration can reduce the probability of success.
Another shot would restart the chosen circuit from a fresh preparation.
03 / Repetitions and cost · 3.1
The second reflection brings back the other amplitudes.
The first iteration left amplitudes (0, 0, 1, 0).
After the second oracle
After the second diffuser
Unmarked: 2(−¼) − 0 = −½.
Marked: 2(−¼) − (−1) = ½.
| Number of iterations | 0 | 1 | 2 |
|---|---|---|---|
| P(10) | ¼ | 1 | ¼ |
We choose the iteration count before the final measurement.
03 / Repetitions and cost · 3.2
The two reflections give a rotation.
Marked direction: \(|w\rangle=|10\rangle\).
Other direction: the normalized equal combination of the remaining candidates.
The unmarked amplitudes stay equal, so they share one direction.
Of reflects across \(|u\rangle\): θ → −θ.
D reflects across \(|s\rangle\): −θ → 3θ.
Here θ = 30°. One iteration adds 2θ and reaches 90°, along the marked direction.
03 / Repetitions and cost · 3.2
A smaller starting amplitude requires more iterations.
With one solution among N candidates, its starting amplitude is \(1/\sqrt N\).
Each iteration adds the same angle
r is the number of iterations.
For large N, \(\theta\approx1/\sqrt N\).
An ideal example
N = 1,024
25 iterations
Success probability
≈ 0.99946
Classical unstructured search
Order N callsGrover search
Order √N callsOne solution, with a fixed high probability of success. The saving is quadratic in query growth.
03 / Repetitions and cost · 3.3 / Illustrative circuit budget
An oracle call contains gates whose cost still counts.
For the 25-iteration example, suppose each call uses these gate counts:
Oracle
two-qubit gates per call
Diffuser
two-qubit gates per call
Two-qubit gates in the iteration loop.
These are supplied assumptions for a cost calculation.
Preparation, readout and checking the measured candidate add work.
03 / Repetitions and cost · 3.3
A comparison includes the complete run.
Preparation
Uniform state
Iterations
Oracle, then diffuser
Chosen count r
Measurement
One candidate x
Classical check
Did it pass?
Access to required data.
Gates and readout.
Fresh attempts if needed.
We compare the same problem, including any useful classical structure.
The full cost determines whether the query saving helps an implementation.
Phase mark / Changed amplitudes / Repetitions and cost
Phase marking, interference and repetition have distinct roles.
01 A phase mark preserves probabilities in the computational basis.
02 Interference can make a marked solution more likely to appear.
03 For one solution, Grover needs order √N calls to the checking rule.
Grover search uses interference to find a solution with fewer calls to a checking rule.
The exercise
What happens to the amplitudes in this example?
06.01 · One complete Grover iteration ↗What is the mean after the phase mark?
What is the marked amplitude after the diffuser?
Which candidate will we measure with certainty?
Let’s work through 06.01 together.
We enter the three answers in order, separated by commas.
Leading zeros are part of a bit string.
Candidate order: q₀q₁. Amplitude order: 00, 01, 10, 11.