Checkpoint: Estimate a Phase
This checkpoint brings together every building block from the module — phase kickback, controlled- powers, and the inverse QFT — into a single working Quantum Phase Estimation (QPE) circuit.
The target problem
The gate (phase gate) acts on its eigenstate as
The eigenphase is . Written in two-bit binary, , so a two-qubit QPE circuit should produce the bitstring in the counting register with certainty.
Circuit structure
A QPE circuit for counting qubits and a single-qubit target has four stages.
Stage 1 — Prepare the eigenstate. Apply to the target qubit (qubit 2), turning into the eigenstate .
Stage 2 — Superpose the counting register. Apply to each counting qubit (qubits 0 and 1), creating the uniform superposition
Stage 3 — Phase kickback. Each counting qubit controls on the target:
- Qubit 0 (MSB): controls , implemented as
cp(PI, 0, 2). - Qubit 1 (LSB): controls , implemented as
cp(PI/2, 1, 2).
In standard QPE, the MSB counting qubit controls the highest power of so that the resulting superposition of the counting register equals the quantum Fourier transform of the phase integer. Because is an eigenstate of , each controlled- does not entangle the registers — it only multiplies the component of the respective counting qubit by the phase factor . After kickback, the counting register holds
This is exactly , the quantum Fourier transform of the state (integer 1, encoding ).
Stage 4 — Inverse QFT. Applying undoes the Fourier transform and collapses the counting register to . The 2-qubit inverse QFT circuit is
After the inverse QFT, measuring the counting register gives 01 with probability 1, so reading off is exact.
Try it
Implement the full QPE circuit. The grader checks the output distribution: the combined state of all three qubits should place all probability on the bitstring 011 (counting register 01, target qubit 1 — qubit 2 remains in since phase kickback leaves an eigenstate unchanged up to global phase).
Sign in on the full site to ask questions and join the discussion.