Period Finding as HSP
Shor's factoring algorithm, the most celebrated application of quantum computing, rests on a single mathematical engine: period finding. Once you understand how period finding fits inside the Hidden Subgroup Problem (HSP) framework, the structure of the algorithm becomes almost inevitable.
What period finding asks
Fix a positive integer and an integer with . Define the function
Because the multiplicative group is finite, this function is periodic: there exists a smallest positive integer (the order of modulo ) such that
The period is the information Shor needs. Given , a simple classical calculation finds a non-trivial factor of with probability at least (Nielsen & Chuang, §5.3): if is even and , then yields a factor.
Casting period finding as an HSP
To place period finding inside the HSP framework, we work over the group (the integers under addition), but in practice a finite approximation suffices — use for a large power of two .
The function has a crucial property: it takes the same value on a whole coset of and distinct values across different cosets. In HSP language:
- The group is .
- The hidden subgroup is (the multiples of inside ).
- is constant on every left coset and distinct across cosets.
Finding is therefore the same as finding the generator of the hidden subgroup .
Because is abelian, this is an instance of the abelian HSP, which is efficiently solvable by the standard quantum HSP algorithm using the Quantum Fourier Transform (QFT).
The quantum algorithm in four steps
The abelian-HSP template applied to period finding gives exactly Shor's circuit:
-
Prepare a uniform superposition of the first (index) register over :
-
Query the oracle , creating the entangled state
-
Measure the second register. Suppose the outcome is for some . The first register collapses to the uniform superposition over the coset
-
Apply the QFT to the first register. The QFT maps the uniform superposition over to amplitudes that are non-zero only at integer multiples of :
Measuring yields a uniformly random . The ratio can be extracted from this integer by classical continued-fraction expansion, giving in repetitions.
The measurement step (step 3) is not strictly necessary — modern presentations skip it and show that the QFT still produces the right distribution — but it makes the coset structure transparent.
Why the QFT is the right tool
The QFT over is the quantum analogue of the discrete Fourier transform. Its defining action is
A state that is uniform over an arithmetic progression with step (i.e., the coset ) has a discrete Fourier transform that is itself concentrated on multiples of . The QFT makes this frequency visible in the computational basis, where a single measurement reads it off. This is the Fourier sampling principle that underlies every abelian HSP algorithm.
Complexity
The QFT over (with for qubits) requires only gates (Nielsen & Chuang, §5.1). The modular exponentiation oracle is implementable in gates using repeated squaring. The total circuit depth is therefore , compared to the best known classical factoring algorithm (the Number Field Sieve), which runs in sub-exponential time — an exponential quantum speedup for large .
The HSP unification
Period finding joins a family of problems that all reduce to the abelian HSP:
| Problem | Group | Hidden subgroup | |---|---|---| | Deutsch-Jozsa | | or | | Simon's problem | | | | Period finding (Shor) | | | | Discrete logarithm | | a cyclic subgroup |
All of these are solved by the same algorithmic template: prepare a uniform superposition, query the oracle, apply the appropriate group-theoretic Fourier transform, measure, and use classical post-processing to identify the hidden subgroup. The next lesson examines what happens when we move beyond abelian groups, where this beautiful template breaks down.
Sign in on the full site to ask questions and join the discussion.