Overview
The quantum Fourier transform (QFT) is the discrete Fourier transform applied to the amplitude vector of a quantum register. On qubits it acts on a vector of amplitudes, yet it can be carried out with about two-qubit gates, against the roughly arithmetic operations of the classical fast Fourier transform on the same vector. It is the step that turns a hidden period into a measurable number in Shor's algorithm, and it is the read-out stage of phase estimation.
The comparison with the classical FFT is not a speed-up by itself: the QFT produces a state whose amplitudes are the Fourier coefficients, and a measurement returns one index sampled from their squared magnitudes, not the coefficients. The QFT is useful when the input state has structure, typically periodicity, that makes this one sample informative. The efficient circuit goes back to Coppersmith and Shor; Kitaev gave the general phase-measurement view.
Intuition
A periodic sequence has a Fourier transform concentrated on multiples of the fundamental frequency. Suppose a register holds an equal superposition of . Applying the QFT makes the contributions to most output indices cancel, and leaves large amplitude only near multiples of . One measurement therefore reveals something about , whatever the unknown offset , because the offset only changes phases, not magnitudes.
The reason the transform is cheap is the product representation: the Fourier transform of a basis state is not entangled. Each output qubit is for an angle determined by a few input bits, so each qubit can be prepared by a Hadamard and a ladder of controlled phase rotations. The lesson The quantum Fourier transform builds the circuit step by step and checks it numerically.
Prerequisites
Tensor products and the computational basis of qubits, the circuit model with controlled gates, and binary expansions of integers and fractions. Qubit 0 is the most significant bit throughout.
Mathematical Definitions
Let be an integer and let be an orthonormal basis of labelled by the integers modulo . Write . The quantum Fourier transform over is the linear map defined on the basis by
Its matrix entries are . It is unitary: for all , , because a sum of all -th powers of an -th root of unity other than 1 vanishes. The inverse is .
On amplitudes, with : the classical discrete Fourier transform of the vector , with the sign convention and unitary normalisation (many numerical libraries use and no normalisation in the forward direction).
For , , the Hadamard gate. More generally the Fourier transform over a finite abelian group is ; over it is , which is not the same map as over the cyclic group .
When the space is that of qubits and is read in binary with qubit 0 as the most significant bit. Efficient circuits exist for (see the product representation); for arbitrary there are polynomial-size circuits approximating to any accuracy (Kitaev) and exact ones (Mosca and Zalka). The transform over with a power of 2 is the one used in Shor's algorithm and in Coppersmith's analysis; a textbook treatment is Chapter 5 of Nielsen and Chuang.
For every and every ,
The most significant output qubit () depends only on the last input bit (), and the least significant one () on all of them. Read from right to left, the formula is a recipe: the factor for output qubit is a Hadamard on bit followed by phase rotations conditioned on the less significant bits . It is used to build the QFT circuit and to see why phase estimation works. The form is standard; it appears in Cleve, Ekert, Macchiavello and Mosca and in Section 5.1 of Nielsen and Chuang.
- ; with the most significant bit, held by qubit 0 in the big-endian convention.
- The tensor factor with index sits on the -th output qubit counted from the most significant one.
- Binary fraction notation .
Proof · Proof of the product representation of the QFT
Write the output index as with , so that . Then and the phase factorises:
The last step is the distributive law: a sum over all bit strings of a product of terms each depending on one bit is the product of the single-bit sums. Each factor is , which is the first form.
For the second form, only modulo 1 matters. With ,
The first sum is an integer and contributes ; the second is by the definition of the binary fraction (its first digit has weight ). This proves the formula. The argument follows section 5.1 of Nielsen and Chuang.
Theorems
For an integer with , let be the unitary implemented by the QFT circuit on qubits after every controlled- with is deleted. Then
Consequently, for every input state the outcome distributions of a computational-basis measurement after and after differ by less than in total variation distance. Choosing (if this exceeds , nothing is deleted) gives error at most with at most controlled rotations, that is gates.
Truncating the small rotations was proposed by Coppersmith and analysed, including under decoherence, by Barenco, Ekert, Suominen and Törmä; the bound above is the elementary one obtained from the triangle inequality, and those papers give sharper estimates. Cleve and Watrous give circuits of size and depth for the same accuracy, and an depth lower bound at constant error.
- and the exact circuit is the standard QFT circuit with controlled gates , .
- Error is measured in the operator norm; all remaining gates are exact.
Proof · Proof of the approximate QFT error bound
Step 1: errors add. Let and be products of unitaries. Then
because the sum telescopes. Unitaries have norm 1 and the operator norm is submultiplicative, so .
Step 2: one deleted gate. Deleting a gate is the same as replacing it by the identity. The controlled- gate is , so
Step 3: count. In the QFT circuit, stage uses for , so occurs in the stages . Applying Step 1 with for every kept gate and Step 2 for every deleted one,
The kept rotations number .
Step 4: measurement statistics. Let be any unit vector, , , and . The trace distance of two pure states is , and
so the trace distance is at most . The total variation distance between the outcome distributions of any measurement is at most the trace distance (it is the trace distance of the post-measurement classical states, and trace distance does not increase under channels). For a mixed input the same bound follows by convexity. Step 1 and Step 4 are the standard error-accumulation arguments of section 4.5.3 of Nielsen and Chuang.
Worked Examples
Two qubits by matrix and by product form
For , and
The input has , . The second column gives . The product form gives, for , the phase and, for , the phase :
the same vector. Note that : the Hadamard transform would give .
How much truncation does Shor-scale factoring allow?
Take an -qubit register (the size of the phase register for a 2048-bit modulus with the textbook choice ) and a target error . The error bound asks for , which guarantees error below . The kept controlled rotations are , numbering , compared with in the exact circuit: about 1.2 % of them. The deleted gates are rotations by angles below radians, which no physical device could implement meaningfully anyway.
Algorithms and Implementations
Gates. , and for the phase gate controlled by another qubit. The controlled- gate is symmetric in its two qubits: it multiplies by and fixes the other basis states.
Input. qubits in a basis state (or any superposition, by linearity), qubit holding bit (qubit is the wire labelled in the diagram, so holds the most significant bit).
Procedure. For :
- apply to qubit ;
- for , apply controlled- with control qubit and target qubit .
Finally reverse the order of the qubits with SWAP gates (qubit with qubit ).
Correctness. Consider stage . Qubits have not been touched yet and still hold . The Hadamard maps to , since . Controlled- with control multiplies the component by , which appends the digit at position of the binary fraction. After the stage, qubit is in and is not touched again. By the product representation this is the factor that belongs on output qubit , so after the reversal the register is in .
Cost. Hadamards, controlled rotations and SWAPs: gates on qubits with no ancillas. The reversal is often omitted and the output wires relabelled instead. The inverse is the same circuit run backwards with every angle negated.
A circuit of this form, together with its truncated version, appears in Coppersmith's 1994 report; the derivation from the product form is that of Cleve, Ekert, Macchiavello and Mosca and section 5.1 of Nielsen and Chuang.
- ; wire (qubit 1 in the procedure) holds the most significant bit of the input index.
- Exact gates and their controlled versions are available.
Semiclassical QFT. When the QFT is followed immediately by a measurement in the computational basis, as in phase estimation and order finding, the controlled rotations can be replaced by measuring one qubit, then applying single-qubit rotations to the remaining qubits conditioned on the classical outcome (Griffiths and Niu). The output distribution is unchanged, and no two-qubit gates are needed for the transform itself. In phase estimation this means each control qubit can be measured as soon as its controlled power has been applied.
Other moduli. For not a power of 2, Kitaev gave polynomial-size approximate circuits for the Fourier transform over any finite abelian group, and Mosca and Zalka showed how to make them exact. Order finding does not need them: the transform over with large enough suffices.
Applications
- Read-out stage of quantum phase estimation, and through it of order finding and factoring (Shor's algorithm).
- The abelian hidden subgroup problem, which contains order finding, discrete logarithms and Simon's problem (Kitaev); see quantum algorithms.
- Changing between the position and momentum representations of a discretised wavefunction in Hamiltonian simulation.
Computational Complexity
| Version | Gates | Depth | Source |
|---|---|---|---|
| Exact, | Coppersmith, Cleve et al. | ||
| Approximate, error | Coppersmith, Barenco et al. | ||
| Approximate, parallel | Cleve and Watrous | ||
| Exact, , sub-quadratic | Cleve and Watrous |
Cleve and Watrous also prove that constant-error approximations need depth .
Limitations and Common Pitfalls
- The amplitudes are not output. A QFT followed by measurement yields one sample. Claims that the QFT "computes the Fourier transform exponentially faster" ignore state preparation and read-out.
- is not . The Hadamard transform is the Fourier transform over the group , used in Deutsch–Jozsa, Bernstein–Vazirani and Simon; the cyclic transform is the one used for periods of integer functions.
- Bit order. The textbook circuit ends with a reversal of the qubits. Omitting the SWAPs is fine only if later code reads the output in reversed order. Libraries that order qubits little-endian also reverse the meaning of the input bits.
- Sign convention. The QFT uses ; common numerical FFT routines use , so a numerical check compares with the inverse FFT scaled by .
- Small rotations are not free on a fault-tolerant machine. Each kept rotation by an angle that is not a multiple of must be approximated by a sequence of Clifford and gates (Clifford+T synthesis); the truncation reduces both their number and the needed precision.
- The QFT is rarely the bottleneck. In order finding the controlled modular exponentiation costs far more than the transform; see Shor's algorithm.
Related Research
Quantum phase estimation, Shor's algorithm, the overview of quantum algorithms, and quantum complexity theory for the role of log-depth Fourier circuits in placing factoring in small-depth classes.