You are on page 1of 41

Generalization of Quantum Search

Algorithm

M.Sc. Project Report


submitted to
Indian Institute of Technology Bombay
in partial fulfillment of the requirements for
the degree of Master of Science in Physics

By

Debasis Sadhukhan
M.Sc. Student
Roll No.: 10512029

Under the Guidance of :


Prof. T. A. Tulsi

Department of Physics
Indian Institute of Technology Bombay
Mumbai 400076, India
April 2012
PROJECT CERTIFICATE

This is to certify that the Project work ‘Generalization of Quantum Search


Algorithm’ is done under my supervision at Department of Physics, IIT Bom-
bay by Debasis Sadhukhan (Roll No.- 10512029) in Spring Semester, 2012 has
been found satisfactory.

This report had not been submitted for any other examination and does
not form a part of any other course undergone by the candidate.

Date: ·····················
Signature
Project Supervisor
Prof. T. A. Tulsi
Department of Physics
IIT Bombay, Mumbai, India

i
Acceptance Certificate
···········································································
Department of Physics, Indian Institute of Technology Bombay

This M.Sc. project report entitled ‘Generalization of Quantum Search


Algorithm’ submitted by Debasis Sadhukhan (Roll No-10512029) may be ac-
cepted.

Date: ·····················
Signature
Project Supervisor

Date: ·····················
Signature
Examinar

Date: ·····················
Signature
Chairman

ii
Declaration

I, hereby, declare that this written submission represents my ideas in


my own words and where other ideas and words have been included; I have
adequately cited and referenced the original sources. I also declare that I
have adhered to all principles of academic honesty and integrity and have
not mispresented or fabricated or falsified any idea/data/fact/source in my
submission. I understand that any violation of the above will be cause for
disciplinary action by the institute and can also evoke penal action from
the sources which have thus not been properly cited or from whom proper
permission has not been taken when needed.

Date: ·····················
Signature
Debasis Sadhukhan
M.Sc. Student
Department of Physics
IIT Bombay, Mumbai, India

iii
Acknowledgments

At first and foremost I would like to express my sincere gratitude and


humble respect to my project guide Prof. T. A. Tulsi for his valuable guidance
and encouragement throughout my work. I am thankful to Prof. Apoorva
Patel (CQIQC, Indian Institute of Science, Bangalore) from whom I learnt
the some advanced topics of Quantum algorithms, that remains very use-
ful in this project. I want take this opportunity to thank Prof. Dipan K.
Ghosh (IIT Bombay) for his excellent instruction in the course ‘Introduction
to Quantum Information and Computing’ that remains very useful for the
entire project. It’s my pleasure to thank Dr. Aditi Sen (De) (QIC, Harish
Chandra Research Institute, Allahabad) who introduced me to the fascinat-
ing field of quantum computation and motivated me to take up this project.
I also wish to acknowledge the continuous supports of my friend Gyanendra
Singh who remains very helpful throughout my project.

iv
Abstract

Grover’s quantum search algorithm is an important landmark discovery


in the area of quantum computing. Basically, it drives a quantum computer
from a known initial state (source state) to an unknown final state (target
state) by using selective phase inversions of these states. The algorithm
is simply a successive iteration of the Grover’s search operator, which is a
product of selective inversion operators of source and target states. In this
project, we wish to generalize the concept of Grover’s search operator. In its
original form, Grover’s operator performs the selective inversions only on a
unique source state and a unique target state. In our generalized version, we
make our search operator to perform selective inversions on more than one
source and target states. First, we find that the case of selective inversions
of two source and two target states can be easily analyzed somewhat similar
to the case of Grover’s algorithm. But unlike Grover’s operator, the selective
inversions of three source and three target states is not so easy to study
analytically and hence we perform numerical calculations on some specific
cases. We find that these generalized search operators also give us a successful
quantum search as expected.

v
Contents

Declaration iii

Acknowledgments iv

Abstract v

1 Introduction and Overview 1


1.1 Quantum Algorithms . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Overview of the thesis . . . . . . . . . . . . . . . . . . . . . . 3

2 Quantum Search Algorithm 4


2.1 The Database and the Classical Search . . . . . . . . . . . . . 4
2.2 Grover’s Quantum Search Algorithm . . . . . . . . . . . . . . 5
2.2.1 Mathematical Description of Quantum Search
Problem . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2.2 The Grover’s Search Operator . . . . . . . . . . . . . . 6
2.2.3 Geometric Visualization . . . . . . . . . . . . . . . . . 7
2.2.4 Example . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.2.5 Limitation . . . . . . . . . . . . . . . . . . . . . . . . . 9

3 Generalized Quantum Search Operator: Selective Inversions


of Two States 10
3.1 Formulation of the problem . . . . . . . . . . . . . . . . . . . 10
3.1.1 Analysis with specific example . . . . . . . . . . . . . . 11
3.2 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

4 Generalized Quantum Search Operator: Selective Inversion


of Three States 17
4.1 Formulation of the problem . . . . . . . . . . . . . . . . . . . 17

vi
4.1.1 Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4.1.2 Numerical Simulation . . . . . . . . . . . . . . . . . . . 21
4.2 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.2.1 Example-1 . . . . . . . . . . . . . . . . . . . . . . . . . 22
4.2.2 Example-2 . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.2.3 Example-3 . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.2.4 Example-4 . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.3 Summery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

vii
List of Tables

4.1 Result for the 512 different values of fij . . . . . . . . . . . . . 22


