[Quantum Information] Shor's Algorithm

  Shor's Algorithm


Notes from RWTH Aachen University course 
“Quantum Information” Summer semester 2020
professor: Müller, Markus

Shor’s Algorithm

  • factor a number

Fourier Transform

  • classical Fourier transform

    • input: x0,x1...,xn1
    • output: y0,y1...,yn1
    • Definition:
      yk=1NN1j=0xje2πijk/N=1NN1j=0ωjkNxj
  • cost?

    • naive: O(N2) for N-vector
    • more efficient: Fast Fourier Transform (FFT): O(nlogn)
  • Quantum Fourier transform (QFT)

    • acts on orthonormal basis |0,|1,...,|N1
      |yk=1NN1k=0e2πijk/N|k




    • If start at a basis state, no entanglement will be created (results in a product state)
    • Resources of n-qubit QFT gate:
      • O(n) hadamard gates
      • O(n2) single qubit rotation gates (2 CNOT each)
      • at most n/2 swap gate: O(n) (3 CNOT each)

    O(n2) Quantum Algorithm

    • classical FFT: O(n2n)
      • QFT provdes an exponential speed up

QFT is not an algorithm to speed up classical transformation
Problem: No way known to access the amplitude in quantum computer.
No way known to prepare efficiently original state to be transformed.
an ingredient of other quantum algorithm

Phase Estimation

  • make use of QFT
  • Setting:
    • U: unitary
    • eigenvector |u with eigenvalues e2πiφ, where φ is unknown
  • Goal: to estimate φ,φ[0,1]
  • Assumption:
    • can prepare |u
    • can perform controlled-U2j
  • Algorithm:
  1. 1-st register prepare t qubits |0, where t depends on

    • precision
    • success probability

    2-nd register begin in |u, contains as many qubits as needed to store |u
    |0|u

  2. Hadamard gates to 1-st register
    |0|uH12(|0+|1)|u

  3. Controlled-U2j on 2-nd register
    12(|0+|1)|ucU2j12|0|u+12U2j|1|u=12|0|u+12e2πi2jφ|1|u=12(|0+e2πi2jφ|1)|u

    • t-qubit
      12t2t1k=0e2πiφk|k
    • suppose φ=0.φ1...φt
      12t(|0+e2πi0.φt|1)(|0+e2πi0.φtφt1|1)...(|0+e2πi0.φt...φ1|1)

      The Fourier transform of |φ=|φ1|φ2...|φt
  4. apply inverse QFT to the 1-st register
    12t2t1k=0e2πiφk|k|uFT|e|u

  5. measure the qubits of first register in computational basis


  • Discuss:
    • To achieve accuracy 2n with probability (1ε)
      t=n+log(2+12ε)
    • What if we cannot prepare the eigenstates |u?
      |ψ=uCu|u

      After the estimation, we get
      uCu|~φu|u

      where ~φu is a good approximation to the eigenvalue φu
      with probability |Cu|2 we get ~φu
      If we do it many times, we can avoid the requirement of preparing |u

Order Finding

  • output r where xr=1 mod N

  • is a hard problem in classical computer (no polynomial time algorithm)

  • in quantum computer, it is the phase estimation algorithm applied to the unitary
    U|y=|xy ( mod N)


    y is an b-qubit state

  • construct
    |us=1rrk=0exp(2πiskr)|xk mod N


    For integer s|us are eigenstates of U.
    U|us=exp(2πisr)|us

    so exp(2πisr) is the eigenvalue of |us
    This allows us to estimate sr=φ
     with the addition work to access order r

    • Problem: not allowed to use r, we cannot prepare |us

    • 1rr1s=0|us=|x0( mod N)=|1

      |1 is trivial to prepare
  • Algorithm:

  1. prepare 1-st register with t qubits |0
    prepare 2-nd regester with |1
  2. run phase estimation
  3. measuring the first registers
    • for each s in the range of 1 to r, this will lead to an estimation of the phase φ=s/r
    • accuracy: 2L+1 bits
    • probability (1ε)/r
      • /r” because don’t know which |us 1rr1s=0|us

        entangled with the second register when measuring.
  • moduler exponentiation
    • speed up exponentiation |z|xz
    • use the third temporary registers
    • reversible computing
    • O(L) spanning operations
      O(L2) standard multiplication for each operation
       total O(L3) operations
  • How to get r from the output φ
  1. run continued function algorithm (on a classical computer)
    • Continued Fraction Algorithm
      • a rational number s/r such that
        |srφ|12r2

        then s/r is a convergence of the continued fraction for φ, and can be calculated in O(L3) steps
      • idea: express the number as
        [a0,a1,...,aM]=a0+1a1+1a2+1...+1aM
      • check [a0],[a0,a1],...[a0,...aM] which satisfies s/r
      • the algorithm provides efficiently s/r
  • complexity
    • Hadamard gates: O(L)
    • Inverse FT: O(L2)
    • Modular exponentiation: O(L3)
    • classical continued fraction algorithm: O(L3)
    • If order finding fails, one has to repeat only for a constant number to obtain r with high probability: O(1)
       overall cost: O(L3)

    can be reduced to almost O(L2) by square-and-multiply

Shor’s Algorithm

  • Factoring N to two prime numbers
  • reduce factoring to order finding
  • If we have
    y2=1 mod N(y1)(y+1)=0 mod N=kN

    If y±1 mod N, then
    gcd(y+1,N)gcd(y1,N)

    must each be a proper divisor of N, i.e. prime factors.
  • How can we find a non-trivial square root y?

  1. choose a random 1<xN1
  2. run the order finding algorithm to find rxr=1 mod N
    • If r is even:
      xr=1 mod N(xr/2+1)(xr/21)=0 mod N=kN

      then y=xr/2 is a square root of 1
      and if xr/2±1, then compute gcd

    success probability to find a “good” x?
    “good”: order r is even and xr/21
    Theorem: If N is divisible by l distinct odd primes, then at least 112l1

     elements are “good”.
    l=21/2 probability to have “good” x
    O(1) trials

    • If r is not even:
  • Complexity:
    • O(1) for order finding
    • overall: O(L3)
    • classical factoring: exp(O(L1/3))
    • exponential speedup

RSA Algorithm

  1. pick random two primes p,q, and n=pq
  2. pick random public key by eϕ(n), where ϕ(n)=(p1)(q1)
  3. choose private key d such that ed=1 mod ϕ(n)
  4. public key: (n,e)
    private key: (n,d)
  • Encryption:
    E(m)=me mod n
  • Decryption:
    D(c)=cd mod n=med mod n=m1 mod ϕ(n) mod n=m mod n

Shor’s Algorithm allows us to factor efficiently on a quantum computer
RSA public key scheme is broken, as soon as sufficiently large quantum computer exists.


Readings
Nielsen and Chuang
    5.1 The quantum Fourier transform
    5.2 Phase estimation
    5.3 Applications: order-finding and factoring

留言

這個網誌中的熱門文章