Project: Estimate a Phase Precisely
Quantum phase estimation (QPE) extracts the phase of a unitary's eigenvalue by encoding it into a register of counting qubits and then reading it out with an inverse QFT. The central trade-off is simple: adding one more counting qubit halves the smallest phase difference that the circuit can distinguish.
The precision formula
With counting qubits the register can represent evenly spaced values in . The precision (the spacing between adjacent representable phases) is
Each extra qubit adds one bit to the binary fraction that encodes :
| | Precision | Representable values | |-----|------------------------|----------------------| | 1 | | 2 | | 2 | | 4 | | 3 | | 8 | | 4 | | 16 |
When is an exact -bit binary fraction the algorithm returns the correct integer with probability 1. When falls between two representable values the probability spreads, but the closest integer still receives at least of the probability mass (Nielsen and Chuang, §5.2).
Circuit structure
The QPE circuit has three stages:
-
Hadamard layer. Apply to every counting qubit to create a uniform superposition.
-
Phase kicks. Each counting qubit is given a phase gate with . This encodes the binary digits of directly into the phases of the counting register:
-
Inverse QFT. Decodes the phase-encoded register back to the computational basis state where .
A worked example:
Binary expansion: . With qubits the precision is , and is an exact 3-bit fraction, so QPE should return the integer (binary ) with probability 1.
Phase kicks for :
- Qubit 0:
- Qubit 1:
- Qubit 2:
After the inverse QFT the three counting qubits collapse to . A 2-qubit register could not represent — the nearest values are and — so those extra qubits are genuinely necessary.
Try it
The starter code has the Hadamard layer, the phase kicks for qubits 0 and 2, and the full inverse QFT. Add the missing phase kick for qubit 1. When your circuit is correct, the distribution grader will show all probability on outcome (decimal 5).
Sign in on the full site to ask questions and join the discussion.