---
title: "Quantum Phase Estimation Interactive Lab | Sandbox Physics"
description: "In quantum phase estimation, how much more evolution does each extra bit of precision need? Twice as much."
canonical_url: "https://sandboxphysics.com/labs/quantum-phase-estimation/"
language: "en"
page_type: "lab"
alternate_languages:
  zh-CN: "https://sandboxphysics.com/zh/labs/quantum-phase-estimation/"
last_modified: "2026-10-27"
---

Q046 · Phase clocks / finite precision

# Quantum Phase Estimation

**In quantum phase estimation, how much more evolution does each extra bit of precision need?** Twice as much. Each extra counting qubit doubles the longest controlled evolution. The inverse Fourier transform then piles the probability onto the phase bin nearest the true value; a phase that falls between bins still spreads over a few neighboring answers.

Set the phase on a clock, choose the size of the counting register and watch controlled evolutions write a pattern of phases onto it. The inverse Fourier transform turns that pattern into a number you can measure. Collect a histogram, then compare the precision you get with the total evolution it costs.

> Interactive simulation: open this page in a web browser to change the parameters and run the model.

A classical computer simulates a given diagonal one-qubit unitary and a counting register of two to six qubits. A coherent superposition of two eigenstates shows up in the counting readout as a mixture. Two error models are included: a systematic phase bias and independent bit flips at readout. The clock hands show phase, not physical motion, and the page does not demonstrate any speedup in running time.

Evidence and query counts

Simulated measurement record

## Numbers from repeated readout

Acquire a record to begin.

Colored bars and points come from records; thin gray marks are the model with the configured errors. Whiskers are pointwise 95% Wilson intervals for output or success fractions. They are not phase confidence intervals, simultaneous bands or guarantees after optional stopping.

Most frequent phase bin in the current records

$\text{—}$

Trials at current bit depth

$\text{—}$

All recorded unit evolutions

$\text{—}$

The modal bin uses counts only. More samples stabilize frequencies but do not change the register grid. A bias cannot be distinguished from the eigenphase without separate calibration; a two-eigenstate input can produce two peaks.

Recomputed from the exported trials

| Bits | Trials | Modal integer(s) | Unit evolutions |
| --- | --- | --- | --- |

Latest 12 trials; CSV retains all trials

| Trial | Setting | Reported bits | Integer | Circuit queries |
| --- | --- | --- | --- | --- |

Physics tutorial

## From phase patterns to measured integers

**Background** A phase repeats after every full turn. Controlled evolution turns an eigenphase into a relative phase on a counting register, where interference can reveal it. Here the unitary is a given diagonal matrix with two orthogonal eigenstates.

**Why it matters** A histogram shows the finite precision directly. Comparing different numbers of counting bits also shows how much longer the coherent evolution gets inside the higher controlled powers.

Start with the essentials

- **Focus question**: Does doubling the number of bins require only one more elementary evolution?
- **One-sentence intuition**: Each extra counting bit doubles the longest controlled evolution. Fourier interference piles up probability in the bins near the phase, but a phase that falls between bins still gives several possible answers.

### Core mathematical model

#### The unitary and the input state

$$
U=\operatorname{diag}(e^{2\pi i\theta_0},e^{2\pi i\theta_1}),\quad |\psi\rangle=\sqrt w|0\rangle+\sqrt{1-w}|1\rangle
$$

The two input amplitudes are coherent. Measuring only the counting register cannot tell this superposition apart from an incoherent mixture with the same weights.

#### Controlled powers

$$
|x\rangle|j\rangle\longmapsto e^{2\pi ix(\theta_j+\delta)}|x\rangle|j\rangle
$$

The integer labels the counting basis state. The same bias is added for every unit evolution, so a higher controlled power multiplies it.

#### Inverse Fourier amplitude

$$
a_y(\theta)=\frac{1}{L}\sum_{x=0}^{L-1}e^{2\pi ix(\theta-y/L)},\quad L=2^m
$$

