Question

In: Computer Science

Construct a quantum protocol that produces equally likely binary strings of length six. (A quantum protocol...

Construct a quantum protocol that produces equally likely binary strings of length six.

(A quantum protocol is a classical algorithm which uses at least one quantum computation.

For example, an algorithm which uses Shor’s algorithm to factor a natural number as part of an attack to decrypt a code.)

Solutions

Expert Solution

The problem we are trying to solve is that, given an integer N, we try to find another integer p between 1 and N that divides N.

Shor's algorithm consists of two parts:

  1. A reduction of the factoring problem to the problem of order-finding, which can be done on a classical computer.
  2. A quantum algorithm to solve the order-finding problem.

Classical part

  1. Pick a pseudo-random number a < N
  2. Compute gcd(a, N). This may be done using the Euclidean algorithm.
  3. If gcd(a, N) ≠ 1, then there is a nontrivial factor of N, so we are done.
  4. Otherwise, use the period-finding subroutine (below) to find r, the period of the following function:


    f(x) = ax mod N
    , i.e. the smallest integer r for which f(x + r) = f(x).

  5. If r is odd, go back to step 1.
  6. If a r/2 ≡ -1 (mod N), go back to step 1.
  7. The factors of N are gcd(ar/2 ± 1, N). We are done.

Quantum part: Period-finding subroutine:

  1. Start with a pair of input and output qubit registers with log2N qubits each, and initialize them to


    N − 1/2xx〉∣0〉

    where x runs from 0 to N - 1.

  2. Construct f(x) as a quantum function and apply it to the above state, to obtain


    N − 1/2xx〉∣f(x)〉

  3. Apply the quantum Fourier transform on the input register. The quantum Fourier transform on N points is defined by:


    UQFTx〉 = N − 1/2ye2πixy/Ny

    This leaves us in the following state:


    N − 1xye2πixy/Ny〉∣f(x)〉

  4. Perform a measurement. We obtain some outcome y in the input register and f(x0) in the output register. Since f is periodic, the probability to measure some y is given by


    N − 1∣∑x :  f(x) = f(x0)e2πixy/N2 = N − 1∣∑be2πi(x0 + rb)y/N2

    Analysis now shows that this probability is higher, the closer yr/N is to an integer.

  5. Turn y/N into an irreducible fraction, and extract the denominator r′, which is a candidate for r.
  6. Check if f(x) = f(x + r′). If so, we are done.
  7. Otherwise, obtain more candidates for r by using values near y, or multiples of r′. If any candidate works, we are done.
  8. Otherwise, go back to step 1 of the subroutine.

Explanation of the algorithm

The algorithm is composed of two parts. The first part of the algorithm turns the factoring problem into the problem of finding the period of a function, and may be implemented classically. The second part finds the period using the quantum Fourier transform, and is responsible for the quantum speedup.

I. Obtaining factors from period

The integers less than N and coprime with N form a finite group under multiplication modulo N, which is typically denoted (Z/NZ)×. By the end of step 3, we have an integer a in this group. Since the group is finite, a must have a finite order r, the smallest positive integer such that


ar ≡ 1 mod N. 

Therefore, N | (a r − 1). Suppose we are able to obtain r, and it is even. Then


ar − 1 = (ar/2 − 1)(ar/2 + 1) ≡ 0 mod N


 ⇒ N ∣(ar/2 − 1)(ar/2 + 1). 

r is the smallest positive integer such that a r ≡ 1, so N cannot divide (a r / 2 − 1). If N also does not divide (a r / 2 + 1), then N must have a nontrivial common factor with each of (a r / 2 − 1) and (a r / 2 + 1).

Proof: For simplicity, denote (a r / 2 − 1) and (a r / 2 + 1) by u and v respectively. N | uv, so kN = uv for some integer k. Suppose gcd(u, N) = 1; then mu + nN = 1 for some integers m and n (this is a property of the greatest common divisor.) Multiplying both sides by v, we find that mkN + nvN = v, so N | v. By contradiction, gcd(u, N) ≠ 1. By a similar argument, gcd(v, N) ≠ 1.

This supplies us with a factorization of N. If N is the product of two primes, this is the only possible factorization.

II. Finding the period

Shor's period-finding algorithm relies heavily on the ability of a quantum computer to be in many states simultaneously. Physicists call this behaviour a "superposition" of states. To compute the period of a function f, we evaluate the function at all points simultaneously.

Quantum physics does not allow us to access all this information directly, though. A measurement will yield only one of all possible values, destroying all others. Therefore we have to carefully transform the superposition to another state that will return the correct answer with high probability. This is achieved by the quantum Fourier transform.

Shor thus had to solve three "implementation" problems. All of them had to be implemented "fast", which means that they can be implemented with a number of quantum gates that is polynomial in logN.

  1. Create a superposition of states.

    This can be done by applying Hadamard gates to all qubits in the input register. Another approach would be to use the quantum Fourier transform (see below).

  2. Implement the function f as a quantum transform.

    To achieve this, Shor used repeated squaring for his modular exponentiation transformation.

  3. Perform a quantum Fourier transform.

    By using controlled NOT gates and single qubit rotation gates Shor designed a circuit for the quantum Fourier transform that uses just O((logN)2) gates.

After all these transformations a measurement will yield an approximation to the period r. For simplicity assume that there is a y such that yr/N is an integer. Then the probability to measure y is 1. To see that we notice that then


e2πibyr/N = 1
for all integers b. Therefore the sum that gives us the probability to measure y will be N/r since b takes roughly N/r values and thus the probability is 1/r. There are r y such that yr/N is an integer, so the probabilities sum to 1.

Note: another way to explain Shor's algorithm is by noting that it is just the quantum phase estimation algorithm in disguise.

Modifications to Shor's Algorithm

There have been many modifications to Shor's algorithm. For example, whereas, an order of twenty to thirty runs are required on a quantum computer in the case of Shor's original algorithm, and with some of the other modifications, in the case of the modification done by David McAnally at the University of Queensland an order of only four to eight runs on the quantum computer is required.


Related Solutions

Design an efficient algorithm to compute the number of binary strings with length n that satisfy...
Design an efficient algorithm to compute the number of binary strings with length n that satisfy 1 the regular expression ((0 + 11 + 101)∗ (1101))∗ .
Find a recurrence relation for the number of binary strings of length n which do not...
Find a recurrence relation for the number of binary strings of length n which do not contain the substring 010
1. Write a Post system that defines the set of binary strings of odd length that...
1. Write a Post system that defines the set of binary strings of odd length that have a “x” as the middle character and "x" is a string
If we create a 5 digit bit string that is randomly generated, all strings equally likely......
If we create a 5 digit bit string that is randomly generated, all strings equally likely... 1. possibility of string containing three consecutive zeroes? 2. conditional probability of it containing three consecutive zeroes where first number is a one?
Use inclusion-exclusion to find the number of binary strings of length 5 that have at least...
Use inclusion-exclusion to find the number of binary strings of length 5 that have at least one of the following characteristics: start with a 1, end with a 0, or contain exactly two
Construct a 4 * 4 addition table of binary 2-bit strings modulo 2. For example, 01...
Construct a 4 * 4 addition table of binary 2-bit strings modulo 2. For example, 01 + 11 = 10 and 11 + 11 = 00. Replace each element in the table by its decimal equivalent plus 1. For example, 11 is replaced by 4. Is the resulting table a Latin square? Generalize this method for constructing Latin squares of order n
Recall that the set {0,1}∗ is the set of all finite-length binary strings. Let f:{0,1}∗→{0,1}∗ to...
Recall that the set {0,1}∗ is the set of all finite-length binary strings. Let f:{0,1}∗→{0,1}∗ to be f(x1x2…xk)=x2x3…xkx1. That is, f takes the first bit of a string x and moves it to the end of x, so for example a string 100becomes 001; if |x|≤1, then f(x)=x Also, suppose that g:{0,1}∗→{0,1}∗ is a function such that g(x1…xk)=0x1…xk (that is, gg puts an extra 0 in front of the given string, so for example g(100)=0100. Everywhere in this question we...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT