The quantum Fourier transform (QFT) is, without exaggeration, the single most important subroutine in quantum computing. It’s a quantum generalization of the discrete Fourier transform (DFT) that every signal-processing engineer already knows — and it runs exponentially faster on a quantum computer than the classical version on a classical computer.
Almost every quantum algorithm with an exponential speedup over the best known classical algorithm uses the QFT somewhere: Shor’s factoring, the hidden subgroup problem, phase estimation, HHL for linear systems. When you hear about “the period finding trick” in quantum computing, the engine behind it is the QFT.
What the Fourier transform does
The classical discrete Fourier transform takes a vector of numbers and produces another vector of numbers. Concretely, for an input , the output is:
This is a change of basis: from the “position” basis (where each entry is a sample at a specific time or index) to the “frequency” basis (where each entry is a coefficient on a specific frequency component).
Finding periodic patterns in becomes trivial after the DFT, because periodic patterns in position correspond to concentrated energy at specific frequencies in the transformed vector.
The quantum version
The quantum Fourier transform is the unitary operator that does the same thing to a quantum state:
where for an -qubit register. For a general quantum state , the QFT produces with the same coefficients as the classical DFT.
Why it’s exponentially faster
The classical fast Fourier transform (FFT) runs in time. That’s blazingly fast in practice — it’s how MP3 encoding works — but it’s still polynomial in .
The quantum Fourier transform runs in quantum gates. That’s polynomial in , i.e., polynomial in the number of qubits . Expressed in terms of , that’s exponentially faster than any classical FFT — because you’re not computing all output amplitudes explicitly; you’re preparing a quantum state whose amplitudes are the Fourier coefficients.
Here’s the catch (there’s always a catch): you can’t just read all the QFT output amplitudes. A measurement gives you one basis state, sampled from the probability distribution . You get one sample, not the full transform.
But for some problems — especially period-finding — one sample is enough. That’s exactly the structure Shor’s algorithm exploits.
The circuit
The QFT circuit on qubits looks like this:
- Apply to qubit 0.
- Apply controlled-phase gates (each a rotation by ) between qubit 0 and each subsequent qubit.
- Apply to qubit 1.
- Apply controlled-phase gates between qubit 1 and subsequent qubits.
- … and so on for each remaining qubit.
- Finally, reverse the qubit order with a series of SWAPs.
Total: Hadamards and controlled-phase gates. That’s total.
(Compare to the classical FFT, which performs classical operations — exponentially more.)
Inverse QFT
The inverse quantum Fourier transform is almost the same circuit, just with reversed order and negated phase rotations. Both versions show up: QFT is used when you want to read out frequency information, QFT is used when you want to prepare a state from a frequency description.
QFT in algorithms
Roughly speaking:
- Deutsch-Jozsa and Bernstein-Vazirani use the QFT over , which is just (a Hadamard on every qubit). It’s the simplest non-trivial Fourier transform.
- Simon’s algorithm also uses , applied to extract periodicities in .
- Shor’s algorithm uses the full QFT over for large , to extract periodicities in modular arithmetic.
- Phase estimation uses the QFT to read out the eigenphase of a unitary.
All of these are instances of the same template: “do some quantum operation that encodes structure as a phase pattern, then apply the QFT (or its inverse) to convert that phase pattern into a measurable position pattern.”
What’s next
Shor’s algorithm. You have all the pieces.