Algorithms · Fourier transform primitive
Quantum Fourier Transform
The unitary that maps computational basis states to Fourier-basis phase patterns, and the phase-estimation primitive behind Shor's and HHL's speedups.
Strong empiricalUpdated
Open on the mapView frozen graph
A small worked example, computed in your browser. It is not a result from this record's papers.
QFT then its inverse, on |0101⟩
4 qubits, starting at |0101⟩, applying the QFT then immediately undoing it.
Step 1 of 4 · X
Probability of each outcome after this step
- 0100100%
Prepares qubit 2 as |1⟩.
The whole state moves from 0000 to 0100 — one certain outcome before, one certain outcome after, no superposition either side.
Prepares qubit 0 as |1⟩, so the register reads |0101⟩.
The whole state moves from 0100 to 0101 — one certain outcome before, one certain outcome after, no superposition either side.
Applies the Quantum Fourier Transform, spreading the single input state into an equal-magnitude superposition over all 16 outputs, each carrying a different phase.
Probability spreads from 1 outcome to 16. All 16 are equally likely.
Applies the exact inverse QFT, which collapses the superposition straight back to the original input.
Probability gathers from 16 outcomes onto 1. 0101 goes from 6.3% to 100.0%.
Readout The register reads 0101 again, exactly: the QFT and its inverse cancel, the way any unitary and its adjoint do.
Open in Studio- Steps3
- Wires3
- Qubits3 shown (n general)
- DepthO(n²) gates exact · O(n log n) approximate
- Gate count (n=3)3 H + 3 CP + 1 SWAP
- Papers2
The QFT is the quantum analogue of the discrete Fourier transform, acting on amplitudes rather than a classical vector. It underlies period finding, phase estimation, and several Hamiltonian-simulation techniques.
TakesNothingWhat joins here
No input port at this edge: the record publishes no gate sequence and no register, so there is nothing here to read one off — and unlike a declared hole, nothing has been recorded about what belongs here.
Nothing in the Atlas meets this end.
ReturnsNothingWhat joins here
No output port at this edge: the record publishes no gate sequence and no register, so there is nothing here to read one off — and unlike a declared hole, nothing has been recorded about what belongs here.
Nothing in the Atlas meets this end.
This record publishes no gate sequence and no register, so there is nothing here to read an interface off. Absent rather than empty. See all 152 →
The Quantum Fourier Transform on qubits ( basis states) is the unitary
Unlike the classical discrete Fourier transform, which returns a full length- output vector, the QFT acts on the amplitudes of an -qubit register and its output can only be sampled through measurement — it is a resource for building algorithms, not a way to read out a classical spectrum for free.
Circuit structure. The standard decomposition applies, for each qubit (most significant first), a Hadamard followed by controlled phase gates controlled by the less significant qubits, and finishes with a reversal of qubit order (implemented as SWAPs, or by relabeling wires in software). This gives exactly Hadamards and controlled-phase gates: gates total. Coppersmith's approximate QFT drops controlled rotations with angle smaller than for a cutoff , reducing the gate count to while introducing only exponentially small error for many downstream uses (period finding, phase estimation).
Small worked instance. Take () and the input . Every phase factor , so
exactly the state produced by applying to each of the three qubits independently — a directly checkable identity, since no controlled phase can fire when every control qubit is . For , , i.e. the amplitudes trace out the eight 8th roots of unity in order — exactly the classical DFT of a Kronecker delta at index 1.
Where it is used. The QFT (or its inverse) is the last step of quantum phase estimation, the core of Shor's period-finding routine, and a building block for quantum arithmetic and some Hamiltonian-simulation schemes.
TakesNothingWhat joins here
No input port at this edge: the record publishes no gate sequence and no register, so there is nothing here to read one off — and unlike a declared hole, nothing has been recorded about what belongs here.
Nothing in the Atlas meets this end.
ReturnsNothingWhat joins here
No output port at this edge: the record publishes no gate sequence and no register, so there is nothing here to read one off — and unlike a declared hole, nothing has been recorded about what belongs here.
Nothing in the Atlas meets this end.
This record publishes no gate sequence and no register, so there is nothing here to read an interface off. Absent rather than empty. See all 152 →
- Qubits
- 3 shown (n general)
- Depth
- O(n²) gates exact · O(n log n) approximate
- Gate count (n=3)
- 3 H + 3 CP + 1 SWAP
- Formula
- QFT|j⟩ = (1/√N) Σ_k e^{2πijk/N}|k⟩
- Exact gate count
- O(n²)
- Approximate variant
- O(n log n), Coppersmith 2002
H×3on q[0], q[1], q[2]Controlled phaseson q[0], q[1], q[2]Swap (reversal)on q[0], q[2]
Quantum vs classical
| Metric | Classical | Quantum |
|---|---|---|
| Operation count | O(N log N) — FFT | O(n²) = O(log²N) |
| Register size | N complex values | n = log₂N qubits |
| Output access | full vector | sampled amplitudes only |
Classical baseline
The classical fast Fourier transform (FFT) computes a full length-N output vector explicitly in O(N log N) arithmetic operations.
Quantum claim
The QFT transforms the amplitudes of an n = log N qubit register with O(n²) gates, but the output is only accessible through sampling, not as a free classical vector.
How to compare
Compare circuit depth, approximation cutoff, state preparation cost, and the actual downstream measurement objective against the classical FFT cost for the same task.
Nobody has reviewed this record for gaps yet.
from qiskit import QuantumCircuit
import numpy as np
def qft(n):
qc = QuantumCircuit(n, name="QFT")
for j in range(n):
qc.h(j)
for k in range(j + 1, n):
qc.cp(np.pi / 2 ** (k - j), k, j)
for i in range(n // 2):
qc.swap(i, n - i - 1)
return qc
qc = QuantumCircuit(3, 3)
qc.append(qft(3), [0, 1, 2])
qc.measure(range(3), range(3))
FINAL_CIRCUIT = qcWhere this sits
This record is named by the layer graph at:
- Phase estimation into an ancilla register Method
Takes A circuit for U that can be applied as controlled U^(2^j), a preparation routine for a state whose overlap with the target eigenvector is not negligible, the number of bits of the phase wanted, and the failure probability that may be tolerated. Returns An estimate of the eigenphase to the requested number of bits, with the failure probability it was obtained at, plus the two costs that actually differ between routes: how many ancillas were held at once, and how many sequential rounds were run.
Related entries
- Shor period finding
Algorithms
- Quantum phase estimation
Algorithms
- QFT resource screen
Algorithms
- Iterative phase estimation
Algorithms
References
- An approximate Fourier transform useful in quantum factoring
D. Coppersmith · 2002
Introduces the approximate QFT that drops small-angle controlled rotations, giving O(n log n) gates.
- Quantum Computation and Quantum Information: 10th Anniversary Edition
Michael A. Nielsen and Isaac L. Chuang · 2010
Standard textbook derivation of the QFT circuit and its role in phase estimation (Ch. 5).