Overview

7 The quantum Fourier transform

This chapter introduces the quantum Fourier transform (QFT) as a foundational primitive in quantum computing and a key ingredient in algorithms such as Shor’s factoring and quantum phase estimation. At a high level, the QFT converts information encoded in the phases of a quantum state into magnitudes that can be learned by measurement, leveraging interference and quantum parallelism for efficiency. The text frames QFT as the quantum analogue of the discrete Fourier transform (DFT), highlighting how both transforms expose periodic structure, and emphasizes that the QFT and its inverse (IQFT) are efficient, compact circuit constructions central to achieving quantum speedups.

To build intuition, the chapter begins with periodic signals, sinusoids, and the classical DFT, using familiar examples from audio to show how complex waveforms decompose into frequency components. It then translates these ideas to quantum states, encoding periodic patterns via complex sinusoids with uniform magnitudes and systematically advancing phases—so-called geometric sequence states. Roots of unity and Fourier bases are presented as the mathematical backbone of these encodings. A single-qubit example shows the essence of “phase-to-magnitude” conversion: after phase encoding, a Hadamard gate maps phase differences to measurable probability differences, revealing the encoded angle. This simple case anticipates the structure of multi-qubit QFTs, where Hadamards and controlled phase rotations generalize this conversion.

Bridging classical and quantum perspectives, the chapter defines the QFT/IQFT as inner products with Fourier bases (with 1/√N normalization) and demonstrates classical simulations that mirror their action. It then presents the gate-based implementations built from layered Hadamards and controlled phase rotations, optionally followed by swaps or bit-order reversal, and contrasts their quadratic gate complexity in the number of qubits with the exponential-in-digit-cost of classical FFT when N = 2^n. Conceptually, the QFT maps computational basis states to geometric sequence (Fourier) states whose “frequency” equals the basis index, while the IQFT recovers that frequency, revealing bits step-by-step through successive Hadamards and phase un-rotations. Practical circuit notes—like control/target symmetry for controlled-phase gates and when final swaps are unnecessary—round out the implementation-focused treatment.

A dependency diagram of concepts introduced in this chapter.
CH07 F01 gonciulea
A simple sinusoidal wave, \(\sin (x) \text{ for } -2\pi \le x \le 2\pi\).
CH07 F03 gonciulea
The sinusoidal wave, \(\sin (x)\) for real values \(x\), has amplitude 1, phase 0, and frequency 1.
CH07 F04 gonciulea
The sine and cosine waves plotted together.
CH07 F05 gonciulea
Visualization of the signal with the 8 discrete values.
embedded
Projections of the sine and cosine parts of a complex sinusoid.
embedded
Table 7.1 The geometric sequence state for an angle \(\theta\).
CH07 T01 gonciulea
Unit color wheel representation of the geometric sequence state for \(\theta = \frac{\pi}{3}\).
CH07 F08 gonciulea
Unit color wheel for the geometric sequence state for \(\theta = \frac{\pi}{6}\).
CH07 F09 gonciulea
Table 7.2 The 3-qubit geometric sequence state for \(v = 1.7\).
CH07 T02 gonciulea
Phase encoding for a single qubit with \(\theta = \frac{\pi}{3}\).
CH07 F10 gonciulea
Converting difference in phase (\(\theta = \frac{\pi}{3}\)) to difference in magnitudes.
CH07 F11 gonciulea
Conversion from phase to magnitude encoding in a single-qubit state with a Hadamard gate.
CH07 F12 gonciulea
Table 7.3 Fourier bases \(n\)-qubit quantum state where \(N = 2^n\), \(0 \le k < N\), and \(0 \le l < N\).
CH07 T03 gonciulea
The general form of the amplitudes of a quantum state before and after applying an inverse Fourier transform to it.
CH07 F13 gonciulea
The general form of a quantum state before and after a quantum Fourier transform.
CH07 F14 gonciulea
The Fourier transforms of the computational bases for a three-qubit system.
CH07 F15 gonciulea
A relative comparison of the operations required to compute the QFT and the FFT for a growing number of qubits or binary digits.
CH07 F16 gonciulea
Circuit diagram of the QFT on a 4-qubit system.
CH07 F17 gonciulea
Circuit diagram of the IQFT on a 4-qubit system.
CH07 F18 gonciulea
The first step of the IQFT on a four-qubit state, where a Hadamard gate is applied to the qubit in position 3, followed by three controlled phase rotations.
CH07 F19 gonciulea
The second step of the IQFT on a four-qubit state, where a Hadamard gate is applied to the qubit in position 2, followed by two controlled phase rotations.
CH07 F20 gonciulea
The third step of the IQFT on a four-qubit state, where a Hadamard gate is applied to the qubit in position 1, followed by one controlled phase rotation.
CH07 F21 gonciulea
The fourth step of the IQFT on a four-qubit state, where a Hadamard gate is applied to the qubit in position 0.
CH07 F22 gonciulea
CH07 T03 gonciulea
CH07 F14 gonciulea
CH07 F13 gonciulea

