This preview shows page 1. Sign up to view the full content.
Unformatted text preview: C/CS/Phys 191 Fall 2005 Deutsch and DeutschJosza algorithms Lecture 17 10/25/05 1 Readings
Benenti et al., Ch. 3.9  3.9.2 Stolze and Suter, Quantum Computing, Ch. 8.2  8.2.5) Nielsen and Chuang, Quantum Computation and Quantum Information, Ch. 1.4.3, 1.4.4 2 Deutsch’s algorithm
Deutsch’s algorithm is a perfect illustration of all that is miraculous, subtle, and disappointing about quantum computers. It calculates a solution to a problem faster than any classical computer ever can. It illustrates the subtle interaction of superposition, phasekick back, and interference. Finally, unfortunately, is solves a completely pointless problem. Deutsch’s algorithm answers the following question: suppose f (x) is either constant or balanced, which one is it? If f (x) were constant then for all x the result is either 0 or 1. However, if f (x) were balanced then for one half of the inputs f (x) is 0, and for the other half it is 1 (which x’s correspond to 0 or 1 is completely arbitrary). To answer this question classically, we clearly need to query the function for both x = 0 and x = 1, hence two queries are required. Using a quantum algorithm it turns out that we can solve the problem with just one query of the function. x x Uf
y y f(x)
√ Figure 1: If U f implements f , x is input as 0 + 1 / 2 and y as 0 , then the output is equal to √ 0, f (0) + 1, f (1) / 2. This illustrates the basic feature of parallelism in quantum algorithms. We begin by illustrating how superposition of quantum state creates quantum parallelism or the ability to compute on many states simultaneously. Given a function f (x) : {0, 1} → {0, 1} using a quantum computer, use two qubits x, y and transform them into x, y ⊕ f (x) (where ⊕ represents addition modular two). We use two qubits since we wish to leave the input x or the query register, “unchanged”. The second qubit, y, acts as a result register. Let U f be the unitary transform that implements this. This is illustrated in Figure 1. Suppose we wish to calculate f (0), then we could input x as 0 , and y, our output register, as 0 and apply the U f transform.
C/CS/Phys 191, Fall 2005, Lecture 17 1 The input is written as 0 ⊗ 0 = 0, 0 . Suppose we wish to calculate f (1), then we could input x as 1 , and y, our output register, as 0 and apply the U f transform. The input is written as 1 ⊗ 0 = 1, 0 . The output is transformed by U f to be 1, 0 ⊕ f (1) . The output is transformed by U f to be 0, 0 ⊕ f (0) . But this is not a classical computer – we can actually√ query the results of 0 and 1 simultaneously using quantum parallelism. For this, let x equal 0 + 1 / 2 and y equal 0. The input ψ1 = The output ψ2 =
0,0 + 1,0 √ 2 0, f (0) + 1, f (1) √ 2 −→ Problem: sounds good, but measurement produces either 0, f (0) or 1, f (1) . Hence we need to be clever about what type of question we ask, and how we go about extracting the answer. The solution is to use another quantum mechanical property: interference. −→ Remarkable: U f is applied to 0 and 1 simultaneously! This is known as quantum parallelism. 0> H x x H Uf
1> H y y f(x)
Figure 2: Quantum circuit for Deutsch’s algorithm, testing whether a Boolean function on one qubit is constant or balanced. Aside: Deutsch’s algorithm, as all known quantum algorithms that provide exponential speedup over classical systems do, answers a question about a global property of a solution space. These are often called promise problems, whereby the structure of the solution space is promised to be of some form and by carefully using superposition, entanglement and interference we can extract information about that structure. The reason these problems obtain exponential improvement over all known classical algorithms is that classically one has to calculate every point in the solution space in order to obtain full knowledge about this structure. Quantum mechanically we calculate every point using quantum parallelism. Unfortunately this is often not how most algorithms are phrased. Usually we work with problems that are phrased of the form “what x gives a value of f (x) with the desired property?” Thus far, quantum computers can only provide squareroot improvement to such querybased problems. Let ψ0 be the initial state vector and ψ1 be the state of the system prior to applying U f . Let ψ2 be the state of the system after applying U f and ψ3 be the state of the system prior to measurement.
C/CS/Phys 191, Fall 2005, Lecture 17 2 Input: ψ0 = 0, 1 It may seem strange to start out with a result register of 1 instead of 0, but ignore this for now, we will return to it shortly. Apply the H gate to the query and result registers to obtain: ψ1 = 1 √ 2 0 + 1 1 √ 2 0 − 1 The ﬁrst qubit is referred to as the ’query’ qubit, the second as the ’result’ qubit. (Note that the term ’query’ is used in two different respects here  querying the function f (x), i.e., evaluating it, and querying the qubit 1, i.e., measuring it. Now, lets examine y ⊕ f (x): Suppose f (x) = 0 then y ⊕ f (x) = y ⊕ 0 =
1 √ 2 1 √ 2 0⊕0 − 1⊕0 0⊕1 − 1⊕1 = = 1 √ 2 1 √ 2 0 − 1 −0 + 1 Suppose f (x) = 1 then y ⊕ f (x) = y ⊕ 1 = Since ±1 = (−1) f (x) , we can compactly describe this behavior for both instances with the following single formula:
1 y ⊕ f (x) = (−1) f (x) √2 0 − 1 into: Thus, U f transforms x (−1) f (x) x
1 √ 2 1 √ 2 1 √ 2 0 − 1 0 − 1 0 − 1 =
1 2 Or we can write it all out in detail: Uf 0 + 1
1 √ 2 (−1) f (0) 0 0 − 1 + (−1) f (1) 1 0 − 1 Thus is an example of backward sign propagation or kickback of phase from qubit 2 to qubit 1  actually a very simple one since the phase is only a global phase here at this point. But below we shall see how it gets moved into the state of qubit 1, resulting in a real overall kickback from qubit 2 to qubit 1. Now we look at what this state is for the two instances of f being constant or balanced. First, suppose f is constant, that is f (0) = f (1). Then:
1 2 (−1) f (0) 0 0 − 1 0 − 1
1 √ 2 + (−1) f (1) 1 + 1 0 − 1 1 = 2 (−1) f (0) 0 = = ±1 2 1 ± √2 0 0 + 1 0 − 1 + 1 0 − 1 0 − 1 0 − 1 Since the ﬁrst qubit is in + transform this to 0 . (−1) f (0) 0
1 2 we can anticipate that performing a Hadamard gate on qubit 1 will then Suppose now instead that f is balanced, that is f (0) = f (1), then:
1 2 0 − 1 0 − 1 0 − 1
1 √ 2 + (−1) f (1) 1 0 − 1 0 − 1 = (−1) f (0) 0 + (−1) × (−1) f (0) 1 − 1 0 − 1 0 − 1 1 = 2 (−1) f (0) 0 = ±1 0 2 =
1 ± √2 0 − 1 0 − 1 − 1 0 − 1 C/CS/Phys 191, Fall 2005, Lecture 17 3 Since the ﬁrst qubit is in − here, we can anticipate that performing a Hadamard gate on qubit 1 in this case will transform this to 1 . So it seems we can get orthogonal states for qubit 1 for the two different instances. So lets now run the x qubit through an H gate to get ψ3 : ψ3 = 1 ± √2 0 1 ± √2 1 0 − 1 0 − 1 if if f (0) = f (1) f (0) = f (1) Since in our case f (0) ⊕ f (1) = 0 ⇔ f (0) = f (1) we can write this as ψ3 = ± f (0) ⊕ f (1) 0 − 1 √ 2 Hence it is possible to measure x (the ﬁrst, ’query’, qubit) to ﬁnd f (0) ⊕ f (1). Aside: Note that f (0) ⊕ f (1) is a global property of f (x). Classically it would require two evaluations of f (x) to ﬁnd this answer. Using a quantum computer we are able to evaluate both answers simultaneously and then interfere these answers to combine them together. Another more subtle point is that the phase of the result qubit transfers to the query qubit. This is a special case of phase kick back. In effect, the query qubit acts as a control of whether or not to ﬂip the result qubit. While the result qubit is potentially ﬂipped by the state of the query qubit, the phase of the query qubit is altered by the phase of the result (or target) qubit! This property is also critical to Shor’s algorithm. 3 DeutschJosza algorithm
The DeutschJozsa algorithm is a generalization of Deutsch’s algorithm to Boolean functions on n qubits. Suppose f (x) : {2n } → {0, 1} and that f is either constant or balanced. The goal is determine which one it is. Classically it is easy to see that this would require (in worst case) querying just over half the solution space, or 2n /2 + 1 queries. The DeutschJozsa algorithm answers this question with just one query! 00....0> H n x x H n Uf
1> H y y f(x) Figure 3: Quantum circuit for the DeutschJozsa algorithm, an nqubit generalization of Deutsch’s algorithm We need n qubits and one additional qubit: the former are the analog of x and constitute a query register, while the latter corresponds to the result qubit y in the Deutsch algorithm. The starting state of the system ψ0 is fairly straightforward ψ0 = 0 ⊗n 1
⊗n The symbolic notation 0 simply means n consecutive 0 qubits.
4 C/CS/Phys 191, Fall 2005, Lecture 17 We then apply the H ⊗n transform. This symbol means to apply the H gate to each of the n qubits (in parallel, although this does not matter. The key is only that the H gate is applied once to each qubit). In Homework 3 you showed that this transform is:
√ H ⊗n i = ∑ j (−1)n 2
i· j j Here is another proof of this important relation: Consider ﬁrst an H gate applied to a single qubit x . We need to multiply the component 1 by 1 if x = 0 and by −1 if x = 1: these two procedures can be combined as in the Deutsch algorithm above by simply multiplying by the factor (−1) f (x) . Then H x = = 1 √ 0 + (−1)x 1 2 1 √ ∑(−1)xz z 2 z where here z spans only two values, 0 and 1. This seems like notational overkill to represent a simple Hadamard gate, H. However, when we generalize the latter to H ⊗n the notation pays off since the above form can immediately be generalized by summing over all possible combinations of qubit basis states, i.e., over all nqubit states z: H ⊗n x = 1 √ ∑(−1)x·z z . 2n z Each qubit contributes an independent phase term, leading to the dot product x · z. Coming back to DeutschJozsa, we now transform ψ0 with the nqubit and 1qubit Hadamard gates as: ψ1 = H ⊗n 0
= ⊗n H 1 0 − 1 √ 2 1 √ x 2n x∈{0,1}n ∑ Note that the notation {0, 1}n means all possible bit strings of size n. For example, for n = 2, we have “00”, “01”, “10”, and “11”. We then apply the transform U f that implements f (x) to obtain the state ψ2 : (−1) f (x) √ x = ∑ 2n x∈{0,1}n ψ2 0 − 1 √ 2 Finally we apply another H ⊗n transform to obtain ψ3 : ψ3 = (−1)x·z+ f (x) z ∑ ∑ 2n z∈{0,1}n x∈{0,1}n 0 − 1 √ 2 The key to the DeutschJozsa algorithm is the following rather subtle point. We measure the probability amplitude of z = 0 ⊗n , the all zero state. (If the qubits are spins in a magnetic ﬁeld, this would be the ground state  correct?) Consider the instance when f (x) is constant. Since z = 0 ⊗n , x · z must also be equal to zero and hence (−1)x·z+ f (x) is either −1 or +1 for all values of x, where −1 holds for f (x) = 1 and 1 holds for f (x) = 0. In this case the amplitude for z = 0 ⊗n is ± 1 = ±1 2n x∈{0,1}n ∑ C/CS/Phys 191, Fall 2005, Lecture 17 5 which exhausts the probability amplitude for ψ3 . In other words, since ψ3 is normalized to 1 and the amplitude of z = 0 ⊗n already gives probability 1, there can be no other component in ψ3  all other amplitudes must be zero. Hence when you measure the ﬁrst n qubits in the query register, you will obtain a zero (or more correctly, 0⊗n ). Conversely, if f (x) is balanced then (−1)x·z+ f (x) will be +1 for some values of x and −1 for other values of x. This is where the balanced requirement comes into play. Since all possible x’ values are considered and the function is perfectly balanced, one must have equal numbers of +1 and −1. The amplitude of the all zero state z = 0 ⊗n is then: ∑ 2n + ∑ 2n
x1 x2 +1 −1 =0 where x1 is the set of x’s such that f (x) is equal to 0 and x2 is the set of x’s where f (x) is equal to 1. Hence you will not measure the all zero eigenvalue 0⊗n when f (x) is balanced since the probability amplitudes interfere destructively to produce a net probability amplitude of zero for the all zero state. What will be measured if the function is balanced? Anything except the all zero eigenvalue. At least one qubit will result in a measurement value of 1. Note that this algorithm does require only one query of f (x), i.e., of U f , but it requires the ability to make an nqubit measurement. C/CS/Phys 191, Fall 2005, Lecture 17 6 ...
View
Full
Document
 Spring '05
 umesh

Click to edit the document details