Quantum Computing

Theory · chapter 6 of 10

Finding a needle in fewer tries

Grover's method finds one marked item in a million by looking about a thousand times. An ordinary computer looks half a million. The trick is amplifying the right answer's wave a little with every pass.

Suppose one name in a phone book of a million has a star next to it and you can only check one name at a time. On average you check half a million. There is no shortcut for an ordinary computer.

Grover's method starts by putting all million names in superposition, each with the same small amplitude. Then it does two things, over and over. First, it flips the sign of the starred name's amplitude, crest to trough. Second, it reflects every amplitude about the average. The starred one, being the odd one out, gets pushed up; the rest get pushed down by a hair.

Each round the starred amplitude grows. After about a thousand rounds, the square root of a million, it is nearly all the wave, and a measurement reads it out. Go too many rounds and it starts shrinking again, so you have to count.

That is a square-root speed-up. A million to a thousand is good. A trillion to a million is better. It is not the exponential leap of Shor's method, but it applies to almost any search or optimisation you can phrase as 'check whether this guess is right', which is why it comes up so much.

It has also been proved you cannot do better than the square root for a plain unsorted search. The quantum computer is not magic here. It is a wave doing what a wave can do.

Try it. Sixteen boxes, one marked. Press Step. Watch the marked bar grow and the rest shrink. It takes three steps. Keep pressing past the peak and watch it fall away again.

This demo runs in the browser with JavaScript on. The words above stand on their own.

Sources

← The switches Breaking the locks →