You are on page 1of 33

T HEORY OF C OMPUTING, Volume 1 (2005), pp.

47–79
http://www.theoryofcomputing.org

Quantum Search of Spatial Regions


Scott Aaronson∗ Andris Ambainis†
Received: June 13, 2004; published: June ?, 2005.

Abstract: Can Grover’s algorithm speed up search of a physical region—for example a


√ √ √
2-D grid of size n × n? The problem is that n time seems to be needed for each
query, just to move amplitude across the grid. Here we show that this problem can be sur-
mounted, refuting a claim to the contrary by Benioff. In particular, we show how to search
√ √
a d-dimensional hypercube in time O( n) for d ≥ 3, or O( n log5/2 n) for d = 2. More
generally, we introduce a model of quantum query complexity on graphs, motivated by
fundamental physical limits on information storage, particularly the holographic principle
from black hole thermodynamics. Our results in this model include almost-tight upper and
lower bounds for many search tasks; a generalized algorithm that works for any graph with
good expansion properties, not just hypercubes; and relationships among several notions of
‘locality’ for unitary matrices acting on graphs. As an application of our results, we give

an O( n)-qubit communication protocol for the disjointness problem, which improves an
upper bound of Høyer and de Wolf and matches a lower bound of Razborov.

ACM Classification: F.1.2, F.1.3


AMS Classification: 81P68, 68Q10
Key words and phrases: Quantum computing, Grover search, amplitude amplification, quantum com-
munication complexity, disjointness, lower bounds
∗ This work was mostly done while the author was a PhD student at UC Berkeley, supported by an NSF Graduate Fellowship

and by ARO grant DAAD19-03-1-0082.


† Supported by an IQC University Professorship and by CIAR. This work was mostly done while the author was at the

University of Latvia.

Authors retain copyright to their papers and grant “Theory of Computing” unlimited
rights to publish the paper electronically and in hard copy. Use of the article is permit-
ted as long as the author(s) and the journal are properly acknowledged. For the detailed
copyright statement, see http://theoryofcomputing.org/copyright.html.


c 2005 Scott Aaronson and Andris Ambainis
S. A ARONSON , A. A MBAINIS

n
Robot

Marked item
n
Figure 1: A quantum robot, in a superposition over locations, searching for a marked item on a 2D grid
√ √
of size n × n.

1 Introduction
The goal of Grover’s quantum search algorithm [17, 18] is to search an ‘unsorted database’ of size n

in a number of queries proportional to n. Classically, of course, order n queries are needed. It is
sometimes asserted that, although the speedup of Grover’s algorithm is only quadratic, this speedup is
provable, in contrast to the exponential speedup of Shor’s factoring algorithm [29]. But is that really
true? Grover’s algorithm is typically imagined as speeding up combinatorial search—and we do not
know whether every problem in NP can be classically solved quadratically faster than the “obvious”
way, any more than we know whether factoring is in BPP.
But could Grover’s algorithm speed up search of a physical region? Here the basic problem, it
seems to us, is the time needed for signals to travel across the region. For if we are interested in the
fundamental limits imposed by physics, then we should acknowledge that the speed of light is finite, and
that a bounded region of space can store only a finite amount of information, according to the holographic
principle [9]. We discuss the latter constraint in detail in Section 2; for now, we say only that it suggests
a model in which a ‘quantum robot’ occupies a superposition over finitely many locations, and moving
the robot from one location to an adjacent one takes unit time. In such a model, the time needed to
search a region could depend critically on its spatial layout. For example, if the n entries are arranged
on a line, then even to move the robot from one end to the other takes n − 1 steps. But what if the entries
are arranged on, say, a 2-dimensional square grid (Figure 1)?

1.1 Summary of Results


This paper gives the first systematic treatment of quantum search of spatial regions, with ‘regions’
modeled as connected graphs. Our main result is positive: we show that a quantum √ robot cansearch
a d-dimensional hypercube with n vertices for a unique marked vertex in time O n log3/2 n when
√ √
d = 2, or O ( n) when d ≥ 3. This matches (or in the case of 2 dimensions, nearly matches) the Ω ( n)
lower bound for quantum search, and supports the view that Grover search of a physical region presents
no problem of principle. Our basic technique is divide-and-conquer; indeed, once the idea is pointed out,
an upper bound of O n1/2+ε follows readily. However, to obtain the tighter bounds is more difficult;

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 48


Q UANTUM S EARCH OF S PATIAL R EGIONS

√d = 2  d>2

Hypercube, 1 marked item O n log3/2 n Θ ( n)
√   √ 
Hypercube, k or more marked items O n log5/2 n Θ k1/2−1/d
n

√ O(√log n)  √ 
Arbitrary graph, k or more marked items n2 Θ k
n
e 1/2−1/d

Table 1: Upper and lower bounds for quantum search on a d-dimensional graph given in this paper. The
symbol Θe means that the upper bound includes a polylogarithmic term. Note that, if d = 2, then Ω (√n)
is always a lower bound, for any number of marked items.

for that we use the amplitude-amplification framework of Grover [19] and Brassard et al. [11].
Section 5 presents the main results;
√Section 5.4 shows further that,√ when there are k or more marked

vertices, the search time becomes O n log n when d = 2, or Θ n/k1/2−1/d when d ≥ 3. Also,
5/2

Section 6 generalizes our algorithm to arbitrary graphs that have ‘hypercube-like’ expansion properties.
√ O(√log n) √
Here the best bounds we can achieve are n2 when d = 2, or O ( n polylog n) when d > 2
(note that d need not be an integer). Table 1.1 summarizes the results.
Section 7 shows, as an unexpected application of our search algorithm, that the quantum communi-
√ √ ∗
cation complexity of the well-known disjointness problem is O ( n). This improves an O nclog n

upper bound of Høyer and de Wolf [20], and matches the Ω ( n) lower bound of Razborov [23].
The rest of the paper is about the formal model that underlies our results. Section 2 sets the stage
for this model, by exploring the ultimate limits on information storage imposed by properties of space
and time. This discussion serves only to motivate our results; thus, it can be safely skipped by readers
unconcerned with the physical universe. In Section 3 we define quantum query algorithms on graphs, a
model similar to quantum query algorithms as defined by Beals et al. [4], but with the added requirement
that unitary operations be ‘local’ with respect to some graph. In Section 3.1 we address the difficult
question, which also arises in work on quantum random walks [1] and quantum cellular automata [31],
ofwhat  ‘local’ means. Section 4 proves general facts about our model, including an upper bound of

O nδ for the time needed to search any graph with diameter δ , and a proof (using the hybrid
argument of Bennett et al. [7]) that this upper bound is tight for certain graphs. We conclude in Section
8 with some open problems.

1.2 Related Work


In a paper on ‘Space searches with a quantum robot,’ Benioff [6] asked whether Grover’s algorithm
can speed up search of a physical region, as opposed to a combinatorial search space. His answer was
√ √
discouraging: for a 2-D grid of size n × n, Grover’s algorithm is no faster than classical search. The
√ √
reason is that, during each of the Θ ( n) Grover iterations, the algorithm must use order n steps just
to travel across the grid and return to its starting point for the diffusion step. On the other hand, Benioff
noted, Grover’s algorithm does yield some speedup for grids of dimension 3 or higher, since those grids

have diameter less than n.
Our results show that Benioff’s claim is mistaken: by using Grover’s algorithm more carefully, one

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 49


S. A ARONSON , A. A MBAINIS

√d = 2  d=3

d =4

d ≥5

This paper O n log3/2 n O ( n) O ( n) O ( n)
 √ √
[16] O (n) O n5/6 O ( n log n) O ( n)
√ √ √ √
[3, 15] O ( n log n) O ( n) O ( n) O ( n)

Table 2: Time needed to find a unique marked item in a d-dimensional hypercube, using the divide-and-
conquer algorithms of this paper, the original quantum walk algorithm of Childs and Goldstone [16],
and the improved walk algorithms of Ambainis, Kempe, and Rivosh [3] and Childs and Goldstone [15].

√ 
can search a 2-D grid for a single marked vertex in O n log3/2 n time. To us this illustrates why one
should not assume an algorithm is optimal on heuristic grounds. Painful experience—for example, the
3
“obviously optimal” O n matrix multiplication algorithm [30]—is what taught computer scientists to
see the proving of lower bounds as more than a formality.
Our setting is related to that of quantum random walks on graphs [1, 13, 14, 28]. In an earlier version
of this paper, we asked whether quantum walks might yield an alternative spatial search algorithm,
possibly even one that outperforms our divide-and-conquer algorithm. Motivated by this question,
Childs and Goldstone [16] managed to show that in the continuous-time setting, a quantum walk can
√ √
search a d-dimensional hypercube for a single marked vertex in time O ( n log n) when d = 4, or O ( n)
when d ≥ 5. Our algorithm was still faster in 3 or fewer dimensions (see Table 1.2). Subsequently,
however, Ambainis, Kempe, and Rivosh [3] gave an algorithm based on a discrete-time quantum walk,
which was as fast as ours in 3 or more dimensions, and faster in 2 dimensions. In particular, when

d = 2 their algorithm used only O ( n log n) time to find a unique marked vertex. Childs and Goldstone
[15] then gave a continuous-time quantum walk algorithm with the same performance, and related this

algorithm to properties of the Dirac equation. It is still open whether O ( n) time is achievable in 2
dimensions.
Currently, the main drawback of the quantum walk approach is that all analyses have relied heavily
on symmetries in the underlying graph. If even minor ‘defects’ are introduced, it is no longer known
how to upper-bound the running time. By contrast, the analysis of our divide-and-conquer algorithm
is elementary, and does not depend on eigenvalue bounds. We can therefore show that the algorithm
works for any graphs with sufficiently good expansion properties.
Childs and Goldstone [16] argued that the quantum walk approach has the advantage of requiring
fewer auxiliary qubits than the divide-and-conquer approach. However, the need for many qubits was
an artifact of how we implemented the algorithm in a previous version of the paper. The current version
uses only one qubit.

2 The Physics of Databases


Theoretical computer science generally deals with the limit as some resource (such as time or memory)
increases to infinity. What is not always appreciated is that, as the resource bound increases, physical
constraints may come into play that were negligible at ‘sub-asymptotic’ scales. We believe theoretical
computer scientists ought to know something about such constraints, and to account for them when

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 50


Q UANTUM S EARCH OF S PATIAL R EGIONS

