Quantum Phase Estimation
Suppose a unitary operator has an eigenstate with eigenvalue . Here is an unknown real number in . How can a quantum computer discover ? This question is not academic bookkeeping. It is the single most reused subroutine in quantum algorithms after the Quantum Fourier Transform itself. Shor's factoring algorithm, quantum chemistry simulations, and linear-system solvers all reduce, at their core, to estimating an eigenphase. Quantum Phase Estimation (QPE) solves exactly this problem. Given the ability to apply (or controlled versions of it), and given a copy of an eigenstate , QPE produces a classical bit-string approximation to . Its success probability can be made arbitrarily close to 1. This only requires a few extra qubits. The trick is beautifully simple in hindsight. First, encode into the relative phases of a superposition using controlled- operations. Then read it out using the inverse Quantum Fourier Transform. This is precisely the transform that decodes phases into bit-strings. The importance of QPE in real systems is hard to overstate. It is the engine inside Shor's algorithm's Order-Finding Subroutine. It is also the core primitive of Quantum Counting, and the phase-encoding step of the HHL Algorithm for solving linear systems. Any near-term or fault-tolerant application that needs to know "what eigenvalue does this operator have on this state" routes through some variant of QPE. This includes molecular ground-state energies, spectral gaps, and matrix condition numbers. This article builds QPE from first principles. We explain how the circuit is constructed, and why the inverse QFT correctly decodes the phase. We also examine what happens when is not exactly representable in finitely many bits. Finally, we show how many ancilla qubits are needed to guarantee a target accuracy and success probability. We verify every complexity claim with an explicit derivation rather than asserting it.
- QPE estimates the eigenphase of a unitary given an eigenstate and controlled- access.
- The circuit applies controlled- gates to build a phase-kicked superposition, then inverts the Quantum Fourier Transform to read out in binary.
- With counting qubits, QPE recovers exactly (with probability 1) when has a -bit binary expansion.
- For general , using qubits gives bits of correct with probability at least .
- Total cost is gates for the inverse QFT plus controlled- applications, dominated by the latter.
- QPE underlies the Order-Finding Subroutine in Shor's algorithm, Quantum Counting, and the HHL Algorithm.
Quantum Phase Estimation writes an eigenphase into the amplitudes of a register via controlled powers of , then the inverse QFT converts that phase encoding into a readable binary approximation.
The idea
Let be a unitary operator acting on some Hilbert space, and let be one of its eigenvectors, so that
The number is called the eigenphase of relative to . Because global phases are unobservable and is unitary, its eigenvalues always lie on the unit circle, so writing them as loses no generality. Quantum Phase Estimation is the algorithm that takes as input a copy of , together with the ability to apply (or more precisely, controlled versions of and its powers), and outputs a classical estimate of , correct to bits with high probability. The problem is nontrivial because is a continuous, generally irrational, real number, while quantum measurement produces only discrete classical outcomes. QPE resolves this tension using a two-register architecture. A counting register of qubits, initialized to and then put into uniform superposition, will hold the phase estimate. A target register, holding , is used only to control the application of for various , and it returns to unchanged at the end (this is the defining property of an eigenstate). The counting register accumulates phase kicks proportional to for each qubit , producing exactly the state that the inverse Quantum Fourier Transform is designed to decode. It is essential to be precise about what "controlled-" access means: the algorithm assumes a black-box unitary that applies to the target register exactly when a control qubit is , and does nothing otherwise. Building efficiently (e.g., by repeated squaring, applications of composed, or a native fast-forwarding circuit) is a separate engineering problem whose cost is not included in the abstract "one query" cost of QPE — this distinction matters when comparing QPE's efficiency to classical alternatives.
How it works
The circuit uses counting qubits (initialized to ) and however many qubits are needed to hold .
Step 1 — Superposition. Apply Hadamard gates to all counting qubits:
Step 2 — Controlled phase kicks. For , apply controlled by qubit of the counting register, acting on the target register. Because is an eigenstate of with eigenvalue , it is also an eigenstate of with eigenvalue . Each controlled application therefore imprints a phase onto the corresponding qubit of the counting register without disturbing at all — this is the phase kickback trick. After all controlled operations, the state factors as
Step 3 — Inverse QFT. Apply to the counting register. Recall that the (forward) QFT maps ; its inverse is the natural decoder for a state of the form , which is exactly a QFT-encoded basis state when is an integer.
Step 4 — Measurement. Measure the counting register in the computational basis, obtaining an integer . Output the estimate . ``` Algorithm QuantumPhaseEstimation(U, |psi>, t): Input: black-box controlled-U access; eigenstate |psi> of U with U|psi> = e^{2 pi i * phi} |psi>; t = number of counting qubits (precision/confidence parameter) Output: integer m in [0, 2^t - 1]; estimate phi_hat = m / 2^t
# Registers: counting register C (t qubits, init |0...0>),
# target register T (init |psi>) for j in 0 .. t-1: apply H to C[j] # uniform superposition for j in 0 .. t-1: apply Controlled-U^(2^j) # control = C[j], target = T
# equivalently: apply Controlled-U, 2^j times in sequence,
# or use a precomputed fast-exponentiation circuit for U^(2^j) apply Inverse-QFT to register C m <- measure(C) # standard basis measurement phi_hat <- m / 2^t return phi_hat ``` The qubit ordering convention matters: qubit of the counting register controls , and after the inverse QFT the most significant bit of comes from the qubit that controlled the largest power . Implementations must match this convention to the specific QFT circuit's bit-reversal behavior, or the output will be scrambled.
Complexity & correctness
Gate complexity. The Hadamard layer costs gates. The inverse QFT on qubits costs elementary gates (each of the controlled-phase-rotation layers touches at most qubits), or with approximate/fast variants. The controlled- layer requires applications of controlled powers of ; if each is built by repeating sequentially times, the total number of elementary calls is
which is exponential in unless a fast-forwarding circuit for (cost instead of repetitions) is available. In algorithms like Shor's, modular exponentiation gives exactly such a fast-forwarding circuit, so the total circuit is polynomial in the input size. In the fully black-box query model, complexity is instead measured in queries to : QPE with counting qubits uses such queries in the naive construction, or exactly queries if controlled- is furnished directly as a primitive (which is the standard convention in most textbook analyses, since squaring a unitary classically-described circuit is itself efficient).
Space complexity. counting qubits plus qubits for the target register; no additional workspace is required beyond what the inverse QFT and controlled- implementations use internally.
Correctness, exact case. Suppose exactly for some integer . After step 2 the counting register is in the state
which is precisely by the definition of the QFT. Applying therefore returns exactly , and measurement yields with probability 1. This is the clean base case: when has an exact -bit binary expansion, QPE is deterministic and exact.
Correctness, general case — the amplitude calculation. In general is not exactly for any integer . Let be the integer closest to and write , so . After the inverse QFT, the amplitude on outcome is
This is a geometric sum whose modulus can be bounded to show the distribution concentrates near : the standard bound (proved via the geometric series estimate above) shows that the probability the measured outcome satisfies (i.e., agrees with to bits) is at least
Setting makes this probability at least . This is the precise, checkable statement behind the informal slogan "add a few extra qubits for high confidence": each additional counting qubit beyond the bits of desired precision roughly halves the failure probability.
Correctness intuition without the algebra. The inverse QFT is a discrete Fourier analyzer: it takes a signal of the form (as a function of ) and reports which frequency dominates. If sits exactly on a frequency bin , the analyzer reports it with certainty. If falls between bins, energy leaks into neighboring bins — exactly the "spectral leakage" phenomenon familiar from classical discrete Fourier analysis — but the leaked energy decays quickly away from the true bin, which is why nearby outcomes remain overwhelmingly likely.
Tradeoffs. QPE's precision (number of correct bits ) and its confidence () both cost extra counting qubits, and the query cost to scales with in the worst case. If cannot be fast-forwarded, achieving many bits of precision becomes exponentially expensive in queries — the algorithm's efficiency claims are conditional on efficient controlled-power circuits, not free of assumptions.
Worked example
Take counting qubits and suppose the true phase is in binary — concretely, let
which does not have an exact 3-bit expansion ( exactly, but the extra term pushes it off-grid). This exercises the non-exact case honestly rather than hiding behind a phase that lands perfectly on a grid point. We have . The nearest integer is , and .
| Step | State / quantity | Value |
|---|---|---|
| After Hadamards | uniform superposition | |
| After phase kicks | phase-encoded | |
| Target | ||
| Offset | ||
| (dominant) | ||
| (neighbors) | small residual probability | |
| Measured outcome (typical run) | ||
| Reported estimate | ||
| True | — | |
| Error |
The measured outcome gives estimate , which is the best 3-bit approximation to the true — the algorithm is not "wrong" here, it has correctly found the closest representable value, and the residual error is bounded exactly by the half-bin-width guarantee derived above ( in the worst case for the nearest target, matching the observed ). If a second run is performed, there is a small but nonzero chance of measuring or instead — this is the spectral leakage predicted by the amplitude formula, not a bug. Using counting qubits instead would shrink this residual error by roughly a factor of 8, at the cost of twice as many controlled- layers.
Common pitfalls & traps
| Pitfall | Why it happens | Fix |
|---|---|---|
| Forgetting the target register must hold a true eigenstate | If is a superposition of eigenstates, QPE returns a probabilistic mixture of their phases, not one clean number | Either guarantee an eigenstate input, or accept and interpret the mixture (used deliberately in the Order-Finding Subroutine) |
| Bit-order confusion after inverse QFT | The QFT circuit's natural output order is often bit-reversed relative to the counting register's control order | Add explicit SWAP gates or track the reversal in software when decoding |
| Assuming exact recovery always | Exact recovery only holds when has a finite -bit binary expansion | Always report confidence intervals via the formula, not a bare point estimate |
| Ignoring the cost of building | Repeating sequentially times costs exponentially many queries | Use fast-forwarding / repeated-squaring circuits whenever 's structure allows it |
| Treating more counting qubits as "free" precision | Extra qubits cost more gates and more decoherence exposure on real hardware | Choose using the derived formula for the specific needed, not a fixed large default |
| Using QPE on a state with near-zero overlap with any eigenstate | Output becomes essentially uninformative noise | Precondition or verify eigenstate preparation before invoking QPE |
Pioneers & history
Phase estimation crystallized out of the broader development of quantum algorithms built on the Quantum Fourier Transform, following Shor's 1994 discovery that factoring reduces to period-finding. The phase-estimation formulation — separating "find the eigenphase" from "find the order" — was made explicit shortly after, and it was quickly recognized as a reusable primitive rather than a Shor-specific trick.
Origins · 1 minPeter Williston Shor and how this was discovered
Where this matters
Quantum Phase Estimation is the load-bearing subroutine of Shor's algorithm, where it drives the Order-Finding Subroutine that finds the multiplicative order of an integer modulo — the step that ultimately breaks RSA-style cryptography on a sufficiently large fault-tolerant quantum computer. It is equally central to Quantum Counting, which uses phase estimation on the Grover diffusion operator to count marked items without measuring them directly, generalizing Grover's search to a counting problem. In quantum simulation and chemistry, QPE applied to a Hamiltonian's time-evolution unitary extracts energy eigenvalues directly, making it the textbook approach to computing molecular ground-state energies on a quantum computer — a target application frequently cited by companies and research labs pursuing quantum advantage in materials and drug design. In numerical linear algebra, the HHL Algorithm uses QPE to extract eigenvalues of a matrix encoded as a unitary, invert them, and reconstruct a solution vector to a linear system exponentially faster than classical methods under certain sparsity and conditioning assumptions. Understanding QPE's exact-vs-approximate behavior, and its dependence on efficient controlled- powers, is therefore prerequisite knowledge for essentially every advanced quantum algorithm built after 1994.
Ask the tutor: How does the choice of in QPE translate into the continued-fractions post-processing used in Shor's order-finding algorithm?
Why does QPE need controlled-U rather than just U itself?
QPE must apply different powers of conditioned on different qubits of the counting register, while keeping those qubits in superposition. If were applied unconditionally, every branch of the superposition would receive the same operation and no phase information would become correlated with the counting qubits. The controlled version, , lets each qubit of the counting register act as a control: when that qubit is , the corresponding power of fires; when it is , nothing happens. This is what allows the phase kickback trick to write selectively onto qubit , producing the structured superposition that the inverse QFT can later decode. Without conditioning, the algorithm has no mechanism to correlate phase information with a measurable register at all.
What exactly is "phase kickback" and why doesn't it disturb the eigenstate?
Phase kickback is the phenomenon where applying a controlled- gate to a control qubit and an eigenstate target leaves the target completely unchanged but imprints a phase onto the control. Concretely, , since is an eigenstate. Written out, the phase factor can be pulled outside the target register entirely and attached to the control qubit's amplitude instead, since global-looking phases on a subsystem in a product state act as relative phases on the whole state. This is why the target register in QPE returns unchanged (still ) at the end — it was never actually modified in any observable way, only used as a "mirror" that reflects phase information back onto the counting register.
Can QPE be run without knowing |ψ⟩ in advance?
Yes, and this is exactly what happens in practice for algorithms like Shor's. Instead of preparing a specific eigenstate, one prepares a state that is a superposition over several eigenstates (or simply a convenient computational basis state), runs QPE, and interprets the measurement outcome as a sample from the mixture of phases weighted by overlap. In the Order-Finding Subroutine, for instance, the state is used directly; it decomposes into a uniform superposition of eigenstates of the modular exponentiation unitary, and QPE returns a phase that reveals the order after classical post-processing (continued fractions). The key requirement is not that be known, only that its overlap with the relevant eigenstate(s) be large enough to make the desired outcome likely.
How does QPE relate to classical Fourier analysis, intuitively?
QPE is structurally a quantum implementation of frequency estimation. The controlled- layer produces a discrete signal living in superposition across amplitudes, exactly analogous to sampling a complex exponential at points. The inverse QFT is then a Fourier analyzer that identifies the dominant frequency component of that signal. Classically, estimating a frequency this way would require actually computing and storing samples and Fourier-transforming them, an -space, -time (or with an FFT) classical computation. QPE achieves the analogous frequency read-out using only qubits and gates for the transform step, illustrating precisely where the quantum speedup over classical spectral analysis comes from.
Why is the bound on success probability stated as an inequality rather than an exact formula?
The exact probability of measuring any particular outcome is given by the geometric-sum amplitude formula, which is a specific trigonometric expression depending on . This expression is exact but unwieldy to reason about directly, since is generally unknown and irrational. The standard analysis instead derives a clean lower bound — "the probability of landing within of the ideal outcome is at least " — by bounding the geometric sum's tail using elementary inequalities. This bound is tight enough to design for any target , while remaining true for every possible , which the exact formula alone would not conveniently guarantee.
Does QPE work if U is not exactly unitary, e.g., due to hardware noise?
Formally, QPE's correctness proof assumes a perfectly unitary and a perfectly prepared eigenstate; deviations from either assumption degrade the output distribution. Small unitary errors in the implementation of act like a small perturbation to the effective phase being estimated, typically causing a graceful, bounded degradation in estimation accuracy rather than catastrophic failure, provided the noise is much smaller than the target precision . Larger errors, or non-unitary noise like decoherence, can corrupt the phase-kickback mechanism itself, since kickback relies on exact eigenstate structure being preserved across sequential controlled operations. This sensitivity is one reason fault-tolerant error correction is considered a prerequisite for large- QPE in applications like precise quantum chemistry.