← Quantum Store · Guides · Lessons · Glossary · About · Türkçe

Intermediate course: quantum algorithms · Lesson 6 / 6 · 12 min

Phase estimation: measure a gate’s secret

Combine phase kickback and the inverse Fourier transform to measure the phase a gate adds. A shared building block of Shor’s algorithm and quantum chemistry.

The problem

Suppose we are given a gate U and one of its eigenstates: applied to this state, U leaves it unchanged except for a phase e^(2πiφ). Phase estimation reads the number φ as a binary number in counting qubits. In our example U = S and the eigenstate is |1⟩: S adds a quarter turn to |1⟩, that is φ = 1/4.

Three steps

Preparation: the counting qubits are put into superposition with H and the target qubit into the eigenstate (|1⟩).

Phase kickback: the j-th counting qubit applies U controlled 2^j times. q0 applies one controlled S, q1 two Ss, that is a controlled Z. The target doesn’t change, but each counting qubit has its own phase written onto it. The pattern in the counter is the Fourier transform of the number φ·4.

Readout: the inverse QFT (SWAP, H, CS†, H) turns this pattern back and the counter reads φ·4 = 1 directly, binary 01. The result is q2 q1 q0 = 101: the target stayed at 1, the counter reads 01.

Why does it matter so much?

In Shor’s algorithm the period is really found as the phase of a particular multiplication. In quantum chemistry a molecule’s energy is read as the phase of its time evolution. More counting qubits measure the phase more precisely: each extra qubit adds one more bit of precision.

Try it yourself

Remove the first X gate: the target becomes |0⟩ and S adds no phase to it (φ = 0). The counter reads 00; the result is 000.

Open the circuit in your browser

The circuit playground is in Turkish. Button guide: “1000 kez ölç” = measure 1000 times, “Durum vektörünü göster” = show the state vector, “Bu devrenin Qiskit kodu” = this circuit’s Qiskit code, “Geri al” = undo, “Temizle” = clear. Click a gate in the circuit to remove it.

Key points

Test yourself

If a phase φ = 1/2 is measured with two counting qubits, what does the counter (q1 q0) read?

Show the answer

10. The counter reads φ·4: 1/2 · 4 = 2, which is 10 in binary.

← The quantum Fourier transform: catching the period · Read the guides →

Share: X · LinkedIn