SlideShare a Scribd company logo
Grover’s Algorithm
Quantum Search Algorithm in O(
√
N) complexity
C. Haaland
December 30, 2017
Outline
Classical Search
Quantum Mechanics Overview
Notation
Mathematics
QM Background
Grover’s Algorithm
Explanation
References
Classical Search
Motivation
“Imagine a phone directory containing N names arranged in
completely random order. In order to find someone’s phone
number with a probability of 0.5, any classical algorithm
(whether deterministic or probabilistic) will need to look at a
minimum of N/2 names.”
Classical Search
Motivation
“Imagine a phone directory containing N names arranged in
completely random order. In order to find someone’s phone
number with a probability of 0.5, any classical algorithm
(whether deterministic or probabilistic) will need to look at a
minimum of N/2 names.”
Consider the function F : {0, 1}3 → {0, 1},
F(x, y, z) =(x ∨ y ∨ z)∧
(¬x ∨ ¬y ∨ z)∧
(x ∨ ¬y ∨ ¬z)∧
(¬x ∨ y ∨ ¬z)
Question: For what values of the input does F(x, y, z) = 1?
Classical Search
Complexity
Problems are O(N) on a classical computer
Lov Grover published a quantum algorithm in 1996 with
complexity O(
√
N).
For large N, this represents a significant improvement over the
classical case
Quantum algorithm cannot guarantee the correct answer, only
returns the solution with high probability
Outline
Classical Search
Quantum Mechanics Overview
Notation
Mathematics
QM Background
Grover’s Algorithm
Explanation
References
Outline
Classical Search
Quantum Mechanics Overview
Notation
Mathematics
QM Background
Grover’s Algorithm
Explanation
References
Notation
R is set of real numbers
Notation
R is set of real numbers
C is set of complex numbers (e.g. x + iy)
Notation
R is set of real numbers
C is set of complex numbers (e.g. x + iy)
Rn (Cn) indicates column vector of n real (complex) numbers
respectively
Notation
R is set of real numbers
C is set of complex numbers (e.g. x + iy)
Rn (Cn) indicates column vector of n real (complex) numbers
respectively
z∗ is the complex conjugate
If z = x + iy then z∗
= x − iy
Notation
R is set of real numbers
C is set of complex numbers (e.g. x + iy)
Rn (Cn) indicates column vector of n real (complex) numbers
respectively
z∗ is the complex conjugate
If z = x + iy then z∗
= x − iy
|ψ is Dirac notation for a column vector (ket vector)
Notation
R is set of real numbers
C is set of complex numbers (e.g. x + iy)
Rn (Cn) indicates column vector of n real (complex) numbers
respectively
z∗ is the complex conjugate
If z = x + iy then z∗
= x − iy
|ψ is Dirac notation for a column vector (ket vector)
ψ| is Dirac notation for a row vector (bra vector)
Notation (cont’d)
A ∈ Rm×n(Cm×n) means A is a matrix of real (complex)
numbers with m rows and n columns
Notation (cont’d)
A ∈ Rm×n(Cm×n) means A is a matrix of real (complex)
numbers with m rows and n columns
When m = n we call A an operator
Notation (cont’d)
A ∈ Rm×n(Cm×n) means A is a matrix of real (complex)
numbers with m rows and n columns
When m = n we call A an operator
A† is Hermitian/adjoint/conjugate transpose of A
Notation (cont’d)
A ∈ Rm×n(Cm×n) means A is a matrix of real (complex)
numbers with m rows and n columns
When m = n we call A an operator
A† is Hermitian/adjoint/conjugate transpose of A
If a matrix A has elements Aij the matrix A†
has entries A∗
ji
An example is ψ| = |ψ †
Notation (cont’d)
A ∈ Rm×n(Cm×n) means A is a matrix of real (complex)
numbers with m rows and n columns
When m = n we call A an operator
A† is Hermitian/adjoint/conjugate transpose of A
If a matrix A has elements Aij the matrix A†
has entries A∗
ji
An example is ψ| = |ψ †
The quantity φ|ψ is called the inner product
The quantity is a scalar with value
n
i=1 φ∗
i ψi
Outline
Classical Search
Quantum Mechanics Overview
Notation
Mathematics
QM Background
Grover’s Algorithm
Explanation
References
Vector Norm
The norm/length/magnitude squared of |ψ ∈ Cn is defined as
ψ|ψ =
n
i=1
ψ∗
i ψi =
n
i=1
|ψi |2
Vector Norm
The norm/length/magnitude squared of |ψ ∈ Cn is defined as
ψ|ψ =
n
i=1
ψ∗
i ψi =
n
i=1
|ψi |2
This will always be 1 for a valid quantum mechanical state
Matrices
From the definition of the adjoint
(A|ψ )†
= (|ψ )†
A†
= ψ|A†
where A ∈ Cn×n
Matrices
From the definition of the adjoint
(A|ψ )†
= (|ψ )†
A†
= ψ|A†
where A ∈ Cn×n
Because the norm of a quantum state is 1, if |φ = U|ψ then
φ|φ = 1
Matrices
From the definition of the adjoint
(A|ψ )†
= (|ψ )†
A†
= ψ|A†
where A ∈ Cn×n
Because the norm of a quantum state is 1, if |φ = U|ψ then
φ|φ = 1
From this we have ( ψ|U†
)(U|ψ ) = 1 which means UT
U = I
Matrices
From the definition of the adjoint
(A|ψ )†
= (|ψ )†
A†
= ψ|A†
where A ∈ Cn×n
Because the norm of a quantum state is 1, if |φ = U|ψ then
φ|φ = 1
From this we have ( ψ|U†
)(U|ψ ) = 1 which means UT
U = I
An operator satisfying this property is called unitary
Matrices
From the definition of the adjoint
(A|ψ )†
= (|ψ )†
A†
= ψ|A†
where A ∈ Cn×n
Because the norm of a quantum state is 1, if |φ = U|ψ then
φ|φ = 1
From this we have ( ψ|U†
)(U|ψ ) = 1 which means UT
U = I
An operator satisfying this property is called unitary
Unitary operators are the way in which quantum states are
altered or evolved
H =
1
√
2
1 1
1 −1
, σx =
0 1
1 0
, σy =
0 i
−i 0
, σz =
1 0
0 −1
Linearity
Linearity of a function f means
f (x + y) = f (x) + f (y)
f (αx) = αf (x)
Linearity
Linearity of a function f means
f (x + y) = f (x) + f (y)
f (αx) = αf (x)
Matrix multiplication is linear
Linearity
Linearity of a function f means
f (x + y) = f (x) + f (y)
f (αx) = αf (x)
Matrix multiplication is linear
Common modeling approximation in engineering
Example: log(1 + x) is very nearly x for small x
Linearity & QM
Linearity is a fundamental property of QM
“With classical fields, we often use linear equations,
such as the differential equations that allow us to
solve for small oscillatory motion of, say, a pendu-
lum. In such a classical case, the linear equation is
an approximation; a pendulum with twice the am-
plitude of oscillation will not oscillate at exactly the
same frequency, for example. Hence we cannot take
the solution derived at one amplitude of oscillation of
the pendulum and merely scale it up for larger ampli-
tudes of oscillation, except as a first approximation.
We should emphasize right away, however, that, in
quantum mechanics, this linearity of the equations
with respect to the quantum mechanical amplitude
is not an approximation of any kind; it is apparently
an absolute property.”-David Miller (Prof. Stanford
University)
Outline
Classical Search
Quantum Mechanics Overview
Notation
Mathematics
QM Background
Grover’s Algorithm
Explanation
References
Quantum State
Single Particle System
Single particle can be in one of two states
Quantum State
Single Particle System
Single particle can be in one of two states
Electron, for example, can be spin up, |0 , or spin down, |1
Quantum State
Single Particle System
Single particle can be in one of two states
Electron, for example, can be spin up, |0 , or spin down, |1
Particle encodes a single quantum bit or qubit
Quantum State
Single Particle System
Single particle can be in one of two states
Electron, for example, can be spin up, |0 , or spin down, |1
Particle encodes a single quantum bit or qubit
A qubit is a vector in C2
represented as
|0 =
1
0
, |1 =
0
1
Quantum State
Single Particle System
Single particle can be in one of two states
Electron, for example, can be spin up, |0 , or spin down, |1
Particle encodes a single quantum bit or qubit
A qubit is a vector in C2
represented as
|0 =
1
0
, |1 =
0
1
Measuring, we will find the particle in exactly one of the two
states
Quantum State
Single Particle System
Single particle can be in one of two states
Electron, for example, can be spin up, |0 , or spin down, |1
Particle encodes a single quantum bit or qubit
A qubit is a vector in C2
represented as
|0 =
1
0
, |1 =
0
1
Measuring, we will find the particle in exactly one of the two
states
Before measurement this is not true!
Quantum State
Single Particle System
Single particle can be in one of two states
Electron, for example, can be spin up, |0 , or spin down, |1
Particle encodes a single quantum bit or qubit
A qubit is a vector in C2
represented as
|0 =
1
0
, |1 =
0
1
Measuring, we will find the particle in exactly one of the two
states
Before measurement this is not true!
Particle exists in a linear superposition of these states
Quantum State
Single Particle System
Single particle can be in one of two states
Electron, for example, can be spin up, |0 , or spin down, |1
Particle encodes a single quantum bit or qubit
A qubit is a vector in C2
represented as
|0 =
1
0
, |1 =
0
1
Measuring, we will find the particle in exactly one of the two
states
Before measurement this is not true!
Particle exists in a linear superposition of these states
State will be |ψ = ψ0|0 + ψ1|1
ψ0, ψ1 ∈ C and |ψ0|2
+ |ψ1|2
= 1
Quantum State
Single Particle System
Single particle can be in one of two states
Electron, for example, can be spin up, |0 , or spin down, |1
Particle encodes a single quantum bit or qubit
A qubit is a vector in C2
represented as
|0 =
1
0
, |1 =
0
1
Measuring, we will find the particle in exactly one of the two
states
Before measurement this is not true!
Particle exists in a linear superposition of these states
State will be |ψ = ψ0|0 + ψ1|1
ψ0, ψ1 ∈ C and |ψ0|2
+ |ψ1|2
= 1
Classical analogy is Schrodinger’s cat that is both alive and
dead
Quantum State
Multi-Particle System
Suppose we have n particles each of which can be in one of
two states
Quantum State
Multi-Particle System
Suppose we have n particles each of which can be in one of
two states
The system represents n qubits of information
Quantum State
Multi-Particle System
Suppose we have n particles each of which can be in one of
two states
The system represents n qubits of information
There are N = 2n
possible different states
|0 . . . 00 , |0 . . . 01 , |0 . . . 10 , . . . , |1 . . . 11
Quantum State
Multi-Particle System
Suppose we have n particles each of which can be in one of
two states
The system represents n qubits of information
There are N = 2n
possible different states
|0 . . . 00 , |0 . . . 01 , |0 . . . 10 , . . . , |1 . . . 11
Each state is a standard basis vector in RN
(i.e. one
component equal to 1 and the rest 0)
Note: The vector components are not the same as the entries
of the Dirac notation
Quantum State
Multi-Particle System
Suppose we have n particles each of which can be in one of
two states
The system represents n qubits of information
There are N = 2n
possible different states
|0 . . . 00 , |0 . . . 01 , |0 . . . 10 , . . . , |1 . . . 11
Each state is a standard basis vector in RN
(i.e. one
component equal to 1 and the rest 0)
Note: The vector components are not the same as the entries
of the Dirac notation
Measuring, we will find the system to be in one of N = 2n
possible states |ψ ∈ RN
Quantum State
Multi-Particle System
Suppose we have n particles each of which can be in one of
two states
The system represents n qubits of information
There are N = 2n
possible different states
|0 . . . 00 , |0 . . . 01 , |0 . . . 10 , . . . , |1 . . . 11
Each state is a standard basis vector in RN
(i.e. one
component equal to 1 and the rest 0)
Note: The vector components are not the same as the entries
of the Dirac notation
Measuring, we will find the system to be in one of N = 2n
possible states |ψ ∈ RN
Before measurement, it will be in a linear superposition of
these states
Quantum State
Multi-Particle System
Suppose we have n particles each of which can be in one of
two states
The system represents n qubits of information
There are N = 2n
possible different states
|0 . . . 00 , |0 . . . 01 , |0 . . . 10 , . . . , |1 . . . 11
Each state is a standard basis vector in RN
(i.e. one
component equal to 1 and the rest 0)
Note: The vector components are not the same as the entries
of the Dirac notation
Measuring, we will find the system to be in one of N = 2n
possible states |ψ ∈ RN
Before measurement, it will be in a linear superposition of
these states
Its state will be
|ψ = ψ0|0 . . . 00 + ψ1|0 . . . 01 + · · · + ψN−1|1 . . . 11 where
ψi ∈ C and
N−1
i=0 |ψi |2
= 1
Born Rule
What are the coefficients ψi respresenting physically?
Born Rule
What are the coefficients ψi respresenting physically?
ψi cannot be measured, but |ψi |2
can!
Born Rule
What are the coefficients ψi respresenting physically?
ψi cannot be measured, but |ψi |2
can!
Squared magnitude is the probability of measuring the system
in state i
Born Rule
What are the coefficients ψi respresenting physically?
ψi cannot be measured, but |ψi |2
can!
Squared magnitude is the probability of measuring the system
in state i
This interpretation is called the Born Rule
Born Rule
What are the coefficients ψi respresenting physically?
ψi cannot be measured, but |ψi |2
can!
Squared magnitude is the probability of measuring the system
in state i
This interpretation is called the Born Rule
This is empirical and more like a postulate
Born Rule
What are the coefficients ψi respresenting physically?
ψi cannot be measured, but |ψi |2
can!
Squared magnitude is the probability of measuring the system
in state i
This interpretation is called the Born Rule
This is empirical and more like a postulate
Many attempts to derive it from first principles
Born Rule
What are the coefficients ψi respresenting physically?
ψi cannot be measured, but |ψi |2
can!
Squared magnitude is the probability of measuring the system
in state i
This interpretation is called the Born Rule
This is empirical and more like a postulate
Many attempts to derive it from first principles
Are we sure it’s completely random?
Born Rule
What are the coefficients ψi respresenting physically?
ψi cannot be measured, but |ψi |2
can!
Squared magnitude is the probability of measuring the system
in state i
This interpretation is called the Born Rule
This is empirical and more like a postulate
Many attempts to derive it from first principles
Are we sure it’s completely random?
As far as we can tell, it is actually random (cf. Bell’s
Inequalities)
Born Rule
What are the coefficients ψi respresenting physically?
ψi cannot be measured, but |ψi |2
can!
Squared magnitude is the probability of measuring the system
in state i
This interpretation is called the Born Rule
This is empirical and more like a postulate
Many attempts to derive it from first principles
Are we sure it’s completely random?
As far as we can tell, it is actually random (cf. Bell’s
Inequalities)
Some interpretations of this phenomenon are
Born Rule
What are the coefficients ψi respresenting physically?
ψi cannot be measured, but |ψi |2
can!
Squared magnitude is the probability of measuring the system
in state i
This interpretation is called the Born Rule
This is empirical and more like a postulate
Many attempts to derive it from first principles
Are we sure it’s completely random?
As far as we can tell, it is actually random (cf. Bell’s
Inequalities)
Some interpretations of this phenomenon are
Copenhagen Interpretation
Many World’s Hypothesis
Quantum Decoherence
Quantum Measurement
Wave Particle Duality
A wave (of water say) impinging on a screen with two
openings will yield a diffraction pattern
Quantum Measurement
Wave Particle Duality
A wave (of water say) impinging on a screen with two
openings will yield a diffraction pattern
Each opening becomes the source of a new wave front
Quantum Measurement
Wave Particle Duality
A wave (of water say) impinging on a screen with two
openings will yield a diffraction pattern
Each opening becomes the source of a new wave front
The two waves interfere with each other forming alternating
peaks and troughs
Quantum Measurement
Wave Particle Duality
A wave (of water say) impinging on a screen with two
openings will yield a diffraction pattern
Each opening becomes the source of a new wave front
The two waves interfere with each other forming alternating
peaks and troughs
Quantum Measurement (cont’d)
Wave Particle Duality
Perform the same experiment with an electron gun
Quantum Measurement (cont’d)
Wave Particle Duality
Perform the same experiment with an electron gun
A diffraction pattern is observed!
This indicates electrons are like waves
Quantum Measurement (cont’d)
Wave Particle Duality
Perform the same experiment with an electron gun
A diffraction pattern is observed!
This indicates electrons are like waves
Now we have an apparatus that can shoot only a single
electron at a time
Quantum Measurement (cont’d)
Wave Particle Duality
Perform the same experiment with an electron gun
A diffraction pattern is observed!
This indicates electrons are like waves
Now we have an apparatus that can shoot only a single
electron at a time
A diffraction pattern! The electron is interfering with itself
Quantum Measurement (cont’d)
Wave Particle Duality
Perform the same experiment with an electron gun
A diffraction pattern is observed!
This indicates electrons are like waves
Now we have an apparatus that can shoot only a single
electron at a time
A diffraction pattern! The electron is interfering with itself
A measurement device is placed on one of the slits to see
which one the electron went through
Quantum Measurement (cont’d)
Wave Particle Duality
Perform the same experiment with an electron gun
A diffraction pattern is observed!
This indicates electrons are like waves
Now we have an apparatus that can shoot only a single
electron at a time
A diffraction pattern! The electron is interfering with itself
A measurement device is placed on one of the slits to see
which one the electron went through
Diffraction pattern is gone.
Electron behaves like a particle that goes through one slit or
the other when measured
The act of measurement has altered the outcome
Outline
Classical Search
Quantum Mechanics Overview
Notation
Mathematics
QM Background
Grover’s Algorithm
Explanation
References
Outline
Classical Search
Quantum Mechanics Overview
Notation
Mathematics
QM Background
Grover’s Algorithm
Explanation
References
Grover’s Algorithm
Function Inversion
Often framed in the context of unstructured database search
Grover’s Algorithm
Function Inversion
Often framed in the context of unstructured database search
More precisely, searches a function for a single satisfying input
Grover’s Algorithm
Function Inversion
Often framed in the context of unstructured database search
More precisely, searches a function for a single satisfying input
Given y, find the corresponding x such that f (x) = y.
Invert the function f (·)
To search an explicit list (i.e. unstructured database), need a
function backing it
Grover’s Algorithm
Function Inversion
Often framed in the context of unstructured database search
More precisely, searches a function for a single satisfying input
Given y, find the corresponding x such that f (x) = y.
Invert the function f (·)
To search an explicit list (i.e. unstructured database), need a
function backing it
If there is no solution or multiple solutions, algorithm does not
work out of the box
Grover’s Algorithm
Algorithm
We search for index |ω
Grover’s Algorithm
Algorithm
We search for index |ω
Initialize n qubits to quantum state |s ∈ RN (N = 2n) which
is the uniform superposition of states
Grover’s Algorithm
Algorithm
We search for index |ω
Initialize n qubits to quantum state |s ∈ RN (N = 2n) which
is the uniform superposition of states
|s
1
√
N
N
i=1
|x =
1
√
N
1
Grover’s Algorithm
Algorithm
We search for index |ω
Initialize n qubits to quantum state |s ∈ RN (N = 2n) which
is the uniform superposition of states
|s
1
√
N
N
i=1
|x =
1
√
N
1
Repeat r = π
4
√
N times
Grover’s Algorithm
Algorithm
We search for index |ω
Initialize n qubits to quantum state |s ∈ RN (N = 2n) which
is the uniform superposition of states
|s
1
√
N
N
i=1
|x =
1
√
N
1
Repeat r = π
4
√
N times
Define the oracle operator Uω ∈ Rn×n
as
Uω = I − 2|ω ω| = diag(1, 1, . . . , −1, , . . . , 1, 1
0,1,...,ω,...,N−2,N−1
)
Apply the operator Uω to the qubit state
Grover’s Algorithm
Algorithm
We search for index |ω
Initialize n qubits to quantum state |s ∈ RN (N = 2n) which
is the uniform superposition of states
|s
1
√
N
N
i=1
|x =
1
√
N
1
Repeat r = π
4
√
N times
Define the oracle operator Uω ∈ Rn×n
as
Uω = I − 2|ω ω| = diag(1, 1, . . . , −1, , . . . , 1, 1
0,1,...,ω,...,N−2,N−1
)
Apply the operator Uω to the qubit state
Define the operator Us ∈ Rn×n
as
Us = 2|s s| − I
Apply the operator Us to the qubit state
Grover’s Algorithm
Algorithm
We search for index |ω
Initialize n qubits to quantum state |s ∈ RN (N = 2n) which
is the uniform superposition of states
|s
1
√
N
N
i=1
|x =
1
√
N
1
Repeat r = π
4
√
N times
Define the oracle operator Uω ∈ Rn×n
as
Uω = I − 2|ω ω| = diag(1, 1, . . . , −1, , . . . , 1, 1
0,1,...,ω,...,N−2,N−1
)
Apply the operator Uω to the qubit state
Define the operator Us ∈ Rn×n
as
Us = 2|s s| − I
Apply the operator Us to the qubit state
Measure qubits
Inversion About the Mean
The operator Us can be written as
Us =





