Checkpoint: Implement the QFT
This checkpoint asks you to assemble the complete 3-qubit QFT from scratch — Hadamards, controlled-phase rotations, and the final bit-reversal SWAPs. It consolidates everything covered in this module.
Recap: the product representation
The QFT maps any -qubit basis state to
Each tensor factor depends only on a single binary fraction of , which is what makes an efficient circuit possible: a Hadamard creates the superposition, and controlled-phase gates accumulate the remaining phase contributions from the more-significant (lower-indexed) qubits.
The 3-qubit circuit structure
Label the qubits (most significant), , (least significant). The algorithm proceeds in three stages:
Stage for : Apply to start the Fourier superposition, then use and as controls to add the finer phase contributions. The angles are (from ) and (from ):
Stage for : Apply , then one controlled-phase from with angle :
Stage for : Just a Hadamard:
Bit reversal: The stages above leave the output in reversed bit order — holds the least significant Fourier frequency. A single SWAP between and restores the standard ordering where carries the most significant frequency.
Gate count
For the circuit uses Hadamards and controlled-phase gates, for 6 gates total before the SWAP. In general the QFT uses gates, compared with the operations of a classical FFT on the same -point input.
Try it
Complete the circuit by adding the missing controlled-phase rotation. The grader checks the full unitary matrix of your 3-qubit circuit against the exact QFT unitary, so every gate must be correct — an incomplete or wrong circuit will fail.
Sign in on the full site to ask questions and join the discussion.