← 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
Native
quantum_fourier_transform.py
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 = qc

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.