QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM...

38
1 Quantum Computing Prof. Dr. Jean-Pierre Seifert [email protected] http://www.sec.t-labs.tu-berlin.de/

Transcript of QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM...

Page 1: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

1

Quantum Computing

Prof. Dr. Jean-Pierre Seifert

[email protected]://www.sec.t-labs.tu-berlin.de/

Page 2: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

2

Outline for this lecture

Simple Quantum Algorithms

Page 3: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

3

SIMPLE QUANTUM ALGORITHMS

r This chapter presents very basic techniques of designing

quantum algorithms that are more efficient than their

classical counterparts.

r Quantum algorithms for the

m Deutsch,

m Deutsch-Jozsa and

m Simon problems

are presented and analyzed.

r Power of m quantum parallelism,

m constructive and destructive interference and

m entanglement

r are illustrated.

Page 4: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

4

QUANTUM PARALLELISM

r If

f : {0, 1, . . . , 2n − 1} → {0, 1, . . . , 2n − 1}

then the mapping

f ´ : (x, b) → (x, b ⊕ f(x)),

r where x, b ∈ {0, 1, . . . , 2n − 1} is one-to-one and

therefore there is a unitary transformation Uf such

that

Uf |x⟩|0⟩ = |x⟩|f(x)⟩.

Page 5: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

5

QUANTUM PARALLELISM

r Let

|ψ⟩ = �

��∑ |i⟩|0⟩����

�� .

r Then, with a single application of the mapping Uf

we will get

Uf |ψ⟩ = �

��∑ |i⟩|f (i)⟩����

�� .

r Thus, IN A SINGLE COMPUTATIONAL STEP 2n

VALUES OF f ARE COMPUTED!

Page 6: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

6

INTERPRETATION of QUANTUM PARALLELISM

r Last application of the unitary transformation Uf results in a

state with 2n values of function f .

r In case of n = 100 that resulting state contains billion billion

trillion values of function f .

r Such a massive parallelism is an important part of the

magic quantum computation exhibits.

r However, the major part of such a magic is only apparent.

r Actually one cannot say that the result of such a computation is 2n evaluations of f .

r All one can say is that such a unitary mapping results in a state that fully specifies all values of the function f .

Page 7: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

7

INTERPRETATION of QUANTUM PARALLELISM

r There is, however, in general no way to learn from the resulting state all the values of the function f .

r There is, however, often a way to get, using such quantum

parallelism, important relations between values of the function f

m usually at the price of being no longer able to get values of f , but

instead to its arguments.

Page 8: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

8

INTERPRETATION of QUANTUM PARALLELISM I

r It is wrong, and deeply misleading to say that after an application of the unitary Uf as follows

Uf |ψ⟩ = �

��∑ |i⟩|f (i)⟩����

��

r the quantum computer has evaluated the function f(x) for all

0 ≤ x < 2n.

r Such assertions are based on the mistaken view that each

quantum state encodes a property inherent in the qubits.

r The state encodes only the possibilities available for the

extraction of information from those qubits.

Page 9: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

9

INTERPRETATION of QUANTUM PARALLELISM I

r Due to that “parallelism” QC nevertheless permits a

quantum machine to perform “tricks” that no

classical computer can accomplish.

Page 10: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

10

MEASUREMENT — EXAMPLE

r If we “measure” the second register of the state

|φ⟩ = �

��∑ |i⟩|f (i)⟩����

��

r with respect to the standard basis {|z⟩ | z ∈ {0, 1}n}, then the

state |φ⟩ collapses into one of the states

|φy⟩ = �

∑ |x⟩|y⟩{�|�(�)��}

r where

m y is in the range of the values of the function f,

m � = |{�|�(�) = �}|

Page 11: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

11

MEASUREMENT — EXAMPLE

r and collapse into the state |φy⟩ happens with the probability

��.

r I.e., in the classical world one gets information which y in

the range of f , in the second register, has been (randomly)

chosen.

r This fact we usually interpret as that y is the (classical)

result of the measurement of the second register of the state |φ⟩, with respect to the standard basis.

Page 12: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

12

REDUCTION of PROJECTIVE MEASUREMENT TO COMPUTATIONAL BASIS MEASUREMENT I

r The above figure shows one way how to reduce the

