Professional Documents
Culture Documents
Grover Algorithm in Detail
Grover Algorithm in Detail
Grover Algorithm in Detail
Computing
Juris Smotrovs
University of Latvia
1 2 n 1
2 2 2
1
0
... and |1 = 0 |0 + 1 |1 or 0
1
Eiropas Socil fonda projekts
Datorzintnes pielietojumi un ts saiknes ar kvantu fiziku
Nr.2009/0216/1DP/1.1.1.2.0/09/APIA/VIAA/044
Memory: a quantum bit (qubit)
The exact state of an unknown qubit 0 |0 + 1 |1
cannot be learned
The information from a qubit can be obtained by a
measurement (we will talk about it in more detail
later)
One can measure whether qubit is in state |0 or |1
Then one will obtain:
the answer |0 with probability |0|2,
the answer |1 with probability |1|2
After the measurement the qubit collapses to the
state equal with the given answer
Eiropas Socil fonda projekts
Datorzintnes pielietojumi un ts saiknes ar kvantu fiziku
Nr.2009/0216/1DP/1.1.1.2.0/09/APIA/VIAA/044
Memory: a qubit register
We can put 2 qubits 0 |0 + 1 |1 and 0 |0 + 1 |1
together forming a two qubit register
Then if we measure both qubits, we will obtain for the
first qubit:
the answer |0 with probability |0|2,
the answer |1 with probability |1|2
... and for the second qubit:
the answer |0 with probability |0|2,
the answer |1 with probability |1|2
Eiropas Socil fonda projekts
Datorzintnes pielietojumi un ts saiknes ar kvantu fiziku
Nr.2009/0216/1DP/1.1.1.2.0/09/APIA/VIAA/044
Memory: a qubit register
Alternatively, we can look on a two qubit
register as on a four state |0|0, |0|1, |1|0,
|1|1 system
From such viewpoint we will get:
the answer |0|0 with probability |00|2,
the answer |0|1 with probability |01|2,
the answer |1|0 with probability |10|2,
the answer |1|1 with probability |11|2
Eiropas Socil fonda projekts
Datorzintnes pielietojumi un ts saiknes ar kvantu fiziku
Nr.2009/0216/1DP/1.1.1.2.0/09/APIA/VIAA/044
Memory: a qubit register
A multiplication law works:
0 1 1 0 0 1 1
0
0 0 0 0 0 1 0 1 1 0 1 0 11 1 1
0 0 0
0
0 0 1 0 1
1 1 0 1 0
1 1 1
1
1 2 n 1
2 2 2
00 00 01 01 10 10 11 11
where 00 01 10 11 1
2 2 2 2
1 1
0 0 1 1 1
2 2 2 2
H
1
1
0
1
1 1 1
2 2
2 2
00 00 1 0 0 0
01 01 0 1 0 0
CNOT
10 11 0 0 0 1
0
11 10 0 1 0
|0 H
CNOT
|0
|0 H
CNOT
|0
0 0 00
Eiropas Socil fonda projekts
Datorzintnes pielietojumi un ts saiknes ar kvantu fiziku
Nr.2009/0216/1DP/1.1.1.2.0/09/APIA/VIAA/044
Computation: unitary operators
Example of a computation, creation of the Bell state |+ :
|0 H
CNOT
|0
1 1 1 1
0 1 0 00 10
2 2 2 2
Eiropas Socil fonda projekts
Datorzintnes pielietojumi un ts saiknes ar kvantu fiziku
Nr.2009/0216/1DP/1.1.1.2.0/09/APIA/VIAA/044
Computation: unitary operators
Example of a computation, creation of the Bell state |+ :
|0 H
1 1
CNOT 00 11
2 2
|0
|0 = E1
1/2
0 |0
measurement
|0 H
.................................. f ................. f ....
|0 H
|0 P
measurement
|0 H
.................................. f ................. f ....
|0 H
|0 P
0n 0
Eiropas Socil fonda projekts
Datorzintnes pielietojumi un ts saiknes ar kvantu fiziku
Nr.2009/0216/1DP/1.1.1.2.0/09/APIA/VIAA/044
Efficient quantum algorithm
Example: the Deutsch-Jozsa algorithm (1992)
|0 H
measurement
|0 H
.................................. f ................. f ....
|0 H
|0 P
1
2 n 1
x 0
x 0
n
2
Eiropas Socil fonda projekts
Datorzintnes pielietojumi un ts saiknes ar kvantu fiziku
Nr.2009/0216/1DP/1.1.1.2.0/09/APIA/VIAA/044
Efficient quantum algorithm
Example: the Deutsch-Jozsa algorithm (1992)
|0 H
measurement
|0 H
.................................. f ................. f ....
|0 H
|0 P
1
2 n 1
x 0
x f ( x)
n
2
Eiropas Socil fonda projekts
Datorzintnes pielietojumi un ts saiknes ar kvantu fiziku
Nr.2009/0216/1DP/1.1.1.2.0/09/APIA/VIAA/044
Efficient quantum algorithm
Example: the Deutsch-Jozsa algorithm (1992)
|0 H
measurement
|0 H
.................................. f ................. f ....
|0 H
|0 P
1
n
x 0
2 n 1
1 f ( x)
x f ( x)
2
Eiropas Socil fonda projekts
Datorzintnes pielietojumi un ts saiknes ar kvantu fiziku
Nr.2009/0216/1DP/1.1.1.2.0/09/APIA/VIAA/044
Efficient quantum algorithm
Example: the Deutsch-Jozsa algorithm (1992)
|0 H
measurement
|0 H
.................................. f ................. f ....
|0 H
|0 P
1
n
x 0
2 n 1
1 f ( x)
x 0
2
Eiropas Socil fonda projekts
Datorzintnes pielietojumi un ts saiknes ar kvantu fiziku
Nr.2009/0216/1DP/1.1.1.2.0/09/APIA/VIAA/044
Efficient quantum algorithm
Example: the Deutsch-Jozsa algorithm (1992)
|0 H
measurement
|0 H
.................................. f ................. f ....
|0 H
|0 P
1
1
1
2 n 1 2 n 1
x 0 , Econstant span x 0 , Ebalanced Econstant
f ( x)
x 0 x 0
2
n n
2
Eiropas Socil fonda projekts
Datorzintnes pielietojumi un ts saiknes ar kvantu fiziku
Nr.2009/0216/1DP/1.1.1.2.0/09/APIA/VIAA/044
Efficient quantum algorithm
Econstant is one-dimensional: Econstant = span(|) where
1
2 n 1
x 0
x 0
n
2
Therefore the length of the projection of | on Econstant is the
scalar product of | and |, denoted by |:
1 n x 0 1
1 1 1
x 0
2 n 1 f ( x) 2 n 1 f ( x)
2n 2n 2
... which is by absolute value 1 iff f is constant, and 0 iff f is
balanced
The quantum algorithm is correct with probability 1 and with just
two queries (classically 2n-1+1 are needed in the worst case)
Eiropas Socil fonda projekts
Datorzintnes pielietojumi un ts saiknes ar kvantu fiziku
Nr.2009/0216/1DP/1.1.1.2.0/09/APIA/VIAA/044
Efficient quantum algorithm
Another example: Grovers algorithm (1996)
Input: a black-box function f: {0,1}n {0,1} such
that f(x) = 1 just for one (unknown) value, x = x0; for
all other values f(x) = 0
The algorithm can query the black box; the number of
queries determines the complexity of algorithm
The black box queries on classical inputs work like
this: input |x, output (1) f (x)|x
Output: x0
Eiropas Socil fonda projekts
Datorzintnes pielietojumi un ts saiknes ar kvantu fiziku
Nr.2009/0216/1DP/1.1.1.2.0/09/APIA/VIAA/044
Efficient quantum algorithm
Example: the Grovers algorithm (1996)
|0 H
measurement
|0 H f D
.................................. ........ ....
|0 H
iterate O(N) times
N = 2n
1 0 0 0 0
0 1 0 0 0
f - query 0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
x0
1 2 2
2
2 N N
N
N N 1
2 2
D N 2
J I
N
2 2
N2 1
N N
a1 a1 2m a1 m (m a1 )
a2 2 a2 2m a2 m ( m a2 )
D N J I
a a 2m a m ( m a )
N N N N
a1 a2 a N
where m
N
measurement
|0 H f D
.................................. ........ ....
|0 H
iterate O(N) times
0n
Eiropas Socil fonda projekts
Datorzintnes pielietojumi un ts saiknes ar kvantu fiziku
Nr.2009/0216/1DP/1.1.1.2.0/09/APIA/VIAA/044
Efficient quantum algorithm
Example: the Grovers algorithm (1996)
|0 H
measurement
|0 H f D
.................................. ........ ....
|0 H
iterate O(N) times
T
1 1 1 1
N 1
x 0
x
N N N N
Eiropas Socil fonda projekts
Datorzintnes pielietojumi un ts saiknes ar kvantu fiziku
Nr.2009/0216/1DP/1.1.1.2.0/09/APIA/VIAA/044
Efficient quantum algorithm
The values of the components of the state vector
5/N
4/N
3/N
2/N
1/N
0
|0 |1 |2 |x01 |x0 |x0+1 |N2 |N1
1/N
2/N
3/N
5/N
4/N
3/N
2/N
1/N
..... .....
0
|0 |1 |2 |x01 |x0+1 |N2 |N1
1/N
|x0
2/N
3/N
5/N
4/N
3/N
2/N
1/N mean
..... .....
0
|0 |1 |2 |x01 |x0+1 |N2 |N1
1/N
|x0
2/N
3/N
5/N
4/N
3/N
2/N
1/N
..... .....
0
|0 |1 |2 |x01 |x0+1 |N2 |N1
1/N
|x0
2/N
3/N
5/N
4/N
3/N
2/N
1/N mean
..... .....
0
|0 |1 |2 |x01 |x0+1 |N2 |N1
1/N
|x0
2/N
3/N
Questions?