2
N − 1 2
N · · · 2
N
2
N
2
N − 1 · · · 2
N
...
...
...
...
2
N
2
N · · · 2
N − 1





Applying the operator to |x gives the update
xi ← −xi +
2
N
N
j=1
xj
Adds twice the mean of the coefficients to negation of each
state
State xω was already negated which boosts its value.
Grover’s Example
N=4
For the case of N = 4 we need only compute r = π
4
√
4 = 1
iteration
Uω|s = (I − 2|ω ω|)|s = |s − 2|ω ω|s = |s − 2|ω (1/
√
4)
Us |s −
2
√
4
|ω = (2|s s| − I) (|s − |ω )
= 2|s s|s − |s − |s s|ω + |ω
= 2|s − |s − |s − |ω
= |ω
Measure the system to get the answer
Grover’s Illustration (N=8, ω=3)
Grover’s Illustration (N=8, ω=3)
Grover’s Illustration (N=8, ω=3)
Grover’s Illustration (N=8, ω=3)
Grover’s Illustration (N=8, ω=3)
Graphical
Grover’s Algorithm
Notes
If the solution does not exist, an answer is returned at random
Grover’s Algorithm
Notes
If the solution does not exist, an answer is returned at random
Performing more iterations will degrade the solution
probability
Grover’s Algorithm
Notes
If the solution does not exist, an answer is returned at random
Performing more iterations will degrade the solution
probability
Multiple solutions will change the optimal number of
iterations needed
The Quantum Oracle
The oracle is a (problem dependent) function such that
f (ω) = 1 and 0 otherwise
The Quantum Oracle
The oracle is a (problem dependent) function such that
f (ω) = 1 and 0 otherwise
Each state is then multiplied with (−1)f (x)
to “mark” the
solution
The Quantum Oracle
The oracle is a (problem dependent) function such that
f (ω) = 1 and 0 otherwise
Each state is then multiplied with (−1)f (x)
to “mark” the
solution
Quantum oracle must be able to evaluate on the superposition
of indices
The Quantum Oracle
The oracle is a (problem dependent) function such that
f (ω) = 1 and 0 otherwise
Each state is then multiplied with (−1)f (x)
to “mark” the
solution
Quantum oracle must be able to evaluate on the superposition
of indices
Classically, we can only evaluate one query at a time
The Quantum Oracle
The oracle is a (problem dependent) function such that
f (ω) = 1 and 0 otherwise
Each state is then multiplied with (−1)f (x)
to “mark” the
solution
Quantum oracle must be able to evaluate on the superposition
of indices
Classically, we can only evaluate one query at a time
QM has natural parallelism; if f can evaluate x or y, then we
can evaluate f 1√
2
(x + y)
The Quantum Oracle
The oracle is a (problem dependent) function such that
f (ω) = 1 and 0 otherwise
Each state is then multiplied with (−1)f (x)
to “mark” the
solution
Quantum oracle must be able to evaluate on the superposition
of indices
Classically, we can only evaluate one query at a time
QM has natural parallelism; if f can evaluate x or y, then we
can evaluate f 1√
2
(x + y)
A quantum circuit with quantum gates can be built to
evaluate the predicate
The Quantum Oracle
The oracle is a (problem dependent) function such that
f (ω) = 1 and 0 otherwise
Each state is then multiplied with (−1)f (x)
to “mark” the
solution
Quantum oracle must be able to evaluate on the superposition
of indices
Classically, we can only evaluate one query at a time
QM has natural parallelism; if f can evaluate x or y, then we
can evaluate f 1√
2
(x + y)
A quantum circuit with quantum gates can be built to
evaluate the predicate
Gates such as Hadamard, Pauli Spin, Phase shift, CNOT etc
(all are unitary operators) used to build oracles
The Quantum Oracle
The oracle is a (problem dependent) function such that
f (ω) = 1 and 0 otherwise
Each state is then multiplied with (−1)f (x)
to “mark” the
solution
Quantum oracle must be able to evaluate on the superposition
of indices
Classically, we can only evaluate one query at a time
QM has natural parallelism; if f can evaluate x or y, then we
can evaluate f 1√
2
(x + y)
A quantum circuit with quantum gates can be built to
evaluate the predicate
Gates such as Hadamard, Pauli Spin, Phase shift, CNOT etc
(all are unitary operators) used to build oracles
Programming a quantum computer is more like programming
an FPGA than writing software
Usefulness of Grover’s
The O(
√
N) bound assumes predicate can be evaluated on
superposition of all states
Usefulness of Grover’s
The O(
√
N) bound assumes predicate can be evaluated on
superposition of all states
f (·) must be implemented in quantum hardware using
quantum gates
May be difficult to find compact gate representation
Problems like database search must first convert to an implicit
list
Cost of evaluating f (·) may dominate
Current State of Quantum Computing
IBM claims to have a working prototype of a 50 qubit
quantum computer
Current State of Quantum Computing
IBM claims to have a working prototype of a 50 qubit
quantum computer
D Wave solves optimization problems by exploiting QM effects
Current State of Quantum Computing
IBM claims to have a working prototype of a 50 qubit
quantum computer
D Wave solves optimization problems by exploiting QM effects
Much of quantum computing is still theoretical and uses
simulation
Q#, Libquantum, IBM Q etc
Simulation requires lots of memory (e.g. 32 qubits implies
2 · 232
real numbers)
Outline
Classical Search
Quantum Mechanics Overview
Notation
Mathematics
QM Background
Grover’s Algorithm
Explanation
References
References
https://en.wikipedia.org/wiki/Grover%27s algorithm
https://quantiki.org/wiki/grovers-search-algorithm
Quantum Mechanics for Scientists and Engineers - David
Miller
https://web.eecs.umich.edu/ imarkov/pubs/jour/cise05-
grov.pdf

