Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

QCQI – Chapter 6 Detailed Summary: Quantum Fourier Transform & Applications

Learning Objectives

  • Define the discrete Fourier transform (DFT) and the quantum Fourier transform (QFT) on Z2n\mathbb{Z}_{2^n}.

  • Derive the O(n2)O(n^2) QFT circuit using HH and controlled phase rotations, including the bit-reversal.

  • Understand approximate QFT (aQFT): angle cutoff, error bounds, and asymptotic gate count.

  • Apply QFT to periodic states and phase kickback; connect to order-finding and phase estimation.

  • Implement the semiclassical inverse QFT (Griffiths–Niu) with adaptive single-qubit rotations.

From DFT to QFT

Classical DFT on N=2nN=2^n points uses ω=e2πi/N\omega=e^{2\pi i/N}:

FN: x  1Nk=0N1ωxkk.\begin{aligned} \mathcal{F}_N: \ |x\rangle\ \mapsto\ \frac{1}{\sqrt{N}}\sum_{k=0}^{N-1}\omega^{xk}|k\rangle. \end{aligned}

The QFT is the unitary implementing FN\mathcal{F}_N on the computational basis and linearly extending to superpositions.

Eureka! The QFT is just a change of basis from computational states x|x\rangle to “phase states” k~|\tilde{k}\rangle.

Binary Expansion & Circuit Construction

Write kk in binary as k.kn1k0k.k_{n-1}\dots k_0 and xx as xn1x0x_{n-1}\dots x_0. Using the binary fraction 0.kjkj1k0==0jk2(+1)0.k_jk_{j-1}\cdots k_0=\sum_{\ell=0}^{j}k_{\ell}2^{-(\ell+1)}, the QFT factorizes:

xj=0n10+e2πi0.xjxj1x012.\begin{aligned} |x\rangle\mapsto \bigotimes_{j=0}^{n-1}\frac{|0\rangle+e^{2\pi i\,0.x_jx_{j-1}\cdots x_0}|1\rangle}{\sqrt{2}}. \end{aligned}

This yields a circuit with, for each qubit jj (from MSB to LSB): a Hadamard HH and controlled-RkR_k rotations from lower-order bits, where Rm=diag(1,e2πi/2m)R_m=\mathrm{diag}(1, e^{2\pi i/2^m}). A final bit-reversal (sequence of SWAPs) restores natural order.

Eureka! Each qubit picks up a fractional phase from less significant bits via controlled rotations. The final state is a product state in the phase basis.

Complexity and Approximation

The exact circuit uses 12n(n1)\tfrac12n(n-1) controlled rotations O(n2)\Rightarrow O(n^2) gates. For the approximate QFT (aQFT), drop RmR_m with m>mmaxm>m_{\max} (small angles). For mmax=O(logn)m_{\max}=O(\log n), the operator-norm error is O(1/poly(n))O(1/\mathrm{poly}(n)) and the gate count drops to O(nlogn)O(n\log n).

Eureka! Tiny phase rotations contribute little: trimming them yields near-exact transforms with exponentially small error.

Phase Kickback

If Uu=e2πiϕuU|u\rangle=e^{2\pi i \phi}|u\rangle, then a controlled-UU from a control qubit in +|+\rangle kicks the eigenphase to the control:

0u+1u2cU0u+e2πiϕ1u2.\begin{aligned} \frac{|0\rangle|u\rangle+|1\rangle|u\rangle}{\sqrt2}\xrightarrow{\mathrm{c}U}\frac{|0\rangle|u\rangle+e^{2\pi i \phi}|1\rangle|u\rangle}{\sqrt2}. \end{aligned}

Applying an inverse QFT to a register of such phase-kicked qubits reveals binary digits of ϕ\phi (core of phase estimation).

Eureka! Controlled unitaries turn global eigenphases into observable relative phases on controls.

Periodic States & Fourier Sampling

Given a state uniform on a period-rr coset,

ψ=1Mt=0M1x0+tr(mod N),\begin{aligned} |\psi\rangle=\frac{1}{\sqrt{M}}\sum_{t=0}^{M-1}|x_0+tr\rangle \quad (\mathrm{mod}\ N), \end{aligned}

the QFT produces peaks near integer multiples of N/rN/r. Sampling yields ksNrk \approx s\cdot \frac{N}{r} and hence information about rr via continued fractions.

Eureka! QFT converts periodicity in xx-space into spikes in kk-space.

Semiclassical Inverse QFT (Griffiths–Niu)

Measure qubits one-by-one from least significant to most, feed forward classically controlled RzR_z rotations to cancel known phases before each HH, and continue. This replaces multi-qubit entangling rotations with adaptive single-qubit gates and measurements.

Eureka! Measurement + classical feed-forward can substitute for many entangling gates in QFT1\mathrm{QFT}^{-1}.

Worked Nuggets

3-qubit QFT. HH on MSB; apply CR2\mathrm{CR}_2 from middle, CR3\mathrm{CR}_3 from LSB; repeat pattern for remaining qubits; final SWAP(0,2)(0,2).

aQFT error. Dropping all rotations with angle <2π/2mmax<2\pi/2^{m_{\max}} incurs operator-norm error <m>mmax2m=2mmax<\sum_{m>m_{\max}}2^{-m}=2^{-m_{\max}} (coarse bound).

Fourier adder (idea). Addition by phases: QFT\to phase rotations encoding addend \to inverse QFT.

Pseudo-code Aids

Pseudocode — QFT on nn qubits (exact)

Input: nn qubits ordered MSB..LSB for jj from 0 to n1n-1: apply HH to qubit jj for k=j+1k=j+1 to n1n-1: apply controlled-Rkj+1R_{k-j+1} with control kk target jj finally: reverse bit order using SWAPs

Pseudocode — Approximate QFT (angle cutoff mmaxm_{\max})

Input: nn, cutoff mmaxm_{\max} for each controlled-RmR_m in QFT: if m>mmaxm>m_{\max}, omit it Gate count O(nmmax)O(n\,m_{\max}), operator error O(2mmax)O(2^{-m_{\max}})

Pseudocode — Semiclassical QFT1\mathrm{QFT}^{-1} (LSB-first)

Input: nn-qubit register for jj from n1n-1 down to 0: apply Rz(ϕj)R_z(-\phi_j) depending on previously measured bits apply HH; measure qubit jj; update phases {ϕj1,}\{\phi_{j-1},\dots\}

Schematics

3-Qubit QFT (concept)

Phase Kickback

Hands-on Notebook (Multi-Backend)

Run: L08_QCQI_Ch06_Quantum_Fourier_Transform_and_Applications

In the first cell set backend to one of: cirq, pennylane, braket, pyquil, or qiskit.

Mini-Lab Ideas

  1. Verify QFT on basis states: compare statevector phases to analytic DFT.

  2. Implement aQFT with various mmaxm_{\max}; plot fidelity vs. gate count.

  3. Prepare a period-rr state and recover rr from QFT samples using continued fractions.