0% found this document useful (0 votes)
8 views8 pages

Searching in Grover'S Algorithm: Q HI HI Q H U

This document discusses Grover's algorithm for quantum searching, explaining its structure and the significance of its components, particularly the operator Q. It highlights the algorithm's efficiency in searching an unstructured database, achieving a square root speedup compared to classical methods. The author provides a geometric interpretation of the algorithm through reflections and rotations in a two-dimensional space, clarifying the underlying principles of its operation.

Uploaded by

717823d108
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views8 pages

Searching in Grover'S Algorithm: Q HI HI Q H U

This document discusses Grover's algorithm for quantum searching, explaining its structure and the significance of its components, particularly the operator Q. It highlights the algorithm's efficiency in searching an unstructured database, achieving a square root speedup compared to classical methods. The author provides a geometric interpretation of the algorithm through reflections and rotations in a two-dimensional space, clarifying the underlying principles of its operation.

Uploaded by

717823d108
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

SEARCHING IN GROVER’S ALGORITHM

Richard Jozsa
School of Mathematics and Statistics
University of Plymouth
Plymouth, Devon PL4 8AA, England.
Email: rjozsa@plymouth.ac.uk

ABSTRACT
Grover’s algorithm is usually described in terms of the iteration of a compound operator of the form
arXiv:quant-ph/9901021v1 9 Jan 1999

Q = −HI0 HIx0 . Although it is quite straightforward to verify the algebra of the iteration, this gives
little insight into why the algorithm works. What is the significance of the compound structure of
Q? Why is there a minus sign? Later it was discovered that H could be replaced by essentially any
unitary U . What is the freedom involved here? We give a description of Grover’s algorithm which
provides some clarification of these questions.
INTRODUCTION
Grover’s quantum searching algorithm is usually described [6, 7, 8, 10] in terms of the
iteration of a compound operator Q of the form

Q = −HI0 HIx0 (1)

on a starting state |ψ0 i = H |0i. Here H is the Walsh-Hadamard transform and I0 , Ix0 are
suitable inversion operators (c.f. below).1 Later it was discovered [10, 9, 11] that H may
be replaced by essentially any unitary operation U and using

Q = −U I0 U −1 Ix0 |ψ0 i = U |0i (2)

the searching algorithm still works just as well as before (with at most a constant slowdown
in the number of iterations). At first sight this appeared remarkable since H is known to
be singularly significant for other quantum algorithms [1, 3, 2]. The efficacy of these other
algorithms could be understood in terms of the fast Fourier transform construction [5] but
Grover’s algorithm appears to rest on different principles. Although it is quite straightfor-
ward to work through the algebra of the algorithm [6, 10], this provides little insight into
why it works! The operator −HI0 H was originally called a “diffusion” operator [6] and
later interpreted as “inversion in the average” [7] but neither of these appears to provide
much heuristic insight (especially in the context of the more general eq. (2)). What is the
significance of the particular compound structure of Q for a searching problem? What is
the significance of the minus sign in Q? Why can H be replaced by an arbitrary U – what
is the freedom involved here? The purpose of this note is to give a different description
of Grover’s algorithm which provides some clarification of these issues. We will show that
the algorithm may be seen to be a consequence of the following elementary theorem of
2-dimensional real Euclidean geometry:
1
This Q is the one used in [10]. Grover [6, 7] uses instead QGR = −I0 HIx0 H iterated on |ψ0 i = |0i
which is clearly an equivalent process.

1
Theorem 1: Let M 1 and M 2 be two mirror lines in the Euclidean plane IR2 intersecting
at a point O and let α be the angle in the plane from M 1 to M 2. Then the operation of
reflection in M 1 followed by reflection in M 2 is just rotation by angle 2α about the point
O.

M2

✏✏ M1
✏✏✏
✏✏
α ✏✏✏
✏✏
✏✏✏
✏ ✏✏ O
✏✏

Figure 1. Reflection in M 1 followed by reflection in M 2 is equivalent to rotation about O through