More Related Content

What's hot

Heuristic search
Heuristic searchHeuristic search
Heuristic search
Soheil Khodayari
 
What is the Expectation Maximization (EM) Algorithm?
What is the Expectation Maximization (EM) Algorithm?What is the Expectation Maximization (EM) Algorithm?
What is the Expectation Maximization (EM) Algorithm?
Kazuki Yoshida
 
Nature-inspired metaheuristic algorithms for optimization and computional int...
Nature-inspired metaheuristic algorithms for optimization and computional int...Nature-inspired metaheuristic algorithms for optimization and computional int...
Nature-inspired metaheuristic algorithms for optimization and computional int...
Xin-She Yang
 
Gradient descent method
Gradient descent methodGradient descent method
Gradient descent method
Sanghyuk Chun
 
Artificial Neural Networks Lect1: Introduction & neural computation
Artificial Neural Networks Lect1: Introduction & neural computationArtificial Neural Networks Lect1: Introduction & neural computation
Artificial Neural Networks Lect1: Introduction & neural computation
Mohammed Bennamoun
 
Introduction - Lattice-based Cryptography
Introduction - Lattice-based CryptographyIntroduction - Lattice-based Cryptography
Introduction - Lattice-based Cryptography
Alexandre Augusto Giron
 
Soft Computing-173101
Soft Computing-173101Soft Computing-173101
Soft Computing-173101AMIT KUMAR
 
