Phase Matching in Grover's Algorithm
Phase Matching in Grover's Algorithm
www.elsevier.com/locate/pla
Received 29 October 2006; received in revised form 4 February 2007; accepted 5 February 2007
Available online 13 February 2007
Communicated by P.R. Holland
Abstract
When the Grover’s algorithm is applied to search an unordered database, the probability of getting correct results usually decreases with the
increase of marked items. The reason for this phenomenon is analyzed in this Letter, the Grover iteration is studied, and a new phase matching is
proposed. With application of the new phase matching, when the fraction of marked items is greater than 1/3, the probability of getting correct
results is greater than 25/27 with only one Grover iteration. The validity of the new phase matching is verified by a search example.
© 2007 Elsevier B.V. All rights reserved.
propose a new phase matching with the higher success proba- 2.2. The success probability of Grover’s algorithm
bility. Section 4 gives an example to verify the validity of new
phase matching. Section 5 summarizes the whole Letter. In fact, the Grover iteration can be regarded as a rotation in
the two-dimensional space spanned by the starting vector |φ
2. Grover’s algorithm and its problem and the state consisting of a uniform superposition of solutions
to the search problem. Let |α represent a normalized states of
2.1. Grover’s algorithm summary a sum over all x which are not solutions to the search problem,
and |β represent a normalized states of a sum over all x which
Suppose we wish to search through a search space of N ele- are solutions to the search problem. Simple algebra shows that
ments. Rather than search the elements directly, we concentrate the initial state |φ may be re-expresses as
on the index to those elements, which is just a number in range
0 to N − 1. For convenience we assume N = 2n , so the index
can be stored in n bits, and that the search problem has exactly |φ = cos(t)|α + sin(t)|β (5)
M solutions, with 1 M N . √
where t = arcsin λ. After R Grover iteration, the initial state
The algorithm begins with the state |0⊗n . The Walsh–
is taken to
Hadamard transform is used to put the state |0⊗n in the equal
superposition state, √
GR |φ = cos (2R + 1) arcsin λ |α
N −1
1 √
|φ = |x. (1) + sin (2R + 1) arcsin λ |β. (6)
N 1/2
x=0
The Grover quantum search algorithm then consists of re- Hence, the success probability is
peated application of a quantum subroutine, known as the √
Grover iteration or Grover operator, which we denote G. The P = sin2 (2R + 1) arcsin λ . (7)
Grover iteration may be broken up into four steps:
The curve of P is shown in Fig. 1.
(1) Apply the oracle O. The oracle is a unitary operator defined
by its action on the computational basis 2.3. The drawback of Grover’s algorithm
|x|q → |xq ⊕ f (x)
O
(2)
It is easy to deduce from Eqs. (4) and (7) that Pλ=0.14645 =
where |x is the index register, ⊕ denotes addition mod- 0.85356, Pλ=0.25 = 1.00, Pλ=0.50 = 0.50, and when λ ∈
ulo 2, and the oracle qubit |q is a single qubit which is (0.14645, 0.50), R = 1. Namely, when λ = 0.25, Pλ is maxi-
flipped if f (x) = 1, and is unchanged otherwise. mum; when λ > 0.25, Pλ decreases rapidly; when λ = 0.5, Pλ
(2) Applying the Walsh–Hadamard transform H ⊗n . is minimum; when λ > 0.5, there is R = 0, Pλ = λ, and the al-
(3) Perform a conditional phase shift, with every computa- gorithm is disabled. Hence, the Grover’s algorithm is no longer
tional basis state except |0 receiving a phase shift of useful when λ > 0.25.
−1, |x → −(−1)δx0 |x. The reason for the problem is that the two phase rotations
(4) Applying the Walsh–Hadamard transform H ⊗n . in Grover iteration are fully equivalent in both amplitude and
direction, namely π . According to Ref. [10], the result of such
It is useful to note that the combined effect of steps 2, 3, and phase rotations is that, for the
√ one Grover iteration, the phase
4 is of the |φ increases 2 arcsin λ radian. When 0 < λ 0.25, the
|φ will gradually approach to the |β, and when λ > 0.25, the
H ⊗n 2|00| − I H ⊗n = 2|φφ| − I (3)
|φ will rapidly keep away from the |β.
where |φ is the equally weighted superposition of states, (1).
Thus the Grover iteration, G, may be written as G = (2|φφ| −
I )O.
Let λ = M/N , and let CI(x) denote the integer closest to
the real number x, where by convention we round halves down.
Then repeating the Grover iteration
√
arccos λ
R = CI √ (4)
2 arcsin λ
√
times rotates |φ to within an angle arcsin λ π/4 of a su-
perposition state of marked states [10]. Observation of the state
in the computational basis then yields a solution to the search
problem with probability at least one-half. Fig. 1. The success probability curve of Grover’s algorithm.
44 P. Li, S. Li / Physics Letters A 366 (2007) 42–46
3. The new phase matching for Grover’s algorithm Proof. Suppose U = I − (1 − eiα ) M m=1 |τm τm |, for |φ de-
scribed by Eq. (1), applying U to |φ gives
3.1. The new phase matching
N−M−1
1 eiα
M−1
The two phase shift operators in the Grover’s algorithm may |φ̂ = U |φ = √ |xj + √ |xk . (10)
j =0
N k=0
N
be generally expressed as follow
Applying Eq. (9), Eq. (3) is re-expressed as follow
M
I − 1−e iα
|τm τm |, (8)
m=1
1 − eiβ |φφ| + eiβ I. (11)
1 − eiβ |00| + eiβ I. (9) Applying Eq. (11) to Eq. (10) and using some algebra gives
In the Grover’s original algorithm, there is θ = ϕ = π . Ac-
cording to the postulates of quantum mechanics [7], the evo- |φ̃ = 1 − eiβ |φφ| + eiβ I |φ̂
lution of a closed quantum system is described by a unitary 1
N−M−1
iα
transformation. So as far as the unitarity of operators described = √ M e + eiβ − ei(α+β) + N − M |j
by Eqs. (8) and (9) is concerned, we have the following conclu- N N j =0
sions.
M
+ (N − M) ei(α+β) − eiβ + 1 + Meiα |k . (12)
Theorem 1. The operators described by Eqs. (8) and (9) are k=0
unitary.
Let p = (N − M)(ei(α+β) − eiβ + 1) + Meiα , the success
Proof. Let probability P is equal to M|p|2 . Using some simple algebra
gives
M
U = I − 1 − eiα |τm τm |, P = −4λ3 + 6λ2 − 2λ (cos α + cos β)
m=1
+ 2λ3 − 2λ2 cos(α − β)
M
U + = I − 1 − e−iα |τm τm |,
+ 2λ(1 − λ)2 cos(α + β) + 3λ(1 − λ)2 + λ3 (13)
m=1
M when α = −β = π/2,
U + U = I − 2 − eiα − e−iα |τm τm |
m=1 P̃ = Pmax = 4λ3 − 8λ2 + 5λ. (14)
2
−iα
M
Compare Eq. (14) with Eq. (7), we obtain the following con-
+ 1 − eiα 1 − e |τm τm | = I.
m=1 clusions:
Hence, the operator described by Eq. (8) is unitary. (I) when 0 < λ < 1/3, P̃ < P ;
Let (II) when λ = 1/3, P̃ = P ;
(III) when 1/3 < λ < 1, P̃ > P , and P̃1/3<λ<1 P̃λ=5/6 =
V = 1 − eiβ |00| + eiβ I,
25/27. 2
V + = 1 − e−iβ |00| + e−iβ I,
⎡1 ··· ··· 0 ⎤ According to Theorem 2, applying the new phase matching,
⎢0 ei(−β+β) ··· 0 ⎥ Eqs. (8) and (9) can be re-expressed as follow
V +V = ⎢ .
⎣ ..
.. .. ⎥ = I.
⎦
. . 0
..
M
0 . ··· ei(−β+β) I − (1 − i) |τm τm |, (15)
m=1
Hence, the operator described by Eq. (9) is unitary. 2
(1 + i)|00| − iI (16)
For the matching of α and β, the conclusion of Ref. [3] is and Eq. (11) can be re-expressed as follow
that if and only if α = β, the quantum search is feasible.
When 0 < λ 1/3, α = β is necessary. When λ > 1/3, we (1 + i)|φφ| − iI. (17)
propose a new phase matching described by Theorem 2.
On the basis of the new phase matching, the success proba-
Theorem 2. When λ > 1/3 and α = −β = π/2, the success bility curve is shown in Fig. 2.
probability P̃ 25/27 can be obtained after only one Grover It can be seen from Fig. 2 that when 1/3 < λ < 1, the new
iteration. phase matching is superior to the original ones.
P. Li, S. Li / Physics Letters A 366 (2007) 42–46 45
Table 1
The target serial numbers and marked states
k Serial numbers Marked states
0 1 |00001
1 3 |00011
2 4 |00100
3 6 |00110
4 8 |01000
5 9 |01001
6 11 |01011
7 13 |01101
8 14 |01110
9 16 |10000
Fig. 2. Comparison of success probability curves between Grover’s original
10 18 |10010
algorithm and improved ones.
11 19 |10011
12 21 |10101
13 23 |10111
14 24 |11000
15 26 |11010
16 28 |11100
17 29 |11101
18 31 |11111
Fig. 3. The sketch map of phase rotation based on the new phase matching. 4. Search example
3.2. The sketch map of phase rotation based on the new phase There are 32 students in a certain class whose serial numbers
matching are in range 0 to 31. The search targets are the students whose
3 ), where k = 0, 1, . . . , 18.
serial number satisfies n = CI( 5k+3
For the phase rotation in the Grover iteration based on the The target serial numbers and marked states are shown in Ta-
new phase matching, we present a visible geometry expression ble 1.
that is shown in Fig. 3, where O and G are the operators de- In this search, N = 32, M = 19, λ = 0.5938, using 5 qubits
fined by Eqs. (15) and (17), respectively; G̃ is the projective
√ can store all serial numbers. The initial state of the |φ is ex-
operator onthe plane spanned by |α and |β; θ = arcsin λ; pressed as follow
√
θ̃ = arcsin P̃ ; and i = −1. For each of Grover iteration, the 1
phase of |φ increases θ̃ − θ radian. The map shows the phase |φ = √ |0 + |1 + · · · + |31 .
4 2
shift in the search process based on the new phase matching.
The search process can be described as follow:
3.3. The algorithm description based on the new phase
M
For the original phase matching, as λ = 0.5938 > 0.5, the 5. Conclusion
success probability, according to Fig. 1, is Pλ = λ = 0.5938. In
fact, here, the success probability descends rapidly after apply- To increase the success probability of the Grover’s algorithm
ing one Grover iteration, which is described as follow: when the fraction of marked items is greater than 1/3, a new
phase matching is proposed, which is not the same as the con-
•
M
clusion of Ref. [3]. In this new phase matching, the amplitudes
|φ̂ = I − 2 |τm τm | |φ
of two phase shifts are equal to π/2, however, the direction of
m=1
two phase shifts is contrary. The search example shows that the
1 new phase matching is efficient.
= √ (1 − 11 − 1 − 11 − 11 − 1 − 11 − 11 − 1 − 11
4 2
− 11 − 1 − 11 − 11 − 1 − 11 − 11 − 1 − 11 − 1). References
• [1] L.K. Grover, A fast quantum mechanical algorithm for database search,
|φ̃ = 2|φφ| − I |φ̂ in: Proceedings of the 28th Annual ACM Symposium on the Theory of
Computing, Pennsylvania, 1996, pp. 212–221.
1
= √ (abab baba bbab abba babb abab [2] L.K. Grover, Phys. Rev. Lett. 80 (1998) 4329.
32 2 [3] G.L. Long, et al., Phys. Lett. A 262 (1999) 27.
[4] D. Li, et al., Phys. Lett. A 287 (2001) 304.
baba bbab) [5] D. Li, et al., Theor. Math. Phys. 144 (3) (2005) 1279.
[6] E. Biham, et al., Phys. Rev. A 60 (1999) 2472.
where a = −11; b = 5. [7] E. Biham, et al., Phys. Rev. A 66 (2002) 062301.
• The probability of finding the marked states is given as fol- [8] L.K. Grover, Phys. Rev. Lett. 95 (2005) 150501.
low [9] D. Li, et al., Phys. Lett. A 262 (2006) 27.
[10] M.A. Nielsen, I.L. Chuang, Quantum Computation and Quantum Infor-
2 mation, Cambridge Univ. Press, 2000, pp. 248–255.
5
P = 19 √ = 0.2319.
32 2