possible. For if the constraints are ignored on the ground that they “never matter in practice,” then the
obvious question arises: why use asymptotic analysis in the first place, rather than restricting attention
to those instance sizes that occur in practice?
A constraint of particular interest for us is the holographic principle [9], which arose from black-
hole thermodynamics. The principle states that the information content of any spatial region is upper-
bounded by its surface area (not volume), at a rate of one bit per Planck area, or about 1.4 × 1069 bits per
square meter. Intuitively, if one tried to build a spherical hard disk with mass density υ , one pcould not
keep expanding it forever. For as soon as the radius reached the Schwarzschild bound of r = 3/ (8πυ )
(in Planck units, c = G = h̄ = k = 1), the hard disk would collapse to form a black hole, and thus its
contents would be irretrievable.
Actually the situation is worse than that: even a planar hard disk of constant mass density would
collapse to form a black hole once its radius became sufficiently large, r = Θ (1/υ ). (We assume
here that the hard disk is disc-shaped. A linear or 1-D hard disk could expand indefinitely without
collapse.) It is possible, though, that a hard disk’s information content could asymptotically exceed its
mass. For example, a black hole’s mass is proportional to the radius of its event horizon, but the entropy
is proportional to the square of the radius (that is, to the surface area). Admittedly, inherent difficulties
with storage and retrieval make a black hole horizon less than ideal as a hard disk. However, even a
weakly-gravitating system could store information at a rate asymptotically exceeding its mass-energy.
For instance, Bousso [9] shows that an enclosed ball of radiation with radius r can store n = Θ r3/2
bits, even though its energy grows only as r. Our results in Section 6.1 will imply that  a quantum  robot
could (in principle!) search such a ‘radiation disk’ for a marked item in time O r5/4 = O n5/6 . This
is some improvement over the trivial O (n) upper bound for a 1-D hard disk, though it falls short of the

desired O ( n).
In general, if n = rc bits are scattered throughout a 3-D ball of radius r (where c ≤ 3 and the bits’
locations are known), we will show in Theorem 6.7 that the time needed tosearch for a ‘1’ bit grows as
n1/c+1/6 = r1+c/6 (omitting logarithmic factors). In particular, if n = Θ r2 (saturating the holographic

bound), then the time grows as n2/3 or r4/3 . To achieve a search time of O ( n polylog n), the bits would
need to be concentrated on a 2-D surface.
Because of the holographic principle, we see that it is not only quantum mechanics that yields a

Ω ( n) lower bound on the number of steps needed for unordered search. If the items to be searched
are laid out spatially, then general relativity in 3 + 1 dimensions independently yields the same bound,

Ω ( n), up to a constant factor.1 Interestingly, in d + 1 dimensions the relativity bound would be
Ω n1/(d−1) , which for d > 3 is weaker than the quantum mechanics bound. Given that our two funda-
mental theories yield the same lower bound, it is natural to ask whether that bound is tight. The answer
seems to be that it is not tight, since (i) the entropy on a black hole horizon is not efficiently accessible2 ,
and (ii) weakly-gravitating systems are subject to the Bekenstein bound [5], an even stronger entropy
constraint than the holographic bound.

1 Admittedly, the holographic principle is part of quantum gravity and not general relativity per se. All that matters for us,
though, is that the principle seems logically independent of quantum-mechanical linearity, which is what produces the “other”

Ω ( n) bound.
2 In the case of a black hole horizon, waiting for the bits to be emitted as Hawking radiation—as recent evidence suggests

that they are [27]—takes time proportional to r3 , which is much too long.

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 51


S. A ARONSON , A. A MBAINIS

Yet it is still of basic interest to know whether n bits in a radius-r ball can be searched in time

o (min {n, r n})—that is, whether it is possible to do anything better than either brute-force quantum
search (with the drawback pointed out by Benioff [6]), or classical search. Our results show that it is
possible.
From a physical point of view, several questions naturally arise: (1) whether our complexity measure
is realistic; (2) how to account for time dilation; and (3) whether given the number of bits we are
imagining, cosmological bounds are also relevant. Let us address these questions in turn.

(1) One could argue that to maintain a ‘quantum database’ of size n requires n computing elements
([32], though see also [24]). So why not just exploit those elements to search the database in
parallel? Then it becomes trivial to show that the search time is limited only by the radius of
the database, so the algorithms of this paper are unnecessary. Our response is that, while there
might be n ‘passive’ computing elements (capable of storing data), there might be many fewer
‘active’ elements, which we consequently wish to place in a superposition over locations. This
assumption seems physically unobjectionable. For a particle (and indeed any object) really does
have an indeterminate location, not merely an indeterminate internal state (such as spin) at some
location. We leave as an open problem, however, whether our assumption is valid for specific
quantum computer architectures such as ion traps.
(2) So long as we invoke general relativity, should we not also consider the effects of time dilation?
Those effects are indeed pronounced near a black hole horizon. Again, though, for our upper
bounds we will have in mind systems far from the Schwarzschild limit, for which any time dilation
is by at most a constant factor independent of n.

(3) How do cosmological considerations affect our analysis? Bousso [8] argues that, in a spacetime
with positive cosmological constant Λ > 0, the total number of bits accessible to any one exper-
iment is at most 3π / (Λ ln 2), or roughly 10122 given current experimental bounds [26] on Λ.3
Intuitively, even if the universe is spatially infinite, most of it recedes too quickly from any one
observer to be harnessed as computer memory.
One response to this result is to assume an idealization in which Λ vanishes, although Planck’s
constant h̄ does not vanish. As justification, one could argue that without the idealization Λ = 0,
all asymptotic bounds in computer science are basically fictions. But perhaps a better response is
to accept the 3π / (Λ ln 2) bound, and then ask how close one can come to saturating it in different
scenarios. Classically, the√maximum number of bits that can be searched is, in a crude model4 ,
actually proportional
√ to 1/ Λ ≈ 10√ 61 rather than 1/Λ. The reason is that if a region had much

more than 1/ Λ bits, then after 1/ Λ Planck times—that is, about 1010 years, or roughly the
current age of the universe—most of the region would have receded beyond one’s cosmological
3 Also, Lloyd [21] argues that the total number of bits accessible up till now is at most the square of the number of Planck
2
times elapsed so far, or about 1061 = 10122 . Lloyd’s bound, unlike Bousso’s, does not depend on Λ being positive. The
numerical coincidence between the two bounds reflects the experimental finding [26, 25] that we live in a transitional era, when
both Λ and “dust” contribute significantly to the universe’s net energy balance (ΩΛ ≈ 0.7, Ωdust ≈ 0.3). In earlier times dust
(and before that radiation) dominated, and Lloyd’s bound was tighter. In later times Λ will dominate, and Bousso’s bound will
be tighter. Why we should live in such a transitional era is unknown.
4 Specifically, neglecting gravity and other forces that could counteract the effect of Λ.

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 52


Q UANTUM S EARCH OF S PATIAL R EGIONS

horizon. What our results suggest is that, using a quantum robot, one could come closer to
saturating the cosmologicalbound—since, for example, a 2-D region of size 1/Λ can be searched
in time O √1Λ polylog √1Λ . How anyone could prepare a database of size much greater than

1/ Λ remains unclear, but if such a database existed, it could be searched!

3 The Model
Much of what is known about the power of quantum computing comes from the black-box or query
model [2, 4, 7, 17, 29], in which one counts only the number of queries to an oracle, not the number of
computational steps. We will take this model as the starting point for a formal definition of quantum
robots. Doing so will focus attention on our main concern: how much harder is it to evaluate a function
when its inputs are spatially separated? As it turns out, all of our algorithms will be efficient as measured
by the number of gates and auxiliary qubits needed to implement them.
For simplicity, we assume that a robot’s goal is to evaluate a Boolean function f : {0, 1}n → {0, 1},
which could be partial or total. A ‘region of space’ is a connected undirected graph G = (V, E) with
vertices V = {v1 , . . . , vn }. Let X = x1 . . . xn ∈ {0, 1}n be an input to f ; then each bit xi is available only
at vertex vi . We assume the robot knows G and the vertex labels in advance, and so is ignorant only
of the xi bits. We thus sidestep a major difficulty for quantum walks [1], which is how to ensure that a
process on an unknown graph is unitary.
At any time, the robot’s state has the form

∑ αi,z |vi , zi .
Here vi ∈ V is a vertex, representing the robot’s location; and z is a bit string (which can be arbitrarily
long), representing the robot’s internal configuration. The state evolves via an alternating sequence of
T algorithm steps and T oracle steps:

U (1) → O(1) → U (1) → · · · → U (T ) → O(T ) .

An oracle step O(t) maps each basis state |vi , zi to |vi , z ⊕ xi i, where xi is exclusive-OR’ed into the first
bit of z. An algorithm step U (t) can be any unitary matrix that (1) does not depend on X , and (2) acts
‘locally’ on G. How to make the second condition precise is the subject of Section 3.1.
(t)
The initial state of the algorithm is |v1 , 0i. Let αi,z (X ) be the amplitude of |vi , zi immediately after
the t th oracle step; then the algorithm succeeds with probability 1 − ε if
2
(T )
∑ αi,z (X ) ≥ 1−ε
|vi ,zi :zOU T = f (X)

for all inputs X , where zOUT is a bit of z representing the output.

3.1 Locality Criteria


Classically, it is easy to decide whether a stochastic matrix acts locally with respect to a graph G: it does
if it moves probability only along the edges of G. In the quantum case, however, interference makes the

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 53


S. A ARONSON , A. A MBAINIS

question much more subtle. In this section we propose three criteria for whether a unitary matrix U is
local. Our algorithms will then be implemented using the most restrictive of these criteria.
The first criterion we call Z-locality (for zero): U is Z-local if, given any pair of non-neighboring
vertices v1 , v2 in G, U “sends no amplitude” from v1 to v2 ; that is, the corresponding entries in U are all
0. The second criterion, C-locality (for composability), says that this is not enough: not only must U
send amplitude only between neighboring vertices, but it must be composed of a product of commuting
unitaries, each of which acts on a single edge. The third criterion is perhaps the most natural one to a
physicist: U is H-local (for Hamiltonian) if it can be obtained by applying a locally-acting, low-energy
Hamiltonian for some fixed amount of time. More formally, let Ui,z→i∗ ,z∗ be the entry in the |vi , zi column
and |vi∗ , z∗ i row of U .

Definition 3.1. U is Z-local if Ui,z→i∗ ,z∗ = 0 whenever i 6= i∗ and (vi , vi∗ ) is not an edge of G.

Definition 3.2. U is C-local if the basis states can be partitioned into subsets P1 , . . . , Pq such that

(i) Ui,z→i∗ ,z∗ = 0 whenever |vi , zi and |vi∗ , z∗ i belong to distinct Pj ’s, and

(ii) for each j, all basis states in Pj are either from the same vertex or from two adjacent vertices.

Definition 3.3. U is H-local if U = eiH for some Hermitian H with eigenvalues of absolute value at most
π , such that Hi,z→i∗ ,z∗ = 0 whenever i 6= i∗ and (vi , vi∗ ) is not an edge in E.

If a unitary matrix is C-local, then it is also Z-local and H-local. For the latter implication, note that
any unitary U can be written as eiH for some H with eigenvalues of absolute value at most π . So we can
write the unitary U j acting on each Pj as eiH j ; then since the U j ’s commute,

∏ U j = ei ∑ H .
j

Beyond that, though, how are the locality criteria related? Are they approximately equivalent? If
not, then does a problem’s complexity in our model ever depend on which criterion is chosen? Let
us emphasize that these questions are not answered by, for example, the Solovay-Kitaev theorem (see
[22]), that an n × n unitary matrix can be approximated using a number of gates polynomial in n. For
recall that the definition of C-locality requires the edgewise operations to commute—indeed, without
that requirement, one could produce any unitary matrix at all. So the relevant question, which we leave
open, is whether any Z-local or H-local unitary can be approximated by a product of, say, O (log n)
C-local unitaries. (A product of O (n) such unitaries trivially suffices, but that is far too many.)

