1. 1
A Quick Safari Through
Quantum Computation and
Algorithms
M. Reza Rahimi,
Computer Science Department,
Sharif University of Technology,
Tehran, Iran,
August 2005.
2. 2
Outline
Introduction
Quantum Physics
Quantum Physics Foundations
Classical Computation Using Reversible Gates
Quantum Gates and Universal Quantum Gates
Quantum Complexity Class BQP
Case Study: Grovers’ Search Algorithm
Conclusion
3. 3
Introduction
Computation is basically a physical fact. This is the
origin of Church-Turing-Markov thesis, which
implies that:
A Partial function is computable (in any accepted informal sense)
if and only if it is computable by some binary Turing machine.
In this case, Church-Turing’s thesis is saying that
the universe can be simulated by a Turing machine .
4. 4
So if we know the rules of the universe, we can
make good physical model for computation.
One of the first questions that leaded us toward
quantum computation was ” What is the minimum
energy for computing of a special problem?”
In this case we must analysis our program in
respect of power consumption.
Landauer’s Principle:
Erasure of information is necessarily a dissipative process.
If the process of erasure is isothermal then the work needed,
is at least:
W=KTLn2.
5. 5
This rule tells us that any physical computation
process that erases information, is energy
consuming process. ( this fact is derived
according to thermodynamics laws.)
Charles Bennett found another interesting
principle in 1973 that :
“Any computation that can be carried out in the reversible
process is dissipating no power.”
So if we can make reversible gates, we can make
computers that dissipate no power.
This phenomenon will be very important if we want
to make VLSI chip. The generated hit may damage
the chip.
6. 6
As we know: “the universe is fundamentally
quantum mechanics, and the rules of quantum
mechanics are reversible in time, what kinds of
problems quantum machine can solve for us?”
The break of this question was Peter Shor
Algorithm about integer factorization in
polynomial time.
It was not known that integer factorization has a
classical polynomial time algorithm or not.
The time complexity of Shor algorithm for L- digit
number is:
O ( L2 Log ( L) Log ( Log ( L)))
The best known classical algorithm runs in:
1 2
O (exp(cL Log 3 L))
3
7. 7
So studying quantum computation is useful,
For examples :
2. In chip design industry,
3. In cryptography,
4. ……
In this talk I focuse on theoretical point of
quantum computation. At first general
principles of quantum physics and reversible
computation is reviewd, then quantum
complexity class is defined, and finally I focus
on Grover’s search algorithm.
8. 8
Quantum Physics
Quantum physics phenomena are very odd. Let’s
take a look at an example.
In figure 1 we have the wall with two slits on it
and one electron gun which shoots electrons
( Young’s Experiment).
The first experience:
Cover one of the slits and compute the number
of electrons that collide the wall.
Figure 1 shows the results according to our
expectation.
9. 9
Figure 1: The result of the first experience.
The second experience :
Now use both of the slits and count the number
of electrons that collide the wall.
What do you expect?
10. 10
Figure 2: The result of the second experience.
Very interesting result! it seems that electrons
behave like wave.
The third experience:
Now use one detector in one of the slits and see
the movement of electrons. what do you expect to
see on the wall?
11. 11
The experience shows that in this case we have
the result expected in classical physics, that
means the similar result drown in figure 1.
So it seems that classical physics rules can not
describe subatomic phenomena.
We need physical framework for subatomic
physics.
12. 12
Quantum Physics Foundations
States: A state is a complete description of a
physical system. In quantum mechanics a state is a
ray in Hilbert Space . We use the following Dirac
Ket Notation.
ϕ = ∑αi i , αi ∈C
i
Observables: The observable is a property of a
physical system that in principle can be measured.
In quantum mechanics an observable is a self-
adjoint operator:
A = At
13. 13
Measurement: In quantum mechanics the
numerical outcome of a measurement of
observable A is an eigenvalue of A, and the
state of it is eigenstate. Briefly we have:
2 2
ϕ =α 0 + β 1 α + β =1
Which α2 and β are the probability of system
2
to be in state 0 or 1 after measurement.
Dynamics: Time evolution of the system is
unitary we have Schrödinger equation.
d
ϕ(t ) = −iH ϕ(t ) → ϕ(t ) = U (t ) ϕ(0)
dt
U (t ) t U (t ) = I
14. 14
Examples:
State of the n-qubit quantum register is:
∑α ∑α
2
ϕ = s S s =1
n
s∈ 0 ,1} n
{ s∈ 0 ,1}
{
Suppose that we observe one qubit of
quantum register and see it is 0. what is the
state of the register after observation?
1
∑α s 0 ⊗ S + βs 1 ⊗ S 0observed in qreg[1]→
is
∑α s 0 ⊗S
∑α
2
s∈{0 ,1}n −1 s∈{0 ,1}n −1
s
s∈{0 ,1} n −1
15. 15
For 1- qubit system we have:
ϕ =α 0 +β 1 α + β =1
2 2
The above expression means that:
Pr[ After measurement the 1-qubit is in state 0]= α
2
Pr[ After measurement the 1-qubit is in state 1]= β
2
For 2-qubit system we have:
2 2 2 2
ϕ = α 00 00 + α 01 01 + α 10 10 + α 11 11 , α 00 + α 01 + α 10 + α 11 = 1
2
Pr[ After measurement the 2-qubit is in state 00]= α 00
2
Pr[ After measurement the 2-qubit is in state 01]= α01
2
Pr[ After measurement the 2-qubit is in state 10]= α10
2
Pr[ After measurement the 2-qubit is in state 11]= α11
16. 16
Classical Computation Using Reversible
Gates
As stated before if we want to achieve
minimum energy, we must use reversible gates.
f : {0,1}n −1→ 0,1}n
{
1
For example classical AND and OR gates are
not reversible.
One of the most popular reversible gates is
Fredkin gate.
The definition of this gate is as follow:
17. 17
f(a, b, c) = (a, if(a) then b else c, if(a) then c else b).
It is easy to check that F(F(a,b,c))=(a,b,c).
AND, OR, and NOT gates can be easily made up of
Fredkin gate as follow:
a a
a^b
b
Fredkin Gate
0 ¬a^b
Figure 3: AND gate Implementation.
a a
0 ¬a
Fredkin Gate
1 a
Figure 4: NOT gate Implementation.
18. 18
So we can implement any logical circuit with
Universal Fredkin gate. (in linear size with
some control input bits).
Input Bits Output Bits
Fredkin Circuit
Control Input Bits Some Junk output
19. 19
Quantum Gates and Universal Quantum
Gates
As it was said quantum gates are unitary
matrices. For example:
u00 u01
1-input quantum gate is: U =
u , UU t = I
10 u11
α0 0 + β0 1 u u01 α 0 + β 1
U = 00
u
10 u11
U (α0 0 + β0 1 ) = (α 0 + β 1 ).
20. 20
For 2-input quantum gate we have:
u00 u01 u02 u03
α 00 00 + α 01 01 + α10 10 + α11 11 u u11 u12 u13 β 00 00 + β 01 01 + β10 10 + β11 11
U = 10 , UU = I
t
u u21 u22 u23
20
u u31 u32 u33
30
Generally for n-input quantum gate the matrix
size is: 2 × 2
n n
21. 21
There are some examples of famous quantum
gates:
1 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0
0 1 0 0 0 0 0 0
0 0
1 1 1
F =
0 0 1 0 0 0
0
H=
1 − 1
0 0 0 0 1 0 0
2
0 0 0 0 0 1 0 0
0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 1 8×8
Fredkin Quantum Gate Hadamard Quantum Gate
Note that the Fredkin gate is permutation
matrix and Hadamard gate has this property
that if input is in state 0 or 1 the output state
will be symmetric. (Both are Unitary Matrix).
22. 22
Suppose we have n-qbit register and on the
first qbit U operates. what is the new state of
the system?
U
n-qbit n-qbit
(U ⊗ I )( 0 ⊗ ϕ 0 + 1 ⊗ ϕ 1 ) = U 0 ⊗ I ϕ 0 + U 1 ⊗ I ϕ 1
a00 B a01B ...
A ⊗ B = a10 B ... ... ϕ ⊗ φ = ∑αiβ j i ⊗ j
i, j
... ... ...
23. 23
As it is clear the set of all quantum gates are
uncountable, So one may ask are there any
small sets of universal quantum gates?
The answer to this question is Yes.
Researchers have shown that there are some
universal quantum gates that we can make every
quantum circuit with good approximation. (for
example Tofolli and Hadamard Gates is
universal set)
But for now we only use Hadamard and Fredkin
gates.
24. 24
Quantum Complexity Class BQP
Definition: A language L ⊂ {0,1}∗ is in BQP iff there is a set of
quantum circuit {Cn }of size n k that:
2
x ∈ L ⇒ Pr{C ( x)1 = 1} ≥
3
1
x ∉ L ⇒ Pr{C ( x)1 = 1} ≤
3
Also the circuit must be uniform which means that a
n
deterministic polynomial time Turing machine with input 1 writes
the description of the circuit {Cn } .
Note!
the Turing machine writes the approximation of the circuit
because each gate can have complex numbers and for complex
numbers we need generally infinite precession.
25. 25
Theorems:
1. P ⊆ BQP
2. BPP ⊆ BQP
3. BQP ⊆ PSPACE
For proving the first one we know that every
language in P has Polynomial size circuit, we
can easily replace it with Fredkin gate.
For the second one we know that BPP has
polynomial size circuit with random control
bits.
26. 26
x1 |x1>
Out Out
x2 |x2>
x3 Transformation to Quantum circuit |x3>
x4 Classical Circuit |x4> Fredkin Circuit
xn |xn>
rand1 |0> H
rand2 |0> H
randn |0> H
For the proof of the last one you can see
references.
27. 27
Case Study: Grover's Search Algorithm
Problem Statement:
There is quantum space of size N we want the target
state a .
This Problem is usually called Quantum Database Search.
For solving this problem we use Grover Search
Algorithm.
Before presentation of algorithm lets define
some basic unitary operators.
28. 28
1 0 ... 0
0 1 ... 0
. . a = −1 0
ii
0 ... 0 1 N ×N
Phase shift operator which changes the sign of the i th element .
It is Obvious that this operator is unitary.
−1 0 ... 0
0 1 ... 0
D = HN H N , H N = H 2× 2 ⊗ H 2× 2 ⊗ ... ⊗ H 2× 2
... ... ... ...
Log 2 N Times
0 0 0 1
D is called diffusion operator .
29. 29
Lemma: Diffusion operator has two properties:
It is unitary and can be efficiently realized.
It can be interpreted as “inversion about the mean”.
Proof:
−
1 0 ... 0
0 1 ... 0
D =H N ... HN
... ... ...
0 0 ... 1
−
2 0 ... 0
0
0 ... 0
=H N ...
+I N
H
... ... ...
0 0 0 0
−
2 N − N
2 ... − N
2
−
2 N − N
2 ... − N
2
= +I
... ... ... ...
2 N
− − N
2 − N
2 − N
2
2 N +
− 1 − N
2 ... − N
2
− N
2 − N +
2 1 ... − N
2
=
... ... ... ...
− N
2 − N
2 ... − N +
2 1
31. 31
1
1. Start state is ϕ =∑
x .
x N
2. Invert the phase of a using phase shift
operator.
3. Then invert about the mean using D.
4. Repeat step 2 and 3 N times.
5. Measure.
According to the last relation it is obvious
that after N we can measure a with
probability at least 0.5.
Running Time of The Grover Search Algorithm = O ( N ).
32. 32
Conclusion
In this talk we took a glance at quantum
computation.
It is clear that quantum computing can solve
some problems that are hard for classical
computers.
Some people may ask “what is the
philosophical source of the power for
quantum machines?”
Really the sources of the power of quantum
machines are quantum superposition and
quantum entanglement.
33. 33
Talking about these properties is a little long
and deep so for more information you can see
books in quantum mechanics.
Nowadays researchers spend a lot of time
working on theoretical and practical aspects of
quantum machines.
The END