Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 20

STUDY OF QUANTUM

ALGORITHMS AND ANALYSIS

DEVELOPED BY

1.HARSHIT KUMAR SHARMA


2.ABHILASH GHOSH
3.SUBHRAJIT PAUL
4.SAHITYA CHAKRABORTY

UNDER THE SUPERVISION OF

DR. KUNAL DAS


CSE DEPT

DATE: DECEMBER 2018


DOMAIN OF QUANTUM COMPUTING,
EXPONENTIAL TIME PROBLEM SOLVING

Submitted in partial fulfillment for the Degree of Bachelor


of Technology (B.TECH), 7th Semester in Computer Science
& Engineering

Submitted by
Name University University Roll
Registration Number
Number
HARSHIT SHARMA 151270110039 0115010039
ABHILASH GHOSH 151270110001 0115010001
SUBHRAJIT PAUL 151270110105 0115010105
SAHITYA 151270110068 0115010068
CHAKRABORTY

Under the Supervision of


DR. KUNAL DAS
PROF,CSE DEPT

Narula Institute of Technology

Maulana Abul Kalam Azad University of Technology


CERTIFICATE OF ORIGINALITY

The project entitled “STUDY OF QUANTUM ALGORITHMS, EXPONENTIAL TIME


PROBLEM SOLVING” has been carried out by myself in partial fulfillment of the degree of
Bachelor of Technology in Computer Science& Engineering of Narula Institute of
Technology, Agarpara, Kolkata under MaulanaAbulKalam Azad University of Technology
during the academic year 2015-19

While developing this project no unfair means or illegal copies of software etc. have been
used and neither any part of this project nor any documentation have been submitted
elsewhere or copied as far in my knowledge.
Signature

Name:

WBUT Roll No.:

WBUT Registration No.:

Signature

Name:

WBUT Roll No.:

WBUT Registration No.:

Signature

Name:

WBUT Roll No.:

WBUT Registration No.:

Signature

Name:

WBUT Roll No.:

WBUT Registration No.:


CERTIFICATE OF APPROVAL
This is to certify that the project entitled “STUDY OF QUANTUM ALGORITHMS,
EXPONENTIAL TIME PROBLEM SOLVING” has been carried out by HARSHIT
KUMAR SHARMA, ABHILASH GHOSH, SUBHRAJIT PAUL, SAHITYA
CHAKRABORTY, under my supervision in partial fulfillment for the degree of Bachelor of
Technology (B.TECH) in Computer Science & Engineering of Narula Institute of
Technology, Agarpara affiliated to MaulanaAbulKalam Azad University of Technology
during the academic year 2015-19

It is understood that by this approval the undersigned do not necessarily endorse any of the
statements made or opinion expressed therein but approves it only for the purpose for which
it is submitted.
Submitted By:

Name: Name:

University Roll No.: University Roll No.:

University Registration No: University Registration No:

Name: Name:

University Roll No.: University Roll No.:

University Registration No: University Registration No:

--------------------------------- ------------------------------------

Name of the Guide (Mr. Jayanta Pal)

Designation, Department HOD, CSE Dept


THE SEARCH PROBLEM

• Searching is an important task that modern computers


can help us with
• Unfortunately, they’re not very good at it!
• Classically, the only way to do a search is to
systematically examine all
the possibilities until you find the solution
• Clearly if the search space has
N entries, then the time taken to
complete a search is
O(N) (on average, N/2)
• No classical algorithm can do better than this
• Quantum search algorithms can do better than
O(N)
• Grover’s algorithm works in time
O(square root(N))
• This is the best that a quantum computer can do
• For large N, this could yield very large performance
increases
• The key idea is that although finding a solution to the
search problem is
hard, recognising a solution is easy
Grover's search algorithm

Grover's algorithm is a quantum algorithm for


searching an unsorted database with N entries
in O(N1/2) time and using O(logN)storage space
(see big O notation). It was invented by Lov
Grover in 1996.

Introduction

Classically, searching an unsorted database requires a linear


search, which is O(N) in time. Grover's algorithm, which
takes O(N1/2)time, is the fastest possible quantum algorithm
for searching an unsorted database. It provides "only" a
quadratic speedup, unlike other quantum algorithms, which can
provide exponential speedup over their classical counterparts.
However, even quadratic speedup is considerable when N is
large.
Like all quantum computer algorithms, Grover's algorithm is
probabilistic, in the sense that it gives the correct answer with
high probability. The probability of failure can be decreased by
repeating the algorithm.
Uses of Grover's algorithm

