Shor's Algorithm - From Factoring to Period Finding
Let’s devise a framework to find the non-trivial square root X. In doing so, we shall translate our problem of factorization to a problem that closely relates to period finding.
As a refresher, when we want to factor an integer , we want to find the non-trivial square root of the congruence . Then we feed the obtained into an efficient algorithm that calculates the greatest common divisor of two numbers to obtain two factors of with . Now, the agenda of this lesson is to find . So, let’s get started.
Let’s revisit our problem from the previous lesson. We want to factor . Let’s pick an at random, where . The inequality exists as we are not interested in obtaining or itself as its own factor, defeating the purpose of our original problem. Let’s say we pick . Now, we create a table with two columns and multiple rows. In the first column, we have , which is the number to which we shall be raising . In the second column, we have a function , which shows us the remainder we get after raising to that and then dividing it by .
Interestingly, after the entry, the remainders in the congruence start repeating. This repetition means that the function is periodic. Here, is the period or order of the function above. Notice that we can write the first repetition as . We can rewrite this as to mimic the form . So, this gives us . What is ? Yep, . How was significant? Well, was a non-trivial square root of . This is exactly what we set out to find! And this right here is the procedure for finding !
Get hands-on with 1400+ tech skills courses.