4 General Bounds
Given a Boolean function f : {0, 1}n → {0, 1}, the quantum query complexity Q ( f ), defined by Beals
et al. [4], is the minimum T for which there exists a T -query quantum algorithm that evaluates f with
probability at least 2/3 on all inputs. (We will always be interested in the two-sided, bounded-error
complexity, sometimes denoted Q2 ( f ).) Similarly, given a graph G with n vertices labeled 1, . . . , n, we
let Q ( f , G) be the minimum T for which there exists a T -query quantum robot on G that evaluates f

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 54


Q UANTUM S EARCH OF S PATIAL R EGIONS

with probability 2/3. Here we require the algorithm steps to be C-local. One might also consider the
corresponding measures QZ ( f , G) and QH ( f , G) with Z-local and H-local steps respectively. Clearly
Q ( f , G) ≥ QZ ( f , G) and Q ( f , G) ≥ QH ( f , G); we conjecture that all three measures are asymptotically
equivalent but were unable to prove this.
Let δG be the diameter of G, and call f nondegenerate if it depends on all n input bits.

Proposition 4.1. For all f , G,

(i) Q ( f ) ≤ Q ( f , G) ≤ 2n − 3.

(ii) Q ( f , G) ≤ (2δG + 1) Q ( f ).

(iii) Q ( f , G) ≥ δG /2 if f is nondegenerate.

Proof.

(i) Q ( f ) ≤ Q ( f , g) is obvious. Also, starting from the root, a spanning tree for G can be traversed
in 2 (n − 1) − 1 steps (there is no need to return to the root).

(ii) We can simulate a query in 2δG steps, by fanning out from the start vertex v1 and then returning.
Applying a unitary at v1 takes 1 step.

(iii) There exists a vertex vi whose distance to v1 is at least δG /2, and f could depend on xi .

We now show that the model is robust.

Proposition 4.2. For nondegenerate f , the following change Q ( f , G) by at most a constant factor.

(i) Replacing the initial state |v1 , 0i by an arbitrary (known) |ψ i.

(ii) Requiring the final state to be localized at some vertex vi with probability at least 1 − ε , for a
constant ε > 0.

(iii) Allowing multiple algorithm steps between each oracle step (and measuring the complexity by the
number of algorithm steps).

Proof.

(i) We can transform |v1 , 0i to |ψ i (and hence |ψ i to |v1 , 0i) in δG = O (Q ( f , G)) steps, by fanning
out from v1 along the edges of a minimum-height spanning tree.

(ii) Assume without loss of generality that zOUT is accessed only once, to write the output. Then after
zOUT is accessed, uncompute (that is, run the algorithm backwards) to localize the final state at
v1 . The state can then be localized at any vi in δG = O (Q ( f , G)) steps. We can succeed with any
constant probability by repeating this procedure a constant number of times.

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 55


S. A ARONSON , A. A MBAINIS

(iii) The oracle step O is its own inverse, so we can implement a sequence U1 ,U2 , . . . of algorithm steps
as follows (where I is the identity):

U1 → O → I → O → U2 → · · ·

A function of particular interest is f = OR (x1 , . . . , xn ), which outputs 1 if and only if xi = 1 for some
i. We first give a general upper bound on Q (OR, G) in terms of the diameter of G. (Throughout the
paper, we sometimes omit floor and ceiling signs if they clearly have no effect on the asymptotics.)

Proposition 4.3. p 
Q (OR, G) = O nδG .

Proof. Let τ be a minimum-height spanning tree for G, rooted at v1 . A depth-first search on τ uses
2n − 2 steps. Let S1 be the set of vertices visited by depth-first search in steps 1 to δG , S2 be those
visited in steps δG + 1 to 2δG , and so on. Then

S1 ∪ · · · ∪ S2n/δG = V .

Furthermore, for each S j there is a classical algorithm A j , using at most 3δG steps, that starts at v1 , ends
at v1 , and outputs ‘1’ if and only if xi = 1 for some vi ∈ S j . Then we simply perform
 Grover search at
p
v1 over all A j ; since each iteration takes O (δG ) steps and there are O 2n/δG iterations, the number
√ 
of steps is O nδG .

The bound of Proposition 4.3 is tight:

Theorem 4.4. For all δ , there exists a graph G with diameter δG = δ such that
√ 
Q (OR, G) = Ω nδ .

Proof. Let G be a ‘starfish’ with central vertex v1 and M = 2 (n − 1) /δ legs L1 , . . . , LM , each of length
δ /2 (see Figure 2). We use the hybrid argument of Bennett et al. [7]. Suppose we run the algorithm on
(t)
the all-zero input X0 . Then define the query magnitude Γ j to be the probability of finding the robot in
leg L j immediately after the t th query:
2

∑ ∑ αi,z (X0)
(t) (t)
Γj = .
vi ∈L j z

Let T be the total number of queries, and let w = T / (cδ ) for some constant 0 < c < 1/2. Clearly
w−1 M w−1
(T −qcδ )
∑ ∑ Γj ≤ ∑ 1 = w.
q=0 j=1 q=0

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 56


Q UANTUM S EARCH OF S PATIAL R EGIONS

δ/2

Figure 2: The ‘starfish’ graph G. The marked item is at one of the tip vertices.

Hence there must exist a leg L j∗ such that


w−1
(T −qcδ ) w wδ
∑ Γj ∗ ≤ =
M 2 (n − 1)
.
q=0

Let vi∗ be the tip vertex of L j∗ , and let Y be the input which is 1 at vi∗ and 0 elsewhere. Then let Xq be a
hybrid input, which is X0 during queries 1 to T − qcδ , but Y during queries T − qcδ + 1 to T . Also, let
E
(t)
ψ (Xq ) = ∑ αi,z (Xq ) |vi , zi
(t)

i,z

be the algorithm’s state after t queries when run on Xq , and let


E E 2

D (q, r) = ψ (T ) (Xq ) − ψ (T ) (Xr )
2
2
(T )
= ∑ ∑ αi,z (Xq ) − αi,z (Xr ) .
(T )

vi ∈G z

(T −qcδ )
Then for all q ≥ 1, we claim that D (q − 1, q) ≤ 4Γ j∗ . For by unitarity, the Euclidean distance
(t) (t)
between ψ (Xq−1 ) and ψ (Xq ) can only increase as a result of queries T − qcδ + 1 through
T − (q − 1) cδ . But no amplitude from outside L j∗ can reach vi∗ during that interval, since the distance
is δ /2 and there are only cδ < δ /2 time steps. Therefore, switching from Xq−1 to Xq can only affect
amplitude that is in L j∗ immediately after query T − qcδ :
  2
(T −qcδ ) (T −qcδ )
D (q − 1, q) ≤ ∑ ∑ αi,z (Xq ) − −αi,z (Xq )
vi ∈L j∗ z
2
(T −qcδ ) (T −qcδ )
=4 ∑ ∑ αi,z (X0 ) = 4Γ j∗ .
vi ∈L j∗ z

It follows that
s s
q
p w p w
(T −qcδ ) δ T 2
D (0, w) ≤ ∑ D (q − 1, q) ≤ 2 ∑ Γ j∗ ≤ 2w
2 (n − 1)
=
c δ (n − 1)
.
q=1 q=1

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 57


S. A ARONSON , A. A MBAINIS

Here the first inequality uses the triangle inequality, and the third uses the Cauchy-Schwarz
√inequality.

Now assuming the algorithm is correct we need D (0, w) = Ω (1), which implies that T = Ω nδ .

It is immediate
√ that Theorem 4.4 applies to Z-local unitaries as well as C-local ones: that is,
QZ (OR, G) =Ω nδ . We believe the theorem can be extended to H-local unitaries as well, but
a full discussion of this issue would take us too far afield.

5 Search on Grids
Let Ld (n) be a d-dimensional  grid graph of size n1/d × · · · × n1/d . That is, each vertex is specified
by d coordinates i1 , . . . , id ∈ 1, . . . , n1/d , and is connected to the at most 2d vertices obtainable by
adding or subtracting 1 from a single coordinate (boundary vertices have fewer than 2d neighbors). We
write simply Ld when n is clear from context. In this section we present our main positive results: that
√ √
Q (OR, Ld ) = Θ ( n) for d ≥ 3, and Q (OR, L2 ) = O ( n polylog n) for d = 2.
Before proving these claims, let us develop some intuition  by showing weaker bounds, taking the
3/4 √
case d = 2 for illustration. Clearly Q (OR, L2 ) = O n : we simply partition L2 (n) into n sub-
√ √
squares, each a copy of L2 ( n). In 5 n steps, the robot can travel from the start vertex to any
subsquare C, search C classically for a marked vertex, and then return to the start vertex. Thus, by

searching all n ofthe C’s in superposition  and applying Grover’s algorithm, the robot can search the

grid in time O n1/4 × 5 n = O n3/4 .

Once we know that, we might as well partition L2 (n) into n1/3 subsquares, each  a copy of
 L2 n2/3 .
3/4 √
Searching any one of these subsquares by the previous algorithm takes time O n2/3 = O ( n),
an amount of time that also suffices to travel to the subsquare √ and back from the start vertex. So using
√ 2/3

Grover’s algorithm, the robot can search L2 (n) in time O n1/3 · n = O n . We can continue

recursively in this manner to make the running time approach O ( n). The trouble is that, with each
additional layer of recursion, the robot needs to repeat the search more often to upper-bound the error

probability. Using this approach, the best bounds we could obtain are roughly O ( n polylog n) for
√ O(√log n)
d ≥ 3, or n2 for d = 2. In what follows, we use the amplitude amplification approach of
Grover [19] and Brassard et al. [11] toimprove these  bounds, in the case of a single marked vertex, to
√ √ 3/2
O ( n) for d ≥ 3 (Section 5.2) and O n log n for d = 2 (Section 5.3). Section 5.4 generalizes
these results to the case of multiple marked vertices.

Intuitively, the reason the case d = 2 is special is that there, the diameter of the grid is Θ ( n), which
matches exactly the time needed for Grover search. For d ≥ 3, by contrast, the robot can travel across
the grid in much less time than is needed to search it.

5.1 Amplitude Amplification


We start by describing amplitude amplification [11, 19], a generalization of Grover search. Let U be a
quantum algorithm that, with probability ε , outputs a correct answer together with a witness that proves
the answer correct. (For example, in the case of search, the algorithm outputs a vertex label i such that

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 58


Q UANTUM S EARCH OF S PATIAL R EGIONS


xi = 1.) Amplification generates a new algorithm that calls U order 1/ ε times, and that produces both
a correct answer and a witness with probability Ω (1). In particular, assume U starts in basis state |si,
and let m be a positive integer. Then the amplification procedure works as follows:
(1) Set |ψ0 i = U |si.
(2) For i = 1 to m set |ψi+1 i = USU−1W |ψi i, where