Optimization in Deep Learning
Optimization in Deep LearningOptimization in Deep Learning
Optimization in Deep Learning
Yan Xu
 
Quantum programming
Quantum programmingQuantum programming
Quantum programming
Francisco J. Gálvez Ramírez
 
Deep neural networks
Deep neural networksDeep neural networks
Deep neural networks
Si Haem
 
Fuzzy logic ppt
Fuzzy logic pptFuzzy logic ppt
Fuzzy logic ppt
hammadhasan10
 
Fault-tolerance Quantum computation and Quantum Error Correction
Fault-tolerance Quantum computation and Quantum Error CorrectionFault-tolerance Quantum computation and Quantum Error Correction
Fault-tolerance Quantum computation and Quantum Error Correction
Facultad de Informática UCM
 
Markov decision process
Markov decision processMarkov decision process
Markov decision process
Hamed Abdi
 
1619 quantum computing
1619 quantum computing1619 quantum computing
1619 quantum computing
Dr Fereidoun Dejahang
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithm
DurgeshPratapSIngh8
 
Nature-Inspired Optimization Algorithms
Nature-Inspired Optimization Algorithms Nature-Inspired Optimization Algorithms
Nature-Inspired Optimization Algorithms
Xin-She Yang
 
Introduction to Quantum Computation. Part - 1
Introduction to Quantum Computation. Part - 1Introduction to Quantum Computation. Part - 1
Introduction to Quantum Computation. Part - 1
Arunabha Saha
 
Markov decision process
Markov decision processMarkov decision process
Markov decision process
Jie-Han Chen
 
Feed forward ,back propagation,gradient descent
Feed forward ,back propagation,gradient descentFeed forward ,back propagation,gradient descent
Feed forward ,back propagation,gradient descent
Muhammad Rasel
 
Multilayer perceptron
Multilayer perceptronMultilayer perceptron
Multilayer perceptron
omaraldabash
 

What's hot (20)

Heuristic search
Heuristic searchHeuristic search
Heuristic search
 
What is the Expectation Maximization (EM) Algorithm?
What is the Expectation Maximization (EM) Algorithm?What is the Expectation Maximization (EM) Algorithm?
What is the Expectation Maximization (EM) Algorithm?
 
Nature-inspired metaheuristic algorithms for optimization and computional int...
Nature-inspired metaheuristic algorithms for optimization and computional int...Nature-inspired metaheuristic algorithms for optimization and computional int...
Nature-inspired metaheuristic algorithms for optimization and computional int...
 
Gradient descent method
Gradient descent methodGradient descent method
Gradient descent method
 
Artificial Neural Networks Lect1: Introduction & neural computation
Artificial Neural Networks Lect1: Introduction & neural computationArtificial Neural Networks Lect1: Introduction & neural computation
Artificial Neural Networks Lect1: Introduction & neural computation
 
Introduction - Lattice-based Cryptography
Introduction - Lattice-based CryptographyIntroduction - Lattice-based Cryptography
Introduction - Lattice-based Cryptography
 
Soft Computing-173101
Soft Computing-173101Soft Computing-173101
Soft Computing-173101
 
Optimization in Deep Learning
Optimization in Deep LearningOptimization in Deep Learning
Optimization in Deep Learning
 
Quantum programming
Quantum programmingQuantum programming
Quantum programming
 
Deep neural networks
Deep neural networksDeep neural networks
Deep neural networks
 
Fuzzy logic ppt
Fuzzy logic pptFuzzy logic ppt
Fuzzy logic ppt
 
Fault-tolerance Quantum computation and Quantum Error Correction
Fault-tolerance Quantum computation and Quantum Error CorrectionFault-tolerance Quantum computation and Quantum Error Correction
Fault-tolerance Quantum computation and Quantum Error Correction
 
Markov decision process
Markov decision processMarkov decision process
Markov decision process
 
1619 quantum computing
1619 quantum computing1619 quantum computing
1619 quantum computing
 
Genetic algorithm
Genetic algorithmGenetic algorithm
Genetic algorithm
 
Nature-Inspired Optimization Algorithms
Nature-Inspired Optimization Algorithms Nature-Inspired Optimization Algorithms
Nature-Inspired Optimization Algorithms
 