An exact finite Fourier transform is applied to each target branch. In the circuit diagram the controls are counted from the least significant bit, while output strings print the most significant bit first.

#### Trace out the target

$$
P(y)=w|a_y(\theta_0+\delta)|^2+(1-w)|a_y(\theta_1+\delta)|^2
$$

The target states are orthogonal and their register is not measured, so the cross terms vanish. Two peaks come from two separate phases, not from a single phase in between.

#### Resolution and total evolution

$$
\Delta\theta=2^{-m},\qquad C_U=\sum_{j=0}^{m-1}2^j=2^m-1
$$

This count treats the unitary as a black box and adds up how many times the unit evolution is repeated. A compiled gate for a high power may cost a different amount, and nothing here estimates hardware time.

#### Estimate from the most frequent outcome

$$
\widehat y\in\operatorname*{arg\,max}_y N_y,\quad\widehat\theta=\widehat y/2^m
$$

The most frequent bin is found from the reported outcomes alone, and ties stay tied. This is not a maximum-likelihood fit of a continuous phase, and it gives no confidence interval for the phase.

### Common difficulties

#### The clocks are not spinning particles

**Typical misconception** The clock hands show qubits physically spinning.

**Better mental model** The hands show phases in a mathematical picture. Each row is an operation, not a path through space.

#### Phase wraps around

**Typical misconception** A phase of zero and a phase of one full turn are far apart.

**Better mental model** They give the same eigenvalue. When the phase is near this boundary, probability can show up in both the last bin and the first bin.

#### Model curve versus samples

**Typical misconception** The gray model curve is rebuilt from the detector clicks.

**Better mental model** The gray curve comes from the model with the current settings. The colored bars and the most-frequent-bin estimate use only the sampled outcomes. Error bars on the fractions do not set limits on the unknown phase.

### Run the experiment

1. 01

   #### Land on a grid point

   Acquire Exactly on a bin, with no readout error.

   **What to observe:** At the default eigenphase every outcome is the same, because the phase has an exact binary representation.

2. 02

   #### Move between bins

   Choose Between two bins, then compare 2–6 bits.

   **What to observe:** The peak narrows as the bins get finer, but the number of unit evolutions grows. More trials with the same number of bits do not make the bins finer.

3. 03

   #### Prepare two eigenstates

   Choose Two eigenphases and change the first-state weight.

   **What to observe:** The heights of the two peaks change. Each measurement samples one eigenphase from the spectrum; it does not return their average.

4. 04

   #### Separate precision from bias

   Choose Systematic bias, then increase bit depth.

   **What to observe:** A narrower distribution can still be centered on the biased phase. Adding bits does not calibrate the unitary.

Physical conclusion

The finite precision of the register, the noise from finite samples, the weights of the input state and a systematic phase bias are separate limits on the result.

Quantum & fields · Starter path

## Start from a single measurement

Predict an outcome, then count what the measurements actually give. The path starts with one qubit and moves on to wave packets, bound states and two-photon interference.

[Start here → **Quantum State & Born Measurement** Predict a probability, turn the analyzer, then compare your prediction with the measured frequency over many shots. Observe · 15 min](https://sandboxphysics.com/labs/qubit-state/)

1. [1 Quantum State & Born Measurement](https://sandboxphysics.com/labs/qubit-state/)
2. [2 Stern–Gerlach Sequence](https://sandboxphysics.com/labs/stern-gerlach-sequence/)
3. [3 Wave Packet & Uncertainty](https://sandboxphysics.com/labs/wave-packet-uncertainty/)
4. [4 Quantum Harmonic Oscillator](https://sandboxphysics.com/labs/quantum-harmonic-oscillator/)
5. [5 Which Path & Quantum Eraser](https://sandboxphysics.com/labs/quantum-eraser/)
6. [6 Hong–Ou–Mandel Two-Photon Interference](https://sandboxphysics.com/labs/hong-ou-mandel/)

[View the full path →](https://sandboxphysics.com/topics/quantum/#starter-path)