• W flips the phase of basis state |yi if and only if |yi contains a description of a correct
witness, and
• S flips the phase of basis state |yi if and only if |yi = |si.

We can decompose |ψ0 i as sin α |Ψsucc i + cos α |Ψfail i, where |Ψsucc i is a superposition over basis
states containing a correct witness and |Ψfail i is a superposition over all other basis states. Brassard et
al. [11] showed the following:
Lemma 5.1 ([11]). |ψi i = sin [(2i + 1) α ] |Ψsucc i + cos [(2i + 1) α ] |Ψfail i.

|ψ0 i gives a correct witness with probability ε , then |sin α |2 = ε and |α | ≥ 1/ ε . So
If measuring √
taking m = O(1/ ε ) yields sin [(2m + 1) α ] ≈ 1. For our algorithms, though, the multiplicative constant
under the big-O also matters. To upper-bound this constant, we prove the following lemma.
Lemma 5.2. Suppose a quantum algorithm U outputs a correct answer and witness with probability
exactly ε . Then by using 2m + 1 calls to U or U−1 , where
π 1
m≤ √ − ,
4 arcsin ε 2
we can output a correct answer and witness with probability at least
!
(2m + 1)2
1− ε (2m + 1)2 ε .
3

Proof. We perform m steps of amplitude amplification, which requires 2m + 1 calls to U or U−1 . By


Lemma 5.1, this yields the final state
sin [(2m + 1) α ] |Ψsucc i + cos [(2m + 1) α ] |Ψfail i .

where α = arcsin ε . Therefore the success probability is
 √   √ 
sin2 (2m + 1) arcsin ε ≥ sin2 (2m + 1) ε
!2
√ (2m + 1)3 3/2
≥ (2m + 1) ε − ε
6
(2m + 1)4 2
≥ (2m + 1)2 ε − ε .
3
Here the first line uses the monotonicity of sin2 x in the interval [0, π /2], and the second line uses the
fact that sin x ≥ x − x3 /6 for all x ≥ 0 by Taylor series expansion.

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 59


S. A ARONSON , A. A MBAINIS

Note that there is no need to uncompute any garbage left by U, beyond the uncomputation that
happens “automatically” within the amplification procedure.

5.2 Dimension At Least 3


Our goal is the following:

Theorem 5.3. If d ≥ 3, then Q (OR, Ld ) = Θ ( n).

In this section, we prove Theorem 5.3 for the special case of a unique marked vertex; then, in
Sections 5.4 and 5.5, we will generalize to multiple marked vertices. Let OR(k) be the problem of
deciding whether there are no marked vertices or exactly k of them, given that one of these is true.
Then:
  √
Theorem 5.4. If d ≥ 3, then Q OR(1) , Ld = Θ ( n).

Choose constants β ∈ (2/3, 1) and µ ∈ (1/3, 1/2) such that β µ > 1/3 (for example, β = 4/5 and
µ = l5/11 will m work). Let ℓ0 be a large positive integer; then for all positive integers R, let ℓR =
1/β −1
ℓR−1 ℓR−1 . Also let nR = ℓdR . Assume for simplicity that n = nR for some R; in other words, that the
hypercube Ld (nR ) to be searched has sides of length ℓR . Later we will remove this assumption.
Consider the following recursive algorithm A. If n = n0 , then search Ld (n0 ) classically, returning 1
if a marked vertex is found and 0 otherwise. Otherwise partition Ld (nR ) into nR /nR−1 subcubes, each
one a copy of Ld (nR−1 ). Take the algorithm that consists of picking a subcube C uniformly at random,
and then running A recursively on C. Amplify this algorithm (nR /nR−1 )µ times.
β β /2
The intuition behind the exponents is that nR−1 ≈ nR , so searching Ld (nR−1 ) should take about nR
1/d
steps, which dominates the nR steps needed to travel across the hypercube when d ≥ 3. Also, at level
R we want to amplify a number of times that is less than (nR /nR−1 )1/2 by some polynomial amount,
since full amplification would be inefficient. The reason for the constraint β µ > 1/3 will appear in the
analysis.
We now provide a more explicit description of A, which shows that it can be implemented using
C-local unitaries and only a single bit of workspace. At any time, the quantum robot’s state will have
the form ∑i,z αi,z |vi , zi, where vi is a vertex of Ld (nR ) and z is a single bit that records whether or not
a marked vertex has been found. Given a subcube C, let v (C) be the “corner” vertex of C; that is, the
vertex that is minimal in all d coordinates. Then the initial state when searching C will be |v (C) , 0i.
Beware, however, that “initial state” in this context just means the state |si from Section 5.1. Because of
the way amplitude amplification works, A will often be invoked on C with other initial states, and even
run in reverse.
For convenience, we will implement A using a two-stage recursion: given any subcube, the task of A
will be to amplify the result of another procedure called U, which in turn runs A recursively on smaller
subcubes. We will also use the conditional phase flips W and S from Section 5.1. For convenience, we
write AR , UR ,WR , SR to denote the level of recursion that is currently active. Thus, AR calls UR , which
calls AR−1 , which calls UR−1 , and so on down to A0 .

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 60


Q UANTUM S EARCH OF S PATIAL R EGIONS

Algorithm 5.5 (AR ). Searches a subcube C of size nR for the marked vertex, and amplifies the result to
have larger probability. Default initial state: |v (C) , 0i.
If R = 0 then:

(1) Use classical C-local operations to visit all n0 vertices of C in any order. At each vi ∈ C, use a
query transformation to map the state |vi , zi to |vi , z ⊕ xi i.

(2) Return to v (C).

If R ≥ 1 then:

(1) Let mR be the smallest integer such that 2mR + 1 ≥ (nR /nR−1 )µ .

(2) Call UR .

(3) For i = 1 to mR , call WR , then U−1


R , then SR , then UR .

Suppose AR is run on the initial state |v (C) , 0i, and let C1 , . . . ,CnR /n0 be the minimal subcubes in
C—meaning those of size n0 . Then the final state after AR terminates should be
nR /n0
1
p ∑ |v (Ci) , 0i
nR /n0 i=1

if C does not contain the marked vertex. Otherwise the final state should have non-negligible overlap
with |v (Ci∗ ) , 1i, where Ci∗ is the minimal subcube in C that contains the marked vertex. In particular, if
R = 0, then the final state should be |v (C) , 1i if C contains the marked vertex, and |v (C) , 0i otherwise.
The two phase-flip subroutines, WR and SR , are both trivial to implement. To apply WR , map each
basis state |vi , zi to (−1)z |vi , zi. To apply SR , map each |vi , zi to − |vi , zi if z = 0 and vi = v (C) for some
subcube C of size nR , and to |vi , zi otherwise. Below we give pseudocode for UR .

Algorithm 5.6 (UR ). Searches a subcube C of size nR for the marked vertex. Default initial state:
|v (C) , 0i.

(1) Partition C into nR /nR−1 smaller subcubes C1 , . . . ,CnR /nR−1 , each of size nR−1 .

(2) For all j ∈ {1, . . . , d}, let V j be the set of corner vertices v (Ci ) that differ from v (C) only in the
first j coordinates. Thus V0 = {v (C)}, and in general V j = (ℓR /ℓR−1 ) . For j = 1 to d, let V j
j

be the state

V j = 1
j/2 ∑
|v (Ci ) , 0i
ℓR v(Ci )∈V j

Apply a sequence of transformations Z1 , Z2 , . . ., Zd where Z j is a unitary that maps V j−1 to V j
by applying C-local unitaries that move amplitude only along the jth coordinate.

(3) Call AR−1 recursively. (Note that this searches C1 , . . . ,CnR /nR−1 in superposition. Also, the
required amplification is performed for each of these subcubes automatically by step (3) of AR−1 .)

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 61


S. A ARONSON , A. A MBAINIS

If UR is run on the initial state |v (C) , 0i, then the final state should be
nR /n0
1
p ∑ |φi i ,
nR /nR−1 i=1

where |φi i is the correct final state when AR−1 is run on subcube Ci with initial state |v (Ci ) , 0i. A key
point is that there is no need for UR to call AR−1 twice, once to compute and once to uncompute—for
the uncomputation is already built into AR . This is what will enable us to prove an upper bound of
√ √  √
O ( n) instead of O n2R = O ( n polylog n).
We now analyze the running time of AR .
µ
Lemma 5.7. AR uses O nR steps.
Proof. Let TA (R) and TU (R) be the total numbers of steps used by AR and UR respectively in searching
Ld (nR ). Then we have TA (0) = O (1), and

TA (R) ≤ (2mR + 1) TU (R) + 2mR


1/d
TU (R) ≤ dnR + TA (R − 1)
1/d
for all R ≥ 1. For WR and SR can both be implemented in a single step, while UR uses dℓR = dnR steps
to move the robot across the hypercube. Combining,
 
1/d
TA (R) ≤ (2mR + 1) dnR + TA (R − 1) + 2mR
  1/d 
≤ (nR /nR−1 )µ + 2 dnR + TA (R − 1) + (nR /nR−1 )µ + 1
  
= O (nR /nR−1 )µ nR + (nR /nR−1 )µ + 2 TA (R − 1)
1/d

 
= O (nR /nR−1 )µ nR + (nR /nR−1 )µ TA (R − 1)
1/d

 
= O (nR /nR−1 )µ nR + (nR /nR−2 )µ nR−1 + · · · + (nR /n0 )µ n1
1/d 1/d 1/d

1/d 1/d
!
1/d
µ nR nR−1 n1
= nR · O µ + µ + ···+ µ
nR−1 nR−2 n0
 
µ 1/d−β µ 1/d−β µ 1/d−β µ
= nR · O nR + · · · + n2 + n1
     R−1 
µ 1/d−β µ 1/d−β µ 1/β 1/d−β µ 1/β
= nR · O nR + nR + · · · + nR
µ
= O nR .

Here the second line follows because 2mR + 1 ≤ (nR /nR−1 )µ + 2, the fourth because the (nR /nR−1 )µ
terms increase doubly
 exponentially,
 so adding 2 to each will not affect the asymptotics; the seventh
µ µ β β
because ni = Ω ni+1 , the eighth because nR−1 ≤ nR ; and the last because β µ > 1/3 ≥ 1/d, hence
1/d−β µ
n1 < 1.

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 62


Q UANTUM S EARCH OF S PATIAL R EGIONS

Next we need to lower-bound the success probability. Say that AR or UR “succeeds” if a measure-
ment in the standard basis yields the result |v (Ci∗ ) , 1i, where Ci∗ is the minimal subcube that contains
the marked vertex. Of course, the marked vertex itself can then be found in n0 = O (1) steps.
 
1−2µ
Lemma 5.8. Assuming there is a unique marked vertex, AR succeeds with probability Ω 1/nR .

Proof. Let PA (R) and PU (R) be the success probabilities of AR and UR respectively when searching
Ld (nR ). Then clearly PA (0) = 1, and PU (R) = (nR−1 /nR ) PA (R − 1) for all R ≥ 1. So by Lemma 5.2,
 
