Honors Theory, Spring 2002, Yap Homework 8

This last homework will not graded. Solution sketch will be published on Wed May 7. Please read the lecture notes on the quantum factorization algorithm, and the provided number theory

background.

1. Consider classical reversible circuits to compute the following transformation: f : 𝔹^{2n} → 𝔹^{2n} where f(x, y) = (x, yx mod N) if x, y ∈ ℤ_{N}^{∗} (N = 2^{n}), and f(x, y) = (x, y) otherwise. Construct the circuit explicitly for the case n = 3 using the family of T_{n} gates. SOLUTION: Since n = 3 and N = 8, ℤ_{8}^{∗} = {1, 3, 5, 7}. For most (x, y), f(x, y) = (x, y), i.e., the transformation is trivial. Consider the nontrivial transformations of f: If x = 3, then we see that the second register is transformed according to the two transpositions: 1 ↔ 3, and 5 ↔ 7. If x = 5, then the second register is transformed according to the two transpositions: 1 ↔ 5, and 3 ↔ 7. If x = 7, then the second register is transformed according to the two transpositions: 1 ↔ 7, and 3 ↔ 5. We saw in class (problem session on Wednesday) how to do this for x = 3. consider how to implement the 1 ↔ 3 transposition: |011, 001⟩ ↔ |011, 011⟩. Let the qubits be |x_{1}x_{2}x_{3}, y_{1}y_{2}y_{3}⟩. We want a 6-input control-NOT (T_{6}) gate to flip y_{2} iff the x_{1}x_{2}x_{3} = 011 and y_{1}y_{3} = 01. This is done is three stages:

• First negate x_{1} and y_{1}.

• Then apply T_{6} to flip y_{2} (with all the other 5 lines as controls).

• Finally, we negate x_{1} and y_{1} again (thus returning them to the original values).

We leave it to you to draw the reversible circuit. It is clear that you can repeat this for each of the other transpositions.

2. Let n = 3 and N = 2^{3} = 8. Suppose we prepare the state |111⟩, and then apply Hadamard transform to each bit. Then we apply QF T to the result. What is the resulting state? SOLUTION: A bit tedious to carry this out. Note that |x⟩ = H|111⟩ = \frac{1}{\sqrt{8}}(|0⟩ − |1⟩)^{⊗3}. One way is to apply the quantum circuit for QFT to this input. Alternatively, use the equation for QF T (|x⟩) as in the definition.

3. Let N = 2^{n}, m be an odd number less than N, and x ∈ ℤ_{m}^{∗}. We define a transformation on two quwords, each with n qubits. defined as follows: U_{m,x} be

U_{m,x}(|k⟩|y⟩) = |k⟩|yx^{k} mod m⟩.

Here, we assume that U_{m,x}(|k⟩|y⟩) = |k⟩|y⟩ in case y ≥ m.

Let |z⟩ = \frac{1}{\sqrt{N}} ∑_{ℓ=0}^{N−1} |k⟩|1⟩. To be specific, let n = 3, m = 10, x = 4. What is U_{m,x}(|z⟩)? Suppose you measure the second quword, and obtain the result 1. What is the resulting state? If you next measure the first quword, what information can you get about the period of x modulo m? SOLUTION:

U_{m,x}(|z⟩) = \frac{1}{\sqrt{16}}(
|0, 1⟩ + |1, 3⟩ + |2, 9⟩ + |3, 7⟩ +
|4, 1⟩ + |5, 3⟩ + |6, 9⟩ + |7, 7⟩ +
|8, 1⟩ + |9, 3⟩ + |10, 1⟩ + |11, 1⟩ +
|12, 1⟩ + |13, 1⟩ + |14, 1⟩ + |15, 1⟩).

You measure and get 1 in the second quword, the probability is 9/16, and the resulting state is

(|0, 1⟩+|1, 3⟩+|2, 9⟩+|3, 7⟩+|4, 1⟩+|5, 3⟩+|6, 9⟩+|7, 7⟩+|8, 1⟩+|9, 3⟩+|10, 1⟩+|11, 1⟩+|12, 1⟩+|13, 1⟩+|14, 1⟩+|15, 1⟩)/3.

4. Integer Factorization: give a simple polynomial time algorithm to detect if an input integer N is a power or not. In case of a non-power, output its power factorization, namely N = M^{e} for some M, e ∈ ℕ.

SOLUTION: Assume N is an n-bit number. Note that e ranges from 2 to at most n. If you fix any e, then M has at most m = ⌊n/e⌋ bits. We can determine each of the m bits of M, starting from the most significant bit: for instance if M = (b_{1}b_{2} ⋯ b_{m})_{2}, then we check if b_{1} = 1 by computing T_{1}^{e} and comparing it to N. Here, T_{1} = (10 ⋯ 0)_{2} is a m-bit number. If this number is equal to N, we are done. If it is greater than N then b_{1} must be 0. Otherwise, it must be 1. We continue to test for b_{2} by considering T_{2} = (b_{1}10 ⋯ 0)_{2}, and comparing T_{2}^{e} against N. And so on. This is easily seen to take O(n^{4}) time. Since we have to test for each e, the overall algorithm is O(n^{5}).

5. Find all the square roots of of 1 modulo 45. Describe your method for finding them.

NOTE: we want you to do your calculations by hand (not by writing a program to do it, for instance). SOLUTION:

6. Let x ∈ ℤ_{n}^{∗}. If h(x) = (g_{1}, …, g_{m}) where each g_{i} is a generator and 2ℓ = LCM(ϕ(q_{1}), …, ϕ(q_{m})). Characterize the conditions where x^{ℓ} ≡ −1(mod n).

SOLUTION: Write h(x^{ℓ}) = (y_{1}, …, y_{m}) where each y_{i} ∈ {±1}. Hence we require y_{i} = −1 for all i. Since ϕ(q_{i})|2ℓ and ϕ(q_{i}) ∼ | ℓ, we must have v_{2}(ϕ(q_{i})) = v_{2}(2ℓ). Thus v_{2}(ϕ(q_{i}) = v_{2}(ϕ(q_{j})) for all i, j = 1, …, m.

EXTRA EXERCISES:

7. Consider the following linear equation:

ax = b(mod n)

where a, b ∈ ℤ_{n} are given. We want to find x ∈ ℤ_{n}. Let d = GCD(a, n).

(i) The linear equation has a solution iff d|b. (ii) In case d = 1, the solution is unique and given by x = ba^{−1} mod n. (iii) In case d ≥ 2, there are exactly d solutions. Find these solutions. HINT: consider the “reduced equation” a′x = b′(mod n′) where a = a′d, b = b′d, n = n′d.