angle 2α.

THE SEARCH PROBLEM


The search problem is often phrased in terms of an exponentially large unstructured
database with N = 2n records, of which one is specially marked. The problem is to locate
the special record. Elementary probability theory shows that classically if we examine k
records then we have probability k/N of finding the special one so we need O(N ) such trials
to find it with any constant (independent√of N ) level of probability. Grover’s
√ quantum
algorithm achieves
√ this result with only O( N ) steps (or more precisely O( N ) iterations
of Q but O( N log N ) steps, the log N term coming from the implementation of H.) It
may be shown [12] that the square root speedup of Grover’s algorithm is optimal within
the context of quantum computation.
The search problem may be more accurately phrased in terms of an oracle problem,
which we adopt here. In the description above, there is a potential difficulty concerning
the physical realisation of an exponentially large unstructured database. One might expect
that it will require exponentially many degrees of freedom of some physical resource, such as
space, and consequently it may need exponential (i.e. O(N )) effort or time just to access a
typical (remotely lying) record. We will replace the database by an oracle which computes
an n bit function f : B n → B (where B = {0, 1}). It is promised that f (x) = 0 for
all n bit strings except exactly one string, denoted x0 (the “marked” position) for which
f (x0 ) = 1. Our problem is to determine x0 . We assume as usual that f is given as a unitary

2
transformation Uf on n + 1 qubits defined by

Uf |xi |yi = |xi |y ⊕ f (x)i (3)

Here the input register |xi consists of n qubits as x ranges over all n bit strings and the
output register |yi consists of a single qubit with y = 0 or 1. The symbol ⊕ denoted addition
modulo 2.

|xi ✲ ✲ |xi
Uf
|yi ✲ ✲ |y ⊕ f (x)i