4.2 Data for optimal no of iteration for different n . . . . . . . . . 25
4.3 Data for optimal no of iteration for different n for the target
state |t1 i , |t1 i and |t3 i . . . . . . . . . . . . . . . . . . . . . . . 27

viii
List of Figures

2.1 A practical demonstration for the superiority of the quantum


search over the classical search. . . . . . . . . . . . . . . . . . 5
2.2 Geometric visualization of the Grover’s operator G = −Is It . . 7
2.3 Final result after 5 Grover’s iteration. . . . . . . . . . . . . . . 8

4.1 The variation of amplitude of |t2 i with the number of iteration


for n = 16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.2 The variation of amplitude of |t1 i with the number of iteration
for n = 24 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.3 The variation of amplitude of target |t1 i with the number of
iteration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.4 n vs. log2 p plot . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.5 The variation of amplitude of |t1 i with the number of iteration
for n = 16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.6 The variation of amplitude of |t2 i with the number of iteration
for n = 16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.7 The variation of amplitude of target states with the number
of iteration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.8 The variation of amplitude of target state with the number of
iteration for n = 16 . . . . . . . . . . . . . . . . . . . . . . . . 29

ix
Chapter 1

Introduction and Overview

Quantum computation is a new paradigm created by reformulating infor-


mation and computation in a quantum mechanical framework. One of the
main motivation in the pursuit for quantum computation is the promising
possibility that quantum algorithm can be more efficient than their classical
counterpart. Quantum mechanics provides us useful computational resources
that can be used to accelerate classical algorithms. Problems, that are con-
sidered to be hard to solve in a classical computer, can be solved efficiently
with a polynomial or exponential quantum speed-up with the help of quan-
tum computation.

1.1 Quantum Algorithms

An algorithm is a well-defined procedure or a set of instructions to per-


form a information processing task and a computer is a physical device that
helps in information processing. A computer requires a physical system that
consists of some initial state, some final state, and some interaction in be-
tween, to execute an information processing task. Here, the initial state is
the input, the final state is the output and interaction represents the appro-
priate logic operations to execute the algorithm[1].

Development in theoretical computer science are mostly based on the


“particle-like” discrete digital framework. The prediction of Moore’s law[2]

1
and the shirking size of the elementary components in a chip suggests us that
the computer technology will inevitably encounter the dynamics of atomic
scale[3, 4]. We must apply the laws of quantum mechanics to analyze the
computational framework because quantum objects are both “particle-like”
and “wave-like”. Here, the superposition principle allows not only the dis-
crete eigenstates that forms the Hilbert space basis, but also the simultaneous
existence of multiple components. And that is where the advantage quantum
algorithm lies.

A quantum algorithm is nothing but an algorithm that uses quantum me-


chanical principles at the time of its execution1 . The superiority of quantum
algorithm lies in the parallelism, gained from the superposition of quantum
states. This allows a quantum algorithm to exploit an exponentially large
number of quantum components using only polynomial resources. For ex-
ample, a uniform superposition of 2n quantum components can be created
using only n qubits and n rotations.
 ⊗n n −1
2X
⊗n |0i + |1i −n/2
|0i −→ √ =2 |ii (1.1)
2 i=0

So, a single execution of a quantum algorithm can take 2n superposed in-


puts to 2n superposed outputs and that is how a single quantum instruction
applied to a superposed state processes all the quantum components together,
resulting in a exponential advantage over the classical algorithms. In recent
years, a lot of research effort has been given to discover quantum solution
of those problems whose classical solution is in class NP (non-deterministic
polynomial), while the quantum solution would be in class P (polynomial).

But since our intuition lies in the classical world, it is hard to design a
quantum algorithm. Also, one need to make sure that the new algorithm
must be more efficient than the existing classical ones2 . That is why so less
number of quantum algorithms has been discovered so far.

As of now there are only two main class of quantum algorithm. One is
1
Note that, execution of a quantum algorithm requires a quantum computer.
2
The full exponential advantage provided by the quantum superposition can not be
always used to make the quantum solution to be exponentially faster than the classical
one.

2
Shor’s algorithm for factoring large integers[5], based on an exponentially
faster quantum Fourier transform to the period finding problem. And the
other is Grover’s algorithm for searching an object in an unsorted database[6],
which provides a quadratic speed-up.

1.2 Overview of the thesis

In this thesis, we have studied further generalization of Grover’s search


algorithm. Grover’s quantum search algorithm is an important landmark
discovery in the area of quantum computing. Basically, it drives a quantum
computer from a known initial state (source state) to an unknown final state
(target state) by using selective phase inversions of these states. The algo-
rithm is simply a successive iteration of the Grover’s search operator, which
is a product of selective inversion operators of source and target states. In
this project, we wish to generalize the concept of Grover’s search operator.
In its original form, Grover’s operator performs the selective inversions only
on a unique source state and a unique target state. In our generalized ver-
sion, we make our search operator to perform selective inversions on more
than one source and target states. First, we find that the case of selective
inversions of two source and two target states can be easily analyzed some-
what similar to the case of Grover’s algorithm. But unlike Grover’s operator,
the selective inversions of three source and three target states is not so easy
to study analytically and hence we perform numerical calculations on some
specific cases. We find that these generalized search operators also give us a
successful quantum search as expected.

3
Chapter 2

Quantum Search Algorithm

The problem of database search is to find an item with the desired prop-
erties from the collection. A search operator needs a oracle like that search
for a specific items with the desired properties by checking every items with
desired items in the database. An efficient search process is the one which
can locate the desired item in the database using the least application of
oracles.

2.1 The Database and the Classical Search