Introduction to Quantum Computation. Part - 1
Introduction to Quantum Computation. Part - 1Introduction to Quantum Computation. Part - 1
Introduction to Quantum Computation. Part - 1
 
Markov decision process
Markov decision processMarkov decision process
Markov decision process
 
Feed forward ,back propagation,gradient descent
Feed forward ,back propagation,gradient descentFeed forward ,back propagation,gradient descent
Feed forward ,back propagation,gradient descent
 
Multilayer perceptron
Multilayer perceptronMultilayer perceptron
Multilayer perceptron
 

Similar to Grovers Algorithm

MC0082 –Theory of Computer Science
MC0082 –Theory of Computer ScienceMC0082 –Theory of Computer Science
MC0082 –Theory of Computer Science
Aravind NC
 
Ch01
Ch01Ch01
Vector space introduction
Vector space introductionVector space introduction
Vector space introduction
ROHAN GAIKWAD
 
Module 1 Theory of Matrices.pdf
Module 1 Theory of Matrices.pdfModule 1 Theory of Matrices.pdf
Module 1 Theory of Matrices.pdf
PrathamPatel560716
 
MASSS_Presentation_20160209
MASSS_Presentation_20160209MASSS_Presentation_20160209
MASSS_Presentation_20160209Yimin Wu
 
2 vectors notes
2 vectors notes2 vectors notes
2 vectors notes
Vinh Nguyen Xuan
 
sequence and series.docx
sequence and series.docxsequence and series.docx
sequence and series.docx
Getachew Mulaw
 
Random Matrix Theory and Machine Learning - Part 3
Random Matrix Theory and Machine Learning - Part 3Random Matrix Theory and Machine Learning - Part 3
Random Matrix Theory and Machine Learning - Part 3
Fabian Pedregosa
 
Unit 4 jwfiles
Unit 4 jwfilesUnit 4 jwfiles
Unit 4 jwfiles
Nv Thejaswini
 
1533 game mathematics
1533 game mathematics1533 game mathematics
1533 game mathematics
Dr Fereidoun Dejahang
 
Maths-->>Eigenvalues and eigenvectors
Maths-->>Eigenvalues and eigenvectorsMaths-->>Eigenvalues and eigenvectors
Maths-->>Eigenvalues and eigenvectors
Jaydev Kishnani
 
Finite mathematics
Finite mathematicsFinite mathematics
Finite mathematics
Igor Rivin
 
01.02 linear equations
01.02 linear equations01.02 linear equations
01.02 linear equations
Andres Mendez-Vazquez
 
Week_10.2.pdf
Week_10.2.pdfWeek_10.2.pdf
Week_10.2.pdf
Mir Shah
 
A Probabilistic Algorithm for Computation of Polynomial Greatest Common with ...
A Probabilistic Algorithm for Computation of Polynomial Greatest Common with ...A Probabilistic Algorithm for Computation of Polynomial Greatest Common with ...
A Probabilistic Algorithm for Computation of Polynomial Greatest Common with ...
mathsjournal
 
Linear Algebra Presentation including basic of linear Algebra
Linear Algebra Presentation including basic of linear AlgebraLinear Algebra Presentation including basic of linear Algebra
Linear Algebra Presentation including basic of linear Algebra
MUHAMMADUSMAN93058
 

Similar to Grovers Algorithm (20)

MC0082 –Theory of Computer Science
MC0082 –Theory of Computer ScienceMC0082 –Theory of Computer Science
MC0082 –Theory of Computer Science
 
Ch07 6
Ch07 6Ch07 6
Ch07 6
 
Ch01
Ch01Ch01
Ch01
 
Vector space introduction
Vector space introductionVector space introduction
Vector space introduction
 
Module 1 Theory of Matrices.pdf
Module 1 Theory of Matrices.pdfModule 1 Theory of Matrices.pdf
Module 1 Theory of Matrices.pdf
 
MASSS_Presentation_20160209
MASSS_Presentation_20160209MASSS_Presentation_20160209
MASSS_Presentation_20160209
 
FUZZY LOGIC
FUZZY LOGICFUZZY LOGIC
FUZZY LOGIC
 
2 vectors notes
2 vectors notes2 vectors notes
2 vectors notes
 
sequence and series.docx
sequence and series.docxsequence and series.docx
sequence and series.docx
 
Random Matrix Theory and Machine Learning - Part 3
Random Matrix Theory and Machine Learning - Part 3Random Matrix Theory and Machine Learning - Part 3
Random Matrix Theory and Machine Learning - Part 3
 
L16
L16L16
L16
 
Unit 4 jwfiles
Unit 4 jwfilesUnit 4 jwfiles
Unit 4 jwfiles
 
1533 game mathematics
1533 game mathematics1533 game mathematics
1533 game mathematics
 
Maths-->>Eigenvalues and eigenvectors
Maths-->>Eigenvalues and eigenvectorsMaths-->>Eigenvalues and eigenvectors
Maths-->>Eigenvalues and eigenvectors
 
algorithm Unit 4
algorithm Unit 4 algorithm Unit 4
algorithm Unit 4
 
Finite mathematics
Finite mathematicsFinite mathematics
Finite mathematics
 
01.02 linear equations
01.02 linear equations01.02 linear equations
01.02 linear equations
 
Week_10.2.pdf
Week_10.2.pdfWeek_10.2.pdf
Week_10.2.pdf
 
A Probabilistic Algorithm for Computation of Polynomial Greatest Common with ...
A Probabilistic Algorithm for Computation of Polynomial Greatest Common with ...A Probabilistic Algorithm for Computation of Polynomial Greatest Common with ...
A Probabilistic Algorithm for Computation of Polynomial Greatest Common with ...
 
Linear Algebra Presentation including basic of linear Algebra
Linear Algebra Presentation including basic of linear AlgebraLinear Algebra Presentation including basic of linear Algebra
Linear Algebra Presentation including basic of linear Algebra
 

Recently uploaded

The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
Vijay Dialani, PhD
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
ongomchris
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
BrazilAccount1
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
BrazilAccount1
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
ydteq
 

Recently uploaded (20)

The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
space technology lecture notes on satellite
space technology lecture notes on satellitespace technology lecture notes on satellite
space technology lecture notes on satellite
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
AP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specificAP LAB PPT.pdf ap lab ppt no title specific
AP LAB PPT.pdf ap lab ppt no title specific
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
一比一原版(UofT毕业证)多伦多大学毕业证成绩单如何办理
 