measurement with respect to any orthogonal basis {|φj⟩}j=1, …, 2

n to a measurement with respect to the

computational basis {|j⟩}j=1, …, 2n.

r Through measurement the state |j⟩ is obtained with

probability |αj|2. The state of the system after this

measurement is |j⟩. After inverse unitary U−1 is applied the

resulting state will be |φj⟩ to the standard basis.

Page 13: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

13

REDUCTION of PROJECTIVE MEASUREMENT TO COMPUTATIONAL BASIS MEASUREMENT I

r At first a unitary transformation U is applied that transforms

the basis {|φj⟩}j to the computational basis.

Page 14: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

14

REDUCTION of PROJECTIVE MEASUREMENT TO COMPUTATIONAL BASIS MEASUREMENT II

r Another way to implement the von Neumann measurements is as follows. First the outcome of the transformation U is mapped into ancillary registers to create the state ∑ αj

|j⟩|j⟩� . The inverse basis

change unitary U−1 leaves as result the state ∑ |φ(j)⟩|j⟩� . The following

measurement of the ancillary register in the computational basis gives the outcome ”j” with probability |αj|

2 and leaves the main register in the

state |φj⟩.

Page 15: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

15

Uf OPERATOR versus Vf OPERATOR

r Another very important operator related to functions

f :{0, 1, . . . , 2n − 1} → {0, 1}

r is the operator

Vf : |x⟩→ (−1) f(x) |x⟩,

r where x ∈ {0, 1, . . . , 2n − 1}, which can be expressed using

the operator

Uf : |x, b ⟩ → |x, b ⊕ f(x)⟩

r and one additional qubit, called again ancilla, initialized to

the state �

�(|0⟩ − |1⟩) as follows

Uf : |x, �

�(|0⟩ − |1⟩)⟩ =

�(|x, 0 ⊕ f(x)⟩ − |x, 1 ⊕ f(x)⟩)

= (−1) f(x) |x⟩ ⊗ �

� (|0⟩ − |1⟩)

Page 16: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

16

EXAMPLE

r Mapping Vf : {0, 1}2 → {0, 1} is realized by the

unitary matrix

Page 17: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

17

Deutsch’s Problem –randomized solution

r Given a function f :{0, 1} → {0, 1}, as a black box,

the task is to determine whether f is constant or

balanced, i.e., f(0) ⊕ f(1) = 0 (constant) or 1

(balanced).

m In classical computing 2 calls of f are required.

m In quantum computing 1 call of f is sufficient.

Page 18: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

18

Deutsch’s Problem –randomized solution

r The quantum algorithm as presented above solves the problem with probability 1/2 in such a way that we know

whether the answer is correct.

r Consider

Uf : �

�(|0⟩ + |1⟩)|0⟩ =

�(|0, f(0)⟩ + |1, f(1)⟩).

Page 19: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

19

Deutsch’s Problem –randomized solution

r The above quantum algorithm solves the problem with probability 1/2 in such a way that we know whether the

answer is correct. Since

Uf : �

�(|0⟩ + |1⟩)|0⟩ =

�(|0, f(0)⟩ + |1, f(1)⟩)

(the result can be written as follows)

r If f is constant, i.e., f ({0,1})=0, f ({0,1})=1:

= �

�(|0, 0⟩ + |1, 0⟩)

= �

�(|0, 1⟩ + |1, 1⟩)

r If f is balanced , i.e., f (1)=0, f (0)=1:

= �

�(|0, 0⟩ + |1, 1⟩)

= �

�(|0, 1⟩ + |1, 0⟩)

Entangled output!

Page 20: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

20

Deutsch’s Problem –randomized solution

r �2 on second qubit

If f is constant, i.e., f ({0,1})=0, f ({0,1})=1:�

� �

�(|0, 0⟩ + |0, 1⟩ + |1, 0⟩ + |1, 1⟩)

�� �

�(|0, 0⟩ − |0, 1⟩ + |1, 0⟩ − |1, 1⟩)

r �2 on second qubit

If f is balanced , i.e., f (1)=0, f (0)=1: �

� �

�(|0, 0⟩ + |0, 1⟩ + |1, 0⟩ − |1, 1⟩)

�� �

�(|0, 0⟩ − |0, 1⟩ + |1, 0⟩ + |1, 1⟩)

Page 21: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

21

Deutsch’s Problem –randomized solution

r Measure second qubit

If f is constant, i.e., f ({0,1})=0, f ({0,1})=1:�

�(|0, 0⟩ − |0, 1⟩ + |1, 0⟩ − |1, 1⟩)

in each case (0 or 1 measure) first qubit one will be in state�

�(|0⟩ + |1⟩)

r Measure second qubit, here first qubit depends on second qubit

If f is balanced , i.e., f (1)=0, f (0)=1: �

� �

�(|0, 0⟩ + |0, 1⟩ + |1, 0⟩ − |1, 1⟩)

�� �

�(|0, 0⟩ − |0, 1⟩ + |1, 0⟩ + |1, 1⟩)

measure 0 : overall state (|00⟩ + |10⟩)

measure 1 : overall state (|01⟩ − |11⟩) or(−|01⟩ + |11⟩)

Page 22: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

22

Deutsch’s Problem –randomized solution

r Summing up our situation:

r Measure second qubit as 0,

then first qubit one will be in state�

�(|0⟩ + |1⟩)

r Measure second qubit as 1,

then first qubit will be in state�

�(|0⟩ + |1⟩) f is constant

and

then first qubit will be in state�

�(|0⟩ − |1⟩) f is balanced

Page 23: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

23

Deutsch’s Problem –randomized solution

r Measure second qubit as 1,

then first qubit will be in state�

�(|0⟩ + |1⟩) : f is constant

and

then first qubit will be in state�

�(|0⟩ − |1⟩) : f is balanced

Thus �2 on first qubit:

�(|0⟩ + |1⟩)

��|0⟩ : f is constant

�(|0⟩ − |1⟩)

��|1⟩ : f is balanced

Page 24: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

24

Deutsch’s Problem –randomized solution

r If the measurement of the second qubit in the provides 0 we

have lost all information about f.

r Otherwise the measurement of the first qubit yields the

correct result.

Page 25: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

25

Deutsch’s Problem –deterministic solution

r Apply first the Hadamard transform on both registers in the initial state |0, 1⟩ and then Uf to get

Page 26: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

26

Deutsch’s Problem –deterministic solution

�2|0, 1⟩�

�(|0⟩ + |1⟩) (|0⟩ − |1⟩)

=�

�(|0⟩(|0⟩ − |1⟩) + |1⟩(|0⟩ − |1⟩))

Uf �

�(|0⟩(|0⊕f(0)⟩ − |1⊕f(0)⟩) + |1⟩(|0 ⊕f(1)⟩ − |1 ⊕f(1)⟩))

=�

�(∑ (−1) f(x) |x⟩(|0⟩ |1⟩)�

�� )=

�((−1) f(0) |0⟩ + (−1) f(1) |1⟩)(|0⟩ − |1⟩)

r From the above right side the two possibilities for f to be

constant lead to left sides and to two possibilities for f to be

balanced, i.e.,

Page 27: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

27

Deutsch’s Problem –deterministic solution

1

2((−1) f(0) |0⟩ + (−1) f(1) |1⟩)(|0⟩ − |1⟩)

r By measuring the first bit, with respect to the dual basis, we can immediately see whether f is constant or balanced.

constant

balanced

f ({0,1})=0

f ({0,1})=1

, f (1)=1

, f (1)=0

Page 28: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

28

Even-Odd Problem

r A function f :{0, 1}2 → {0, 1} is called even (odd) if the range of f has an even (odd) number of ones.

r Classically, given such a function f as an oracle, one

needs 4 calls of f to determine whether f is even or odd.

r On a QC one can do

r and therefore using only two quantum calls of f (of Vf ), the

problem is transformed into the problem to distinguish two

non-orthogonal quantum states.

r Unfortunately, there is no projection measurement that can

faithfully distinguish such non-orthogonal states, but …

Page 29: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

29

Deutsch-Jozsa Promise Problem

r Given a function f :{0, 1}n → {0, 1}, as a black box, that is

(promised to be) balanced or constant. Decide which property f has.

r Classical deterministic computers need, in the worst case,

exponential time to solve the problem.

r Surprisingly, there is a quantum algorithm to solve the problem by applying f only once.