1
PA (R) ≥ 1 − (2mR + 1) PU (R) (2mR + 1)2 PU (R)
2
3
 
1 2 nR−1 nR−1
= 1 − (2mR + 1) PA (R − 1) (2mR + 1)2 PA (R − 1)
3 nR nR
 
1 2µ nR−1 nR−1
≥ 1 − (nR /nR−1 ) PA (R − 1) (nR /nR−1 )2µ PA (R − 1)
3 nR nR
 
1
≥ 1 − (nR−1 /nR )1−2µ (nR−1 /nR )1−2µ PA (R − 1)
3
R  
1
≥ (n0 /nR ) 1−2µ
∏ 1 − 3 (nR−1/nR ) 1−2µ

r=1
!
R
1
≥ (n0 /nR )1−2µ ∏ 1 − (1−β )(1−2µ )
r=1 3nR
!
R
1
≥ (n0 /nR ) 1−2µ
1 − ∑ (1−β )(1−2µ )
r=1 3nR
 
1−2µ
= Ω 1/nR .

Here the third line follows because 2mR + 1 ≥ (nR−1 /nR )µ and the function x − 13 x2 is nondecreasing in
β
the interval [0, 1]; the fourth because PA (R − 1) ≤ 1; the sixth because nR−1 ≤ nR ; and the last because
β < 1 and µ < 1/2, the nR ’s increase doubly exponentially, and n0 is sufficiently large.

1/2− µ
Finally, take AR itself and amplify it to success probability Ω (1) by running
  it O(nR ) times.
1/2
This yields an algorithm for searching Ld (nR ) with overall running time O nR , which implies that
   
(1) 1/2
Q OR , Ld (nR ) = O nR .
All that remains is to handle values of n that do not equal nR for any R. The solution is simple:
 d
first find the largest R such thatnR < n. Thenset n′ = nR n1/d /ℓR , and embed Ld (n) into the larger
hypercube Ld (n′ ). Clearly Q OR(1) , Ld (n) ≤ Q OR(1) , Ld (n′ ) . Also notice that n′ = O (n) and
   
1/β 3/2
that n′ = O nR = O nR . Next partition Ld (n′ ) into n′ /nR subcubes, each a copy of Ld (nR ). The
algorithm will now have one additional level of recursion, which chooses a subcube of Ld (n′ ) uniformly

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 63


S. A ARONSON , A. A MBAINIS
p 
at random, runs AR on that subcube, and then amplifies the resulting procedure Θ n′ /nR times. The
total time is now r  ! r !
n′   n ′ √ 
1/d 1/2 1/2
O n′ + nR =O nR =O n ,
nR nR
while the success probability is Ω (1). This completes Theorem 5.4.

5.3 Dimension 2
In the d = 2 case, the best we can achieve is the following:
√ 
Theorem 5.9. Q (OR, L2 ) = O n log5/2 n .
Again, we start with the single marked vertex case and postpone the general case to Sections 5.4 and
5.5.
  √ 
Theorem 5.10. Q OR(1) , L2 = O n log3/2 n .

For d ≥ 3, we performed amplification on large (greater than O 1/n1−2µ ) probabilities only once,
at the end. For d = 2, on the other hand, any algorithm that we construct with any nonzero success

probability will have running time Ω ( n), simply because that is the diameter of the grid. If we

want to keep the running time O ( n), then we can only perform O (1) amplification steps at the end.
Therefore we need to keep the success probability relatively high throughout the recursion, meaning that
we suffer an increase in the running time, since amplification to high probabilities is less efficient.
The procedures AR , UR , WR , and SR are identical to those in Section 5.2; all that changes are the
parameter settings. For all integers R ≥ 0, we now let nR = ℓ2R 0 , for some odd integer ℓ0 ≥ 3 to be set
later. Thus, AR and UR search the square grid L2 (nR ) of size ℓR0 × ℓR0 . Also, let m = (ℓ0 − 1) /2; then
AR applies m steps of amplitude amplification to UR .
We now prove the counterparts of Lemmas 5.7 and 5.8 for the two-dimensional case.

Lemma 5.11. AR uses O Rℓ0R+1 steps.
Proof. Let TA (R) and TU (R) be the time used by AR and UR respectively in searching L2 (nR ). Then
TA (0) = 1, and for all R ≥ 1,
TA (R) ≤ (2m + 1) TU (R) + 2m,
1/2
TU (R) ≤ 2nR + TA (R − 1) .
Combining,
 
1/2
TA (R) ≤ (2m + 1) 2nR + TA (R − 1) + 2m

= ℓ0 2ℓR0 + TA (R − 1) + ℓ0 − 1

= O ℓ0R+1 + ℓ0 TA (R − 1)

= O Rℓ0R+1 .

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 64


Q UANTUM S EARCH OF S PATIAL R EGIONS

Lemma 5.12. AR succeeds with probability Ω (1/R).

Proof. Let PA (R) and PU (R) be the success probabilities of AR and UR respectively when searching
L2 (nR ). Then PU (R) = PA (R − 1)/ℓ20 for all R ≥ 1. So by Lemma 5.2, and using the fact that
2m + 1 = ℓ0 ,
!
(2m + 1)2
PA (R) ≥ 1 − PU (R) (2m + 1)2 PU (R)
3
 
ℓ20 PA (R − 1) 2 PA (R − 1)
= 1− ℓ0
3 ℓ20 ℓ20
1 2
= PA (R − 1) − PA (R − 1)
3
= Ω (1/R) .

This is because Ω (R) iterations of the map xR := xR−1 − 13 x2R−1 are needed to drop from (say) 2/R to
1/R, and x0 = PA (0) = 1 is greater than 2/R.
√ 
We can amplify AR to success probability Ω (1) by repeating it O R times. This yields an algo-
 √ 
rithm for searching L2 (nR ) that uses O R3/2 ℓ0R+1 = O nR R3/2 ℓ0 steps in total. We can minimize
this
 expression subject
 to
√ 0 = nR by taking ℓ0 to be constant and R to be Θ (log nR ), which yields
ℓ2R
(1) 3/2
Q OR , L2 (nR ) = O nR log nR . If n is not of the form ℓ2R
0 , then we simply find the smallest

integer R such that n < ℓ2R 2R
0 , and embed L2 (n) in the larger grid L2 ℓ0 . Since ℓ0 is a constant, this
increases the running time by at most a constant factor. We have now proved Theorem 5.10.

5.4 Multiple Marked Items


What about the case in which there are multiple i’s with xi = 1? If there are k marked items (where k
neednot be known in advance), then Grover’s algorithm can find a marked item with high probability
p
in O n/k queries, as shown by Boyer et al. [10]. In our setting, however, this is too much to hope
for—since even if there are many markedp vertices, they might all be in a faraway part of the hypercube.
Then Ω n1/d steps are needed, even if n/k < n1/d . Indeed, we can show a stronger lower bound.
Recall that OR(k) is the problem of deciding whether there are no marked vertices or exactly k of them.

Theorem 5.13. For all dimensions d ≥ 2,


   √ 
n
Q OR , Ld = Ω
(k)
.
k1/2−1/d
Here, for simplicity, we ignore constant factors depending on d.
1/d
Proof. For simplicity, we assume that both k1/d and n/3d k are integers. (In the general case, we
 1/d d
can just replace k by k and n by the largest integer of the form (3m)d k which is less than n. This
only changes the lower bound by a constant factor depending on d.)

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 65


S. A ARONSON , A. A MBAINIS

We use a hybrid argument almost identical to that of Theorem 4.4. Divide Ld into n/k subcubes,
each having k vertices and side length k1/d . Let S be a regularly-spaced set of M = n/ 3d k of these
subcubes, so that any two subcubes in S have distance at least 2k1/d from one another. Then choose a
subcube C j ∈ S uniformly at random and mark all k vertices in C j . This enables us to consider each
C j ∈ S itself as a single vertex (out of M in total), having distance at least 2k1/d to every other vertex.
More formally, given a subcube C j ∈ S, let Cej be the set of vertices consisting of C j and the 3d − 1
subcubes surrounding it. (Thus, Cej is a subcube of side length 3k1/d .) Then the query magnitude of Cej
after the t th query is
2
(t)
Γ j = ∑ ∑ αi,z (X0 ) ,
(t)

vi ∈Cej z

where X0 is the all-zero input. Let T be the number of queries, and let w = T / ck1/d for some constant
c > 0. Then as in Theorem 4.4, there must exist a subcube Cej∗ such that
w−1
(T −qck1/d ) w 3d kw
∑ Γj ∗ ≤
M
=
n
.
q=0

Let Y be the input which is 1 in C j∗ and 0 elsewhere; then let Xq be a hybrid input which is X0 during
queries 1 to T − qck1/d , but Y during queries T − qck1/d + 1 to T . Next let
2
(T )
D (q, r) = ∑ ∑ αi,z (Xq ) − αi,z (Xr ) .
(T )

vi ∈G z

(T −qck1/d )
Then as in Theorem 4.4, for all c < 1 we have D (q − 1, q) ≤ 4Γ j∗ . For in the ck1/d queries from
T − qck1/d + 1 through T − (q − 1) ck1/d , no amplitude originating outside Cej∗ can travel a distance k1/d
and thereby reach C j∗ . Therefore switching from Xq−1 to Xq can only affect amplitude that is in Cej∗
immediately after query T − qck1/d . It follows that
r r √
p w p w
(T −qck1/d ) 3d k 2 3d k1/2−1/d T
D (0, w) ≤ ∑ D (q − 1, q) ≤ 2 ∑ Γ j∗ ≤ 2w = √ .
q=1 q=1 n c n
√ 
Hence T = Ω n/k1/2−1/d for constant d, since assuming the algorithm is correct we need D (0, w) =
Ω (1).

Notice that if k ≈ n, then the bound of Theorem 5.13 becomes Ω n1/d which is just the diameter of

Ld . Also, if d = 2, then 1/2 − 1/d = 0 and the bound is simply Ω ( n) independent of k. The bound of
Theorem 5.13 can be achieved (up to a constant factor that depends on d) for d ≥ 3, and nearly achieved
for d = 2. We first construct an algorithm for the case when k is known.
Theorem 5.14.

(i) For d ≥ 3,  √ 
  n
Q OR(k) , Ld = O .
k1/2−1/d

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 66


Q UANTUM S EARCH OF S PATIAL R EGIONS

(ii) For d = 2,
  √ 
Q OR(k) , L2 = O n log3/2 n .

To prove Theorem 5.14, we first divide Ld (n) into n/γ subcubes, each of size γ 1/d × · · · × γ 1/d
(where γ will be fixed later). Then in each subcube, we choose one vertex uniformly at random.

Lemma 5.15. If γ ≥ k, then the probability that exactly one marked vertex is chosen is at least k/γ −
(k/γ )2 .

Proof. Let x be a marked vertex. The probability that x is chosen is 1/γ . Given that x is chosen, the
probability that one of the other marked vertices, y, is chosen is 0 if x and y belong to the same subcube,
or 1/γ if they belong to different subcubes. Therefore, the probability that x alone is chosen is at least
   