A database is nothing but a collection of items. Suppose we have a


database consists of N words. Now, we want to search for a specific word
say “Computation”. To do that we have to go through every word and check
whether this is “Computation” or not. To solve this problem, a classical
computer would need N/2 database queries on average, and in the worst
case it would need N − 1 queries. Now, if the word Computation occurs M
N
times, then it is easy to show that we require O( M ) trial to succeed with
classical algorithm because any randomly chosen word will be Computation
with the probability M/N . For M = 1, we require O(N ) trial to succeed.

4
2.2 Grover’s Quantum Search Algorithm

Now, is it possible to improve the search algorithm? In the classical


search we have an implicit assumption that we can search only one item at a
time. But, we can overcome this limitation if we use quantum dynamics. In
a quantum algorithm one can inspect many (even all) items in a quarry if we
work with a superposition of states. Lov Grover first uses this superposition
feature of quantum dynamics and discovered the optimal quantum search
algorithm[6], which is quadratically faster that the classical search.

Figure 2.1: A practical demonstration for the superiority of the quantum


search over the classical search.

2.2.1 Mathematical Description of Quantum Search


Problem
The database is a set of N (= 2n ) items labeled by an index j. The
database contains M solutions, where 1 ≤ M ≤ N . From now and onwards

5
we will call our solution to be target(t). Now, we define a binary function
f (i), such that,

f (i) = 1 f or i=t
=0 f or i 6= t (2.1)

Now, assume that we have a quantum oracle1 that will do the operation,
specified by the function f (i).

Uf : |ii |qi → |ii |q ⊕ f (i)i (2.2)

where, |ii is the index register, ⊕ denotes addition modulo 2, |qi is the
ancilla qubit, which is flipped if f (i) = 1 and is unchanged otherwise.

Notice that, if we construct |qi such that |qif lipped = − |qi, then when
f (i) = 1, we can write |qi = (−1)f (i) |qi. An example of such |qi will be
|0i−|1i

2
. The action of the oracle is then:

|0i − |1i |0i − |1i


Uf : |ii √ = (−1)f (i) |ii √ (2.3)
2 2
Notice the ancilla bits remains unchanged. So, we can drop that part.
So, the oracle may be written as:

Uf : |ii = (−1)f (i) |ii (2.4)

2.2.2 The Grover’s Search Operator


Consider a quantum system with an N-dimensional Hilbert space, whose
basis states |ji , j  0, 1, · · · , N − 1, encode the N items. The target state
|ji corresponds to the target item, while all other basis states are non-target
states.To demonstrate the above operation, we begin our initial state with
the uniform superposition of all states.
2 −1n
1 X
|ψi = |ji (2.5)
2n/2 j=0

1
Oracle is a black box that will perform some operation, but we don’t know it’s internal
hardware working principal.

6
So, one can write the uniform superposition to be,
N −1
r r
1 X M N −M
|ψi = √ |ji = |ti + |t⊥ i (2.6)
N j=0 N N

We will now define a unitary operator G = −Is It , such that,

It : 1 − 2 |ti ht| (2.7)


Is : 1 − 2 |si hs| (2.8)

2.2.3 Geometric Visualization


Let us start with the uniform superposition of all the n qubit states i.e.
|si. We will describe our two dimensional sub-space in terms of two orthog-
onal basis out of which one is parallel to |ti and the other is perpendicular
to |ti i.e. along |t⊥ i.

Figure 2.2: Geometric visualization of the Grover’s operator G = −Is It .

Let us assume |si makes angle θ with |t⊥ i. After operation of It , the
component of |si along |ti get flipped. So, It |si makes an angle 2θ with |si.
Now, (−Is ) will flip the component perpendicular to |si. So, (−Is It ) |si will
now make an angle 3θ with |t⊥ i.

So, in one iteration we move an angle 2θ towards our desired state |ti.

7
Let’a say, after m iteration we will get our solution |ti, so
π
m(2θ) = − θ
2
π 1
So, m= − (2.9)
4θ 2
q
Now, from figure 2.2, we can see that , cos( π2 − θ) = sin θ = hs| ti = N1 for
q
one solution and M N
for M solution. In general, N is very large compared
to M . So, we can assume that sin θ ≈ θ. Thus, no of iteration required is :
1 r N 
m=O =O (2.10)
θ M

2.2.4 Example
With a database of total√ 49 items and 1 target item, number of Grover’s
iteration required = π4 ∗ 49 − 21 = 4.9977 ≈ 5. So, after 5 iteration we will

Figure 2.3: Final result after 5 Grover’s iteration.

get the target state with almost 100% probability.

8
2.2.5 Limitation

For a problem with database size N and M target state,we have seen that
we get a quadratic speed
qupover the classical counterpart using the quantum
N
search i.e. we need O M
trials. Notice that if we do not know the exact
number of solutions i.e. M , we may may not reach to our desired solution
state as no of iteration explicitly depend on M . To overcome this problem,
we first need to estimate the no of solution in our database. By combining
the phase estimation technique with the Grover’s algorithm we can count the
no of solution state in our database. By estimating the the eigenvalues of
the Grover’s iteration G, we can determine the no of solution M.

It is easy to see that the result depends only on | ht| si | and not on ht| si.
The phases of various components of |si can therefore be arbitrary[1]. The
quantum algorithm for searching an unsorted database does not assume any
specific structure or pattern as far as the input data are concerned. This
makes it highly versatile with broad utility. The algorithm can be applied,
either in full or in part, in the quantum solutions of a variety of problems
such as square-root speed-up of solutions to NP-complete problems, finding
mean and median of statistical distributions, locating minimum of a function,
quantum counting, deciphering cryptographic codes, etc[7].

