Shor's Algorithm and the Quantum Fourier Transform
A first pass. Incomplete by design.
Part of the track Derived, Borrowed, Learned
The reduction
Factoring N reduces to finding the period r of f(x) = a^x mod N for a random a. Once r is known, gcd(a^(r/2) ± 1, N) yields a factor with good probability. The number theory is classical and cheap. The hard step is finding r. See RSA and the Factoring ProblemNoteGrowingRSA and the Factoring ProblemHow RSA turns the difficulty of factoring into a lock, why the lock has a hidden period, and a worked example with small numbers. Originally Appendix A of The Resolution of Reality..
The quantum step
- Prepare a register in a uniform superposition over inputs x from 0 to some Q ≫ N².
- Compute f(x) into a second register, so the state is a superposition of pairs (x, a^x mod N).
- Apply the Quantum Fourier Transform to the first register.
- Measure. The outcome is, with high probability, close to a multiple of Q/r. A few repetitions and a continued-fraction step recover r.
The reason step 3 works is exactly the reason the classical Fourier TransformNoteSeedFourier TransformAny physically realistic signal is a sum of sines and cosines; the transform recovers which ones and how strongly. Built to solve the heat equation, it is also the engine of Shor's algorithm. works: a periodic signal has a spectrum concentrated at multiples of its fundamental frequency. Amplitudes at other frequencies cancel. Quantum interference performs the whole transform in one pass over 2^n amplitudes, which no classical machine can do.
Why this note is the bridge
The mathematics essay From Smooth to JaggedEssayFrom Smooth to JaggedHow mathematics grew a new tool each time reality posed a problem the existing math could not solve, from Taylor series to the Fourier transform, stochastic calculus, fractal geometry, and rough paths, ending with a personal encounter with Benoit Mandelbrot and its bearing on reading markets. presents the Fourier transform as the tool Joseph Fourier built to solve the heat equation. The quantum primer The Resolution of RealityEssayThe Resolution of RealityA primer on quantum computing: how physical law replaces brute-force search, why the advantage depends on how native the problem is to the machine, and where hybrid classical-quantum architectures fit. presents Shor's algorithm as the lens that focuses a superposition onto the correct period. They are the same operation. A reader who understands one has most of the other.
What this note does not yet cover
- The circuit for the QFT and why it costs O(n²) gates rather than the classical O(n 2^n).
- Why Q must be much larger than N² (resolution of the period).
- The continued-fraction post-processing.
Review log
- 2026-09-08: seeded to fix an ambiguity in Section VII of the primer, where the RSA lens and the molecule lens were described with one mechanism.
Appears in
Essays that draw on this note.
- From Smooth to JaggedHow mathematics grew a new tool each time reality posed a problem the existing math could not solve, from Taylor series to the Fourier transform, stochastic calculus, fractal geometry, and rough paths, ending with a personal encounter with Benoit Mandelbrot and its bearing on reading markets.
- The Resolution of RealityA primer on quantum computing: how physical law replaces brute-force search, why the advantage depends on how native the problem is to the machine, and where hybrid classical-quantum architectures fit.
Links out
- RSA and the Factoring ProblemHow RSA turns the difficulty of factoring into a lock, why the lock has a hidden period, and a worked example with small numbers. Originally Appendix A of The Resolution of Reality.
- Fourier TransformAny physically realistic signal is a sum of sines and cosines; the transform recovers which ones and how strongly. Built to solve the heat equation, it is also the engine of Shor's algorithm.
- From Smooth to JaggedHow mathematics grew a new tool each time reality posed a problem the existing math could not solve, from Taylor series to the Fourier transform, stochastic calculus, fractal geometry, and rough paths, ending with a personal encounter with Benoit Mandelbrot and its bearing on reading markets.
- The Resolution of RealityA primer on quantum computing: how physical law replaces brute-force search, why the advantage depends on how native the problem is to the machine, and where hybrid classical-quantum architectures fit.
Referenced by
Other notes and pages that link here.
- Fourier TransformAny physically realistic signal is a sum of sines and cosines; the transform recovers which ones and how strongly. Built to solve the heat equation, it is also the engine of Shor's algorithm.
- Key Quantum Algorithms: Shor, Grover, and SimulationThe three algorithm families that define what quantum computers are for, the speedup each delivers, and why the speedups differ. Originally Appendix D of The Resolution of Reality.
- RSA and the Factoring ProblemHow RSA turns the difficulty of factoring into a lock, why the lock has a hidden period, and a worked example with small numbers. Originally Appendix A of The Resolution of Reality.
Related
- Key Quantum Algorithms: Shor, Grover, and SimulationThe three algorithm families that define what quantum computers are for, the speedup each delivers, and why the speedups differ. Originally Appendix D of The Resolution of Reality.
- Superposition and InterferenceA qubit before measurement holds amplitudes for both outcomes; computation is the controlled interference of those amplitudes. The double slit is the physical demonstration.