1 k−1 1 k
1− ≥ 1− .
γ γ γ γ

Since the events “x alone is chosen” are mutually disjoint, we conclude that the probability that exactly
one marked vertex is chosen is at least k/γ − (k/γ )2 .

In particular, fix γ so that γ /3 < k < 2γ /3; then Lemma 5.15 implies that the probability of choosing
exactly one marked vertex is at least 2/9. The algorithm is now as follows. As in the lemma, subdivide
Ld (n) into n/γ subcubes and choose one location at random from each. Then run the algorithm for
the unique-solution case (Theorem 5.4 or 5.10) on the chosen locations only, as if they were vertices of
Ld (n/γ ). p 
The running time in the unique case was O n/γ for d ≥ 3 or

r  r 
n n 3/2
O log (n/γ ) = O
3/2
log n
γ γ

for d = 2. However, each local unitary in the original algorithm now becomes a unitary affecting two
vertices v and w in neighboring subcubes Cv and Cw . When placed side by side, Cv and Cw form a
rectangular box of size 2γ 1/d × γ 1/d × · · · × γ 1/d . Therefore the distance between v and w is at most
(d + 1) γ 1/d . It follows that each local unitary in the original algorithm takes O d γ 1/d time in the new
algorithm. For d ≥ 3, this results in an overall running time of
r   √   √ 
n 1/d n n
O dγ =O d =O .
γ γ 1/2−1/d k1/2−1/d

For d = 2 we obtain r 
n 1/2 3/2 √ 
O γ log n = O n log3/2 n .
γ

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 67


S. A ARONSON , A. A MBAINIS

5.5 Unknown Number of Marked Items


We now show how to deal with an unknown k. Let OR(≥k) be the problem of deciding whether there
are no marked vertices or at least k of them, given that one of these is true.

Theorem 5.16.

(i) For d ≥ 3,
   √ 
(≥k) n
Q OR , Ld = O .
k1/2−1/d

(ii) For d = 2,
  √ 
Q OR(≥k) , L2 = O n log5/2 n .

Proof. We use the straightforward ‘doubling’ approach of Boyer et al. [10]:

(1) For j = 0 to log2 (n/k)

• Run the algorithm of Theorem 5.14 with subcubes of size γ j = 2 j k.


• If a marked vertex is found, then output 1 and halt.

(2) Query a random vertex v, and output 1 if v is a marked vertex and 0 otherwise.

Let k∗ ≥ k be the number of marked vertices. If k∗ ≤ n/3, then there exists a j ≤ log2 (n/k) such
that γ j /3 ≤ k∗ ≤ 2γ j /3. So Lemma 5.15 implies that the jth iteration of step (1) finds a marked vertex
with probability at least 2/9. On the other hand, if k∗ ≥ n/3, then step (2) finds a marked vertex with
probability at least 1/3. For d ≥ 3, the time used in step (1) is at most

√ √ " #  √ 
log2 (n/k) log2 (n/k)
n n 1 n
∑ = ∑ =O ,
γj
1/2−1/d k1/2−1/d 2 j(1/2−1/d) k1/2−1/d
j=0 j=0

√ 
the sum in brackets being a decreasing geometric series. For d = 2, the time is O n log5/2 n , since
√ 
each iteration takes O n log3/2 n time and there are at most log n iterations. In neither case does step

(2) affect the bound, since k ≤ n implies that n1/d ≤ n/k1/2−1/d .


Taking k = 1 gives algorithms for unconstrained OR with running times O( n) for d ≥ 3 and

O( n log5/2 n) for d = 2, thereby establishing Theorems 5.3 and 5.9.

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 68


Q UANTUM S EARCH OF S PATIAL R EGIONS

6 Search on Irregular Graphs


In Section 1.2, we claimed that our divide-and-conquer approach has the advantage of being robust: it
works not only for highly symmetric graphs such as hypercubes, but for any graphs having comparable
expansion properties. Let us now substantiate this claim.
Say a family of connected graphs {Gn = (Vn , En )} is d-dimensional if there exists a κ > 0 such that
for all n, ℓ and v ∈ Vn ,  
|B (v, ℓ)| ≥ min κ ℓd , n ,

where B (v, ℓ) is the set of vertices having distance at most ℓ from v in Gn . Intuitively, Gn is d-
dimensional (for d ≥ 2 an integer) if its expansion properties are at least as good as those of the hy-
percube Ld (n).5 It is immediate that the diameter of Gn is at most (n/κ )1/d . Note, though, that Gn
might not be an expander graph in the usual sense, since we have not required that every sufficiently
small set of vertices has many neighbors.
Our goal is to show the following.

Theorem 6.1. If G is d-dimensional, then

(i) For a constant d > 2, √ 


Q (OR, G) = O n polylog n .

(ii) For d = 2,
√ √
Q (OR, G) = n2O( log n)
.

In proving part (i), the intuition is simple: we want to decompose G recursively into subgraphs
(called clusters), which will serve the same role as subcubes did in the hypercube case. The procedure is
as follows. For some constant n1 > 1, first choose ⌈n/n1 ⌉ vertices uniformly at random to be designated
as 1-pegs. Then form 1-clusters by assigning each vertex in G to its closest 1-peg, as in a Voronoi
diagram. (Ties are broken randomly.) Let v (C) be the peg of cluster C. Next, split up any 1-cluster
C with more than n1 vertices into ⌈|C| /n1 ⌉ arbitrarily-chosen 1-clusters, each with size at most n1 and
with v (C) as its 1-peg. Observe that
⌈n/n1 ⌉    
|Ci | n
∑ n1
≤2
n1
,
i=1

where n = |C1 | + · · · + C⌈n/n1 ⌉ . Therefore, the splitting-up step can at most double the number of
clusters.
1/β
In the next iteration, set n2 = n1 , for some constant β ∈ (2/d, 1). Choose 2 ⌈n/n2 ⌉ vertices
uniformly at random as 2-pegs. Then form 2-clusters by assigning each 1-cluster C to the 2-peg that
is closest to the 1-peg v (C). Given a 2-cluster C′ , let |C′ | be the number of 1-clusters in C′ . Then as
before, split up any C′ with |C′ | > n2 /n1 into ⌈|C′ | / (n2 /n1 )⌉ arbitrarily-chosen 2-clusters, each with
1/β
size at most n2 /n1 and with v (C′ ) as its 2-peg. Continue recursively in this manner, setting nR = nR−1
5 In general, it makes sense to consider non-integer d as well.

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 69


S. A ARONSON , A. A MBAINIS

and choosing 2R−1 ⌈n/nR ⌉ vertices as R-pegs for each R. Stop at the maximum R such that nR ≤ n. For
technical convenience, set n0 = 1, and consider each vertex v to be the 0-peg of the 0-cluster {v}.
For R ≥ 1, define the radius of an R-cluster C to be the maximum, over all (R − 1)-clusters C′ in
C, of the distance from v (C) to v (C′ ). Also, call an R-cluster good if it has radius at most ℓR , where
1/d
ℓR = κ2 nR ln n .
Lemma 6.2. With probability 1 − o (1) over the choice of clusters, all clusters are good.
Proof. Let v be the (R − 1)-peg of an (R − 1)-cluster. Then |B (v, ℓ)| ≥ κ ℓd , where B (v, ℓ) is the ball of
radius ℓ about v. So the probability that v has distance greater than ℓR to the nearest R-peg is at most
 ⌈n/nR ⌉  n/nR
κ ℓd 2 ln n 1
1− R ≤ 1− < .
n n/nR n2
Furthermore, the total number of pegs is easily seen to be O (n). It follows by the union bound that every
(R − 1)-peg for every R has distance at most ℓR to the nearest R-peg, with probability 1 − O (1/n) =
1 − o (1) over the choice of clusters.

At the end we have a tree of clusters, which can be searched recursively just as in the hypercube
case. Lemma 6.2 gives us a guarantee on the time needed to move a level down (from a peg of an
R-cluster to a peg of an R − 1-cluster contained in it) or a level up. Also, let K ′ (C) be the number of
(R − 1)-clusters in R-cluster C; then K ′ (C) ≤ K (R) where K (R) = 2 ⌈nR /nR−1 ⌉. If K ′ (C) < K (R), then
place K (R) − K ′ (C) “dummy” (R − 1)-clusters in C, each of which has (R − 1)-peg v (C). Now, every
R-cluster contains an equal number of R − 1 clusters.
Our algorithm is similar to Section 5.2 but the basis states now have the form |v, z,Ci, where v is
a vertex, z is an answer bit, and C is the label of the cluster currently being searched. (Unfortunately,
because multiple R-clusters can have the same peg, a single auxiliary qubit no longer suffices.)
The algorithm AR from Section 5.2 now does the following, when invoked on the initial state
|v (C) , 0,Ci, where C is an R-cluster. If R = 0, then AR uses a query transformation to prepare the
state |v (C) , 1,Ci if v (C) is the marked vertex and |v (C) , 0,Ci otherwise. If R ≥ 1 and C is not a
dummy cluster, then AR performs
p mR steps of amplitude amplification on UR , where mR is the largest in-
teger such that 2mR + 1 ≤ nR /nR−1 .6 If C is a dummy cluster, then AR does nothing for an appropriate
number of steps, and then returns that no marked item was found.
We now describe the subroutine UR , for R ≥ 1. When invoked with |v (C) , 0,Ci as its initial state,
UR first prepares a uniform superposition
K(R)
1
|φC i = p ∑ |v (Ci ) , 0,Ci i .
K (R) i=1

It does this by first constructing a spanning tree T for C, rooted at v (C) and having minimal depth, and
then moving amplitude along the edges of T so as to prepare |φC i. After |φC i has been prepared, UR
then calls AR−1 recursively, to search C1 , . . . ,CK(R) in superposition and amplify the results. Note that,
6 In √ √
the hypercube case, we performed fewer amplifications in order to lower the running time from n polylog n to n.
Here, though, the splitting-up step produces a polylog n factor anyway.

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 70


Q UANTUM S EARCH OF S PATIAL R EGIONS

because of the cluster labels, there is no reason why amplitude being routed through C should not pass
through some other cluster C′ along the way—but there is also no advantage in our analysis for allowing
this.
We now analyze the running time and success probability of AR .
√ 
Lemma 6.3. AR uses O nR log1/d n steps, assuming that all clusters are good.

Proof. Let TA (R) and TU (R) be the time used by AR and UR respectively in searching an R-cluster.
Then we have
p
TA (R) ≤ nR /nR−1 TU (R),
TU (R) ≤ ℓR + TA (R − 1)
with the base case TA (0) = 1. Combining,
p
TA (R) ≤ nR /nR−1 (ℓR + TA (R − 1))
p p p
≤ nR /nR−1 ℓR + nR /nR−2 ℓR−1 + · · · + nR /n0 ℓ1
!
√ (nR ln n)1/d (n1 ln n)1/d
= nR · O √ + ··· + √
nR−1 n0
√  1/d   1/d−β /2 1/d−β /2

= nR ln n · O nR + · · · + n1
 R−1 