9
Chapter 3

Generalized Quantum Search


Operator: Selective Inversions
of Two States

3.1 Formulation of the problem

Grover’s search operator has been generalized in several ways ( see [8]
and references therein). In this chapter, we generalize it to the case when
the search operator involves the selective phase inversions of two source states
and two target states. Mathematically, the search operator discussed in this
chapter is,

G2 = −Is1 ,s2 It1 ,t2 (3.1)

where,

Is1 ,s2 = 1 − 2 |s1 i hs1 | − 2 |s2 i hs2 |


It1 ,t2 = 1 − 2 |t1 i ht1 | − 2 |t2 i ht2 | (3.2)
Here, |t1 i , |t2 i are the basis states of the Hilbert space of dimension N,
where N is taken to be 2n . |s1 i , |s2 i are the superposition of all the possible
state in the search space. We can generate the source state with the Walsh-
Hadamard transform on any possible state1 in the 2n dimensional Hilbert
1
that corresponds to a particular item in the search space

10
space.

So,

|s1 i = W |j1 i = H ⊗n |j1 i ; (3.3)


|s2 i = W |j2 i = H ⊗n |j2 i ; (3.4)

Since, |t1 i, |t2 i and |j1 i, |j2 i are the basis states of our N dimensional
Hilbert space, we can say, by the property of Walsh-Hadamard transform
1
hsi | tj i = (−1)fij √ (3.5)
N
where fij is either 0 or 1 and i, j runs from 1 to 2.

In this chapter, for simplicity we have removed the subscript G2 and used
G instead of G2 .

3.1.1 Analysis with specific example


Let us take a specific example with f11 = f12 = f21 = 0 and f22 = 1. So,
1 1 1 1
hs1 | t1 i = √ , hs1 | t2 i = √ , hs2 | t1 i = √ , hs2 | t2 i = − √ , (3.6)
N N N N
Since, the operator (G = −Is It ) involves only |s1 i , |s2 i , |t1 i and |t2 i, we
can predict that this operator must preserves at most a 4 dimensional
subspace. First, we need construct a four dimensional orthonormal basis to
analyze the operation of the generalized Grover’s operator for two source state
and two target state. So, we want to write the operator G in the 4 dimen-
sional subspace confined by the orthonormal basis vectors |t⊥1 i , |t⊥2 i , |t1 i
and |t2 i .

First, we define,
1 
|s01 i = √ |s1 i + |s2 i

2
1 
|s02 i = √ |s1 i − |s2 i

(3.7)
2

11
q q
So, ht1 | s01 i = 2
N
and ht2 | s02 i = 2
N
.

To make |t⊥1 i and |t⊥2 i to be perpendicular to |t1 i and |t2 i respectively,


we have taken |t⊥1 i and |t⊥2 i to be,
q
|s01 i − N2 |t1 i
|t⊥1 i = q (3.8)
2
1− N
q
|s02 i − N2 |t2 i
|t⊥2 i = q (3.9)
2
1− N

So, |t⊥1 i, |t⊥2 i along with |t1 i and |t2 i forms a orthonormal basis.

Now, since |t⊥1 i is perpendicular to |t1 i and |t2 i , It1 ,t2 can not make any
change when applied on |t⊥1 i. So,
 r 
1 0 2
Is1 ,s2 It1 ,t2 |t⊥1 i = Is1 ,s2 q |s1 i − |t1 i
1 − N2 N
 r r r r r 
1 0 2 2 1 2 1
=q − |s1 i − |t1 i + 2 |s1 i + +2 |s2 i
1− N 2 N N N N N
 r 
1 4 
0 2
=q − 1 |s1 i − |t1 i (3.10)
1− 2 N N
N

We can now find out all the matrix element of the Grover’s operator G,
in the orthonormal subspace, So,
G11 = ht⊥1 | Is1 ,s2 It1 ,t2 |t⊥1 i
1

4  2 4 r 2 r 2 2

= −1 − − −1 +
1 − N2 N N N N N N
4
= −1
N
Similarly, it is very easy to show that,
G21 = ht⊥2 | Is1 ,s2 It1 ,t2 |t⊥1 i = 0 and G41 = ht2 | Is1 ,s2 It1 ,t2 |t⊥1 i = 0.

12
Also,

G31 = ht1 | Is1 ,s2 It1 ,t2 |t⊥1 i


1

4 r 2 r 
2
=q −1 −
1 − N2 N N N
r r
2 2
= −2 1−
N N
Similarly,

 r
1 2
Is1 ,s2 It1 ,t2 |t⊥2 i = Is1 ,s2 q − |s02 i
|t2 i
1 − N2 N
 r 
1 4 
0 2
=q − 1 |s2 i − |t2 i (3.11)
1− 2 N N
N

So, G12 = ht⊥1 | Is1 ,s2 It1 ,t2 |t⊥2 i = 0 and G32 = ht1 | Is1 ,s2 It1 ,t2 |t⊥2 i = 0.
Now, similarly one can show that,
4
G22 = ht⊥2 | Is1 ,s2 It1 ,t2 |t⊥2 i = − 1,
Nr r
2 2
& G42 = ht2 | Is1 ,s2 It1 ,t2 |t⊥2 i = −2 1−
N N
Also,
h i
Is1 ,s2 It1 ,t2 |t1 i = Is1 ,s2 − |t1 i
r
h 2 0 i
= − |t1 i − 2 |s i (3.12)
N 1
So,
r r
2 2
G13 = ht⊥1 | Is1 ,s2 It1 ,t2 |t1 i = 2 1− ;
N N
4
& G33 = ht1 | Is1 ,s2 It1 ,t2 |t1 i = −1
N

