Quantum Computing MAS 725 Hartmut Klauck NTU
Question: Can we solve NP complete problems efficiently on a quantum computer ?? Of course we cannot disprove such a possibility More specific: Is it possible by using only black box techniques? And not the precise problem structure E.g. SAT Problem: given a CNF formula on n variables, is there a satisfying assignment? Trivial approach: Try all 2 n assignments of the variables Can a quantum computer do this efficiently?
Black Box Model Can we solve SAT quickly in the black box model? I.e., assume all we can do is test assignments, we cannot use more information about a formula n Boolean variables, N=2 n assignments Search problem: for bits x 0,...,x N-1 find x i =1 if such an i exists
Search problems Problem 1: Given x 0,...,x N-1, find i with x i =1 if possible Problem 2 : Given x 0,...,x N-1 with a guarantee that there is exactly one x i =1, find i Problem 3: Given x 0,...,x N-1, compute OR(x 0,...,x N-1 ) Problem 4: Given x 0,...,x N-1 with guarantee that either exactly one x i =1 or no x i =1, decide which 2),3) are easier than 1), and 4) is easier than 2),3)
Classical algorithms Consider any randomized algorithm with error 1/3 for Problem 4) We will show: (N) queries are necessary
Quantum algorithms How fast can quantum computers search? Grover’s algorithm needs O(N 1/2 ) queries! A matching lower bound was proved 2 years earlier… Every quantum algorithm for Problem 4) needs (N 1/2 ) queries This rules out “brute force” algorithms for SAT, they need time 2 n/2
Grover’s algorithm [Grover 96] Needs N 1/2 queries in the worst case More general: If there are t positions i with x i =1, then we need (N/t) 1/2 queries
Grover’s algorithm We start by assuming there is exactly one x i =1, unknown to us (Problem 2) Consider vectors |i i and the vector | 0 i = j=0...N-1 1/N 1/2 |j i ”Goal” und “Start” We try to decrease the distance between the two? Consider the plane spanned by|i i and | 0 i ; Let|e i be orthogonal to |i i in that plane
Grover’s algorithm Consider the plane spanned by|i i and | 0 i ; Let|e i be orthogonal to |i i in that plane Reflect around |e i and then around | 0 i Result: |i i |e i |i|i
Grover’s algorithm Consider the plane spanned by|i i and | 0 i ; Let|e i be orthogonal to |i i in that plane Reflect around |e i and then around | 0 i Result: |i i |e i |i|i
Grover’s algorithm Consider the plane spanned by|i i and | 0 i ; Let|e i be orthogonal to |i i in that plane Reflect around |e i and then around | 0 i Result: rotation by 2 |i i |e i |i|i
Grover’s algorithm Consider the plane spanned by|i i and | 0 i ; Let|e i be orthogonal to |i i in that plane Reflect around |e i and then around | 0 i Result: rotation by 2 If our vector has an angle to | 0 i, then first - - to |e i and then 2 + to | 0 i |i i |e i |i|i
Grover’s algorithm Reflect around |e i and then around | i Result: rotation by 2 |e i = i j 1/(N-1) 1/2 |j i How many iterations? At most ( /2)/(2 ) iterations 1/N 1/2 = h i| 0 i = cos( /2- ) = sin( ) Then 1/N 1/2 = sin( ) ¼ and we need around /4 ¢ N 1/2 iterations
Grover’s algorithm Reflect around |e i and then around | i Result: rotation by 2 |e i = i j 1/(N-1) 1/2 |j i But how can we do it? Reflection around |e i : map a|i i + b|e i to -a|i i + b|e i We can do this with a query! Black box query can change sign for|i i when x i =1 |e i |i|i |i i
Grover’s algorithm Reflect around |e i and then around | i Reflection around | 0 i : Apply 2| 0 ih 0 |- I Let N=2 n, positions 0,...,N-1 in binary Implement this unitary by H n P H n, where P|0 n i =|0 n i and P|x i =-|x i otherwise |e i |i|i |i i
Grover’s algorithm Operation 2| 0 ih 0 |- I Implemented as H n P H n, where P|0 n i =|0 n i and P|x i =-|x i otherwise
Grover’s algorithm Operation 2| 0 ih 0 |- I Implemented as H n P H n, where P|0 n i =|0 n i and P|x i =-|x i
Grover’s algorithm Operation 2| 0 ih 0 |- I Other interpretation: vector (a 0,...,a N-1 ) is mapped to vector with (2 j a j /N)-a i in position i Inversion around the average
Grover’s algorithm Black Box: Use additional qubit 1/2 1/2 (|0 i -|1 i ) Apply the usual black box: |i i |a i is mapped to |i i |a © x i i Trick with the additional qubit: black box maps |i i to (-1) x i |i i
Grover’s algorithm Register with n qubits Starting state | 0 i = j=0...N-1 1/N 1/2 |j i [Apply H n to |0 n i ] Iterate roughly N 1/2 times: Apply black box Apply H n P H n, where P|0 n i =|0 n i and P|x i =-|x i Measure i, test also, if x i =1
Grover’s algorithm H H H H H H O H H H H H H H H H H H H P ¼ /4 N 1/2
Example x 0 =1, other x i =0 Start: j=0...N-1 1/N 1/2 |j i Query: j=1...N-1 1/N 1/2 |j i - 1/N 1/2 |0 i Inversion around the average vector (a 0,...,a N-1 ) maps to vector with (2 j a j /N)-a i in position i Result: amplitude of |0 i increases to roughly 3/N 1/2, other amplitudes stay almost the same Repeat…. Finish after ( /2)/(2/N 1/2 )=( /4) N 1/2 steps
Exact number of iterations If we iterate too many times we move away from the desired final state! Start: j=0...N-1 1/N 1/2 |j i 1/N 1/2 |i 0 i + j i 0 1/N 1/2 |j i k j : amplitude of i 0 after j iterations; l j : other amplitudes after j iterations; k 0,l 0 =1/N 1/2 Next iteration k j+1 = (N-2)/N ¢ k j +2(N-1)/N ¢ l j l j+1 = (N-2)/N ¢ l j -2/N ¢ k j We can show that k j =sin((2j+1) ); l j =1/(N-1) 1/2 cos((2j+1) ) where such that sin 2 ( )=1/N k m =1 if (2m+1) = /2, if m=( -2 )/(4 ) Error is smaller than 1/N if b /4 N 1/2 c iterations
More than one solution Assume there are t values of i with x i =1 t known Same algorithm, fewer iterations Similar analysis as before, error t/N after b /4 ¢ (N/t) 1/2 c iterations Important observation: superposition over all marked positions |i i (the goal state) has inner product (t/N) 1/2 with | Á 0 i and so angle between | Á 0 i and |e i is of that size
Unknown number of solutions There are t values of i with x i =1 t is now unknown We use smaller and smaller estimates for t and run the previous algorithm s=N/2,N/4,N/8,..., ¼ t/2,... Every time we make O((N/s) 1/2 ) queries Total number of queries s=N/2,N/4,...,t/2 (N/s) 1/2 = O((N/t) 1/2 ) Consider (N/t) -1/2 ¢ a=1,...,log N-log t+1 2 a/2 =O(1) geometric sum
Classical algorithms Consider randomized algorithms with error 1/3 for Problem 4) We show that we need (N) queries
Classical algorithms Given: randomized algorithm If we have a randomized algo with T queries (worst case) and success probability p then there is a deterministic algorithm with T queries and success p for random x E x E r [Success for x with r]=p ) there is r, such that E x [Success for x] ¸ p Fix r ) deterministic algorithm
Classical algorithms Distribution on inputs: probability 1/2 for 0 N, inputs 000 have probability 1/(2N) each Deterministic algo with error 1/3 and <N/3 queries Must be correct on 000 00 If 2/3 ¢ N positions, that could be one, hence the algorithm makes mistakes on >2N/3, error >1/3 Every algorithm needs at least N/3 queries
Quantum search Grover does it in O(N 1/2 ) Lower bound for Problem 4) (N 1/2 )
The lower bound Consider quantum query algorithm A Run A on 0 N, with T queries States 0...N-1 a i,t |i i |u i,t i |v i,t i i: address, u register for output of the black box, v for workspace, t=1..T time Define query magnitude M(i) = t=1...T |a i,t | 2 Intuitively “probability of querying i” E i M(i) · T/N Fix i with M(i) · T/N A has little information regarding x i, cannot decide well whether x i =1 or =0
The lower bound Query magnitude M(i) = t=1...T |a i,t | 2 Fix i with M(i) · T/N Cauchy Schwarz: t=1...T |a i,t | · t=1...T 1 ¢ |a i,t | · T 1/2 ( t=1...T |a i,t | 2 ) 1/2 · T/N 1/2 y(i) is a string with y(i) i =1 and 0 elsewhere Consider the following situations: In query 1 to t Black Box holds 0 N From query t+1 Black Box holds y(i) Final state | (t) i | (0) i Final state on y(i); | (T) i Final state on 0 N
The lower bound Consider distance between | (t) i and | (t-1) i Then: Same until step t-1 In step t we introduce distance 2 1/2 |a i,t | From step t+1 no change Set |E(t) i = | (t) i -| (t-1) i Then k E(t) k· 2 1/2 |a i,t |
The lower bound | (0) i final state on y(i); | (T) i final state on 0 N k | (T) i - | (0) i k = k | (T) i - | (T-1) i +| (T-1) i - | (0) i k · k | (T) i - | (T-1) i k + k | (T-1) i - | (0) i k · t=1...T k | (t) i - | (t-1) i k = t=1...T k |E (t) i k · t=1...T 2 1/2 |a i,t | · 2 1/2 T/N 1/2 If T<N 1/2 /10, then the distance is some small constant, i.e., the error will be large and 0 N and y(i) have the same output with some good probability