Skip to main content
KetQat

Appearance

Algorithm · intermediate

Quantum Fourier transform circuit

The exact circuit for the Fourier transform on n qubits, read off from the product representation - n Hadamards, n(n-1)/2 controlled phase rotations and a final reversal of the qubit order - with a proof that it is correct.

Established resultMachine-checkedUpdated 2026-12-01 · last verified 2026-12-01

AI-assisted text, machine-checked, not yet reviewed by a person. Citations resolve and an automated pass compared the statements with the cited sources. That is not peer review; check the sources for anything you depend on.

Gates. HH, and for k≥2k \ge 2 the phase gate Rk=diag⁡(1,e2πi/2k)=P(2π/2k)R_k = \operatorname{diag}(1, e^{2\pi i/2^{k}}) = P(2\pi/2^k) controlled by another qubit. The controlled-RkR_k gate is symmetric in its two qubits: it multiplies ∣11⟩\ket{11} by e2πi/2ke^{2\pi i/2^k} and fixes the other basis states.

Input. nn qubits in a basis state ∣j1j2⋯jn⟩\ket{j_1 j_2 \cdots j_n} (or any superposition, by linearity), qubit mm holding bit jmj_m (qubit mm is the wire labelled qm−1q_{m-1} in the diagram, so q0q_0 holds the most significant bit).

Procedure. For m=1,2,…,nm = 1, 2, \dots, n:

  1. apply HH to qubit mm;
  2. for k=2,…,n−m+1k = 2, \dots, n - m + 1, apply controlled-RkR_k with control qubit m+k−1m + k - 1 and target qubit mm.

Finally reverse the order of the qubits with ⌊n/2⌋\lfloor n/2 \rfloor SWAP gates (qubit mm with qubit n+1−mn + 1 - m).

Quantum circuit on 4 wires (q0, q1, q2, q3). step 1: H on q0. step 2: controlled phase π/2, control q1, target q0. step 3: controlled phase π/4, control q2, target q0. step 4: controlled phase π/8, control q3, target q0. step 5: H on q1. step 6: controlled phase π/2, control q2, target q1. step 7: controlled phase π/4, control q3, target q1. step 8: H on q2. step 9: controlled phase π/2, control q3, target q2. step 10: H on q3. step 11: SWAP q0 and q3. step 12: SWAP q1 and q2.q0q1q2q3HP(π/2)P(π/4)P(π/8)HP(π/2)P(π/4)HP(π/2)H
The four-qubit QFT. Qubit q0 holds the most significant input bit. Each wire receives a Hadamard and then controlled phase rotations from the wires below it; the angle halves with each step down. The two SWAP gates reverse the order of the wires.

Correctness. Consider stage mm. Qubits m+1,…,nm+1, \dots, n have not been touched yet and still hold jm+1,…,jnj_{m+1}, \dots, j_n. The Hadamard maps ∣jm⟩\ket{j_m} to (∣0⟩+e2πi 0.jm∣1⟩)/2(\ket{0} + e^{2\pi i\, 0.j_m}\ket{1})/\sqrt2, since (−1)jm=e2πi jm/2(-1)^{j_m} = e^{2\pi i\, j_m/2}. Controlled-RkR_k with control jm+k−1j_{m+k-1} multiplies the ∣1⟩\ket{1} component by e2πi jm+k−1/2ke^{2\pi i\, j_{m+k-1}/2^{k}}, which appends the digit jm+k−1j_{m+k-1} at position kk of the binary fraction. After the stage, qubit mm is in (∣0⟩+e2πi 0.jmjm+1⋯jn∣1⟩)/2(\ket{0} + e^{2\pi i\, 0.j_m j_{m+1}\cdots j_n}\ket{1})/\sqrt2 and is not touched again. By the product representation this is the factor that belongs on output qubit ℓ=n−m+1\ell = n - m + 1, so after the reversal the register is in F2n∣j⟩F_{2^n}\ket{j}.

Cost. nn Hadamards, ∑m=1n(n−m)=n(n−1)/2\sum_{m=1}^{n} (n - m) = n(n-1)/2 controlled rotations and ⌊n/2⌋\lfloor n/2 \rfloor SWAPs: Θ(n2)\Theta(n^2) gates on nn qubits with no ancillas. The reversal is often omitted and the output wires relabelled instead. The inverse F2n†F_{2^n}\dagg 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.

Holds when

  • N=2nN = 2^n; wire q0q_0 (qubit 1 in the procedure) holds the most significant bit of the input index.
  • Exact gates Rk=diag⁡(1,e2πi/2k)R_k = \operatorname{diag}(1, e^{2\pi i/2^k}) and their controlled versions are available.
Builds on
Used by

Open in the knowledge graph

Contributions about this record

Nobody has published a contribution about it yet.

Publish a result, reproduction or commentPropose a correction to this page

References

  1. Don Coppersmith (1994). An approximate Fourier transform useful in quantum factoring. IBM Research Report RC 19642 (posted to arXiv in 2002). arXiv:quant-ph/0201067
  2. Richard Cleve, Artur Ekert, Chiara Macchiavello, Michele Mosca (1998). Quantum algorithms revisited. Proceedings of the Royal Society A 454, 339-354. doi:10.1098/rspa.1998.0164arXiv:quant-ph/9708016
  3. Michael A. Nielsen, Isaac L. Chuang (2010). Quantum Computation and Quantum Information (10th Anniversary Edition). Cambridge University Press. doi:10.1017/CBO9780511976667

Contributors

  • KetQat maintainers · @ketqatConceptualization; Supervision (CRediT roles)
  • Claude (AI drafting assistant)Writing, original draft (CRediT roles)

Review history

  1. Automated source check · Pass with notes · 2026-12-01 · Independent automated verification pass (AI, not the drafting session)

    Procedure, correctness argument and gate counts re-derived; the circuit (H then controlled-R_k from qubit m+k-1, final reversal) simulated exactly for n = 1..5 and found equal to the defining matrix of F_(2^n); count n(n-1)/2 of controlled rotations confirmed in the same run; the four-qubit diagram checked gate by gate against the procedure (CP(pi/2) = R_2 etc.). Attributions compared with Coppersmith arXiv:quant-ph/0201067 (two-bit phase-shift network, truncated AFFT with about Lm operations, bit-reversed output), Cleve-Ekert-Macchiavello-Mosca arXiv:quant-ph/9708016 Section 4 (eqs. 4.2-4.6), and Nielsen-Chuang Section 5.1 via the publisher's table of contents.

    The procedure numbers qubits 1..n while the assumption and diagram use q0 for the most significant bit; added a clause mapping qubit m to wire q_(m-1) so the indexing is unambiguous.

Revision history

  1. 2026-12-01Content release 2.1.0: 35 more topics, an independent source check of every record, intake hardening (#17)80537b7e
  2. 2026-11-30KetQat Commons: free learning paths, knowledge records, research problems, literature intake (#14)571c9b10

Current revision 8d5e6616fefc1014. Source file knowledge/records/algorithm/quantum-fourier-transform-circuit.md in the content repository (readable there once it is public).