Part V · Chapter 29

Quantum Fourier Transform

Read ~22 min Prerequisites Ch. 5, Ch. 22 Tools period-detection widget, code cell Live
Basic

Grover's algorithm (Ch. 28) searches; the next two chapters are about a different superpower — detecting hidden periodicity, which turns out to be the actual mathematical engine behind breaking RSA encryption (Ch. 31). The Quantum Fourier Transform is the subroutine that makes it possible: the quantum analog of the ordinary discrete Fourier transform, converting a signal in "position" into the same signal described by its frequencies.

The definition

QFT|x⟩ = (1/√N) Σ_y e^(2πixy/N) |y⟩

Every basis state |x⟩ gets spread into a superposition of every |y⟩, weighted by a complex phase that depends on x and y together. Applied to a full superposition rather than a single |x⟩, the linearity from Ch. 4 does the rest.

Intermediate
Fig. 29.1 — pick a period, watch the QFT find itN=16

Input (a periodic "comb" of spikes)

Output (QFT applied)

This is the single most important fact about the QFT for everything that follows: feed it a periodic pattern, and it hands back spikes exactly at the period's multiples. Ch. 30 and Ch. 31 are both, underneath, applications of exactly this behavior.

Why this is the right generalization of the classical FFT

The classical discrete Fourier transform turns a signal sampled at N points into N frequency components, in O(N log N) classical operations via the Fast Fourier Transform. The quantum version computes the analogous transform on n=log₂N qubits using only O(n²) quantum gates — exponentially fewer gates than even the classical FFT needs additions. The catch, and it's a serious one: you can't read out all N transformed amplitudes the way classical FFT output lets you — Ch. 7's Born rule only ever gives you one measurement. The QFT's speed is only useful when, like Ch. 30's phase estimation, you only need a small amount of information out of the transformed state, not the whole thing.

Advanced

How the O(n²) gate count is actually achieved

The circuit that implements the QFT efficiently uses H gates and controlled phase-rotation gates R_k = diag(1, e^(2πi/2^k)) between every pair of qubits, followed by a final bit-reversal of the output register. The controlled-phase structure is exactly Ch. 5's tensor-product machinery combined with Ch. 23's phase-oracle idea, applied recursively — it's the same building blocks from earlier chapters, arranged cleverly enough to avoid ever needing the full N×N matrix this chapter's definition writes down explicitly.

Fig. 29.2 — code, runs in your browser
Try changing `period` to 2 or 8 and re-running — the nonzero output positions always land exactly on multiples of N/period, matching Fig. 29.1.
Check your understanding

What does the QFT do to a basis state |x⟩?

Spreads it into a superposition of every |y⟩, each weighted by a complex phase e^(2πixy/N) — analogous to how the classical Fourier transform decomposes a signal into frequency components.

Check your understanding

If you feed the QFT a periodic input with period p (within N total positions), where does the output concentrate?

Exactly at multiples of N/p — every other output amplitude is zero.

Check your understanding

How many gates does the efficient QFT circuit need, for n qubits, compared to the classical FFT?

O(n²) quantum gates, versus O(N log N) = O(n·2ⁿ) classical operations — exponentially fewer.

Check your understanding

Why isn't the QFT's speed advantage usable for ordinary classical-style signal processing?

Because a single measurement only ever gives you one of the N transformed amplitudes, not the full output the way classical FFT does. The speedup is only useful when you need just a small amount of information from the result, as in phase estimation (Ch. 30).

Check your understanding

What two earlier chapters' ideas combine to make the efficient O(n²) QFT circuit work?

Ch. 5's tensor-product structure and Ch. 23's phase-oracle/phase-rotation idea, arranged recursively as controlled phase-rotation gates between qubit pairs.

Review queue

Scroll back to a chapter's quiz cards to review them once they're due — a full cross-chapter queue view is a planned upgrade.