Although the purpose of Grover's algorithm is usually described


as "searching a database", it may be more accurate to describe
it as "inverting a function". Roughly speaking, if we have a
function y=f(x) that can be evaluated on a quantum computer,
Grover's algorithm allows us to calculate x when given y.
Inverting a function is related to the searching of a database
because we could come up with a function that produces a
particular value of y if x matches a desired entry in a database,
and another value of y for other values of x.

Grover's algorithm can also be used for estimating


the mean and median of a set of numbers, and for solving
the collision problem. In addition, it can be used to solve NP-
complete problems by performing exhaustive searches over the
set of possible solutions. This would result in a considerable
speedup over classical solutions, even though it does not
provide the "holy grail" of a polynomial-time solution.

Below, we present the basic form of Grover's algorithm, which


searches for a single matching entry. The algorithm can be
further optimized if there is more than one matching entry and
the number of matches is known beforehand.
Setup

Consider an unsorted database with N entries. The algorithm requires


an N-dimensional state space H, which can be supplied by log2N qubits.

Let us number the database entries by 0, 1, ... (N-1). Choose an


observable, Ω, acting on H, with N distinct eigenvalues whose values are
all known. Each of the eigenstates of Ω encode one of the entries in the
database, in a manner that we will describe. Denote the eigenstates
(using bra-ket notation) as
{∣0⟩, ∣1⟩, ⋯, ∣N − 1⟩}
and the corresponding eigenvalues by
{λ0, λ1, ⋯, λN − 1}

We are provided with a unitary operator, Uω, which acts as


a subroutine that compares database entries according to some search
criterion. The algorithm does not specify how this subroutine works, but
it must be a quantum subroutine that works with superpositions of
states. Furthermore, it must act specially on one of the eigenstates, |ω>,
which corresponds to thedatabase entry matching the search criterion.
To be precise, we require Uω to have the following effects:
Uω∣ω⟩ =  − ∣ω⟩
Uω∣x⟩ = ∣x⟩  for all x ≠ ω
Our goal is to identify this eigenstate |ω>, or equivalently the eigenvalue
ω, that Uω acts specially upon.
Steps of the algorithm

The steps of Grover's algorithm are as follows:

1. Initialize the system to the state |s\ranglele =


\frac{1}{\sqrt{N}} \sum_x |x\ranglele

2. Perform the following "Grover iteration" r(N) times.


The function r(N) is described below.
1. Apply the operator Uω
2. Apply the operator Us = 2∣s⟩le⟨les∣ − I.

3. Perform the measurement Ω. The measurement


result will be λω with probability approaching 1 for
N>>1. From λω, ω may be obtained.
Explanation of the algorithm

Our initial state is


|s⟩=1N−−√∑x|x⟩|s⟩=1N∑x|x⟩
Consider the plane spanned by |s> and |ω>. Let |ω×> be a ket in this
plane perpendicular to |ω>. Since |ω> is one of the basis vectors, the
overlap is
⟨ω|s⟩=1N−−√⟨ω|s⟩=1N
In geometric terms, there is an angle (π/2 - θ) between |ω> and |s>,
where θ is given by:
cos(π2−θ)=1N−−√cos⁡(π2−θ)=1N
sinθ=1N−−√sin⁡θ=1N
The operator Uω is a reflection at the hyperplane orthogonal to |ω>; for
vectors in the plane spanned by |s> and |ω>, it acts as a reflection at the
line through |ω×>. The operator Us is a reflection at the line through |s>.
Therefore, the state vector remains in the plane spanned by |s> and |ω>
after each application of Us and after each application of Uω, and it is
straightforward to check that the operator UsUω of each Grover iteration
step rotates the state vector by an angle of 2θ toward |ω>.
We need to stop when the state vector passes close to |ω>; after this,
subsequent iterations rotate the state vector away from |ω>, reducing
the probability of obtaining the correct answer. The number of times to
iterate is given by r. In order to align the state vector exactly with |ω>, we
need:
π2−θ=2θrπ2−θ=2θr
r=(πθ−2)4r=(πθ−2)4
However, r must be an integer, so generally we can only set r to be the
integer closest to (π/θ - 2)/4. The angle between |ω> and the final state
vector is O(θ), so the probability of obtaining the wrong answer is O(1 -
cos2θ) = O(sin2θ).
For N>>1, θ ≈ N-1/2, so
r→πN−−√4r→πN4
Furthermore, the probability of obtaining the wrong answer becomes
O(1/N), which goes to zero for large N.
Extensions

