Last revised 4/7/05
LECTURE NOTES ON QUANTUM COMPUTATION
Cornell University, Physics 481681, CS 483; Spring, 2005
c
±
2005, N. David Mermin
IV. Searching with a Quantum Computer
Suppose you know that exactly one integer between 1 and
N
satisfes a certain con
dition, and suppose you have a blackboxed subroutine that takes integers between one
and
N
as input, and outputs 1 (“true”) iF the integer is the special one and 0 (“False”)
otherwise.
In the absence oF any Further inFormation, to fnd the special integer you can do noth
ing better with a classical computer than repeatedly applying the subroutine to di±erent
random numbers less than or equal to
N
until you fnd the one that outputs 1. You must
test
1
2
N
di±erent integers to achieve a 50% chance oF fnding the special one.
IF, however, you have a quantum computer and have a quantum subroutine that per
Forms the test, then with probability very close to 1 you can fnd the special integer by
calling the subroutine a number oF times that is only proportional to
√
N
. (More precisely,
it is proportional to
√
N
log
N
. The source oF the logarithmic Factor is described in Sec
tion B below.) This very general capability oF quantum computers was discovered by Lov
Grover, and goes under the name oF
Grover’s search algorithm
. Shor’s periodfnding algo
rithm, Grover’s search algorithm, and their various modifcations and extensions constitute
the two great triumphs oF quantum computational soFtware design.
One can think oF the blackbox in various ways.
It could perForm a mathematical
calculation to determine whether the input integer is the special one. ²or example iF an
odd number
p
can be expressed as
a
2
+
b
2
then since one oF
a
or
b
must be even and the
other odd,
p
must be oF the Form 4
n
+ 1.
It is a Fairly elementary theorem oF number
theory that iF
p
is a
prime
number oF the Form 4
n
+ 1 then it can indeed be expressed
as such a sum oF two squares and in only one way.
1
Given any such prime
p
, the most
simpleminded way
2
to fnd the two squares is to take randomly selected integers
x
with
1
≤
x
≤
N
, with
N
the largest integer less than
p
p/
2, until you fnd the one For which
p
p

x
2
is an integer
a
. IF
p
is oF the order oF a trillion, then Following the simpleminded
1
Thus 5 = 4+1, 13 = 9+4, 17 = 16+1, 29 = 25 + 4, 37 = 36+1, 41 = 25+16, etc.
2
Mathematically wellinFormed Friends tell me that this example admits oF much more
e³cient ways to proceed than random testing, but the quantum algorithm to be described
enables even mathematical ignoramuses like me to do better than random testing by a
Factor oF 1
/
√
N
, iF they have access to a quantum computer. And Grover will provide this
speedup even on problems that stump the mathematically wellinFormed.