Search⌘ K
AI Features

Shor's Algorithm - From Factoring to Period Finding

Explore Shor's Algorithm to learn how quantum computing tackles the problem of integer factorization by reducing it to period finding. Understand the use of modular exponentiation, superposition, and Quantum Phase Estimation to efficiently find non-trivial square roots and factors of large numbers. This lesson bridges classical concepts and quantum advantages to provide a strong foundation for implementing Shor's algorithm.

As a refresher, when we want to factor an integer NN, we want to find the non-trivial square root XX of the congruence X21 (mod N)X^{2}\equiv1\space (mod \space N). Then we feed the obtained XX into an efficient algorithm that calculates the greatest common divisor of two numbers to obtain two factors of NN with gcd(N,X±1)gcd(N, X\pm1). Now, the agenda of this lesson is to find XX. So, let’s get started.

Let’s revisit our problem from the previous lesson. We want to factor N=21N=21. Let’s pick an XX at random, where 1<X<N11 < X < N-1. The inequality exists as we are not interested in obtaining 11 or NN itself as its own factor, defeating the purpose of our original problem. Let’s say we pick N=2N=2. Now, we create a table with two columns and multiple rows. In the first column, we have aa, which is the number to which we shall be raising X=2X=2. In the second column, we have a function f(a)=Xa (mod N)f(a)=X^{a}\space (mod\space N), which shows us the remainder we get after raising X=2X=2 to that aa and then dividing it by N=21N=21.

aa f(a)=Xa (mod N)f(a)=X^{a}\space (mod\space N)
0{0} 201 (mod 21)2^{0}\equiv1\space (mod \space 21)
...