If, instead of 1 matching entry, there are k matching entries, the


same algorithm works but the number of iterations must
be π(N/k)1/2/4instead of πN1/2/4. There are several ways to
handle the case if k is unknown. For example, one could run
Grover's algorithm several times, with

πN1/24,π(N/2)1/24,π(N/4)1/24,…πN1/24,π(N/2)1/24,π(N/4)1/24,

iterations. For any k, one of iterations will find a matching entry


with a sufficiently high probability. The total number of iterations
is at most
πN1/24(1+12–√+12+⋯)πN1/24(1+12+12+⋯)
which is still O(N1/2).

It is known that Grover's algorithm is optimal. That is, any


algorithm that accesses the database only by using the
operator Uω must apply Uω at least as many times as Grover's
algorithm (Bernstein et al., 1997).
Implementing the oracle

An oracle is a quantum circuit that recognizes solutions to a


given problem. For example, suppose we wish to solve a
version of the travelling salesman problem, where the goal is
to find a route visiting a given collection of cities that is
shorter than some specified length L .Although it is in general
hard to find such a route, it is easy to recognize whether a
proposed route solves the problem: simply add up the total
distance the salesman would travel on the proposed route,
and compare it to L .Specifically, an oracle is a circuit that,
given an input consisting of a potential solution to a problem,
flips the sign of an ancilla qubit if and only if the input is a
solution to the problem. Since the only action of the oracle is
to recognize solutions, its internal structure is unimportant in
a test of the algorithm itself. Thus, for our purposes, the
choice of oracle is arbitrary, and may be chosen to be as
simple as possible. Although the internal workings of the
oracle are unimportant for the purposes of testing the
algorithm, the complexity of implementing some oracle must
be included to characterize the difficulty of performing the
experiment. A simple implementation of an oracle marking
one of four states is a Toffoligate, with the control qubits
negated where necessary to specify any of the states 00, 01,
10, or 11 (see the Fig. 2a. for the example where the marked
state is 11).
If the marked state is 11, the action of the oracle on the three qubits
is to take the state ( ) 00 + 01 + 10 + 11 ( ) 0 − 1 to ( 00 + 01 + 10 )( 0 −
1 )+ 11 (1 − 0 ) (omitting the normalization). Thus the oracle simply
has the effect of flipping the sign of the marked state. The ancilla is
not used again, so it can be discarded at this point. Toffoli gates are
difficult to implement in LOQC because there is no known way to
implement one without using several CNOT gate. However, for our
purposes, a full Toffoli gate is not required because the ancilla qubit
plays such a limited role.

Fig:2a

Fig:2b
FIG. 2a: The circuit shows the beginning of the Grover circuit with an
example oracle (inside the dashed box) marking the item 11. We
have implemented the oracle using a variant of the Toffoli gate,
where the state of the third qubit is flipped when the first two qubits
are in the state 11 , as indicated by the closed circles on the control
qubits. We have moved the measurement on the third qubit forward
since it plays no further role in the algorithm. However, this circuit is
in fact equivalent to the simplification in the Fig 2b., where the
Toffoli has been replaced by a controlled-Z operation followed by the
X gates A simplified circuit to implement the four-element Grover
algorithm is given in Fig. 3.

Fig: 3
CONCLUSION

It is just the short synopsis of the searching algorithm


using quantum computing technique. Here we discuss
about the Grover searching algorithm and its
technique, how the Hadamard gates are used to
superimpose the different state of outputs. Other
algorithms will be discussed in the next synopsis where
the study and more analysis will be shown.
Superposition is the key figure regarding the inputs.
In Classical world bits are just 0 and 1. But in the
quantum world, a single quantum bit, or qubit ,can be
0 and 1 at the same time. The qubit is in a
superposition of states. Quantum algorithms must be
implemented by a quantum computer and in 1996
Grover did his work. These were little more than a
distant dream. But later on quantum computer was
invented in 1998 and showed how it could execute
Grover’s algorithm in the same year.
Other algorithms and implementations of different
Quantum algorithms will be studied and discussed in
the next synopsis.
THANK YOU

You might also like