Level 3, Propeller head
Grover's search
Grover’s search, published by Lov Grover in 1996, is a quantum method that finds a marked answer in fewer checks than a classical search. It is the adding and the cancelling done at a larger size. A marked answer grows and the others shrink, so the final measurement is more likely to show the marked one. The rounds grow with the square root of the number of candidates, where a classical search grows with the number itself.
On four candidates the arithmetic fits on one sheet, and one round leaves the marked answer certain. Keith’s poster still says the machine tries every answer at once, while the sheet shows one bar growing and three bars shrinking.
An example
Take four candidates, 00, 01, 10 and 11, with 11 marked. A classical search checking one at a time never needs more than three checks, since three misses leave the fourth. Averaged over where the marked one might sit, it needs 2.25.
The quantum version needs a box that flips the sign of the marked amplitude and leaves the rest alone. That box is called the oracle.
H on both wires puts 0.5 on each, a chance of 0.25. Call the oracle once, giving 0.5, 0.5, 0.5 and −0.5. The chances are still 0.25 each.
The second step flips every amplitude about the average. The average is (0.5 + 0.5 + 0.5 − 0.5) ÷ 4 = 0.25. Each new amplitude is twice the average minus the old one. That gives 0.5 − 0.5 = 0 for 00, 01 and 10, and 0.5 + 0.5 = 1 for 11. After one round the pair reads 11 every time.
A second round spoils it. The oracle gives 0, 0, 0 and −1, the average is −0.25, and the new amplitudes are −0.5, −0.5, −0.5 and 0.5. The chance of 11 is back to 0.25, so the count of rounds matters.
What it is not
It does not try every answer and read off the right one. The rounds steer amplitude toward the marked one.
For a search with no pattern to exploit, the saving is a square root and no more. Make the list four times longer and Grover needs about twice as many rounds, where a classical search needs about four times as many checks.
It also needs the oracle, a circuit that someone must build to check an answer. The saving is counted in calls to it.
Related words
The cancelling is interference on four amplitudes. The first step is the Hadamard gate, and the oracle writes a phase. The note The sign is what cancels does the same sums on one qubit, and Which Algorithm asks you to pick Grover from a lineup.
Used in
Longer explanation: Can quantum computers break encryption?