The Quantum Fourier Transform, Explained with Code You Can Check
The Quantum Fourier Transform (QFT) sits inside Shor's algorithm, phase estimation and most of the "big" quantum algorithms. It is also one of the most hand-waved parts of any introduction. This post builds it from gates, checks it against Qiskit's own implementation, shows what it actually does with a period-finding example, and then measures what it costs on hardware. What the QFT does The classical discrete Fourier transform turns a list of numbers into its frequency components. The QFT does the same to the amplitudes of a quantum state: a state that repeats with some period gets mapped to a state concentrated on values related to that period. You cannot read all the amplitudes out (measurement gives one sample), so the QFT is only useful when the answer you need is in where the probability concentrates — which is exactly the situation in period finding. Building it from gates For n qubits the circuit is a Hadamard on each qubit followed by controlled phas...