13
Also,

G23 = ht⊥1 | Is1 ,s2 It1 ,t2 |t2 i = 0; & G43 = ht1 | Is1 ,s2 It1 ,t2 |t2 i = 0

qSimilarly,
q it is easy to show that G14 = G34 = 0 and G24 = −G42 =
2 N 1 − N & G44 = N4 − 1.
2 2

Now, the total matrix G in the new basis can be written as,
 q q 
−1 + N4 0 2 N2 1 − N2 0
 q q 
0 −1 + N4 0 2 N2 1 − 2

 N
G≡ q q 
−2 N2 1 − N2 0 −1 + N4 0
 

 q q 
0 −2 N2 1 − N2 0 −1 + N4
(3.13)

Now, since actually G = (−Is1 ,s2 It1 ,t2 ), we should write, considering the phase
factors
 q q 
4 2 2
1− N 0 −2 N 1 − N 0
 q q 
0 1 − N4 0 −2 N2 1 − N2 
 

G≡ q q 
2 2 4
2 N 1 − N 0 1− N 0
 

 q q 
0 2 N2 1 − N2 0 1 − N4
(3.14)
Which is equivalent to
 
cos θ 0 − sin θ 0
 0 cos θ 0 − sin θ
G≡  sin θ
 (3.15)
0 cos θ 0 
0 sin θ 0 cos θ
q q
−1 −1
where, θ = cos (1 − N ) = sin (2 N2 1 − N2 ). Generally, N is very large,
4

so θ will be very small, for these case. The eigenvalues for this matrix G will
be e±iθ , e±iθ . So, we have got only one θ, instead of θ1 and θ2 2 . That means
2
Our expected eigenvalues was e±θ1 and e±θ2

14
the iteration is same in both the |t⊥1 i − |t1 i and |t⊥2 i − |t2 i search space.

Now, we can see that the matrix G can be analyzed by the two disjoint
matrices while the first matrix belongs to |t1 i − |t⊥1 i search space and the
other belongs to |t2 i − |t⊥2 i search space.

So, for the |t⊥1 i − |t1 i search space and |t⊥2 i − |t2 i search space, we have
G1 and G2 respectively,
   
cos θ − sin θ cos θ − sin θ
G1 ≡ ; G2 ≡ (3.16)
sin θ cos θ sin θ cos θ

Result
Notice that, for these case we can effectively reduce the search problem with
two initial state and two target state, to two identical canonical Grover’s
search problem with one initial state[6, 7]. Similarly, for other combinations
of hsi | tj i(except all positive or all negative), one can use a similar treatment
and can effectively reduce the problem with two Grover’s search problem[6].

Analysis for all hsi | tj i to be positive or negative:

For all the hsi | tj i to be positive or negative, we have,


r
1
hs1 | t1 i = hs1 | t2 i = hs2 | t1 i = hs2 | t2 i = (3.17)
N
We choose,
1  
|s+ i = √ |s1 i + |s2 i (3.18)
2
1  
|s− i = √ |s1 i − |s2 i (3.19)
2
(3.20)
Now, one can see that |s− i is perpendicular to both |t1 i & |t2 i. Since |s− i
is perpendicular to |t1 i , |t2 i , |s+ i, the search operator does not induce any
coupling between these states and |s− i. Then the search problem effec-
tively reduces to the conventional Grover’s search problem where we have
one unique source states |s+ i and multiple target sates |t1 i and |t2 i

15
3.2 Summary
In the analysis of the above mentioned search problem with two source
state, our result can be classified in two main category:
1. For any arbitrary combination of hsi | tj i(except all positive or all nega-
tive), we can reduce the problem into two Grover’s search problem in two
different subspace, confined by |t⊥1 i − |t1 i and |t⊥2 i − |t2 i.
2. If all the hsi | tj i are positive or negative, then the problem is nothing but
a Grover’s search problem which can be analyzed in conventional |t⊥ i − |ti
basis.

But, we have checked with numerical simulation, that if we have two


source state but more than two target state, we may get two different θ,
depending upon the situation.

16
Chapter 4

Generalized Quantum Search


Operator: Selective Inversion
of Three States

4.1 Formulation of the problem

Similar to the last case, here also, we assume each source state to be
N (= 2n ) dimensional in the 2n dimensional Hilbert space. Firstly, we are
interested in finding out the dimension of the subspace that is preserved
under the new generalized Grover’s iteration G3 for the three source states
and three target states.

Let us first take three source state to be |s1 i , |s2 i and |s3 i, that can be
generated by a similar treatment as presented in equation 3.4.

|s1 i = W |j1 i = H ⊗n |j1 i ; (4.1)


|s2 i = W |j2 i = H ⊗n |j2 i ; (4.2)
|s3 i = W |j3 i = H ⊗n |j3 i (4.3)

|t1 i, |t2 i , |t3 i and |j1 i, |j2 i , |j3 i are the basis states of our N dimensional
Hilbert space. Since the source states are the Walsh-Hadamard transform of

17
the elements of the search space, we must have,
1
hsi | tj i = (−1)fij √ (4.4)
N
where fij is either 0 or 1 and i, j runs from 1 to 3.

Similar to the previous case, we have defined the search operator to be

Is1 ,s2 ,s3 = 1 − 2 |s1 i hs1 | − 2 |s2 i hs2 | − 2 |s2 i hs3 |