√  1/d  1/d−β /2
 
1/d−β /2 1/β
 
1/d−β /2 (1/β )
= nR ln n · O n1 + n1 + · · · + n1
√ 
=O nR log1/d n ,
1/d−β /2
where the last line holds because β > 2/d and therefore n1 < 1.

Lemma 6.4. AR succeeds with probability Ω (1/ polylog nR ) in searching a graph of size n = nR , as-
suming there is a unique marked vertex.
Proof. For all R ≥ 0, let CR be the R-cluster that contains the marked vertex, and let PA (R) and PU (R)
be the success probabilities of AR and UR respectively when searching CR . Then for all R ≥ 1, we have
PU (R) = PA (R − 1)/K (R), and therefore
!
(2mR + 1)2
PA (R) ≥ 1 − PU (R) (2mR + 1)2 PU (R)
3
!
(2mR + 1)2 PA (R − 1) PA (R − 1)
= 1− · (2mR + 1)2
3 K (R) K (R)
= Ω (PA (R − 1))
= Ω (1/ polylog nR ) .

Here the third line holds because (2mR + 1)2 ≈ nR /nR−1 ≈ K (R)/2, and the last line because R =
Θ (log log nR ).

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 71


S. A ARONSON , A. A MBAINIS

 AR itself O(polylog nR ) times, to achieve a constant success probability using


Finally, we repeat

O nR polylog nR steps in total. Again, if n is not equal to nR for any R, then we simply find the
largest R such that nR < n, and then
p  add one more level of recursion that searches a random R-cluster

and amplifies the result Θ n/nR times. The resulting algorithm uses O ( n polylog n) steps, thereby
establishing part (i) of Theorem 6.1 for the case of a unique marked vertex. The generalization to
multiple marked vertices is straightforward.
Corllary 6.5. If G is d-dimensional for a constant d > 2, then
  √ 
(≥k) n polylog nk
Q OR ,G = O .
k1/2−1/d
Proof. Assume  without loss of generality that k = o (n), since otherwise a marked item is trivially found
in O n1/d steps. As in Theorem 5.16, we give an algorithm B consisting of log2 (n/k) + 1 iterations.
In iteration j = 0, choose ⌈n/k⌉ vertices w1 , . . . , w⌈n/k⌉ uniformly at random. Then run the algorithm for
the unique marked vertex case, but instead of taking all vertices in G as 0-pegs, take only w1 , . . . , w⌈n/k⌉ .
On the other hand, still choose the 1-pegs, 2-pegs, and so on uniformly at random from among all
vertices in G. For all R, the number of R-pegs should be ⌈(n/k) /nR ⌉. In general, in iteration j of
B, choose n/ 2 j k vertices w1 , . . . , w⌈n/(2 j k)⌉ uniformly at random, and then run the algorithm for a
unique marked vertex as if w1 , . . . , w⌈n/(2 j k)⌉ were the only vertices in the graph.
It is easy to see that, assuming there are k or more marked vertices, with probability Ω (1) there exists
an iteration j such that exactly one of w1 , . . . , w⌈n/(2 j k)⌉ is marked. Hence B succeeds with probability
Ω (1). It remains only to upper-bound B’s running time.
( j) 1/d
In iteration j, notice that Lemma 6.2 goes through if we use ℓR := κ2 2 j knR ln nk instead of ℓR .
That is, with probability 1 − O (k/n) = 1 − o (1) over the choice of clusters, every R-cluster has radius
( j)
at most ℓR . So letting TA (R) be the running time of AR on an R-cluster, the recurrence in Lemma 6.3
becomes p   √ 1/d 
( j)
TA (R) ≤ nR /nR−1 ℓR + TA (R − 1) = O nR 2 j k log (n/k) ,
which is √ !
n log1/d n
k
O 1/2−1/d
(2 j k)
 
if nR = Θ n/ 2 j k . As usual, the case where there is no R such that nR = Θ n/ 2 j k is trivially
handled by adding one more level of recursion. If we factor in the O (1/ polylog nR ) repetitions of AR
needed to boost the success probability to Ω (1), then the total running time of iteration j is
√ !
n polylog nk
O .
(2 j k)1/2−1/d
Therefore B’s running time is
√ ! √ 
log2 (n/k)
n polylog n n polylog n
O ∑ (2 j k)1/2−1/d
=O
k1/2−1/d
.
j=0

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 72


Q UANTUM S EARCH OF S PATIAL R EGIONS

√ √
For the d = 2 case, the best upper bound we can show is n2O( log n) . This is obtained by simply
1/µ
modifying AR to have a deeper recursion tree. Instead of taking nR = nR−1 for some µ , we take
√ √  √ 
nR = 2 log n nR−1 = 2R log n , so that the total number of levels is log n . Lemma 6.2 goes through
without modification, while the recurrence for the running time becomes
p
TA (R) ≤ nR /nR−1 (ℓR + TA (R − 1))
p p p
≤ nR /nR−1 ℓR + nR /nR−2 ℓR−1 + · · · + nR /n0 ℓ1
 √ √ √ √ 
= O 2 log n(R/2) ln n + · · · + 2 log n(R/2) ln n
√ √
= n2O( log n) .
Also, since the√success probability decreases

by at most a constant factor at each level, we have that
−O( log n) O( log n)
PA (R) = 2 , and hence 2 amplification steps suffice to boost the success probability
to Ω√(1). Handling multiple marked items adds an additional factor of log n, which is absorbed into
2O( log n) . This completes Theorem 6.1.

6.1 Bits Scattered on a Graph


In Section 2, we discussed several ways to pack a given amount of entropy into a spatial region of given
dimensions. However, we said nothing about how the entropy is distributed within the region. It might
be uniform, or concentrated on the boundary, or distributed in some other way. So we need to answer
the following: suppose that in some graph, h out of the n vertices might be marked, and we know which
h those are. Then how much time is needed to determine whether any of the h is marked? If the graph
is the hypercube Ld for d ≥ 2 or is d-dimensional for d > 2, then the results of the previous sections

imply that O ( n polylog n) steps suffice. However, we wish to use fewer steps, taking advantage of the
fact that h might be much smaller than n. Formally, suppose we are given a graph G with n vertices,
of which h are potentially marked. Let OR(h,≥k) be the problem of deciding whether G has no marked
vertices or at least k of them, given that one of these is the case.
Proposition 6.6. For all integer constants d ≥ 2, there exists a d-dimensional graph G such that
   1/2−1/d !
1/d h
Q OR (h,≥k)
,G = Ω n .
k
Proof. Let G be the d-dimensional hypercube Ld (n). Create h/k subcubes of potentially marked ver-
tices, each having k vertices and side length
 k1/d . Space these subcubes out in Ld (n) so that the
distance between any pair of them is Ω (nk/h)1/d . Then choose a subcube C uniformly at random
and mark all kvertices in C. This enables us to consider each subcube as a single vertex, having distance
Ω (nk/h)1/d to every other vertex. The lower bound now follows by a hybrid argument essentially
identical to that of Theorem 5.13.

In particular, if d = 2 then Ω ( n) time is always needed, since the potentially marked vertices
might all be far from the start vertex. The lower bound of Proposition 6.6 can be achieved up to a
polylogarithmic factor.

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 73


S. A ARONSON , A. A MBAINIS

Proposition 6.7. If G is d-dimensional for a constant d > 2, then


 1/2−1/d !
 
(h,≥k) 1/d h h
Q OR ,G = O n polylog .
k k

Proof. Assume without loss of generality that k = o (h), since otherwise a marked item is trivially
found.
 j
 algorithm B from Corollary 6.5, with the following simple change. In iteration j, choose
Use
h/ 2 k potentially marked vertices w1 , . . . , w⌈h/(2 j k)⌉ uniformly at random, and then run the algo-
rithm for a unique marked vertex as if w1 , . . . , w⌈h/(2 j k)⌉ were the only vertices in the graph. That is, take
 
w1 , . . . , w⌈h/(2 j k)⌉ as 0-pegs; then for all R ≥ 1, choose h/ 2 j knR vertices of G uniformly at random
( j) 1/d
as R-pegs. Lemma 6.2 goes through if we use ℓbR := κ2 nh 2 j knR ln hk instead of ℓR . So following
Corollary 6.5, the running time of iteration j is now
    !
√  n j 1/d h 1/d h 1/2−1/d h
O nR 2 k polylog =O n polylog
h k 2 jk k

if nR = Θ h/ 2 j k . Therefore the total running time is
 1/2−1/d !  1/2−1/d !
log2 (h/k)
h h h h
O ∑ 1/d
n
2 jk
polylog
k
1/d
=O n
k
polylog
k
.
j=0

Intuitively, Proposition 6.7 says that the worst case for search occurs when the h potential marked
vertices are scattered evenly throughout the graph.

7 Application to Disjointness
In this section we show how our results can be used to strengthen a seemingly unrelated result in quantum
computing. Suppose Alice has a string X = x1 . . . xn ∈ {0, 1}n , and Bob has a string Y = y1 . . . yn ∈
{0, 1}n . In the disjointness problem, Alice and Bob must decide with high probability whether there
exists an i such that xi = yi = 1, using as few bits of communication as possible. Buhrman, Cleve, and
Wigderson [12] observed that in the quantum setting, Alice and Bob can solve this problem using only

O ( n log n) qubits of communication. This was subsequently improved by Høyer and de Wolf [20]
√ ∗ 
to O nclog n , where c is a constant and log∗ n is the iterated logarithm function. Using the search
√ √
algorithm of Theorem 5.3, we can improve this to O ( n), which matches the celebrated Ω ( n) lower
bound of Razborov [23].

Theorem 7.1. The quantum communication complexity of the disjointness problem is O ( n).

Proof. The protocol is as follows. Alice and Bob both store their inputs in a 3-D cube  L3 (n) (Figure
3); that is, they let x jkl = xi and y jkl = yi , where i = n2/3 j + n1/3 k + l + 1 and j, k, l ∈ 0, . . . , n1/3 − 1 .

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 74


Q UANTUM S EARCH OF S PATIAL R EGIONS

A B
Figure 3: Alice and Bob ‘synchronize’ locations on their respective cubes.

To decide whether there exists a ( j, k, l) with x jkl = y jkl = 1, Alice simply runs our search algorithm for
an unknown number of marked items. If the search algorithm is in the state

∑ α j,k,l,z v jkl , z ,
then the joint state of Alice and Bob will be


∑ α j,k,l,z,c v jkl
⊗ |zi ⊗ |ci ⊗ v jkl , (7.1)

where Alice holds the first v jkl and |zi, Bob holds the second v jkl , and |ci is the communication
channel. Thus, whenever Alice is at location ( j, k, l) of her cube, Bob is at location ( j, k, l) of his cube.

(1) To simulate a query, Alice sends |zi and an auxiliary qubit holding x jkl to Bob. Bob performs
|zi → |z ⊕ y jkl i, conditional on x jkl = 1. He then returns both bits to Alice, and finally Alice
returns the auxiliary qubit to the |0i state by exclusive-OR’ing it with x jkl .

(2) To simulate a non-query transformation that does not change v jkl , Alice just performs it herself.