Page 30: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

30

Deutsch-Jozsa Promise Problem

r Let us consider one quantum register with n qubits and

apply the Hadamard transformation Hn to this register. This

yields

|0"⟩ �

|φ⟩ = �

��∑ |i⟩����

��

r By applying now the transformation Vf (only on this

register?!) we get

Vf |φ⟩ = �

��∑ (−1) f(i)|i⟩����

�� ≝ |φ1⟩

r What has been achieved by these operations?

r The values of f were transferred to their amplitudes.

Page 31: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

31

Deutsch-Jozsa Promise Problem

r The former fact can be utilized, through the power of

quantum superposition and a proper observable, as follows.

r Let us consider the observable D ={Ea, Eb}, where Ea is the

one-dimensional subspace spanned by the vector

|Ψa⟩ = �

��∑ |i⟩����

�� ,

r and Eb = (Ea)⊥. The projection of |φ1⟩ onto Ea and Eb has the

form

|φ1⟩ = α |Ψa⟩ + β |Ψb⟩ with |α|2 +|β|2 = 1,

where |Ψb⟩ is a vector in Eb such that |Ψb⟩⊥ |Ψa⟩.

r Thus, a measurement by D provides “the value a or b” with

probability |α|2 or |β|2.

Page 32: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

32

Deutsch-Jozsa Promise Problem

r It is easy to determine α from

|φ1⟩ = α |Ψa⟩ + β |Ψb⟩ with |α|2 +|β|2 = 1,

using the above projection of |φ1⟩ onto Ea by the computation

α = ⟨Ψa | φ1⟩.

Page 33: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

33

Deutsch-Jozsa Promise Problem

r Indeed

α = ⟨Ψa | φ1⟩

= �

��∑ ⟨i|����

���

��∑ (−1) f(j)|j⟩����

��

= �

��∑ ∑ ����

�������� (−1) f(j) ⟨i | j⟩

= �

��∑ ����

�� (−1) f(j)

because ⟨i | j⟩ = 1 if and only if i = j and 0 otherwise.

Page 34: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

34

Deutsch-Jozsa Promise Problem

r Yet, we have

α = �

��∑ ����

�� (−1) f(j).

r If f is balanced, then the sum for α contains the same

number of 1s and −1s and therefore α = 0. A measurement of |φ1⟩ with respect to D, therefore provides, for sure, the

outcome b.

r If f is constant, then either α = 1 or α = −1 and therefore the measurement of |φ1⟩ with respect to D always gives the

outcome a.

r A single measurement of |φ1⟩, with respect to D, therefore

provides the solution of the problem with probability 1.

Page 35: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

35

Deutsch-Jozsa – second solution

r If the Hadamard transformation is applied to the state |φ1⟩we get

Hn |φ1⟩ = �

��∑ (−1) f

(i)������

��∑ (−1)u

∗ i|u⟩����

'�

= �

��∑ ∑ ����

�� (−1)u ∗

i (−1) f

(i)����'� |u⟩

r If f is constant, then

r If f is balanced, then

r One measurement therefore shows with prob. 1 whether f is

balanced or not.

I.e., Hn |φ1⟩ = |0⟩ with prob. 1 iff. f is constant.

Page 36: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

36

Deutsch-Jozsa – randomized solution

r It is easy to show that though deterministic algorithms to solve the Deutsch-Jozsa problem for n = 2k require 2k−1 + 1

queries in the worst case, there are probabilistic algorithms

to solve this problem relatively fast, if we are willing to

tolerate some error.m Indeed, a randomized algorithm can solve the Deutsch-Jozsa problem with

probability of error at most 1/3 with only two queries.

m The probability of error can be reduced to less than 1/2k with only k + 1

queries.

r Therefore, in spite of the fact that there is an exponential

gap between deterministic classical and exact quantum

query complexity, the gap between randomized classical

complexity and quantum query complexity is in this case

constant in the case of constant error.

Page 37: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

Outline for next lecture

Simon´s Problem

37

Page 38: QC15 05 simple quantum algos - TU Berlin · 2016. 6. 13. · 6 INTERPRETATION of QUANTUM PARALLELISM Last application of the unitary transformation Uf results in a state with 2n values

38

Questions?