The Famous Algorithms
The quantum Fourier transform
Reading a hidden period out of a superposition
Every algorithm in this module has been a way of arranging amplitudes so that interference answers a question. Grover concentrated weight onto one marked item. The quantum Fourier transform concentrates weight onto a hidden rhythm: hand it a state whose amplitudes repeat every steps, and it collapses that repetition into a few sharp spikes that reveal . That single trick is the engine that breaks RSA in the next lesson.
What it does not do
Watch repetition become location
The input below is a comb: an amplitude spike every bins across positions. Change the period and watch where the transform piles the output. Then slide the offset - the whole comb shifts, but the output peaks stay locked in place.
Slide the offset and the peaks do not move - only the position of the comb changed, not its period. That is the point: the transform reads the spacing, not the starting place. Measure the output and you land on a multiple of 4, which hands you N/r - and from that, r.
Two facts fall out of playing with it. The output peaks sit on the multiples of , so their spacing is the reciprocal of the input's: a tightly repeating input (small ) spreads its output peaks far apart, and vice versa. And the offset is invisible in the peak positions - it only turns their phases. The transform reads spacing, not starting point.
The transform, stated
The is a change of basis. On basis states it sends each to an even spread over all outputs, each output carrying a phase that winds at a rate set by :
You do not need to grind through this sum - the full derivation and the circuit that implements it live on the reference sheet. What matters is what it does to a periodic superposition. Feed in a state that is an equal spread over the positions - the comb - and the winding phases from all those equally spaced terms reinforce each other only when is a multiple of , and cancel everywhere else. The result concentrates on exactly those multiples:
Why the offset drops out
So the QFT is the frequency-reading half of the interference toolkit. Where Grover rotated toward a marked answer, the QFT tunes into a hidden frequency. And because a measurement afterward returns a multiple of , one run plus some arithmetic recovers the period that a periodic function was hiding.
Lock it in
- The QFT is a change of basis: it sends |j> to an even spread of outputs whose phases wind at a rate set by j.
- On a comb of period r it interferes constructively only at multiples of N/r and destructively elsewhere, so the output is a few sharp peaks.
- The peak spacing N/r is the reciprocal of the input period; a measurement returns one such multiple, from which you recover r.
- Shifting the input only adds phases, so the peak positions are blind to the offset - the reason period-finding works without knowing the start.
Check yourself
You put a superposition with period r through the QFT. Where does the output concentrate?
Why is the QFT the key subroutine in Shor's algorithm?
Recall: what structure does the QFT expose, and where does its output land?
The one input-output behavior Shor depends on. Try to state it, then check.
Match each idea to its role in the transform.
produces sharp peaks at multiples of N/r
reveals the hidden period as a frequency
returns one multiple of N/r
the quantity Shor's algorithm needs
Primary source
Nielsen and Chuang, Quantum Computation and Quantum Information (chapter 5)Chapter 5 derives the QFT, its efficient circuit, and the phase-estimation and period-finding routines built on it - the full sum this lesson only stated, worked out step by step.[1]
Next: Shor's algorithm, which turns factoring into period-finding and lets this transform bring down RSA.[2]
Sources