Grovers Algorithm

  • 1. Grover’s Algorithm Quantum Search Algorithm in O( √ N) complexity C. Haaland December 30, 2017
  • 2. Outline Classical Search Quantum Mechanics Overview Notation Mathematics QM Background Grover’s Algorithm Explanation References
  • 3. Classical Search Motivation “Imagine a phone directory containing N names arranged in completely random order. In order to find someone’s phone number with a probability of 0.5, any classical algorithm (whether deterministic or probabilistic) will need to look at a minimum of N/2 names.”
  • 4. Classical Search Motivation “Imagine a phone directory containing N names arranged in completely random order. In order to find someone’s phone number with a probability of 0.5, any classical algorithm (whether deterministic or probabilistic) will need to look at a minimum of N/2 names.” Consider the function F : {0, 1}3 → {0, 1}, F(x, y, z) =(x ∨ y ∨ z)∧ (¬x ∨ ¬y ∨ z)∧ (x ∨ ¬y ∨ ¬z)∧ (¬x ∨ y ∨ ¬z) Question: For what values of the input does F(x, y, z) = 1?
  • 5. Classical Search Complexity Problems are O(N) on a classical computer Lov Grover published a quantum algorithm in 1996 with complexity O( √ N). For large N, this represents a significant improvement over the classical case Quantum algorithm cannot guarantee the correct answer, only returns the solution with high probability
  • 6. Outline Classical Search Quantum Mechanics Overview Notation Mathematics QM Background Grover’s Algorithm Explanation References
  • 7. Outline Classical Search Quantum Mechanics Overview Notation Mathematics QM Background Grover’s Algorithm Explanation References
  • 8. Notation R is set of real numbers
  • 9. Notation R is set of real numbers C is set of complex numbers (e.g. x + iy)
  • 10. Notation R is set of real numbers C is set of complex numbers (e.g. x + iy) Rn (Cn) indicates column vector of n real (complex) numbers respectively
  • 11. Notation R is set of real numbers C is set of complex numbers (e.g. x + iy) Rn (Cn) indicates column vector of n real (complex) numbers respectively z∗ is the complex conjugate If z = x + iy then z∗ = x − iy
  • 12. Notation R is set of real numbers C is set of complex numbers (e.g. x + iy) Rn (Cn) indicates column vector of n real (complex) numbers respectively z∗ is the complex conjugate If z = x + iy then z∗ = x − iy |ψ is Dirac notation for a column vector (ket vector)
  • 13. Notation R is set of real numbers C is set of complex numbers (e.g. x + iy) Rn (Cn) indicates column vector of n real (complex) numbers respectively z∗ is the complex conjugate If z = x + iy then z∗ = x − iy |ψ is Dirac notation for a column vector (ket vector) ψ| is Dirac notation for a row vector (bra vector)
  • 14. Notation (cont’d) A ∈ Rm×n(Cm×n) means A is a matrix of real (complex) numbers with m rows and n columns
  • 15. Notation (cont’d) A ∈ Rm×n(Cm×n) means A is a matrix of real (complex) numbers with m rows and n columns When m = n we call A an operator
  • 16. Notation (cont’d) A ∈ Rm×n(Cm×n) means A is a matrix of real (complex) numbers with m rows and n columns When m = n we call A an operator A† is Hermitian/adjoint/conjugate transpose of A
  • 17. Notation (cont’d) A ∈ Rm×n(Cm×n) means A is a matrix of real (complex) numbers with m rows and n columns When m = n we call A an operator A† is Hermitian/adjoint/conjugate transpose of A If a matrix A has elements Aij the matrix A† has entries A∗ ji An example is ψ| = |ψ †
  • 18. Notation (cont’d) A ∈ Rm×n(Cm×n) means A is a matrix of real (complex) numbers with m rows and n columns When m = n we call A an operator A† is Hermitian/adjoint/conjugate transpose of A If a matrix A has elements Aij the matrix A† has entries A∗ ji An example is ψ| = |ψ † The quantity φ|ψ is called the inner product The quantity is a scalar with value n i=1 φ∗ i ψi
  • 19. Outline Classical Search Quantum Mechanics Overview Notation Mathematics QM Background Grover’s Algorithm Explanation References
  • 20. Vector Norm The norm/length/magnitude squared of |ψ ∈ Cn is defined as ψ|ψ = n i=1 ψ∗ i ψi = n i=1 |ψi |2
  • 21. Vector Norm The norm/length/magnitude squared of |ψ ∈ Cn is defined as ψ|ψ = n i=1 ψ∗ i ψi = n i=1 |ψi |2 This will always be 1 for a valid quantum mechanical state
  • 22. Matrices From the definition of the adjoint (A|ψ )† = (|ψ )† A† = ψ|A† where A ∈ Cn×n
  • 23. Matrices From the definition of the adjoint (A|ψ )† = (|ψ )† A† = ψ|A† where A ∈ Cn×n Because the norm of a quantum state is 1, if |φ = U|ψ then φ|φ = 1
  • 24. Matrices From the definition of the adjoint (A|ψ )† = (|ψ )† A† = ψ|A† where A ∈ Cn×n Because the norm of a quantum state is 1, if |φ = U|ψ then φ|φ = 1 From this we have ( ψ|U† )(U|ψ ) = 1 which means UT U = I
  • 25. Matrices From the definition of the adjoint (A|ψ )† = (|ψ )† A† = ψ|A† where A ∈ Cn×n Because the norm of a quantum state is 1, if |φ = U|ψ then φ|φ = 1 From this we have ( ψ|U† )(U|ψ ) = 1 which means UT U = I An operator satisfying this property is called unitary
  • 26. Matrices From the definition of the adjoint (A|ψ )† = (|ψ )† A† = ψ|A† where A ∈ Cn×n Because the norm of a quantum state is 1, if |φ = U|ψ then φ|φ = 1 From this we have ( ψ|U† )(U|ψ ) = 1 which means UT U = I An operator satisfying this property is called unitary Unitary operators are the way in which quantum states are altered or evolved H = 1 √ 2 1 1 1 −1 , σx = 0 1 1 0 , σy = 0 i −i 0 , σz = 1 0 0 −1
  • 27. Linearity Linearity of a function f means f (x + y) = f (x) + f (y) f (αx) = αf (x)
  • 28. Linearity Linearity of a function f means f (x + y) = f (x) + f (y) f (αx) = αf (x) Matrix multiplication is linear
  • 29. Linearity Linearity of a function f means f (x + y) = f (x) + f (y) f (αx) = αf (x) Matrix multiplication is linear Common modeling approximation in engineering Example: log(1 + x) is very nearly x for small x
  • 30. Linearity & QM Linearity is a fundamental property of QM “With classical fields, we often use linear equations, such as the differential equations that allow us to solve for small oscillatory motion of, say, a pendu- lum. In such a classical case, the linear equation is an approximation; a pendulum with twice the am- plitude of oscillation will not oscillate at exactly the same frequency, for example. Hence we cannot take the solution derived at one amplitude of oscillation of the pendulum and merely scale it up for larger ampli- tudes of oscillation, except as a first approximation. We should emphasize right away, however, that, in quantum mechanics, this linearity of the equations with respect to the quantum mechanical amplitude is not an approximation of any kind; it is apparently an absolute property.”-David Miller (Prof. Stanford University)
  • 31. Outline Classical Search Quantum Mechanics Overview Notation Mathematics QM Background Grover’s Algorithm Explanation References
  • 32. Quantum State Single Particle System Single particle can be in one of two states
  • 33. Quantum State Single Particle System Single particle can be in one of two states Electron, for example, can be spin up, |0 , or spin down, |1
  • 34. Quantum State Single Particle System Single particle can be in one of two states Electron, for example, can be spin up, |0 , or spin down, |1 Particle encodes a single quantum bit or qubit
  • 35. Quantum State Single Particle System Single particle can be in one of two states Electron, for example, can be spin up, |0 , or spin down, |1 Particle encodes a single quantum bit or qubit A qubit is a vector in C2 represented as |0 = 1 0 , |1 = 0 1
  • 36. Quantum State Single Particle System Single particle can be in one of two states Electron, for example, can be spin up, |0 , or spin down, |1 Particle encodes a single quantum bit or qubit A qubit is a vector in C2 represented as |0 = 1 0 , |1 = 0 1 Measuring, we will find the particle in exactly one of the two states
  • 37. Quantum State Single Particle System Single particle can be in one of two states Electron, for example, can be spin up, |0 , or spin down, |1 Particle encodes a single quantum bit or qubit A qubit is a vector in C2 represented as |0 = 1 0 , |1 = 0 1 Measuring, we will find the particle in exactly one of the two states Before measurement this is not true!
  • 38. Quantum State Single Particle System Single particle can be in one of two states Electron, for example, can be spin up, |0 , or spin down, |1 Particle encodes a single quantum bit or qubit A qubit is a vector in C2 represented as |0 = 1 0 , |1 = 0 1 Measuring, we will find the particle in exactly one of the two states Before measurement this is not true! Particle exists in a linear superposition of these states
  • 39. Quantum State Single Particle System Single particle can be in one of two states Electron, for example, can be spin up, |0 , or spin down, |1 Particle encodes a single quantum bit or qubit A qubit is a vector in C2 represented as |0 = 1 0 , |1 = 0 1 Measuring, we will find the particle in exactly one of the two states Before measurement this is not true! Particle exists in a linear superposition of these states State will be |ψ = ψ0|0 + ψ1|1 ψ0, ψ1 ∈ C and |ψ0|2 + |ψ1|2 = 1
  • 40. Quantum State Single Particle System Single particle can be in one of two states Electron, for example, can be spin up, |0 , or spin down, |1 Particle encodes a single quantum bit or qubit A qubit is a vector in C2 represented as |0 = 1 0 , |1 = 0 1 Measuring, we will find the particle in exactly one of the two states Before measurement this is not true! Particle exists in a linear superposition of these states State will be |ψ = ψ0|0 + ψ1|1 ψ0, ψ1 ∈ C and |ψ0|2 + |ψ1|2 = 1 Classical analogy is Schrodinger’s cat that is both alive and dead
  • 41. Quantum State Multi-Particle System Suppose we have n particles each of which can be in one of two states
  • 42. Quantum State Multi-Particle System Suppose we have n particles each of which can be in one of two states The system represents n qubits of information
  • 43. Quantum State Multi-Particle System Suppose we have n particles each of which can be in one of two states The system represents n qubits of information There are N = 2n possible different states |0 . . . 00 , |0 . . . 01 , |0 . . . 10 , . . . , |1 . . . 11
  • 44. Quantum State Multi-Particle System Suppose we have n particles each of which can be in one of two states The system represents n qubits of information There are N = 2n possible different states |0 . . . 00 , |0 . . . 01 , |0 . . . 10 , . . . , |1 . . . 11 Each state is a standard basis vector in RN (i.e. one component equal to 1 and the rest 0) Note: The vector components are not the same as the entries of the Dirac notation
  • 45. Quantum State Multi-Particle System Suppose we have n particles each of which can be in one of two states The system represents n qubits of information There are N = 2n possible different states |0 . . . 00 , |0 . . . 01 , |0 . . . 10 , . . . , |1 . . . 11 Each state is a standard basis vector in RN (i.e. one component equal to 1 and the rest 0) Note: The vector components are not the same as the entries of the Dirac notation Measuring, we will find the system to be in one of N = 2n possible states |ψ ∈ RN
  • 46. Quantum State Multi-Particle System Suppose we have n particles each of which can be in one of two states The system represents n qubits of information There are N = 2n possible different states |0 . . . 00 , |0 . . . 01 , |0 . . . 10 , . . . , |1 . . . 11 Each state is a standard basis vector in RN (i.e. one component equal to 1 and the rest 0) Note: The vector components are not the same as the entries of the Dirac notation Measuring, we will find the system to be in one of N = 2n possible states |ψ ∈ RN Before measurement, it will be in a linear superposition of these states
  • 47. Quantum State Multi-Particle System Suppose we have n particles each of which can be in one of two states The system represents n qubits of information There are N = 2n possible different states |0 . . . 00 , |0 . . . 01 , |0 . . . 10 , . . . , |1 . . . 11 Each state is a standard basis vector in RN (i.e. one component equal to 1 and the rest 0) Note: The vector components are not the same as the entries of the Dirac notation Measuring, we will find the system to be in one of N = 2n possible states |ψ ∈ RN Before measurement, it will be in a linear superposition of these states Its state will be |ψ = ψ0|0 . . . 00 + ψ1|0 . . . 01 + · · · + ψN−1|1 . . . 11 where ψi ∈ C and N−1 i=0 |ψi |2 = 1
  • 48. Born Rule What are the coefficients ψi respresenting physically?
  • 49. Born Rule What are the coefficients ψi respresenting physically? ψi cannot be measured, but |ψi |2 can!
  • 50. Born Rule What are the coefficients ψi respresenting physically? ψi cannot be measured, but |ψi |2 can! Squared magnitude is the probability of measuring the system in state i
  • 51. Born Rule What are the coefficients ψi respresenting physically? ψi cannot be measured, but |ψi |2 can! Squared magnitude is the probability of measuring the system in state i This interpretation is called the Born Rule
  • 52. Born Rule What are the coefficients ψi respresenting physically? ψi cannot be measured, but |ψi |2 can! Squared magnitude is the probability of measuring the system in state i This interpretation is called the Born Rule This is empirical and more like a postulate
  • 53. Born Rule What are the coefficients ψi respresenting physically? ψi cannot be measured, but |ψi |2 can! Squared magnitude is the probability of measuring the system in state i This interpretation is called the Born Rule This is empirical and more like a postulate Many attempts to derive it from first principles
  • 54. Born Rule What are the coefficients ψi respresenting physically? ψi cannot be measured, but |ψi |2 can! Squared magnitude is the probability of measuring the system in state i This interpretation is called the Born Rule This is empirical and more like a postulate Many attempts to derive it from first principles Are we sure it’s completely random?
  • 55. Born Rule What are the coefficients ψi respresenting physically? ψi cannot be measured, but |ψi |2 can! Squared magnitude is the probability of measuring the system in state i This interpretation is called the Born Rule This is empirical and more like a postulate Many attempts to derive it from first principles Are we sure it’s completely random? As far as we can tell, it is actually random (cf. Bell’s Inequalities)
  • 56. Born Rule What are the coefficients ψi respresenting physically? ψi cannot be measured, but |ψi |2 can! Squared magnitude is the probability of measuring the system in state i This interpretation is called the Born Rule This is empirical and more like a postulate Many attempts to derive it from first principles Are we sure it’s completely random? As far as we can tell, it is actually random (cf. Bell’s Inequalities) Some interpretations of this phenomenon are
  • 57. Born Rule What are the coefficients ψi respresenting physically? ψi cannot be measured, but |ψi |2 can! Squared magnitude is the probability of measuring the system in state i This interpretation is called the Born Rule This is empirical and more like a postulate Many attempts to derive it from first principles Are we sure it’s completely random? As far as we can tell, it is actually random (cf. Bell’s Inequalities) Some interpretations of this phenomenon are Copenhagen Interpretation Many World’s Hypothesis Quantum Decoherence
  • 58. Quantum Measurement Wave Particle Duality A wave (of water say) impinging on a screen with two openings will yield a diffraction pattern
  • 59. Quantum Measurement Wave Particle Duality A wave (of water say) impinging on a screen with two openings will yield a diffraction pattern Each opening becomes the source of a new wave front
  • 60. Quantum Measurement Wave Particle Duality A wave (of water say) impinging on a screen with two openings will yield a diffraction pattern Each opening becomes the source of a new wave front The two waves interfere with each other forming alternating peaks and troughs
  • 61. Quantum Measurement Wave Particle Duality A wave (of water say) impinging on a screen with two openings will yield a diffraction pattern Each opening becomes the source of a new wave front The two waves interfere with each other forming alternating peaks and troughs
  • 62. Quantum Measurement (cont’d) Wave Particle Duality Perform the same experiment with an electron gun
  • 63. Quantum Measurement (cont’d) Wave Particle Duality Perform the same experiment with an electron gun A diffraction pattern is observed! This indicates electrons are like waves
  • 64. Quantum Measurement (cont’d) Wave Particle Duality Perform the same experiment with an electron gun A diffraction pattern is observed! This indicates electrons are like waves Now we have an apparatus that can shoot only a single electron at a time
  • 65. Quantum Measurement (cont’d) Wave Particle Duality Perform the same experiment with an electron gun A diffraction pattern is observed! This indicates electrons are like waves Now we have an apparatus that can shoot only a single electron at a time A diffraction pattern! The electron is interfering with itself
  • 66. Quantum Measurement (cont’d) Wave Particle Duality Perform the same experiment with an electron gun A diffraction pattern is observed! This indicates electrons are like waves Now we have an apparatus that can shoot only a single electron at a time A diffraction pattern! The electron is interfering with itself A measurement device is placed on one of the slits to see which one the electron went through
  • 67. Quantum Measurement (cont’d) Wave Particle Duality Perform the same experiment with an electron gun A diffraction pattern is observed! This indicates electrons are like waves Now we have an apparatus that can shoot only a single electron at a time A diffraction pattern! The electron is interfering with itself A measurement device is placed on one of the slits to see which one the electron went through Diffraction pattern is gone. Electron behaves like a particle that goes through one slit or the other when measured The act of measurement has altered the outcome
  • 68. Outline Classical Search Quantum Mechanics Overview Notation Mathematics QM Background Grover’s Algorithm Explanation References
  • 69. Outline Classical Search Quantum Mechanics Overview Notation Mathematics QM Background Grover’s Algorithm Explanation References
  • 70. Grover’s Algorithm Function Inversion Often framed in the context of unstructured database search
  • 71. Grover’s Algorithm Function Inversion Often framed in the context of unstructured database search More precisely, searches a function for a single satisfying input
  • 72. Grover’s Algorithm Function Inversion Often framed in the context of unstructured database search More precisely, searches a function for a single satisfying input Given y, find the corresponding x such that f (x) = y. Invert the function f (·) To search an explicit list (i.e. unstructured database), need a function backing it
  • 73. Grover’s Algorithm Function Inversion Often framed in the context of unstructured database search More precisely, searches a function for a single satisfying input Given y, find the corresponding x such that f (x) = y. Invert the function f (·) To search an explicit list (i.e. unstructured database), need a function backing it If there is no solution or multiple solutions, algorithm does not work out of the box
  • 75. Grover’s Algorithm Algorithm We search for index |ω Initialize n qubits to quantum state |s ∈ RN (N = 2n) which is the uniform superposition of states
  • 76. Grover’s Algorithm Algorithm We search for index |ω Initialize n qubits to quantum state |s ∈ RN (N = 2n) which is the uniform superposition of states |s 1 √ N N i=1 |x = 1 √ N 1
  • 77. Grover’s Algorithm Algorithm We search for index |ω Initialize n qubits to quantum state |s ∈ RN (N = 2n) which is the uniform superposition of states |s 1 √ N N i=1 |x = 1 √ N 1 Repeat r = π 4 √ N times
  • 78. Grover’s Algorithm Algorithm We search for index |ω Initialize n qubits to quantum state |s ∈ RN (N = 2n) which is the uniform superposition of states |s 1 √ N N i=1 |x = 1 √ N 1 Repeat r = π 4 √ N times Define the oracle operator Uω ∈ Rn×n as Uω = I − 2|ω ω| = diag(1, 1, . . . , −1, , . . . , 1, 1 0,1,...,ω,...,N−2,N−1 ) Apply the operator Uω to the qubit state
  • 79. Grover’s Algorithm Algorithm We search for index |ω Initialize n qubits to quantum state |s ∈ RN (N = 2n) which is the uniform superposition of states |s 1 √ N N i=1 |x = 1 √ N 1 Repeat r = π 4 √ N times Define the oracle operator Uω ∈ Rn×n as Uω = I − 2|ω ω| = diag(1, 1, . . . , −1, , . . . , 1, 1 0,1,...,ω,...,N−2,N−1 ) Apply the operator Uω to the qubit state Define the operator Us ∈ Rn×n as Us = 2|s s| − I Apply the operator Us to the qubit state
  • 80. Grover’s Algorithm Algorithm We search for index |ω Initialize n qubits to quantum state |s ∈ RN (N = 2n) which is the uniform superposition of states |s 1 √ N N i=1 |x = 1 √ N 1 Repeat r = π 4 √ N times Define the oracle operator Uω ∈ Rn×n as Uω = I − 2|ω ω| = diag(1, 1, . . . , −1, , . . . , 1, 1 0,1,...,ω,...,N−2,N−1 ) Apply the operator Uω to the qubit state Define the operator Us ∈ Rn×n as Us = 2|s s| − I Apply the operator Us to the qubit state Measure qubits
  • 81. Inversion About the Mean The operator Us can be written as Us =      2 N − 1 2 N · · · 2 N 2 N 2 N − 1 · · · 2 N ... ... ... ... 2 N 2 N · · · 2 N − 1      Applying the operator to |x gives the update xi ← −xi + 2 N N j=1 xj Adds twice the mean of the coefficients to negation of each state State xω was already negated which boosts its value.
  • 82. Grover’s Example N=4 For the case of N = 4 we need only compute r = π 4 √ 4 = 1 iteration Uω|s = (I − 2|ω ω|)|s = |s − 2|ω ω|s = |s − 2|ω (1/ √ 4) Us |s − 2 √ 4 |ω = (2|s s| − I) (|s − |ω ) = 2|s s|s − |s − |s s|ω + |ω = 2|s − |s − |s − |ω = |ω Measure the system to get the answer
  • 87. Grover’s Illustration (N=8, ω=3) Graphical
  • 88. Grover’s Algorithm Notes If the solution does not exist, an answer is returned at random
  • 89. Grover’s Algorithm Notes If the solution does not exist, an answer is returned at random Performing more iterations will degrade the solution probability
  • 90. Grover’s Algorithm Notes If the solution does not exist, an answer is returned at random Performing more iterations will degrade the solution probability Multiple solutions will change the optimal number of iterations needed
  • 91. The Quantum Oracle The oracle is a (problem dependent) function such that f (ω) = 1 and 0 otherwise
  • 92. The Quantum Oracle The oracle is a (problem dependent) function such that f (ω) = 1 and 0 otherwise Each state is then multiplied with (−1)f (x) to “mark” the solution
  • 93. The Quantum Oracle The oracle is a (problem dependent) function such that f (ω) = 1 and 0 otherwise Each state is then multiplied with (−1)f (x) to “mark” the solution Quantum oracle must be able to evaluate on the superposition of indices
  • 94. The Quantum Oracle The oracle is a (problem dependent) function such that f (ω) = 1 and 0 otherwise Each state is then multiplied with (−1)f (x) to “mark” the solution Quantum oracle must be able to evaluate on the superposition of indices Classically, we can only evaluate one query at a time
  • 95. The Quantum Oracle The oracle is a (problem dependent) function such that f (ω) = 1 and 0 otherwise Each state is then multiplied with (−1)f (x) to “mark” the solution Quantum oracle must be able to evaluate on the superposition of indices Classically, we can only evaluate one query at a time QM has natural parallelism; if f can evaluate x or y, then we can evaluate f 1√ 2 (x + y)
  • 96. The Quantum Oracle The oracle is a (problem dependent) function such that f (ω) = 1 and 0 otherwise Each state is then multiplied with (−1)f (x) to “mark” the solution Quantum oracle must be able to evaluate on the superposition of indices Classically, we can only evaluate one query at a time QM has natural parallelism; if f can evaluate x or y, then we can evaluate f 1√ 2 (x + y) A quantum circuit with quantum gates can be built to evaluate the predicate
  • 97. The Quantum Oracle The oracle is a (problem dependent) function such that f (ω) = 1 and 0 otherwise Each state is then multiplied with (−1)f (x) to “mark” the solution Quantum oracle must be able to evaluate on the superposition of indices Classically, we can only evaluate one query at a time QM has natural parallelism; if f can evaluate x or y, then we can evaluate f 1√ 2 (x + y) A quantum circuit with quantum gates can be built to evaluate the predicate Gates such as Hadamard, Pauli Spin, Phase shift, CNOT etc (all are unitary operators) used to build oracles
  • 98. The Quantum Oracle The oracle is a (problem dependent) function such that f (ω) = 1 and 0 otherwise Each state is then multiplied with (−1)f (x) to “mark” the solution Quantum oracle must be able to evaluate on the superposition of indices Classically, we can only evaluate one query at a time QM has natural parallelism; if f can evaluate x or y, then we can evaluate f 1√ 2 (x + y) A quantum circuit with quantum gates can be built to evaluate the predicate Gates such as Hadamard, Pauli Spin, Phase shift, CNOT etc (all are unitary operators) used to build oracles Programming a quantum computer is more like programming an FPGA than writing software
  • 99. Usefulness of Grover’s The O( √ N) bound assumes predicate can be evaluated on superposition of all states
  • 100. Usefulness of Grover’s The O( √ N) bound assumes predicate can be evaluated on superposition of all states f (·) must be implemented in quantum hardware using quantum gates May be difficult to find compact gate representation Problems like database search must first convert to an implicit list Cost of evaluating f (·) may dominate
  • 101. Current State of Quantum Computing IBM claims to have a working prototype of a 50 qubit quantum computer
  • 102. Current State of Quantum Computing IBM claims to have a working prototype of a 50 qubit quantum computer D Wave solves optimization problems by exploiting QM effects
  • 103. Current State of Quantum Computing IBM claims to have a working prototype of a 50 qubit quantum computer D Wave solves optimization problems by exploiting QM effects Much of quantum computing is still theoretical and uses simulation Q#, Libquantum, IBM Q etc Simulation requires lots of memory (e.g. 32 qubits implies 2 · 232 real numbers)
  • 104. Outline Classical Search Quantum Mechanics Overview Notation Mathematics QM Background Grover’s Algorithm Explanation References
  • 105. References https://en.wikipedia.org/wiki/Grover%27s algorithm https://quantiki.org/wiki/grovers-search-algorithm Quantum Mechanics for Scientists and Engineers - David Miller https://web.eecs.umich.edu/ imarkov/pubs/jour/cise05- grov.pdf