It1 ,t2 ,t3 = 1 − 2 |t1 i ht1 | − 2 |t2 i ht2 | − 2 |t3 i ht3 | (4.5)
& G3 = Is1 ,s2 ,s3 It1 ,t2 ,t3
(4.6)

Since G3 involves 3 source state and 3 target state, we can intuitively say
that the search operator G3 must confined to at most 6 dimensional vector
space.

In this chapter, for simplicity we have removed the subscript G3 and used
G instead of G3 .

4.1.1 Analysis

To find out the dimension of the subspace to be conserved under the


generalized Grover’s iteration, we have simulated the search operation nu-
merically with n = 5, i.e. in a 32 dimensional vector space. We can write
the generalized Grover’s operator to be,
    
G = W Ij1 ,j2 ,j3 W It1 ,t2 ,t3 (4.7)

Here, W represent the Walsh-Hadamard transform and j1 , j2 , j3 are the wave


functions corresponding to 3 different components of the search space. [Refer
equation 3.4]

After constructing the matrix G numerically, we search out the eigenval-


ues of G. After considering different values of j1 , j2 , j3 and t1 , t2 , t3 randomly,

18
we found that we can have at most 3 pairs of different eigenvalues in the eiθ
form and all the other eigenvalues are one. So, we can conclude that the
generalized search operator preserves at most a 6 dimensional vector space.
So, we can write G in a 6 dimensional vector space.

Similar to the previous case, we need to find the generalized search


operator G for 3 source states in a orthonormal basis constructed from
|s1 i , |s2 i , |s3 i and |t1 i , |t2 i , |t3 i. Now, in this case, it is very difficult to
find orthonormal vectors in a similar manner like the previous case. So, we
have used the Gram-Schmidt orthogonalization to construct a orthonormal
basis from |s1 i , |s2 i & |s3 i. Notice that,hsi | tj i = htj | si i = (−1)fij √1N .
So,

|s01 i = |s1 i − ht1 | s1 i |t1 i − ht2 | s1 i |t2 i − ht3 | s1 i |t3 i


(−1)f11 (−1)f12 (−1)f13
= |s1 i − √ |t1 i − √ |t2 i − √ |t3 i (4.8)
N N N

Since, hs01 | s01 i = 1 − 3


N
, we define the first basis to be

1 h (−1)f11 (−1)f12 (−1)f13 i


|t⊥1 i = q |s1 i − √ |t1 i − √ |t2 i − √ |t3 i (4.9)
1− 3 N N N
N

Now, for the second basis, we find

|s02 i = |s2 i − ht1 | s2 i |t1 i − ht2 | s2 i |t2 i − ht3 | s2 i |t3 i − ht⊥1 | s2 i |t⊥1 i
(−1)f21 (−1)f22 (−1)f23
= |s2 i − √ |t1 i − √ |t2 i − √ |t3 i
N N N
1 h i
+ q (−1)f11 +f21 + (−1)f12 +f22 + (−1)f13 +f23 |t⊥1 i
N 1 − N3
(4.10)
h i2
Now, hs02 | s02 i = 1− N3 1
− N 2 (1− 3
)
(−1)f11 +f21
+(−1) f12 +f22
+(−1)f13 +f23
=
N
2
a (say).

19
So, the second orthonormal basis will be,
"
1 (−1)f21 (−1)f22 (−1)f23
|t⊥2 i = |s2 i − √ |t1 i − √ |t2 i − √ |t3 i
a N N N
#
1 h i
+ q (−1)f11 +f21 + (−1)f12 +f22 + (−1)f13 +f23 |t⊥1 i (4.11)
3
N 1− N

Similarly, the third basis can be constructed as ,

|s03 i = |s3 i − ht1 | s3 i |t1 i − ht2 | s3 i |t2 i − ht3 | s3 i |t3 i − ht⊥1 | s3 i |t⊥1 i − ht⊥2 | s3 i |t⊥2 i

So, the third orthonormal basis will be


"
1 (−1)f31 (−1)f32 (−1)f33
|t⊥3 i = |s3 i − √ |t1 i − √ |t2 i − √ |t3 i
b N N N
1 h i
+ q (−1)f11 +f31 + (−1)f12 +f32 + (−1)f13 +f33 |t⊥1 i
N 1 − N3
1 h 1
(−1)f21 +f31 + (−1)f22 +f32 + (−1)f23 +f33 + (−1)f11 +f31

+ 3
aN N (1 − N )
#
i
+ (−1)f12 +f32 + (−1)f13 +f33 (−1)f11 +f21 + (−1)f12 +f22 + (−1)f13 +f23 |t⊥2 i
 

(4.12)
p
where b = ht⊥3 | t⊥3 i

Now, we want to find out the generalized grover operator G in the new
basis, constructed by |t⊥1 i , |t⊥2 i , |t⊥3 i and |t1 i , |t2 i , |t3 i. For, this we first
need to write the initial states |s1 i , |s2 i , |s3 i in the new orthonormal basis
and then we will find out the unitary form of the matrix G in the new or-
thonormal basis using equation 4.5.
h iT
So, the initial states in |t⊥1 i |t⊥2 i |t⊥3 i |t1 i |t2 i |t3 i basis
will be,

20
q   h i
3 1 f11 +f21 f12 +f22 f13 +f23
1− N − √ (−1) + (−1) + (−1)
   N 2 −3N 

 0 


 a 

 0   0 
|s1 i =  (−1)f11  ; |s i = 
   f

(−1) 21
 √N  2 √