Summary

  • The QFT is essential in many quantum algorithms. The QFT can convert information stored in the phase of a quantum state to magnitudes. It can also help us efficiently prepare states, like the geometric sequence with a certain frequency.
  • We learned we can represent periodic patterns in quantum states with real amplitudes or complex.
CH07 T03 gonciulea
  • The inner product of two state vectors captures their similarity.
  • The QFT converts a quantum state into another quantum state consisting of the inner products of the original state with Fourier bases (conjugated).
CH07 F14 gonciulea
CH07 F13 gonciulea

FAQ

What is the Quantum Fourier Transform (QFT) in simple terms?The QFT is a quantum operation that maps a quantum state into its frequency-domain representation. It performs the same transformation as the discrete Fourier transform (up to a 1/√N factor and a sign convention) but as a unitary acting on qubits, enabling quantum algorithms to extract periodicity encoded in phases.
How does the QFT differ from the classical Discrete Fourier Transform (DFT)?Mathematically they compute the same spectrum (up to normalization and sign). The DFT runs on classical data and needs O(N log N) time (with N points), while an n-qubit QFT uses O(n²) quantum gates, which is polynomial in n where N = 2ⁿ. The QFT also leverages quantum parallelism and interference.
Why is the QFT important in quantum algorithms like Shor’s and Phase Estimation?These algorithms encode unknown periods or phases into the relative phases of a quantum state. The QFT converts that phase information into amplitude magnitudes (measurable probabilities), making the hidden period or phase observable with high likelihood.
How are periodic patterns encoded in a quantum state?Using a geometric sequence (complex sinusoid): amplitudes have equal magnitude 1/√N and phases that advance linearly, amp[k] ∝ e^{i k θ}. The angle θ determines the frequency v by θ/(2π) = v/N.
What are “roots of unity” and how do they relate to the QFT?Roots of unity are complex numbers whose integer powers wrap around the unit circle and cycle every N steps. With ωₙ = e^{i 2π/N}, the Fourier bases are sequences of powers (1, ωₙˡ, ωₙ²ˡ, …), which are precisely the geometric (phase-progressing) states used by the QFT.
How does a single Hadamard gate realize the 1-qubit QFT/IQFT?For one qubit, the Fourier bases are the normalized sum and difference states. A Hadamard replaces amplitudes with their sum and difference, exactly implementing the 1-qubit QFT and IQFT. It also turns a phase offset into a magnitude difference, enabling measurement-based readout.
How does the QFT convert phase information into measurable magnitudes?If a frequency is encoded as a phase ramp across amplitudes, the QFT interferes these phases so that one (or a few) output basis states acquire large magnitudes. In the 1-qubit example, applying H after a phase shift yields magnitudes cos(θ/2) and sin(θ/2), which show up directly in measurement probabilities.
What does a Fourier basis state look like on n qubits?It is a valid quantum state with entries of magnitude 1/√N and phases e^{i 2π k l / N} for k = 0,…,N−1. The QFT maps a computational basis state |l⟩ to the l-th Fourier basis; the inverse transform maps that Fourier basis back to |l⟩.
How is the QFT circuit built from quantum gates?For each qubit (from most to least significant), apply a Hadamard, then a ladder of controlled phase rotations with angles that halve down the chain (e.g., controlled RZ with angles proportional to π·2^{k−j}). An optional final swap (bit reversal) reorders the qubits.
How does the inverse QFT (IQFT) recover a frequency step-by-step?The IQFT walks from the least significant qubit upward. Each step uses controlled phase “un-rotations” followed by a Hadamard to reveal one binary digit of the encoded frequency. After all steps (and optional swaps), the register collapses to the computational basis representing that frequency.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Building Quantum Software with Python ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Building Quantum Software with Python ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Building Quantum Software with Python ebook for free