Phase Estimation Overview
Quantum Phase Estimation (QPE) extracts eigenvalues of a unitary operator . Given:
QPE outputs a binary approximation to with precision using ancilla qubits.
QPE Circuit
The QPE circuit:
- Prepare ancilla qubits in states
- Apply controlled- for each ancilla
- Apply inverse QFT to ancillas
- Measure ancillas to get binary representation of
The controlled operations implement:
which creates a superposition encoding the phase.
The ladder is the whole algorithm in one expression. Rung applies , so after rungs the target register holds , and because the amplitude of rung carries the phase . Nothing has been measured yet: the phase sits in the relative phases of the ancilla basis states, invisible to any single measurement. The inverse QFT is what converts those relative phases into the computational basis, where reading the ancillas as a binary fraction yields .
Each bit comes out in order of cost. The most significant bit of is decided by the first Hadamard of the inverse QFT, the next bit by the first controlled rotation, and so on â which is exactly why the iterative variant can peel the answer off one bit per round.
Inverse QFT
The inverse Quantum Fourier Transform converts from the frequency domain to the time domain:
The QFT circuit uses gates for qubits: controlled phase rotations and Hadamard gates.
Precision and Resources
For precision , the ancilla count follows from binary resolution:
- Need ancilla qubits
- Rung of the ladder applies , so the circuit contains applications of in total, not
- If costs gates, the run therefore costs about gates â polynomial in , which is the reason QPE is considered efficient rather than exponential
Worked through: resolving a phase to needs ancillas and about one million controlled applications of . If each decomposes to native gates, the run is near gates â far past what an error-corrected device of a few thousand qubits can sustain in one shot without logical compilation. This is the arithmetic behind the rule of thumb that QPE belongs to the fault-tolerant era, and it is also why the ladder is worth compressing: any identity that halves the effective power of on the expensive rungs pays off multiplicatively.
The success probability is for well-prepared input states. If the input is a superposition of eigenstates rather than a single eigenvalue, QPE still works â it measures one eigenvalue drawn with the weight of that component â but the interpretation changes from "the energy" to "an energy", which matters in chemistry where the ground state must be isolated first.
Applications
QPE is a subroutine for:
- Shor's algorithm: finding eigenvalues of modular exponentiation
- Quantum chemistry: computing molecular energy levels
- Hamiltonian simulation: extracting energy spectra
- Quantum linear systems: HHL algorithm
QPE requires deep circuits and is only feasible with fault-tolerant hardware.
Two of those uses deserve specifics. In quantum chemistry the unitary is for a molecular Hamiltonian, the eigenvalue recovered is an energy up to the chosen time step , and the precision target is about hartree â roughly 20 bits of phase once the spectral width is normalised into . In Shor's algorithm the same circuit is period finding in disguise: the unitary is modular exponentiation, the phase is , and continued fractions replaces the binary read-out. In linear-systems algorithms QPE appears twice â once to estimate eigenvalues of the encoded matrix and once to implement the controlled rotation that turns them into amplitudes â so the cost compounds.
| Use | Controlled unitary | Phase means | Target precision |
|---|---|---|---|
| Quantum chemistry | molecular energy | hartree | |
| Shor's factoring | modular exponentiation | fraction | exact after extraction |
| Hamiltonian simulation | time evolution | spectral line | resolution of gaps |
| Linear systems (HHL) | matrix function | eigenvalue of | condition-number dependent |
Iterative Phase Estimation
Iterative QPE uses a single ancilla qubit instead of :
- Use one ancilla qubit
- Apply controlled- and measure
- Apply classical feedback based on measurement
- Repeat for each bit of
This reduces the quantum circuit depth at the cost of multiple rounds of classical communication.
The trade is worth doing the arithmetic on. Standard QPE with needs 20 ancillas held coherent through the entire -length ladder; iterative QPE needs one ancilla, measured and reset 20 times, with a feed-forward decision between rounds. Qubit count drops from to , but wall-clock time grows: each round includes a measurement, a decode, and a classical control latency of microseconds, repeated times, and any error in a decoded bit propagates into the next controlled rotation.
Iterative QPE therefore suits devices that have good mid-circuit measurement and fast classical feedback but scarce qubits â trapped-ion and neutral-atom systems, and superconducting chips running dynamic circuits. Bayesian and robust variants push the same idea further, replacing the fixed ladder with an adaptive schedule that spends more applications of where the posterior on is still broad. The adaptive schedule can reach a target error with fewer applications of in principle, but each new round depends on the last measurement, so the circuit can no longer be parallelised across rungs.
Python: QPE Simulation
import numpy as np
def qpe_simulation(theta, n_ancillas=4):
N = 2**n_ancillas
# Ideal: QPE outputs k/N approximating theta
# Simulate measurement probabilities
probs = np.zeros(N)
for k in range(N):
# Amplitude for outcome k
amp = sum(np.exp(2*np.pi*1j*(k/N - theta)*j) for j in range(N)) / N
probs[k] = np.abs(amp)**2
return np.arange(N)/N, probs
theta = 0.375 # = 3/8
phases, probs = qpe_simulation(theta, n_ancillas=4)
measured = phases[np.argmax(probs)]
print(f"True phase: {theta}")
print(f"Estimated phase: {measured:.4f}")
print(f"Error: {abs(measured - theta):.4f}")
Python: Leakage at Finite Precision
The ideal simulation above hides the effect of choosing . The ladder plus inverse QFT is a matrix product, so it can be written out exactly and the leakage between bins measured directly:
import numpy as np
def qft_inverse(n):
N = 2 ** n
j = np.arange(N)
return np.exp(-2j * np.pi * np.outer(j, j) / N) / np.sqrt(N)
def qpe(phi, m, label):
"""Ladder state sum_k e^{2 pi i k phi} |k>, then the inverse QFT."""
N = 2 ** m
k = np.arange(N)
psi = np.exp(2j * np.pi * k * phi) / np.sqrt(N)
amps = qft_inverse(m) @ psi
probs = np.abs(amps) ** 2
top = np.argsort(probs)[::-1][:3]
print(label)
for idx in top:
print(f" outcome {idx:4d} -> phi ~ {idx / N:.4f} p = {probs[idx]:.3f}")
qpe(0.375, 4, "phi = 0.375 = 3/8 with m = 4: exactly on a bin")
qpe(0.370, 4, "phi = 0.370 with m = 4: one bin is 0.0625 wide, so it leaks")
qpe(0.370, 11, "phi = 0.370 with m = 11: error falls to about 1e-4")
With and , every amplitude lands on bin 6 and the probability is exactly 1. Change the phase to 0.37 and the same four bits cannot represent it: 98 percent of the probability still sits in bin 6, but three percent leaks into the neighbours, and no number of repetitions fixes that â it is resolution, not sampling noise. Increase to and the peak moves to bin 758 of 2048, within of the true value. That is the practical meaning of : each extra ancilla bit halves the width of a bin and halves the leakage that a finite-precision phase produces.
QPE Error Analysis
The QPE error sources:
- State preparation: if is not an exact eigenstate, errors occur
- Finite precision: ancilla qubits give bits of precision
- Gate errors: imperfect controlled- operations
- Decoherence: noise during the deep QPE circuit
The total error probability:
QPE Variants
| Variant | Qubits | Circuit Depth | Applications |
|---|---|---|---|
| Standard QPE | m + n | O(2^m) | Eigenvalue estimation |
| Iterative QPE | 1 + n | O(2^m) | Reduced qubit count |
| Bayesian QPE | 1 + n | O(1/epsilon) | Adaptive estimation |
| Robust QPE | m + n | O(2^m) | Noise-resilient |
Summary
Phase estimation answers one question with a circuit: given a unitary and an eigenstate, what is the eigenvalue? It builds an -bit binary fraction by running controlled powers of , reads the phase with the inverse QFT, and resolves it to . The ladder structure is what sets the price â applications of in total, or gates for a -gate unitary â which is why precision is bought with ancilla qubits and exponential depth rather than with clever classical post-processing.
The failure modes are specific. An input that is not an eigenstate yields a distribution over eigenvalues rather than an error. A phase that is not a dyadic rational leaks across bins at small , and more shots do not move the peak; only more ancillas do. Gate errors and decoherence then add a floor that grows with the ladder.
Iterative, Bayesian and robust variants all spend classical feedback to escape the -ancilla requirement, trading parallel ladder rungs for serial measurement rounds.
Common Mistakes
Assuming extra shots sharpen a phase estimate that is limited by the ancilla count
Fix: Leakage from finite m is a resolution limit, not shot noise; add ancilla qubits to halve the bin width
Reading the controlled-U ladder as m applications of U
Fix: Rung k applies U raised to the 2 to the k, so the total is 2 to the m minus one applications and the cost is T over epsilon gates
Feeding a superposition of eigenstates to QPE and reporting the result as the ground-state energy
Fix: The circuit samples one eigenvalue with the weight of its component; isolate the ground state first or post-select across runs
Key Takeaways
- QPE encodes a phase as m bits using controlled powers of U, then an inverse QFT converts those relative phases into a computational-basis measurement
- Precision of epsilon requires m = ceiling of log base two of one over epsilon ancillas and about T over epsilon total gates
- At finite m a non-binary phase leaks into neighbouring bins, and increasing the shot count cannot recover that resolution
- Iterative QPE replaces 20 ancillas with one and mid-circuit feedback, trading qubits for serial measurement latency