Steven GellerQuantum Computing, End to End

Book contents

Current section

Part IV. Protocols and Algorithms

  1. Bell Tests and Nonclassical Correlations
  2. Superdense Coding
  3. Teleportation
  4. Quantum Key Distribution
  5. Oracles and Query Complexity
  6. Deutsch, Deutsch-Jozsa, and Bernstein-Vazirani
  7. Simon and Hidden Structure
  8. Grover and Amplitude Amplification
  9. Quantum Fourier Transform
  10. Phase Estimation
  11. Shor as Period Finding
  12. Hamiltonian Simulation
  13. Variational Algorithms and Their Limits

Part IV. Protocols and Algorithms · Chapter 31

Quantum Fourier Transform

The quantum Fourier transform never appears in a headline and appears inside nearly every serious algorithm: it is the basis change that turns hidden periodicity into bits you can measure.

Lab
In this chapter 9 sections

Reader question. What transformation does the quantum Fourier transform perform, and what information can its circuit make observable?

The QFT maps computational-basis amplitudes to discrete Fourier components with phase-encoded output, implemented by Hadamards, controlled rotations, and bit reversal; it is valuable as a subroutine when structured phases are later sampled, not as a way to read an exponentially long Fourier vector.

Scope and non-goals.
  • This chapter does not claim the QFT alone solves a problem or outputs all transform coefficients.
  • It does not hide approximation error, qubit-order reversal, or controlled-rotation cost.
The two-qubit QFT circuit Two-qubit QFT: basis labels become phase progressions |x0> |x1> H R2 H swap |y0> |y1> The controlled phase R2 does the real work; the swap only fixes output order.
Figure 31.1. Notice how little machinery the transform needs; one Hadamard per qubit plus controlled phases between them. The circuit is the easy part; what matters is what it decodes: periodic phase structure written by an earlier subroutine.

The DFT written as a unitary

Define the matrix, normalization, and basis action.

The quantum Fourier transform maps computational-basis states to Fourier-basis states; superpositions whose amplitudes step through regular phase progressions. Applied to a state with no periodic structure, it gives you nothing you wanted. Applied to a state whose phases encode a period, the inverse QFT concentrates that information into measurement outcomes you can read.

That is why the QFT appears inside phase estimation and period finding rather than on its own poster. Those algorithms arrange for the answer to live in phases; the QFT is the reader. Understanding it as a basis change; the same conceptual move as the Hadamard, one chapter-sized step further; keeps both halves of that sentence in view.

Evidence boundary. The QFT is the unitary discrete Fourier transform over computational basis states. [Michael A. Nielsen] [John Watrous]

Binary fractions factor the output state

Derive the product form for a basis input.

For an n-bit input x, QFT|x> can be written as a tensor product of single-qubit phase states whose angles are binary fractions 0.x_j x_{j+1}... . Circuit order reverses those factors, which is why diagrams either end with SWAPs or declare reversed output order. A two-qubit hand trace should reconcile matrix indices, wire order, and that swap convention.

Evidence boundary. Its circuit decomposes into Hadamards, controlled phase rotations, and output-order reversal. [John Preskill] [Don Coppersmith]

Two qubits expose every phase

Calculate the four-by-four transform and circuit.

On an nn-qubit register with N=2nN=2^n, the definition is:

QFTNx=1Ny=0N1e2πixy/Ny\operatorname{QFT}_N\lvert x\rangle=\frac1{\sqrt N}\sum_{y=0}^{N-1}e^{2\pi ixy/N}\lvert y\rangle(31.1)

Each input basis state spreads over all output basis states with equal magnitude, distinguished only by phase. For two qubits, N=4N = 4, and the phases step through the fourth roots of unity:

1,i,1,i1 , i , − 1 , − i(31.2)

Different inputs produce different phase progressions, and those progressions are mutually orthogonal; which is why the transform is unitary, reversible, and implementable as a circuit of one Hadamard per qubit plus controlled phase gates. The circuit is a corollary of the definition, not the definition.

Evidence boundary. Approximate QFT can omit small rotations with a quantifiable accuracy/cost tradeoff. [Don Coppersmith] [Peter W. Shor]

QFTNx=1Ny=0N1e2πixy/Ny,N=2n\operatorname{QFT}_N\lvert x\rangle=\frac1{\sqrt N}\sum_{y=0}^{N-1}e^{2\pi ixy/N}\lvert y\rangle,\qquad N=2^n(31.3)

Notation contract: QFTNx=N1/2ye2πixy/Ny\operatorname{QFT}_N\lvert x\rangle=N^{-1/2}\sum_y e^{2\pi ixy/N}\lvert y\rangle; N=2nN=2^n; bit order and sign convention declared; R_k angle defined.

Resource account: controlled rotations build precision

Map phase angles to gate sequence.

Hadamards create each output phase reference; controlled R_k rotations add successively smaller binary-fraction contributions. The exact circuit uses n Hadamards and n(n-1)/2 controlled rotations, plus optional output swaps. This O(n^2) gate account describes preparing Fourier amplitudes, not reading all Fourier coefficients, which measurement cannot do.

Swaps reconcile mathematical and wire order

Make bit reversal explicit.

