Home / Quantum from Scratch / Ep 16
Quantum Fourier transform
Quantum Fourier Transform: How Shor's Algorithm Finds Factors
Go deeper
What I say in the video
Shor's algorithm doesn't try factors. It listens for a rhythm.
Pick a number, keep multiplying it, and the remainders repeat, like a song on loop.
Know the length of that loop, and the factors fall out.
Finding the loop is the hard part. That's the Quantum Fourier Transform's job.
Like a music app hearing a messy wave and finding the beat.
The quantum version makes the repeats interfere until the beat stands out, and you read that beat.
That's why it shines inside Shor's, not on its own.
In plain words
How does Shor's algorithm factor a number without trying factors? It finds a repeating loop, and the Quantum Fourier Transform is what finds that loop.
What this Short covers:
- Shor's algorithm turns factoring into period finding: keep multiplying a number and the remainders repeat.
- Example: 7^x mod 15 gives 7, 4, 13, 1, 7… a loop of length 4.
- Knowing the loop length gives the factors: gcd(7² − 1, 15) = 3 and gcd(7² + 1, 15) = 5, so 15 = 3 × 5.
- For large numbers, finding the loop is hard for classical computers. The Quantum Fourier Transform does it by making the repeats interfere until the period stands out.
- The QFT does not speed up ordinary Fourier transforms: measurement cannot read out all its outputs, so its advantage shows up inside algorithms like Shor's.
What I simplified
Fine print for the algorithms crowd: the "loop" is the period r of a^x mod N (here 7^x mod 15 = 7, 4, 13, 1, so r = 4). With an even period, gcd(a^(r/2) ± 1, N) gives the factors: gcd(48, 15) = 3 and gcd(50, 15) = 5. This works for most choices of a, not every one. "Hard part" means hard for a classical computer; in gate count the QFT is cheap and modular exponentiation is the costly quantum step. "Read that beat": one measurement gives a clue to r, a short classical step (continued fractions) finishes it, and sometimes you rerun. The music-app line is an analogy: beat trackers use Fourier-style analysis of the audio, not a QFT.
Sources (7)
- Shor, "Polynomial-Time Algorithms for Prime Factorization and Discrete Logarithms on a Quantum Computer" (1995)arxiv.org
- Quantum Fourier transformen.wikipedia.org
- Shor's algorithmen.wikipedia.org
- Cambridge DAMTP, Quantum Information and Computation notes, Shor's algorithmqi.damtp.cam.ac.uk
- resources.mpi-inf.mpg.de
- musicinformationretrieval.com
- arxiv.org
One new quantum idea, every week
The next episode in your inbox, with its sources. Free, and one click to unsubscribe.