Figure 2. The action of Uf on a general basis state |xi |yi of the input and output registers.
The assumption that the database was unstructured is formalised here as the standard
oracle idealisation that we have no access to the internal workings of Uf – it operates as
a “black box” on the input and output registers. In this formulation there is no problem
with the access to f (x) for any of the exponentially many x values and indeed we may also
readily query the oracle with a superposition of input values.
Instead of using Uf we will generally use an equivalent operation denoted Ix0 on n
qubits. It is defined by (
|xi if x 6= x0
Ix0 |xi = (4)
− |x0 i if x = x0
i.e. Ix0 simply inverts the amplitude of the |x0 i component. If x0 is the n bit string 00 . . . 0
then Ix0 will be written simply as I0 .
A black box which performs Ix0 may be simply constructed from Uf by just setting the
output register to √12 (|0i − |1i). Then the action of Uf leaves the output register in this
state and effects Ix0 on the input register2 :
2
Note that, conversely, Uf may be constructed from the a black box for Ix0 as follows. Let Jx0 denote
the operation “Ix0 controlled by the output qubit”. Apply H to the output register, then Jx0 to the input
and output registers, then H again to the output register. The total effect is just Uf on the n + 1 qubits of
both registers, as the reader may verify. To construct Jx0 from Ix0 we also need an eigenstate of Ix0 . The
construction is described in [13] or [2].

3
|ψi ✲ ✲ Ix0 |ψi
Uf
|0i − |1i ✲ ✲ |0i − |1i

Figure 3. Construction of Ix0 from Uf . Here |ψi is any n-qubit state.

Our searching problem becomes the following: we are given a black box which computes
Ix0 for some n bit string x0 and we want to determine the value of x0 .
REFLECTIONS ON REFLECTIONS
We first digress briefly to record some elementary properties of reflections which will
provide the basis for our interpretation of Grover’s algorithm.
In two real dimensions:
In real 2 dimensional Euclidean space, let M be any straight line through the origin specified
by a unit vector v perpendicular to M . Let Iv denote the operation of reflection in M . Note
that if u is any vector we may write it uniquely as a sum of components parallel and
perpendicular to v. If v ⊥ is a unit vector lying along M then we have

u = av + bv ⊥

and Iv simply replaces a by −a.


In N complex dimensions:
Note that Iv is exactly like Ix0 in eq. (4) above except that there, we were in a complex
space of higher dimension. We may interpret Ix0 as a reflection in the hyperplane orthogonal
to |x0 i. In terms of formulas, to reflect the x0 amplitude we have

Ix0 = I − 2 |x0 i hx0 | (5)

where I is the identity operator. More generally if |ψi is any state we define

I|ψi = I − 2 |ψi hψ| (6)

Then I|ψi is the operation of reflection in the hyperplane3 orthogonal to |ψi. For any state
|χi we may uniquely express it as a sum of components parallel and orthogonal to |ψi and
I|ψi simply inverts the parallel component.
We have the following simple properties of I|ψi :
Lemma 1: If |χi is any state then I|ψi preserves the 2-dimensional subspace S spanned by
|χi and |ψi.
3
P
More generally, for any subspace D we may define ID by ID = I − 2 d |di hd| where {|di} is any
orthonormal basis of D. Then ID is reflection in the orthogonal complement D⊥ of the subspace D.

4
Proof: Geometrically, S and the mirror hyperplane are orthogonal to each other (in the
sense that the orthogonal complement of either subspace is contained in the other subspace)
so the reflection preserves S. Alternatively in terms of algebra, eq. (6) shows that I|ψi takes
|ψi to − |ψi and for any |χi, it adds a multiple of |ψi to |χi. Hence any linear combination
is mapped to a linear combination of the same two states ✷.
Lemma 2: For any unitary operator U

U I|ψi U −1 = IU |ψi

Proof: Geometrically we are just changing description (reference basis) by U −1 but the
result is also immediate from eq. (6):

U I|ψi U −1 = I − 2U |ψi hψ| U −1 = I − 2 |U ψi hU ψ| = IU |ψi ✷.

Looking back at eq. (2) we see that

Q = −IU |0i I|x0 i (7)

Back to two real dimensions:


By lemma 1, both Ix0 and IU |0i preserve the two dimensional subspace V spanned by |x0 i
and U |0i . Hence by eq. (7), Q preserves V too. Now we may introduce a basis {|e1 i , |e2 i}
into V such that U |0i and |x0 i up to an overall phase, have real coordinates. Indeed
choose |e1 i = U |0i so U |0i has coordinates (1, 0). Then eiξ |x0 i = a |e1 i + b |e2 i where
|e2 i, orthonormal to |e1 i, still has an overall phase freedom. Thus choose ξ to make a real
and the phase of |e2 i to make b real. Then in this basis, since U |0i and |x0 i have real
coordinates, the operators Ix0 and IU |0i when acting on V, are also described by real 2 by 2
matrices – in fact they are just the real 2 dimensional reflections in the lines perpendicular
to |x0 i and U |0i in V. Finally we have:
Lemma 3: For any 2 dimensional real v we have

−Iv = Iv⊥

where v ⊥ is a unit vector perpendicular to v.


Proof: For any vector u we write u = av + bv ⊥ . Then Iv just reverses the sign of a and
−Iv reverses the sign of b. Thus the action of −Iv is the same as that of Iv⊥ ✷.
Later, this lemma will explain the significance of the minus sign in eq. (2). For the
present, note that from eq. (7) we can write

Q = I|wi I|x0 i

where |wi is orthogonal to U |0i and lies in the plane of U |0i and |x0 i. Since we are working
with real coordinates, theorem 1 shows that Q, acting in V, is just the operation of rotation
through angle 2α where α is the angle between |wi and |x0 i i.e. cos α = hx0 |wi. Since U |0i
is perpendicular to |wi we can write sin α = hx0 |U |0i.
GROVER’S ALGORITHM

5
We now give an interpretation of the workings of the quantum searching algorithm in
view of the preceeding simple facts about reflections. Given the black box Ix0 how can we
identify x0 ? Surely we must apply Ix0 to some state (we can do nothing else with a black
box!) but there seems no reason a priori to choose any one state rather than any other. So
let us just choose a state |wi at random. |wi may be written as U |0i where U is chosen at
random.
Now by lemma 1, Ix0 preserves the subspace spanned by |wi and |x0 i and by theorem 1,
I|wi Ix0 provides a way of moving around in this subspace – it is just rotation by twice the
angle between |x0 i and |wi. (Note that I|wi may be constructed via lemma 2 as U I0 U −1 .)
The idea now is to try to use this motion to move from the known starting state |wi towards
the unknown |x0 i. This process has been called “amplitude amplification” [8, 11] as we are
effectively trying to enhance the amplitude of the |x0 i component of the state. Once we
are near to |x0 i then a measurement of the state in the standard basis {|xi} will reveal the
value of x0 with high probability.
However there is an apparent problem: we do not know x0 so we know neither the angle
β, between |x0 i and |wi, nor the angle 2β of rotation of I|wi Ix0 . Hence we do not know how
many times to apply the rotation to move |wi near to |x0 i. Remarkably we can solve this
problem by using the extra information that |x0 i is known to be a member of a particular
basis {|xi} of N orthonormal states! If we choose
1 X
|w0 i = √ |xi (8)
N x

to be a uniform superposition of all the |xi’s then whatever the value of x0 is, we have that
hx0 |w0 i = √1N and hence we will know that the angle β is given by cos β = √1N in every
possible case! Note that for large N (the usual case of interest) |x0 i and |w0 i are nearly
orthogonal so 2β is near to π. This will typically be the case for any |wi chosen at random
in a large Hilbert space – it will tend with high probability to be nearly orthogonal to any
previously fixed state such as |x0 i.
Now, I|wi Ix0 rotating through nearly π, acts rather wildly on the space, moving vectors
through a great distance and we would prefer to have a gentler incremental motion of |w0 i
towards |x0 i. One way of doing this is to use instead, the operation (I|w0 i Ix0 )2 rotating
through 4β which is near to 2π i.e. 0 mod 2π. Since cos β = √1N we have that 4β mod
π
2π is O( √1N ). (To see this, write β = 2 − α so sin α = cos β = √1 .
N
Then 4β = 2π − 4α
and α ≈ √1N for large N ). Now the angle between |w0 i and |x0 i is nearly π/2 so we will

need O( N ) iterations of this rotation to move |w0 i near to |x0 i. A second way of dealing
with the large β problem – the way actually used in Grover’s algorithm – is to simply put a
minus sign in front of I|w0 i Ix0 ! This explains the role of the minus sign in eq. (2). Indeed by
E
lemma 3, −I|wi Ix0 = I|w⊥ i Ix0 where w0⊥ is orthogonal to |w0 i in the subspace spanned by
0 E D E
|w0 i and |x0 i and now the angle α between w0⊥ and |x0 i is given by cos α = x0 |w⊥ i.e.

sin α = hx0 |wi so α ≈ √1N . Again we will need O( N ) iterations of the rotation −Iw0 Ix0

6
through 2α to span the angle between |w0 i and |x0 i.

In conclusion, we choose the starting state |w0 i of eq. (8) and apply O( N ) times, the
operator
Q = I|w⊥ i Ixo = −I|w0 i Ix0 = −U I0 U −1 Ix0
0

where U is any unitary operation with U |0i = |w0 i (for example U = H). The significance
of the minus sign (in the context of reflection operations) is to convert a nearly orthogonal
pair of directions to a nearly parallel pair (c.f. lemma 3) . The composite structure of Q
is just to build a rotation as a product of two reflections (c.f. theorem 1) and the random
choice of U just picks a random starting state in the two dimensional subspace, which is then
moved towards |x0 i. The exact number of iterations of Q required depends on knowledge of
the angle between |x0 i and U |0i. If U |0i = |w0 i = √1N x |xi then this is explicitly known,
P

but if U is chosen more generally at random then we will not know this angle. However Q
will still generally be a small rotation through some angle of order O( √1N ) but we will not
know √ when to stop the iterations. Nevertheless the process will still move U |0i near to |x0 i
in O( N ) steps. It will fail only in the unlikely situation that the randomly chosen U |0i
happens to be exactly orthogonal to the unknown |x0 i (i.e. U has zero matrix element U0x0
as noted in [8, 9]). Q is then a rotation through an angle of zero.
Having identified W as a rotation through 2α in the plane V of |x0 i and |w0 i, where α
is defined by
1
sin α = √ (9)
N
(for the case that U |0i = |w0 i) we may readily calculate the motion of |ψ0 i = |w0 i E=
√1 ⊥
x |xi towards |x0 i by iterated application of W . In V introduce the basis {|x0 i , x0 }
P
N E
where x⊥ = √ 1 |xi. Then from eq. (9) we get
P
0 N −1 x6=x0
E
|ψ0 i = sin α |x0 i + cos α x⊥
0

If we write E
|ψn+1 i = Q |ψn i and |ψn i = sin αn |x0 i + cos αn x⊥
0

then we immediately get from the interpretation of Q as a rotation through 2α

αn+1 = αn + 2α i.e. αn = (2n + 1)α

giving the solution of the iteration derived in [10]. For a more general choice |ψ0 i = |wi of
starting state, the value of α, given by sin−1 | hx0 |wi |, will generally be unknown but the
application of W still increments the angle successively by 2α as above. The number of
iterations is chosen to make αn as close as possible to π/2.
Acknowledgement
After this note was completed it came to my attention that various other workers were
aware of the significance of double reflections for Grover’s algorithm. However it appears
not to be widely known and I present this note for its pedagogical value.

7
References
[1] Deutsch, D. and Jozsa, R. (1992) Proc. Roy. Soc. London Ser A 439, 553-558.

[2] Jozsa, R. (1998) Proc. Roy. Soc. London Ser A, 454, 323-337.

[3] Simon, D. (1994) Proc. of 35th Annual Symposium on the Foundations of Computer
Science, (IEEE Computer Society, Los Alamitos), p. 116 (Extended Abstract). Full
version of this paper appears in S. I. A. M. Journal on Computing (1997) 26, 1474-
1483.

[4] Shor, P. (1994) Proc. of 35th Annual Symposium on the Foundations of Computer
Science, (IEEE Computer Society, Los Alamitos), p. 124 (Extended Abstract). Full
version of this paper appears in S. I. A. M. Journal on Computing 26 (1997), 1484-
1510 and is also available at http://xxx.lanl.gov/quant-ph/9508027.

[5] Ekert, A. and Jozsa, R. (1998) Phil. Trans. Roy. Soc. London Ser A 356, 1769-1782.

[6] Grover, L. (1996) Proc. 28th Annual ACM Symposium on the Theory of Computing,
(ACM Press, New York), 212-219.

[7] Grover, L. (1997) Phys. Rev. Lett. 78, 325-328.

[8] Grover, L. (1997) “A Framework for Fast Quantum Algorithms”, preprint available at
http://xxx.lanl.gov/quant-ph/9711043.

[9] Grover, L. (1998) Phys. Rev. Lett. 80, 4325.

[10] Boyer, M., Brassard, G., Hoyer, P. and Tapp, A. (1996) Proc. of fourth workshop on
Physics and Computation – PhysComp’96, 36-43.

[11] Brassard, G., Hoyer, P. and Tapp, A. (1998) “Quantum Counting”, preprint available
at http://xxx.lanl.gov/quant-ph/9805082.

[12] Bennett, C. H., Bernstein, E., Brassard, G. and Vazirani, U. (1997) SIAM Journal on
Computing, 26, 1510-1523.

[13] Kitaev, A. (1995) Quantum Measurements and the Abelian Stabiliser Problem,
preprint available at http://xxx.lanl.gov/quant-ph/9511026.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy