400 Shor’s factorization algorithm
probability of such intermediate failures remains comparatively small, or innocuous for
computing logistics, and that the chances of success, after only a few trials in the worst of
all cases, are relatively high. As we shall see, all of the above steps are of polynomial-time
complexity. A comparison is made with nonpolynomial algorithms, such as the general
number field sieve (GNFS) approach, which is shown to require decades of CPU comput-
ing time to factorize numbers of 100-bits long! We then establish the connection between
order finding and factorization of composite (or nonprime) numbers by using two basic
theorems. The first theorem yields the two factors N
, N
of any given composite N such
that N = N
× N
, given the knowledge of the period. The second theorem establishes
that the probability of the period meeting certain eligibility criteria is at least 75% for
any composite. These two theorems combined validate and conclude Shor’s factorization
algorithm. The factorization of the composite N = 15 = 3 ×5 is found in textbooks as
the only illustrative example of Shor’s algorithm. Here, we shall investigate the whole
space of nontrivial composites N ≤ 100, as an emulation of the quantum computer. It
is possible to do this based on the fact that for such relatively small numbers, we can
compute (with a basic home computer) all the possibilities associated with each step
of Shor’s algorithm, namely what the period-finding quantum circuit should yield, and
the associated probabilities of success or failure. The result of this investigation is an
original plot showing the probability of successfully concluding the factorization of
nontrivial composites N ≤ 100 in a single run. The exercise helps one to grasp how
Shor’s algorithm would work when taking greater composite numbers. The last section,
which briefly describes public key cryptography (PKC), is not completely out of place in
this chapter. The purpose of this addition is to show how the PKC algorithm works, as
based on the product N = pq of two prime numbers p, q, whose factorization is indeed
considered intractable by classical means. Should a quantum computer of corresponding
computing power be implemented someday, the whole field of PKC-based cryptography,
and Internet security for that matter, would be compromised overnight! Fortunately, this
remains a distant perspective, while from this chapter, we know that the theory works
mathematically.
20.1 Phase estimation
This section considers an algorithm referred to as phase estimation. The word “esti-
mation” is correct, because the outcome of the algorithm is only what can be called a
good estimate of the phase in a quantum system. This phase estimation will enable us
to move another step further in our progression towards Shor’s factorization algorithm,
the second step being the order-finding algorithm, to be considered in the next section.
These two steps are critical in the final understanding of Shor’s algorithm, and this is
why we ought to pay extra attention to the following. While based on lessons from
previous chapters with no new conceptual difficulty, the quantum phase estimation and
its application to order finding involve a few nontrivial properties and results, which
must be fully assimilated at each step of the description.