The QFT is the quantum cousin of the discrete Fourier transform from signal processing, with one decisive difference: you cannot read the coefficients. A classical DFT hands you the whole spectrum; the QFT holds it in amplitudes, and measurement returns samples. Algorithm design is the art of arranging for the coefficient you want to carry most of the probability before you measure.

The implementation checklist for any QFT-based workflow:

  1. choose the register size; it sets both resolution and circuit depth;
  2. prepare the phase-structured input state;
  3. apply the QFT or its inverse;
  4. measure;
  5. interpret the sampled bit string classically.

Precision and sample distributions matter even for clean, noise-free algorithms. A QFT on paper is exact; a QFT in a workflow is a statistical component.

Approximate QFT drops small angles

State an error/cost trade rather than a slogan.

Omitting rotations below an angle threshold shortens depth while perturbing the output state. The approximation must be tied to a norm or downstream success bound and the hardware's native precision; saying a rotation is small is not an error analysis. On noisy devices, an omitted gate can improve observed performance even as ideal algorithmic error rises, so report both contributions.

QFT conformance suite

Acceptance contract for QFT conformance suite
FieldReader-visible record
FormatParameterized circuit generator, dense-matrix oracle, and approximation comparison
VerificationTests n≤6 circuit/matrix equivalence up to declared bit order, inverse round-trip, and approximation error versus omitted rotations.
AvailabilitySource-embedded acceptance record; no separate download is claimed
{
  "artifact": "QFT conformance suite",
  "format": "Parameterized circuit generator, dense-matrix oracle, and approximation comparison",
  "acceptance_test": "Tests n≤6 circuit/matrix equivalence up to declared bit order, inverse round-trip, and approximation error versus omitted rotations.",
  "publication_state": "source-embedded contract and worked fixture"
}

Executable reference fixture

Run with Python 3.11 or later. The final assertion is the chapter-level pass condition for this small instance.

import cmath

def qft_matrix(size, normalized=True):
    if type(size) is not int or size < 2 or size & (size - 1):
        raise ValueError("QFT fixture requires a power-of-two size")
    scale = size ** 0.5 if normalized else 1.0
    return [[cmath.exp(2j * cmath.pi * row * column / size) / scale
             for column in range(size)] for row in range(size)]

def unitarity_error(matrix):
    size = len(matrix)
    return max(abs(sum(matrix[row][a].conjugate() * matrix[row][b] for row in range(size))
                   - (1.0 if a == b else 0.0))
               for a in range(size) for b in range(size))

four_point = qft_matrix(4)
eight_point = qft_matrix(8)
unnormalized = qft_matrix(4, False)
four_error = unitarity_error(four_point)
eight_error = unitarity_error(eight_point)
mutant_error = unitarity_error(unnormalized)
invalid_rejected = False
try:
    qft_matrix(6)
except ValueError:
    invalid_rejected = True
assert four_error < 1e-12 and eight_error < 1e-12
assert mutant_error > 1.0 and invalid_rejected
print(f"PASS: 31 QFT unitary_error_N4={four_error:.3g} N8={eight_error:.3g} unnormalized_error={mutant_error:.1f}")

Scope boundary

  • This chapter does not claim the QFT alone solves a problem or outputs all transform coefficients.
  • It does not hide approximation error, qubit-order reversal, or controlled-rotation cost.

Depth commitment. One unitary definition, one product factorization, one two-qubit trace, and one approximation test.

Practice problem

Compute QFT|01> for two qubits by matrix and circuit, including the final swap convention, then apply inverse QFT.

Deliverable
Two derivations, phase-labeled output vector, ordering statement, and round-trip result.
Pass condition
The conformance suite compares matrix/circuit states up to global phase and recovers |01>.

Verification record

Expected solution form. Dense-matrix calculation beside a gate trace and automated diff.

Model answer. With basis order 00,01,10,11, QFT|01>=(|00>+i|01>-|10>-i|11>)/2. The standard two-qubit circuit produces the same labeled amplitudes once its final swap convention is applied; inverse QFT returns |01>.

Model result and check. CI executes both conventions and verifies the student's declared one.

Acceptance test. The conformance suite compares matrix/circuit states up to global phase and recovers |01>.

Companion work

Artifacts for this chapter

These entries resolve to checked-in local source. Commands are reproduced exactly from the chapter manifest, and source-embedded fixtures are exported as direct downloads.

  1. Reproduce or test

    python3 tools/validate_briefs.py --briefs data/editorial_briefs_00_35.json --from 0 --through 35 --check-rewritten-sources --execute-artifacts

Provenance

Sources and review

  1. Michael A. Nielsen and Isaac L. Chuang. Quantum Computation and Quantum Information. Cambridge University Press. 2010textbook
  2. John Watrous. The Theory of Quantum Information. Cambridge University Press / University of Waterloo. 2018textbook
  3. John Preskill. Lecture Notes for Physics 219: Quantum Computation. California Institute of Technology. 2018graduate lecture notes
  4. Don Coppersmith. An approximate Fourier transform useful in quantum factoring. IBM Research report / arXiv. 2002primary paper
  5. Peter W. Shor. Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer. SIAM Journal on Computing. 1997primary paper

The load-bearing claims in the chapter are mapped inline to this registered source set. A citation supports only the bounded claim beside it.

Cite this chapter