← Atlas

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.

q0q1q2q3Step 1 of 4 · XXStep 2 of 4 · XXStep 3 of 4 · QFT(4)QFT(4)Step 4 of 4 · QFT inverse(4)QFT inverse(4)

Step 1 of 4 · X

Probability of each outcome after this step

  • 0100100%
  1. 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.

  2. 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.

  3. 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.

  4. 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 Quantum Fourier Transform on nn qubits (N=2nN=2^n basis states) is the unitary

QFTN∣j⟩=1N∑k=0N−1e2πijk/N∣k⟩.\mathrm{QFT}_N|j\rangle = \frac{1}{\sqrt{N}}\sum_{k=0}^{N-1} e^{2\pi i jk/N}|k\rangle .

Unlike the classical discrete Fourier transform, which returns a full length-NN output vector, the QFT acts on the amplitudes of an nn-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 jj (most significant first), a Hadamard followed by controlled phase gates Rk=diag(1,e2πi/2k)R_k=\mathrm{diag}(1,e^{2\pi i/2^k}) controlled by the less significant qubits, and finishes with a reversal of qubit order (implemented as ⌊n/2⌋\lfloor n/2\rfloor SWAPs, or by relabeling wires in software). This gives exactly nn Hadamards and n(n−1)/2n(n-1)/2 controlled-phase gates: O(n2)O(n^2) gates total. Coppersmith's approximate QFT drops controlled rotations with angle smaller than 2π/2m2\pi/2^m for a cutoff mm, reducing the gate count to O(nlog⁡n)O(n\log n) while introducing only exponentially small error for many downstream uses (period finding, phase estimation).

Small worked instance. Take n=3n=3 (N=8N=8) and the input ∣j=0⟩=∣000⟩|j=0\rangle = |000\rangle. Every phase factor e2πi⋅0⋅k/8=1e^{2\pi i \cdot 0 \cdot k/8}=1, so

QFT8∣000⟩=18∑k=07∣k⟩,\mathrm{QFT}_8|000\rangle = \frac{1}{\sqrt8}\sum_{k=0}^{7}|k\rangle,

exactly the state produced by applying HH to each of the three qubits independently — a directly checkable identity, since no controlled phase can fire when every control qubit is ∣0⟩|0\rangle. For j=1j=1, QFT8∣001⟩=18∑ke2πik/8∣k⟩\mathrm{QFT}_8|001\rangle=\frac{1}{\sqrt8}\sum_k e^{2\pi i k/8}|k\rangle, 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.

References

Strong empirical
  • Verified by construction
  • Small-instance agreement
  • Peer-reviewed paper
  • Textbook / standard citation
Method
The circuit follows the standard Hadamard + controlled-phase + qubit-reversal decomposition. It is checked against the closed-form QFT definition for a 3-qubit register, including the |0...0> edge case where the transform must reduce to independent Hadamards.
Result
Pass · for input |0> the circuit produces the uniform superposition over all 8 basis states exactly as required, and the general amplitude formula matches the analytic QFT definition.
Caveat
This record verifies the exact-QFT construction and a small hand-worked case; it does not benchmark the approximate QFT variant or run on hardware.
An approximate Fourier transform useful in quantum factoring ↗
Kind
curated reference
Reviewed by
Leona Quantum curation pass
License
CC BY 4.0-compatible reference metadata
fourier transformphase estimationqftcircuit primitive
  • Subroutine inside Shor's factoring and discrete-log algorithms
  • Phase estimation for chemistry and eigenvalue problems
  • Quantum signal processing and spectral filtering

Atlas stars stay in the public catalog. Saving this entry to your workspace starts an unstarred private copy.