(3) By examining Algorithms 5.5 and 5.6, we see that there are two transformations that change v jkl .
We deal with them separately.

First, step 1 of Algorithm 5.5 uses a classical C-local transformation v j,k,l → |v j′ ,k′ ,l′ i. This
transformation can be simulated by Alice and Bob each separately applying |v j,k,l i → |v j′ ,k′ ,l′ i.
Second, step 2 of Algorithm 5.6 applies transformations Z1 , Z2 , and Z3 . For brevity, we restrict

ourselves to discussing Z1 . This transformation maps an initial state v j,k,l , 0 to a uniform su-
perposition over |v j′ ,k,l , 0i for all ( j′ , k, l) lying in the same Ci as ( j, k, l). We can decompose this
into a sequence of transformations mapping |v j′ ,k,l i to α |v j′ ,k,l i + β |v j′ +1,k,l i for some α , β . This
can be implemented in three steps, using an auxiliary qubit. The auxiliary qubit is initialized to
|0i and is initially held by Alice. At the end, the auxiliary qubit is returned to |0i. The sequence
of transformations is

|v j′ ,k,l i |0i |v j′ ,k,l i → α |v j′ ,k,l i |0i |v j′ ,k,l i + β |v j′ ,k,l i |1i |v j′ ,k,l i


→ α |v j′ ,k,l i |0i |v j′ ,k,l i + β |v j′ ,k,l i |1i |v j′ +1,k,l i
→ α |v j′ ,k,l i |0i |v j′ ,k,l iβ |v j′ ,k,l i |0i |v j′ +1,k,l i.

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 75


S. A ARONSON , A. A MBAINIS

The first transformation is performed by Alice who then sends the auxiliary qubit to Bob. The
second transformation is performed by Bob, who then sends the auxiliary qubit back to Alice,
who performs the third transformation.

Since the algorithm uses O ( n) steps, and each step is simulated using a constant amount of com-

munication, the number of qubits communicated in the disjointness protocol is therefore also O ( n).

8 Open Problems
As discussed in Section 3.1, a salient open problem raised by this work is to prove relationships among
Z-local, C-local, and H-local unitary matrices. In particular, can any Z-local or H-local unitary be
approximated by a product of a small number of C-local unitaries? Also, is it true that Q ( f , G) =
Θ QZ ( f , G) = Θ QH ( f , G) for all f , G?
A second problem is to obtain interesting lower bounds in our model. For example, let G be a
√ √
n × n grid, and suppose  f (X ) = 1 if and only if every row of G contains a vertex vi with xi = 1.
Clearly Q ( f , G) = O n3/4 , and we conjecture that this is optimal. However, we were unable to show

any lower bound better than Ω ( n).
Finally, what is the complexity of finding a unique marked vertex on a2-D square  grid? √As men-
(1)
tioned in Section 1.2, Ambainis, Kempe, and Rivosh [3] showed that Q OR , L2 = O ( n log n).
Can the remaining factor of log n be removed?

9 Acknowledgments
We thank Andrew Childs, Julia Kempe, Neil Shenvi, and Ronald de Wolf for helpful conversations;
Jakob Bekenstein, Raphael Bousso, and John Preskill for discussions relevant to Section 2; and the
anonymous reviewers for comments on the manuscript and a simpler proof of Lemma 5.15.

References
[1] D. Aharonov, A. Ambainis, J. Kempe, and U. Vazirani. Quantum walks on graphs. In Proc. ACM
STOC, pages 50–59, 2001. quant-ph/0012090. 1.1, 1.2, 3

[2] A. Ambainis. Quantum lower bounds by quantum arguments. J. Comput. Sys. Sci., 64:750–767,
2002. Earlier version in ACM STOC 2000. quant-ph/0002066. 3

[3] A. Ambainis, J. Kempe, and A. Rivosh. Coins make quantum walks faster. In Proc. ACM-SIAM
Symp. on Discrete Algorithms (SODA), 2005. To appear. quant-ph/0402107. 1.2, 2, 8

[4] R. Beals, H. Buhrman, R. Cleve, M. Mosca, and R. de Wolf. Quantum lower bounds by polyno-
mials. J. ACM, 48(4):778–797, 2001. Earlier version in IEEE FOCS 1998, pp. 352-361. quant-
ph/9802049. 1.1, 3, 4

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 76


Q UANTUM S EARCH OF S PATIAL R EGIONS

[5] J. D. Bekenstein. A universal upper bound on the entropy to energy ratio for bounded systems.
Phys. Rev. D, 23(2):287–298, 1981. 2

[6] P. Benioff. Space searches with a quantum robot. In S. J. Lomonaco and H. E. Brandt, editors,
Quantum Computation and Information, Contemporary Mathematics Series. AMS, 2002. quant-
ph/0003006. 1.2, 2

[7] C. Bennett, E. Bernstein, G. Brassard, and U. Vazirani. Strengths and weaknesses of quantum
computing. SIAM J. Comput., 26(5):1510–1523, 1997. quant-ph/9701001. 1.1, 3, 4

[8] R. Bousso. Positive vacuum energy and the N-bound. J. High Energy Phys., 0011(038), 2000.
hep-th/0010252. 2

[9] R. Bousso. The holographic principle. Reviews of Modern Physics, 74(3), 2002. hep-th/0203101.
1, 2

[10] M. Boyer, G. Brassard, P. Høyer, and A. Tapp. Tight bounds on quantum searching. Fortschritte
Der Physik, 46(4-5):493–505, 1998. quant-ph/9605034. 5.4, 5.5

[11] G. Brassard, P. Høyer, M. Mosca, and A. Tapp. Quantum amplitude amplification and estimation.
In S. J. Lomonaco and H. E. Brandt, editors, Quantum Computation and Information, Contempo-
rary Mathematics Series. AMS, 2002. quant-ph/0005055. 1.1, 5, 5.1, 5.1

[12] H. Buhrman, R. Cleve, and A. Wigderson. Quantum vs. classical communication and computation.
In Proc. ACM STOC, pages 63–68, 1998. quant-ph/9702040. 7

[13] A. M. Childs, R. Cleve, E. Deotto, E. Farhi, S. Gutmann, and D. A. Spielman. Exponential algo-
rithmic speedup by quantum walk. In Proc. ACM STOC, pages 59–68, 2003. quant-ph/0209131.
1.2

[14] A. M. Childs, E. Farhi, and S. Gutmann. An example of the difference between quantum and
classical random walks. Quantum Information and Computation, 1(1-2):35–43, 2002. quant-
ph/0103020. 1.2

[15] A. M. Childs and J. Goldstone. Spatial search and the Dirac equation. Phys. Rev. A, 70(042312),
2004. quant-ph/0405120. 1.2, 2

[16] A. M. Childs and J. Goldstone. Spatial search by quantum walk. Phys. Rev. A, 70(022314), 2004.
quant-ph/0306054. 1.2, 2, 1.2

[17] L. K. Grover. A fast quantum mechanical algorithm for database search. In Proc. ACM STOC,
pages 212–219, 1996. quant-ph/9605043. 1, 3

[18] L. K. Grover. Quantum mechanics helps in searching for a needle in a haystack. Phys. Rev. Lett.,
79(2):325–328, 1997. quant-ph/9706033. 1

[19] L. K. Grover. A framework for fast quantum mechanical algorithms. In Proc. ACM STOC, pages
53–62, 1998. quant-ph/9711043. 1.1, 5, 5.1

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 77


S. A ARONSON , A. A MBAINIS

[20] P. Høyer and R. de Wolf. Improved quantum communication complexity bounds for disjointness
and equality. In Proc. Intl. Symp. on Theoretical Aspects of Computer Science (STACS), pages
299–310, 2002. quant-ph/0109068. 1.1, 7

[21] S. Lloyd. Computational capacity of the universe. Phys. Rev. Lett., 88, 2002. quant-ph/0110141. 3

[22] M. Nielsen and I. Chuang. Quantum Computation and Quantum Information. Cambridge Univer-
sity Press, 2000. 3.1

[23] A. A. Razborov. Quantum communication complexity of symmetric predicates. Izvestiya Math.


(English version), 67(1):145–159, 2003. quant-ph/0204025. 1.1, 7

[24] T. Rudolph and L. Grover. Quantum searching a classical database (or how we learned to stop
worrying and love the bomb). quant-ph/0206066, 2002. 2

[25] B. S. Ryden. Introduction to Cosmology. Addison-Wesley, 2002. 3

[26] S. Perlmutter and 32 others (Supernova Cosmology Project). Measurements of Ω and Λ from 42
high-redshift supernovae. Astrophysical Journal, 517(2):565–586, 1999. astro-ph/9812133. 2, 3

[27] A. Sahai and S. Vadhan. A complete promise problem for statistical zero-knowledge. J. ACM,
50(2):196–249, 2003. ECCC TR00-084. Earlier version in IEEE FOCS 1997. 2

[28] N. Shenvi, J. Kempe, and K. B. Whaley. A quantum random walk search algorithm. Phys. Rev. A,
67(5), 2003. quant-ph/0210064. 1.2

[29] P. Shor. Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum
computer. SIAM J. Comput., 26(5):1484–1509, 1997. Earlier version in IEEE FOCS 1994. quant-
ph/9508027. 1, 3

[30] V. Strassen. Gaussian elimination is not optimal. Numerische Mathematik, 14(13):354–356, 1969.
1.2

[31] J. Watrous. On one-dimensional quantum cellular automata. In Proc. IEEE FOCS, pages 528–537,
1995. 1.1

[32] Ch. Zalka. Could Grover’s algorithm help in searching an actual database? quant-ph/9901068,
1999. 2

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 78


Q UANTUM S EARCH OF S PATIAL R EGIONS

AUTHORS7

Scott Aaronson [About the author]


Postdoctoral Fellow
Institute for Quantum Computing
University of Waterloo
aaronson [at] iqc [dot] ca
http://www.scottaaronson.com

Andris Ambainis [About the author]


Assistant Professor
Department of Combinatorics and Optimization
University of Waterloo
ambainis [at] math [dot] uwaterloo [dot] ca
http://www.math.uwaterloo.ca/∼ambainis

ABOUT THE AUTHORS

S COTT A ARONSON works on computational complexity, quantum computing, and the


foundations of quantum mechanics. He holds a PhD in computer science from UC
Berkeley (supervised by Umesh Vazirani), an undergraduate degree from Cornell Uni-
versity, and a New York State GED. He was born in Philadelphia.

A NDRIS A MBAINIS was born in Daugavpils, Latvia. After undergraduate studies at the
University of Latvia, he received his Ph.D. from the University of California, Berkeley
in 2001, supervised by Umesh Vazirani. Andris joined the University of Waterloo in
August 2004. His research interests include quantum algorithms, quantum complexity
theory, quantum cryptography as well as the classical theory of computation.

7 Toreduce exposure to spammers, T HEORY OF C OMPUTING uses various self-explanatory codes to represent “AT” and
“DOT” in email addresses.

T HEORY OF C OMPUTING, Volume 1 (2005), pp. 47–79 79