N
 
 (−1)f12   (−1) f22 
 √   √ 
 N   N 
f
(−1)f13 (−1) 23


N N
(4.13)

and
 h i
− √N 21−3N (−1)f11 +f31 + (−1)f12 +f32 + (−1)f13 +f33
 

 c 

 b 
|s3 i =  (4.14)
 f

(−1) 31


N
 
(−1)f32
 
 √ 
 N 
f
(−1) 33

N

where,

1 h
c=− (−1)f21 +f31 + (−1)f22 +f32 + (−1)f23 +f33
aN
N
(−1)f11 +f31 + (−1)f12 +f32 + (−1)f13 +f33
 
+ 2
(N − 3N )
i
(−1)f11 +f21 + (−1)f12 +f22 + (−1)f13 +f23


4.1.2 Numerical Simulation

Our goal is to construct the matrix G using equation 4.5, 4.13 and 4.14.
But, it is very laborious to construct and analyze the generalized operator G
analytically for all the possible values of fij . That is why we have simulated

21
the matrix numerically for all the possible values of fij .

Since i, j runs from 1 to 3, there will be a total of 9 different fij and each
fij can have only two possible values i.e. 0 and 1. So, there will be a total
of 29 = 512 cases for different values of fij . For all the 512 cases we have
simulated the matrix G and found out the eigenvalues for each cases. We
found that,

Table 4.1: Result for the 512 different values of fij

Case type Eigenvalue form No. of cases


3 different θ e±iθ1 , e±iθ2 , e±iθ3 284
2 different θ 2 pairs of e±iθ1 , e±iθ2 228
1θ 3 pairs of e±iθ1 0

We also found out the eigenvectors for each cases.

4.2 Example

For the next part, we want to find out the no of iteration needed to search
out the target states with a significantly large probability. For that, we took
some specific examples and analyze the results.

4.2.1 Example-1

For the first example, we have chosen, f11 = 1, f12 = 0, f13 = 1, f21 =
0, f22 = 1, f23 = 0, f31 = 1, f32 = 0, f33 = 1. For this combination, we found
out that there will be 2 pairs of different eigenvalues of the matrix G, out of
them 4 are same(1, i.e. e0 ) and the other pair is (e±.023 ).

Now we have taken n = 16 i.e. the search space is 216 = 65536 dimen-
sional. We applied the search operator on the source states and want to find
out the variation of the amplitude of the target states with the number of

22
iteration. The plot of the amplitude of the target state |t2 i with the number
of iteration is shown in Figure 4.1.

Figure 4.1: The variation of amplitude of |t2 i with the number of iteration
for n = 16

So, we can see from Figure 4.1 that the amplitude is maximum(0.5774)
near the 67th iteration. Also, for target state |t1 i and |t3 i the result is exactly
same to the Figure 4.1. So, if we started with three source state, we will be
able to find out the target states with a probability of 0.57742 = 31 .

Next, we repeat the problem with n = 24 i.e. N = 16777216. Plotting


the amplitude of the target state |t1 i with the number of iteration, we got
Figure 4.2.

We found the maximum amplitude is 0.5774 and it is near to 1072th it-


eration. Here also for |t2 i and |t3 i, we got the same figure.

Now for n = 28 i.e. N = 228 and for n = 32 i.e. N = 232 we got Figure
4.3a and Figure 4.3b , respectively. For n = 28, we found the maximum am-
plitude(0.5774) at 4289th iteration where as for n = 32 we got the maximum

23
Figure 4.2: The variation of amplitude of |t1 i with the number of iteration
for n = 24

(a) n = 28 (b) n = 32

Figure 4.3: The variation of amplitude of target |t1 i with the number of
iteration.

24
amplitude(0.5774) near about 17000th iteration.

Notice that the maximum amplitude does not vary with the variation of
n. So, the maximum amplitude that we got after optimal iterations does not
depend on the dimension of the search space.

In the Table 4.2, we have listed the optimal no of iteration for different
n.

Table 4.2: Data for optimal no of iteration for different n

n Optimal no of iteration(p) log2 (p)


12 17 4.087
16 67 6.066
20 268 8.066
24 1072 10.066
28 4289 12.066

Now, if we plot n vs. log2 p, we got a straight line shown in Fig 4.4.

Figure 4.4: n vs. log2 p plot

25
From the plot, we got the formula n = 2 log2 p + 3.868.
So,

n
−1.934 N
p=2 2 = (4.15)
21.934

4.2.2 Example-2

