Lesson 29 · 100 min · advanced
Quantum Phase Estimation
Given a unitary and an eigenvector with , quantum phase estimation (QPE) writes a -bit approximation of into a counting register. This lesson derives the state produced by phase kickback from the controlled powers , shows that returns exactly when , proves the bound for the nearest -bit estimate in the general case, proves that counting qubits give correct bits with probability at least , and explains how a superposition of eigenvectors makes QPE sample the spectrum, which is the engine of the HHL algorithm.
Prerequisites: The Quantum Fourier Transform
Objectives and key results
State the phase-estimation problem and derive the counting state by phase kickback, with the weight- counting qubit controlling .
Prove that maps the counting state to exactly when .
For a non-dyadic phase, derive the outcome distribution as a geometric sum and prove for .
Prove the precision/success trade-off and explain how QPE on a superposition of eigenvectors samples eigenphases.
- definition · Phase-estimation problem
- identity · Counting state after the controlled powers
- theorem · Nearest-estimate bound
- theorem · Precision versus success probability
The phase-estimation problem#
Definition
Phase estimation
Let be a unitary on qubits and an eigenvector of . Because is unitary, , so its eigenvalue has modulus and can be written with a unique : Phase estimation is the task: given the ability to apply controlled- for and a copy of , output a -bit number such that approximates . The register holding is the counting register; it has qubits, qubit is the most significant bit, so when qubit holds bit . The counting qubit therefore carries the weight , and the last counting qubit has weight .
Phase kickback and the counting state#
Phase kickback
If then for every integer the controlled operation satisfies
Proof (3 steps)
- Step 1:Apply the eigenvalue equation times; scalars commute with . For both sides are .
- Step 2:Definition of the controlled operation on the two control basis states, then the previous step.
- Step 3:Linearity. The scalar belongs to the whole tensor product and may be attached to the of the control: the phase is "kicked back" onto the control while the target stays .
∎
The state after and the controlled powers
- Step 1:on each of the counting qubits.
- Step 2:The counting qubit of weight controls . In big-endian order (qubit = most significant) qubit has weight , so the last counting qubit controls and the first controls .
- Step 3:Apply the kickback lemma with to each counting qubit. The controlled operations act on different controls and leave unchanged, so they can be applied one after another and the state stays a product.
- Step 4:Write each factor as a sum over its bit , where is the bit of weight (stored on qubit ).
- Step 5:Expand the tensor product of sums by multilinearity; the product of the exponentials is the exponential of the sum of exponents.
- Step 6:runs over all integers exactly once as the bits range over , and in big-endian order.
Result
Exact readout for dyadic phases#
Dyadic phases are read exactly
If for an integer , then and therefore : measuring the counting register returns with probability .
Proof (4 steps)
- Step 1:Definition of the QFT from the previous lesson.
- Step 2:Substitute into the counting state; .
- Step 3:The two expansions agree coefficient by coefficient.
- Step 4:is unitary, . The Born rule then gives .
∎
Worked example: , ()
- Step 1:The phase is dyadic with three bits.
- Step 2:Qubit controls , qubit controls , qubit controls ; , .
- Step 3:The counting-state formula with , which is column of the QFT matrix.
- Step 4:The dyadic theorem. The inverse QFT on three qubits is , , , , , , .
Quick check
With counting qubits and , which integer (in decimal) does QPE return with probability ?
Non-dyadic phases: the 4/π² bound#
Outcome amplitude as a geometric sum
- Step 1:Take the adjoint of ; complex conjugation flips the exponent.
- Step 2:Insert and use .
- Step 3:Geometric series with ratio (the case is the dyadic case already treated).
- Step 4:Factor out , which has modulus , and use .
- Step 5:Apply the previous identity with in the numerator and in the denominator.
Result
The nearest estimate is found with probability at least 4/π²
Let (taken modulo ) and , so . Then .
Proof (6 steps)
- Step 1:Rounding to the nearest integer moves by at most ; divide by , then multiply by . If the phase is dyadic and , so assume .
- Step 2:Jordan's inequality: is concave on , so it lies above the chord from to , which is ; is even.
- Step 3:Apply Jordan's inequality with , admissible by the first step.
- Step 4:for all real (the derivative of is ).
- Step 5:Lower-bound the numerator and upper-bound the denominator; cancels.
- Step 6:Square both sides. The bound is approached as with , where the phase sits exactly halfway between two grid points.
∎
Numerical example: ,
- Step 1:The nearest three-bit grid point is .
- Step 2:Definition of .
- Step 3:Evaluate the geometric-sum formula; , .
- Step 4:Consistent with the theorem. The next most likely outcome is (, distance ) with probability , so the two neighbours of together carry .
Quick check
For and , what is the probability that QPE returns the nearest estimate ? Give four decimals.
Precision versus success probability#
Counting qubits for n bits with failure probability ε
Let , let be the integer in with (the best estimate from below), and let be an integer. Then the probability that the measured outcome satisfies (distance taken modulo ) is at most . Consequently, with and , QPE returns to bits of accuracy, , with probability at least .
Proof (12 steps)
- Step 1:The geometric-sum amplitude from the previous section with , , so .
- Step 2:The numerator has modulus at most ; the denominator is by the identity .
- Step 3:Since and , ; apply Jordan's inequality .
- Step 4:Combine the two bounds and multiply numerator and denominator by .
- Step 5:The failure event is the union of the outcomes with or ; sum their probabilities.
- Step 6:. For : . For : .
- Step 7:Substitute in the first sum and in the second, extend both to infinity (all terms are positive), and bound the first sum by the second, which has one more positive term.
- Step 8:because is decreasing, so the whole sum is bounded by .
- Step 9:Combine the last two steps. This is Nielsen and Chuang equation (5.34).
- Step 10:Triangle inequality with : success within distance means bits of accuracy.
- Step 11:Require the failure bound to be at most and solve for ; holds since .
- Step 12:The smallest integer satisfying the previous condition. For example , : , so counting qubits.
∎
Quick check
How many counting qubits does the formula prescribe for bits with failure probability ?
Superpositions of eigenvectors and the road to HHL#
QPE on
- Step 1:A unitary is normal, so by the spectral theorem its eigenvectors form an orthonormal basis and every input expands in it.
- Step 2:QPE on an eigenvector, with the amplitudes of the geometric-sum formula for .
- Step 3:Every gate of QPE is linear, so the circuit acts term by term.
- Step 4:The vectors are orthonormal, so : there is no interference between different eigenvectors.
- Step 5:With dyadic eigenphases . Measuring samples the eigenphase with probability and collapses the target onto .
import { runStatevector } from '@/lib/quantum-simulator';
// Phase estimation of U = P(2 pi phi) = diag(1, e^{2 pi i phi}) with eigenvector |1>.
// Counting qubits 0 .. t-1 (qubit 0 = most significant bit), target qubit t.
const phi = 0.3;
const t = 3;
const ops = [];
ops.push({ kind: 'gate', gate: 'X', targets: [t] });
for (let q = 0; q < t; q++) ops.push({ kind: 'gate', gate: 'H', targets: [q] });
// Counting qubit q has weight 2^(t-1-q) and controls U^(2^(t-1-q)) = P(2 pi phi 2^(t-1-q)).
for (let q = 0; q < t; q++) {
ops.push({ kind: 'gate', gate: 'CP', targets: [q, t], params: [2 * Math.PI * phi * 2 ** (t - 1 - q)] });
}
// Inverse QFT on qubits 0 .. t-1: the QFT circuit reversed, with every angle negated.
for (let q = 0; q < Math.floor(t / 2); q++) ops.push({ kind: 'gate', gate: 'SWAP', targets: [q, t - 1 - q] });
for (let q = t - 1; q >= 0; q--) {
for (let m = t - q; m >= 2; m--) {
ops.push({ kind: 'gate', gate: 'CP', targets: [q + m - 1, q], params: [(-2 * Math.PI) / 2 ** m] });
}
ops.push({ kind: 'gate', gate: 'H', targets: [q] });
}
const amps = runStatevector({ version: 1, numQubits: t + 1, numClbits: 0, ops }).amplitudes();
// Marginal distribution of the counting register (sum over the target qubit, the least significant bit).
const p = new Array(2 ** t).fill(0);
amps.forEach((a, i) => { p[i >> 1] += a.re * a.re + a.im * a.im; });
p.forEach((v, k) => console.log('P(' + k.toString(2).padStart(t, '0') + ') = ' + v.toFixed(6)));
console.log('round(2^t phi) = ' + Math.round(2 ** t * phi));Expected output
P(000) = 0.021593 P(001) = 0.051768 P(010) = 0.577521 P(011) = 0.259336 P(100) = 0.040907 P(101) = 0.019440 P(110) = 0.014487 P(111) = 0.014948 round(2^t phi) = 2
References
- M. A. Nielsen and I. L. Chuang, Quantum Computation and Quantum Information, 10th anniversary ed., Cambridge University Press (2010), §5.2 Phase estimation.doi:10.1017/CBO9780511976667
- R. Cleve, A. Ekert, C. Macchiavello and M. Mosca, "Quantum algorithms revisited", Proceedings of the Royal Society A 454, 339–354 (1998).doi:10.1098/rspa.1998.0164
- A. Yu. Kitaev, "Quantum measurements and the Abelian stabilizer problem" (1995); arXiv:quant-ph/9511026.arxiv.org
Hands-on labs
Three-bit phase estimation of a phase gate
1 step · auto-gradedOpen labComplete a three-qubit phase-estimation circuit around the controlled powers , , of a black-box phase gate , whose eigenvector is with eigenvalue . For the phase is . The grader substitutes , , and and requires the counting register to read with with certainty.