For the second example, we have chosen, f11 = 1, f12 = 1, f13 = 0, f21 =
0, f22 = 1, f23 = 1, f31 = 0, f32 = 0, f33 = 1 .For this combination, we have
three different pairs of eigenvalues - two complex ((e±0.7 , e±1.146 ) and one
real(1 i.e. e0 ).

Now, again, for n = 16, we want to see the variation of the amplitudes of
the target states with the number of iteration. The plot for the amplitude of
|t1 i with the number of iteration is shown in Figure 4.5.

Figure 4.5: The variation of amplitude of |t1 i with the number of iteration
for n = 16

26
So, we can see that the maximum amplitude is 0.6916 and it occurs in
the 81th iteration. Now, for the target states |t3 i, we got the same result.
But for the target state |t2 i, the variation of the amplitude of |t2 i is shown
in Figure 4.6 where the maximum amplitude is 0.9573 and it occurs in 118th
iteration.

Figure 4.6: The variation of amplitude of |t2 i with the number of iteration
for n = 16

Similarly, plotting the same graph for different n, we got the results listed
in Table 4.3.
Table 4.3: Data for optimal no of iteration for different n for the target state
|t1 i , |t1 i and |t3 i .

For |t1 i & |t3 i For |t2 i


n Optimal no of iteration(p) log2 (p) Optimal no of iteration(p) log2 (p)
12 20 4.334 29 4.882
16 81 6.339 118 6.882
20 323 8.335 472 8.882
24 1291 10.334 1880 10.882
28 5164 12.334 7660 12.882

Plotting this data, we got the results shown in Figure 4.7a and 4.7b.

27
(a) For |t1 i & |t3 i (b) For |t2 i

Figure 4.7: The variation of amplitude of target states with the number of
iteration.

Now, from this results, we got the following relations of p and n.


2n/2 N
p = 1.666 = 1.666 (4.16)
2 2√
n/2
2 N
p = 1.118 = 1.118 (4.17)
2 2
Here, for target state |t1 i & |t3 i we got Equation 4.16 and for |t2 i we got
Equation 4.17.

Notice that here also the maximum amplitude does not vary with the di-
mension of the search space. So, for the both cases, the maximum amplitude
is not a function of the dimension of the search space.

4.2.3 Example-3

For the third example, we have chosen, f11 = 1, f12 = 1, f13 = 1, f21 =
1, f22 = 1, f23 = 0, f31 = 1, f32 = 0, f33 = 1. For this combination, we have

28
two same and one different pair of eigenvalues (two e±0.8938 and e±4.46 ).

For n = 16, plotting the amplitude variation with the no of iteration,


we got Figure 4.8, same for all the target states. For this case, we got the
maximum amplitude to be 0.9185, occurring at 108th iteration.

Figure 4.8: The variation of amplitude of target state with the number of
iteration for n = 16

4.2.4 Example-4
For the fourth example, we have chosen, f11 = 1, f12 = 0, f13 = 0, f21 =
1, f22 = 1, f23 = 0, f31 = 1, f32 = 1, f33 = 0 . For this combination, we have
three different pairs of eigenvalues - two complex (e±0.7 , e±1.146 ) and one real
(1 i.e. e0 ).

For n = 16, plotting the amplitude variation with the no of iteration, we


got Figure 4.5, same for |t1 i & |t3 i target states and Figure 4.6, same for |t2 i
target states. So, this case is very similar to the Example-2.

29
4.3 Summery

It is clear that for the three source problem, the results can be distributed
in two main category. One is for three different pairs of eigenvalues and the
other is for two different and one same pair of eigenvalue.

For every cases we have got that the maximum amplitude of the target
states is independent of the dimension of the search space. Now, for the first
case, there is only two different pairs of eigenvalue. For this we got same am-
plitude after optimal number of iteration for all the three target states. For
the first optimal no of iteration(67) we got each target states with a proba-
bility of 0.57742 ≈ 31 . By analyzing the result, we got that the probability of

getting the target states will be nearly equal to 1, if we repeat the process 3
times. For example, for√n = 16, we will get the the target states with almost
100% probability after 3 ∗ 67 ≈ 116 number of iteration, which is clearly in
agreement with the canonical Grover’s search algorithm’s results1 [6, 7].

For the second case, analyzing the numerical result, we got that the am-
plitude of target states |t1 i & |t2 i after the optimal number of iteration(81)
is 0.6916. So, we will get the target state with 0.69162 = 0.4783 ≈ 12 . So, we

have to repeat the process 2 times√to get nearly 100% probability. That
means for this we need the iteration 2 ∗ 81 ≈ 114.55 times. For the target
state |t2 i, we can see that the maximum amplitude is very near to 1 and it
occurs after 118th iteration. So, here also we found that both the results are
in agreement with the results obtained for canonical Grover’s search[6].

Since there are only two types of cases for three initial state, the result for
example-3 and example 4 are very similar to the previous cases. Example-3 is
very to example-1, since it has two same and one different pair of eigenvalues
and example-4 is also similar to example-2 since it has three different pair of
eigenvalues.

So, for each cases, we have analyzed, we found that the number of iter-
ation required to get the target states with almost 100% probability is the
same as the time taken by the canonical Grover’s search operator.

1 π 28
For canonical Grover’s algorithm, optimal number of iteration = 4 ∗ √
3
≈ 116

30
References

[1] A. Patel, Quantum Algorithms: Database Search and its Variations,


Physics News 40 (October 2010) 33-44, arXiv:quant-ph/1102.2058.

[2] G. E. Moore, Cramming more components onto integrated circuits, Elec-


tronics, Volume 38, Number 8, (April 19, 1965).

[3] R.P. Feynman, Feynman Lectures on Computation, Eds. A.J.G. Hey and
R.W. Allen, (Perseus Books, 1996).

[4] Feynman and Computation: Exploring the Limits of Computers, Ed.


A.J.G. Hey, (Perseus Books, 1999).

[5] P. Shor, Polynomial-time Algorithms for Prime Factorisation and Dis-


crete Logarithms on a Quantum Computer, SIAM J. Comp. 26 (1997)
1484, arXiv:quant-ph/9508027.

[6] L.K. Grover, A Fast Quantum Mechanical Algorithm for Database


Search, Proceedings of the 28th Annual ACM Symposium on Theory
of Computing, Philadelphia (1996), p.212, arXiv:quant-ph/9605043.

[7] M.A. Nielsen and I.L. Chuang, Quantum Computation and Quantum
Information, (Cambridge University Press, 2000).

[8] Tulsi, Avatar, General framework for quantum search algorithms.


arXiv:quant-ph/0806.1257

31

You might also like