Education / Quantum Algorithms

Quantum Algorithms · Chapter 11

Adaptive Measurement

So far a measurement has been the end of a computation, or a report sent to a classical optimizer between runs. Every technique before it, from kickback to qubitization, was coherent until the final readout.

A measurement outcome is a classical bit, available the moment it is obtained. Could it choose what happens next: which correction to apply, which basis to measure in, whether to try again? And if it can, what does that buy that coherent control cannot?

We first track computations that branch on mid-circuit outcomes and find that branching can often be traded for coherent control, and the reverse. The reverse trade rebuilds phase estimation with a single control qubit and classical feedback, which raises the question of the ultimate limit on estimating a phase. Finally measurement performs the computation itself: gates teleported through entangled states, whole computations driven by adaptive measurements, and the non-Clifford gates of fault-tolerant machines supplied by injected magic states.

With measurement inside the circuit, every stage of the design process we began with has a technique behind it.

When should the result of a measurement change the rest of the computation?

A measurement outcome is information available mid-computation; used well, it saves qubits, removes randomness, and even applies gates.

In this chapter · 3 sections · 9 topics
  1. 11.1 Conditional Computation
    Topics in this section
    1. 11.1.1 Branches and classical records
    2. 11.1.2 Deferred measurement
    3. 11.1.3 Measurement-dependent corrections
  2. 11.2 Adaptive Estimation
    Topics in this section
    1. 11.2.1 Iterative phase estimation
    2. 11.2.2 A worked example with feedback
    3. 11.2.3 Precision limits and robust estimation
  3. 11.3 Measurement-Based Methods
    Topics in this section
    1. 11.3.1 Teleporting a gate
    2. 11.3.2 Cluster states and adaptive bases
    3. 11.3.3 Magic-state injection
Reading guide · preparation, aims, and assumptions

Use measurement inside a computation: branch on outcomes, defer or advance measurements, estimate phases adaptively with one qubit, and compute by measurement with teleported gates and injected magic states.

Before you begin

Use phase estimation and the inverse QFT (Fourier Methods), the Hadamard test (Phase Encoding), postselection (Operator Embedding), and gate costs in Clifford+T (Coherent Computation).

What you should be able to do

The example to follow

Iterative estimation of φ = 3/8 with one control qubit and two classical corrections, and T-gate injection from the magic state T|+⟩ with a single CNOT, measurement, and conditional S.

Scope and assumptions

Measurements are ideal and feedback is instantaneous unless stated. The iterative-estimation analysis assumes an exact eigenstate and exactly representable phases; general phases need repetition and statistical processing.

11.1

Conditional Computation

How do we describe a computation whose later gates depend on an outcome obtained halfway through? We first write down the branches and the records that label them. Moving a measurement to the end then shows that classical control can be traded for quantum control without changing any statistics, though not without changing the resources. The trade is most useful when every outcome can be repaired by a cheap correction.

11.1.1 Branches and classical records§

mid-circuit measurementclassical recordfeedforward

What does measuring part of a register in the middle of a circuit do to the rest? A mid-circuit measurement splits the computation into branches, one per outcome. For a computational-basis measurement of one qubit, the branch operators are the projectors \(M_0=\ket0\bra0\otimes I\) and \(M_1=\ket1\bra1\otimes I\). Outcome \(b\) occurs with probability

\[p_b=\|M_b\ket\psi\|^2,\]

and leaves the normalized state \(M_b\ket\psi/\sqrt{p_b}\). The outcome is stored as a classical record, a bit that later operations can read. Using it to choose a later gate \(V_b\) is feedforward: the branch with outcome \(b\) continues as \(V_bM_b\ket\psi/\sqrt{p_b}\).

Two features distinguish this from coherent computation. First, branches with different records never interfere again: the record is a which-path record held in a classical register, and classical registers do not go into superposition. Probabilities of branches add; their amplitudes do not. Second, if we ignore the record, the state is the mixture of branches, each with its probability. A mixture can be written as a single matrix, the density operator \(\sum_bV_bM_b\ket\psi\bra\psi M_b^\dagger V_b^\dagger\): each unnormalized branch \(\ket{\chi_b}=V_bM_b\ket\psi\) contributes \(\ket{\chi_b}\bra{\chi_b}\), whose trace is the branch probability \(p_b\).

Measurement with feedforwardThe first qubit of 1/√2(|00⟩+|11⟩) is measured; the outcome, carried on the double line, controls an X on the second qubit. Both branches end with the second qubit in |0⟩: a random outcome has been turned into a deterministic state. Read each circuit left to right; double lines carry classical measurement records.Measurement with feedforward|0⟩m|0⟩|0⟩HX^m
The first qubit of \(\tfrac{1}{\sqrt2}(\ket{00}+\ket{11})\) is measured; the outcome, carried on the double line, controls an \(X\) on the second qubit. Both branches end with the second qubit in \(\ket0\): a random outcome has been turned into a deterministic state.

Example: prepare \(\frac{1}{\sqrt2}(\ket{00}+\ket{11})\), measure the first qubit, and if the outcome is \(1\) apply \(X\) to the second. Both branches end with the second qubit in \(\ket0\). Feedforward has turned a random outcome into a deterministic state, which is the essential trick of teleportation and of every measurement-based method.

Problems
  1. For \(\ket\psi=\frac{1}{\sqrt3}\ket{00}+\sqrt{\frac23}\ket{11}\), give \(p_0\), \(p_1\), and the post-measurement states when the first qubit is measured.

    Show solutionHide solution

    \(p_0=\frac13\) leaving \(\ket{00}\), and \(p_1=\frac23\) leaving \(\ket{11}\).

  2. Measure the first qubit of \(\frac{1}{\sqrt2}(\ket{0}+\ket{1})\ket0\), then apply \(H\) to the first qubit. Compare with applying \(H\) without measuring.

    Show solutionHide solution

    Without measuring, \(H\ket+=\ket0\): outcome \(0\) with certainty. Measuring first gives \(\ket0\) or \(\ket1\) at random; \(H\) then gives \(\ket+\) or \(\ket-\), each a fair coin in the computational basis. The measurement destroyed the interference that \(H\) would have used.

  3. Why can a zero-probability outcome be ignored when writing the conditional states?

    Show solutionHide solution

    If \(p_b=0\), the branch never occurs, and \(M_b\ket\psi=0\) has no normalized version. Any feedforward attached to it is irrelevant. Only branches with nonzero probability need a correction or a decision.

11.1.2 Deferred measurement§

deferred measurement principle

Can a measurement and the classically controlled gate after it be replaced by something coherent? Yes: by a quantum-controlled gate, with the measurement moved to the end. If a qubit is measured in the computational basis and the outcome controls \(V\) on other qubits, then using that qubit as the control of a controlled-\(V\), and measuring it afterwards, gives the same joint distribution of all final outcomes. This is the deferred measurement principle.

Why does it hold? The controlled gate acts as \(\ket0\bra0\otimes I+\ket1\bra1\otimes V\). It never changes the control qubit’s computational-basis value, so the final measurement of that qubit returns the same statistics it would have earlier, and on each value the target receives exactly the same operation as under feedforward. Since nothing afterwards acts on the control qubit, the two procedures cannot be distinguished by their outputs.

Deferring a measurementTop: measure, then apply V if the outcome is 1. Bottom: apply controlled-V coherently and measure the control at the end. The joint distribution of all final outcomes is the same; the resources are not. Read each circuit left to right; double lines carry classical measurement records.Deferring a measurementmeasure, then classically controlled VcontroltargetVcoherently controlled V, measure lastcontroltargetV
Top: measure, then apply \(V\) if the outcome is 1. Bottom: apply controlled-\(V\) coherently and measure the control at the end. The joint distribution of all final outcomes is the same; the resources are not.

The principle is a statement about output statistics, not about resources. The deferred version keeps the measured qubit alive until the end, so it cannot be reset and reused; it needs a controlled gate, which may be more expensive than a classically controlled one; and it must remain coherent longer. The measured version can recycle the qubit immediately but requires fast classical feedback during the computation. Which is cheaper depends on the hardware. The principle can also be used in reverse, starting from a coherent circuit and replacing quantum controls by measurements and classical control, which saves qubits.

Problems
  1. Apply the deferred version of the Bell example: CNOT from the first qubit to the second instead of measure-then-\(X\). What is the final state before measuring the first qubit?

    Show solutionHide solution

    \[\frac{1}{\sqrt2}(\ket{00}+\ket{11})\xrightarrow{\mathrm{CNOT}}\frac{1}{\sqrt2}(\ket{00}+\ket{10})=\ket+\ket0\]. Measuring the first qubit gives a fair coin, and the second qubit is \(\ket0\) in both cases, matching feedforward.

  2. Does deferred measurement apply if, after the measurement, a gate acts on the measured qubit itself, for example a Hadamard?

    Show solutionHide solution

    Not directly. The argument requires that nothing after the controlled gate acts on the control in a way sensitive to coherence. A Hadamard on the measured qubit after measurement produces a random state; on the unmeasured qubit it would interfere branches. The principle holds when the measured qubit is only used as a control and then measured.

  3. A device has 10 qubits and fast mid-circuit measurement. An algorithm in coherent form needs 20 qubits, 10 of which are used only as controls and then measured. How does deferred measurement in reverse help?

    Show solutionHide solution

    Measuring each control qubit as soon as it has done its job, and replacing its quantum control by classical control, frees it to be reset and reused. If the controls are used one at a time, the 10 control qubits can be replaced by a single recycled qubit, and the algorithm fits in 11 qubits. Iterative phase estimation is exactly this transformation.

11.1.3 Measurement-dependent corrections§

Pauli correctionrepeat-until-success

Feedforward is most useful when every outcome leads to the intended result after a cheap fix. Here is a small example. In the Hadamard test, take the controlled unitary to be \(U=e^{i\theta X}\). The two outcomes apply

\[\text{outcome }0:\ \frac{I+U}{2}=\cos\tfrac\theta2\,e^{i\theta X/2},\qquad\text{outcome }1:\ \frac{I-U}{2}=-i\sin\tfrac\theta2\,e^{i\theta X/2}X.\]

Both branches apply the half-angle rotation \(e^{i\theta X/2}\), with an extra \(X\) on outcome \(1\). Since \(X\) commutes with \(e^{i\theta X/2}\), applying \(X\) again after outcome \(1\) gives \(e^{i\theta X/2}\) deterministically, for every input. The outcome probabilities are \(\cos^2\frac\theta2\) and \(\sin^2\frac\theta2\), independent of the input, so the measurement reveals nothing about the data. A fix that is a Pauli gate is a Pauli correction, and Pauli corrections are cheap in nearly every hardware and error-correction scheme.

A measurement-dependent Pauli correctionThe Hadamard-test circuit with controlled-e^(iθ X). Outcome 0 applies e^(iθ X/2); outcome 1 applies e^(iθ X/2)X, which the classically controlled X corrects. The data ends in e^(iθ X/2)|ψ⟩ for every input, and the outcome reveals nothing about |ψ⟩. Read each circuit left to right; double lines carry classical measurement records.A measurement-dependent Pauli correction|0⟩m|ψ⟩e^(iθ X/2)|ψ⟩He^(iθ X)HX^m
The Hadamard-test circuit with controlled-\(e^{i\theta X}\). Outcome 0 applies \(e^{i\theta X/2}\); outcome 1 applies \(e^{i\theta X/2}X\), which the classically controlled \(X\) corrects. The data ends in \(e^{i\theta X/2}\ket\psi\) for every input, and the outcome reveals nothing about \(\ket\psi\).

A related pattern is repeat-until-success. Some circuits apply the desired gate on one outcome and, on the other, a known unitary that can be undone cheaply. On failure, undo and try again. The number of attempts is random, but the final result is exact, and the expected cost can be lower than a deterministic decomposition. For single-qubit rotations in Clifford+\(T\) circuits, repeat-until-success constructions reduce the expected \(T\) count below that of the best deterministic synthesis by a constant factor (Paetznick and Svore, 2014). Postselection on a block encoding, with no way to undo failures, is not of this kind: there a failure destroys the input.

Problems
  1. Verify \((I+e^{i\theta X})/2=\cos\frac\theta2\,e^{i\theta X/2}\).

    Show solutionHide solution

    Factor out \(e^{i\theta X/2}\): \[\frac12e^{i\theta X/2}(e^{-i\theta X/2}+e^{i\theta X/2})=e^{i\theta X/2}\cos(\theta X/2)=\cos\frac\theta2\,e^{i\theta X/2}\], since \(\cos(\theta X/2)=\cos\frac\theta2\,I\) when \(X^2=I\).

  2. For \(\theta=\pi/2\), what are the outcome probabilities, and what gate is applied after correction?

    Show solutionHide solution

    Each outcome has probability \(\frac12\). The corrected gate is \(e^{i\pi X/4}\), a quarter-turn about the \(X\) axis.

  3. A repeat-until-success circuit succeeds with probability \(3/4\) per attempt and costs 4 \(T\) gates per attempt. What is the expected \(T\) count?

    Show solutionHide solution

    The number of attempts is geometric with mean \(1/(3/4)=4/3\), so the expected \(T\) count is \(16/3\approx5.3\). The worst case is unbounded but exponentially unlikely: needing more than \(k\) attempts has probability \(4^{-k}\).

11.2

Adaptive Estimation

Phase estimation used many control qubits and a coherent inverse Fourier transform. Can measurement and feedback do the same job with one control qubit? Reading one bit at a time and correcting later stages classically does it exactly for phases with finitely many digits. A worked example shows the bookkeeping and connects it to the textbook circuit. For general phases each stage is uncertain, so estimation becomes a sequence of experiments chosen from earlier results, and we ask how precise any such sequence can be.

11.2.1 Iterative phase estimation§

iterative phase estimation

How can one control qubit read all the digits? Let \(U\ket u=e^{2\pi i\phi}\ket u\), with \(\phi=0.b_1b_2\cdots b_m\) exactly in binary. We learn the bits one at a time, from the last to the first, with one control qubit that is measured and reused.

At stage \(k\) (running from \(m\) down to \(1\)), prepare the control in \(\ket+\) and apply controlled-\(U^{2^{k-1}}\). The kicked-back phase is \(2\pi\cdot2^{k-1}\phi\) modulo \(2\pi\), which is \(2\pi\,(0.b_kb_{k+1}\cdots b_m)\): multiplying by \(2^{k-1}\) shifts the binary point past the first \(k-1\) digits, which contribute whole turns. The bits after \(b_k\) are already known from earlier stages. Remove their contribution with a phase gate on the control,

\[P(-\omega_k),\qquad\omega_k=2\pi\,(0.0\,b_{k+1}\cdots b_m),\]

leaving phase \(2\pi\,(0.b_k)=\pi b_k\): the control is \(\ket+\) if \(b_k=0\) and \(\ket-\) if \(b_k=1\). A Hadamard and measurement return \(b_k\) with certainty. This is iterative phase estimation, the textbook circuit with deferred measurement run in reverse.

One stage of iterative phase estimationAt stage k, the single control qubit applies U^(2ᵏ⁻¹), receives a phase-gate correction P(−omegaₖ) computed from the bits already measured, and is read in the Hadamard basis to give bₖ. It is then reset for the next stage. Read each circuit left to right; double lines carry classical measurement records.One stage of iterative phase estimation|0⟩bₖ|u⟩|u⟩HU^(2ᵏ⁻¹)P(−omegaₖ)Homegaₖ=2π (0.0 bₖ₊₁⋯ b_m) from earlier outcomes
At stage \(k\), the single control qubit applies \(U^{2^{k-1}}\), receives a phase-gate correction \(P(-\omega_k)\) computed from the bits already measured, and is read in the Hadamard basis to give \(b_k\). It is then reset for the next stage.

The resources compare as follows. Qubits: one control instead of \(m\). Controlled-\(U\) uses: \(2^m-1\) in total, exactly as before, since stage \(k\) still needs \(U^{2^{k-1}}\). Coherence: each stage needs coherence only for its own controlled power, not for the whole computation. Classical feedback: the correction angle \(\omega_k\) depends on earlier outcomes, so the controller must compute it between stages. Iterative estimation saves width, not total evolution.

Problems
  1. For \(\phi=1/4=0.01_2\) with \(m=2\), carry out both stages.

    Show solutionHide solution

    Here \(b_1=0\) and \(b_2=1\). Stage \(k=2\) uses \(U^2\): the phase is \(2\pi\cdot2\cdot\frac14=\pi\), no correction is needed, the control is \(\ket-\), and the outcome is \(b_2=1\). Stage \(k=1\) uses \(U\): the phase is \(2\pi\cdot\frac14=\pi/2\); subtracting \(\omega_1=2\pi\cdot(0.01_2)=\pi/2\) leaves \(0\), so the outcome is \(b_1=0\). The result is \(0.01_2=\frac14\).

  2. What happens at stage 1 if the correction is omitted, for \(\phi=1/4\)?

    Show solutionHide solution

    The control is \(\frac{1}{\sqrt2}(\ket0+i\ket1)\). After \(H\), outcome \(0\) has probability \(|1+i|^2/4=\frac12\). The bit is random: without feedback the earlier result cannot be used to remove the known part of the phase.

  3. Why are the bits measured from least significant to most significant, rather than the other way?

    Show solutionHide solution

    The highest power \(U^{2^{m-1}}\) produces phase \(\pi b_m\) with no contamination from other bits, so \(b_m\) is read first without correction. Each lower power’s phase contains the already-known later bits, which feedback removes. Starting from \(b_1\) with \(U\) alone would give a phase mixing all bits, with nothing yet known to subtract.

11.2.2 A worked example with feedback§

semiclassical Fourier transform

What does the feedback look like in practice? Take \(\phi=3/8=0.011_2\), so \(b_1=0\), \(b_2=1\), \(b_3=1\), and \(m=3\).

Stage 3 uses \(U^4\), which kicks back phase \(2\pi\cdot4\cdot\frac38=2\pi\cdot\frac32\equiv\pi\). No bits are known yet, so no correction is applied. The control is \(\ket-\), and the outcome is \(b_3=1\).

Stage 2 uses \(U^2\), with phase \(2\pi\cdot\frac34\). Knowing \(b_3=1\), we subtract \(\omega_2=2\pi\cdot(0.01)=2\pi\cdot\frac14\), leaving \(\pi\). The outcome is \(b_2=1\).

Stage 1 uses \(U\), with phase \(2\pi\cdot\frac38\). Knowing \(b_2b_3=11\), we subtract \(\omega_1=2\pi\cdot(0.011)=2\pi\cdot\frac38\), leaving \(0\). The outcome is \(b_1=0\).

Iterative phase estimation for φ = 3/8 = 0.011 in binaryBits are acquired from last to first. Each correction subtracts the contribution of the bits already known, leaving a phase of 0 or π that a Hadamard reads exactly. Columns: Stage, Power, Phase / 2π, Correction / 2π, Remaining, Bit. 3, U⁴, 1/2, 0, 1/2, b₃=1; 2, U², 3/4, 1/4, 1/2, b₂=1; 1, U, 3/8, 3/8, 0, b₁=0Iterative phase estimation for φ = 3/8 = 0.011 in binaryStagePowerPhase / 2πCorrection/ 2πRemainingBit3U⁴1/201/2b₃=12U²3/41/41/2b₂=11U3/83/80b₁=0
Bits are acquired from last to first. Each correction subtracts the contribution of the bits already known, leaving a phase of 0 or \(\pi\) that a Hadamard reads exactly.

The acquisition order is \(b_3,b_2,b_1\), but the phase is \(0.b_1b_2b_3=0.011\). Recording bits in the wrong order is an easy implementation error that the problems explore.

The same structure appears inside the textbook circuit. The inverse QFT’s controlled phase gates subtract the contributions of bits already determined, then a Hadamard reads the next bit. If each qubit of the QFT output is measured as soon as it is final, and the measured value classically controls the remaining phase gates, the output statistics are unchanged, by deferred measurement. This is the semiclassical Fourier transform of Griffiths and Niu (1996). It needs only single-qubit gates, measurements, and classical control, no two-qubit gates at all, and it is how Shor’s algorithm can run its \(2n\)-qubit control register on a single recycled qubit.

Problems
  1. Repeat the procedure for \(\phi=5/8=0.101_2\).

    Show solutionHide solution

    Stage 3 (\(U^4\)): phase \(2\pi\cdot\frac{20}{8}\equiv\pi\), so \(b_3=1\). Stage 2 (\(U^2\)): phase \(2\pi\cdot\frac{10}{8}\equiv2\pi\cdot\frac14\); subtract \(\omega_2=2\pi\cdot(0.0b_3)=2\pi\cdot\frac14\), leaving \(0\), so \(b_2=0\). Stage 1 (\(U\)): phase \(2\pi\cdot\frac58\); subtract \(\omega_1=2\pi\cdot(0.0b_2b_3)=2\pi\cdot0.001_2=2\pi\cdot\frac18\), leaving \(2\pi\cdot\frac12=\pi\), so \(b_1=1\). The result is \(0.101_2=\frac58\).

  2. A program stores the bits in acquisition order and reports \(0.b_3b_2b_1\). What does it report for \(\phi=3/8\)?

    Show solutionHide solution

    It reports \(0.110_2=\frac34\) instead of \(\frac38\). Tests with a symmetric bit pattern such as \(0.101\) would not catch this bug, since the pattern reads the same in both orders; test with asymmetric phases.

  3. How many two-qubit gates does the semiclassical inverse QFT on \(m\) qubits use, and what replaces them?

    Show solutionHide solution

    None. Each controlled phase gate whose control has already been measured becomes a phase gate conditioned on a classical bit. The \(m(m-1)/2\) controlled rotations become classically controlled single-qubit rotations, combined into one rotation per stage.

11.2.3 Precision limits and robust estimation§

Heisenberg limitstandard quantum limitrobust phase estimation

What happens when the phase has no finite binary expansion? The exact examples assumed \(\phi\) has \(m\) binary digits. A general phase does not, so each stage’s outcome is probabilistic, and a wrong early bit corrupts the correction for every later one. Practical adaptive schemes therefore repeat stages, use the outcomes as statistical evidence about \(\phi\), and choose later experiments to be informative given what is already known. Bayesian methods keep a probability distribution over \(\phi\) and update it after each outcome; robust phase estimation (Kimmel, Low, and Yoder, 2015) uses a fixed schedule of powers with enough repetitions per power to bound the error even with noise.

How precise can any such scheme be? Count resources as total uses of \(U\), \(N\). Repeating a single Hadamard test \(N\) times estimates \(\phi\) with error of order \(1/\sqrt N\): the standard quantum limit, the same \(1/\sqrt N\) as classical sampling. Using powers \(U^{2^j}\) and adaptive or Fourier processing reaches error of order \(1/N\): the Heisenberg limit. That no strategy does better is a quoted theorem of quantum metrology (Giovannetti, Lloyd, and Maccone, 2006). It is consistent with the search lower bound. An amplitude estimator with error much smaller than \(1/\sqrt N\) after far fewer than \(\sqrt N\) uses could tell a list with one marked item among \(N\) from a list with none, since their amplitudes are \(1/\sqrt N\) and \(0\), and that would beat the \(\Omega(\sqrt N)\) bound. The improvement comes from coherence across many uses of \(U\), concentrated in long controlled powers.

Two scalings of phase estimationError in an estimated phase against total uses N of U, on logarithmic axes (constants omitted). Repeating independent single-use experiments gives the standard quantum limit 1/√N; coherent powers with adaptive or Fourier processing reach the Heisenberg limit 1/N. Horizontal axis: total uses of U, N (log scale); vertical axis: error (log scale). Two scalings of phase estimation110⁻²10⁻⁴10⁻⁶10⁻⁸110²10⁴10⁶10⁸total uses of U, N (log scale)error (log scale)standard limit 1/√NHeisenberg limit 1/N
Error in an estimated phase against total uses \(N\) of \(U\), on logarithmic axes (constants omitted). Repeating independent single-use experiments gives the standard quantum limit \(1/\sqrt N\); coherent powers with adaptive or Fourier processing reach the Heisenberg limit \(1/N\).

In the presence of noise that limits how long a controlled power can stay coherent, the Heisenberg scaling holds only up to that coherence time; beyond it, repetition returns to standard scaling. Adaptive estimation is the setting in which this trade-off is managed: use the longest powers that remain reliable, and repeat them.

Problems
  1. To estimate a phase to \(10^{-4}\), roughly how many uses of \(U\) does each limit require?

    Show solutionHide solution

    Standard quantum limit: error \(\sim1/\sqrt N\), so \(N\sim10^8\). Heisenberg limit: error \(\sim1/N\), so \(N\sim10^4\) (up to constants).

  2. Why does an error in an early bit (\(b_m\)) of iterative phase estimation damage every later stage?

    Show solutionHide solution

    Each correction \(\omega_k\) is built from all later bits. A wrong \(b_m\) adds a wrong term \(2\pi b_m2^{k-1-m}\) to every correction, so each subsequent stage starts from a wrongly shifted phase and its outcome becomes random. Repeating each stage and taking a majority vote makes early bits reliable before they are used.

  3. A device keeps controlled powers coherent only up to \(U^{64}\). How should an estimate to \(10^{-5}\) be organized?

    Show solutionHide solution

    Use powers up to \(64\) to resolve \(\phi\) to about \(1/64\) per measurement with Heisenberg-like efficiency, then repeat the highest-power experiment many times. Repetition reduces the error as \(1/\sqrt{R}\), so reaching \(10^{-5}\) from a per-experiment resolution of about \(10^{-2}\) needs about \(R\sim10^6\) repetitions of \(U^{64}\), roughly \(6\times10^7\) uses of \(U\), far more than the \(10^5\) the Heisenberg limit would allow with longer coherence.

11.3

Measurement-Based Methods

Can measurement do more than read and steer, and perform the computation itself? Entangling the data with a prepared auxiliary qubit, measuring in a chosen basis, and correcting the outcome applies a gate. Chaining such steps gives a model of computation driven entirely by measurement, provided each basis is chosen from earlier outcomes. A related trick supplies the non-Clifford gates that error-corrected computers find hardest.

11.3.1 Teleporting a gate§

gate teleportationone-bit teleportation

Can a measurement move a state onto another qubit and apply a gate on the way? Take an input \(\ket\psi=a\ket0+b\ket1\) and an auxiliary qubit in \(\ket+\). Apply a controlled-\(Z\) between them, giving \(a\ket0\ket++b\ket1\ket-\). Now measure the input qubit in the basis

\[\ket{\pm_\alpha}=\tfrac{1}{\sqrt2}\big(\ket0\pm e^{i\alpha}\ket1\big).\]

Projecting onto \(\ket{\pm_\alpha}\) gives, for outcome \(m\in\{0,1\}\) (\(m=0\) for \(+\)), the unnormalized auxiliary state

\[\tfrac{1}{\sqrt2}\big(a\ket++(-1)^me^{-i\alpha}b\ket-\big)=\tfrac{1}{\sqrt2}\,X^mHP(-\alpha)\ket\psi,\qquad P(\beta)=\mathrm{diag}(1,e^{i\beta}).\]

Each outcome has probability \(\frac12\), whatever \(\ket\psi\) is. The state has moved to the auxiliary qubit, and on the way the gate \(HP(-\alpha)\) has been applied, followed by a known Pauli \(X^m\) that depends on the outcome. This is one-bit teleportation, and the general idea of applying a gate by teleporting through a suitably prepared resource is gate teleportation.

Applying a gate by one-bit teleportationControlled-Z entangles the input with an auxiliary |+⟩. Measuring the input in the basis |±_α⟩ (a phase gate P(−α), a Hadamard, and a computational-basis measurement) leaves X^mHP(−α)|ψ⟩ on the auxiliary qubit; the classically controlled X removes the byproduct. Read each circuit left to right; double lines carry classical measurement records.Applying a gate by one-bit teleportation|ψ⟩m|+⟩HP(−α)|ψ⟩P(−α)HX^m
Controlled-\(Z\) entangles the input with an auxiliary \(\ket+\). Measuring the input in the basis \(\ket{\pm_\alpha}\) (a phase gate \(P(-\alpha)\), a Hadamard, and a computational-basis measurement) leaves \(X^mHP(-\alpha)\ket\psi\) on the auxiliary qubit; the classically controlled \(X\) removes the byproduct.

The measurement basis chooses the gate: different \(\alpha\) give different rotations. The Pauli byproduct can be corrected immediately, or tracked classically and accounted for later. Nothing is cloned, since the input qubit is consumed by the measurement, and nothing is sent faster than light, since the byproduct cannot be interpreted without the outcome bit.

Problems
  1. For \(\alpha=0\), what gate is applied, and what correction does outcome \(m=1\) need?

    Show solutionHide solution

    \(X^mH\ket\psi\). For \(m=0\) the result is \(H\ket\psi\). For \(m=1\) it is \(XH\ket\psi\); applying \(X\) gives \(H\ket\psi\).

  2. Verify the formula for \(\ket\psi=\ket0\), \(\alpha=0\), outcome \(m=0\).

    Show solutionHide solution

    After CZ: \(\ket0\ket+\). Projecting the first qubit onto \(\ket{+}\) gives amplitude \(\braket{+}{0}=\frac{1}{\sqrt2}\), leaving \(\frac{1}{\sqrt2}\ket+\). The formula gives \(\frac{1}{\sqrt2}HP(0)\ket0=\frac{1}{\sqrt2}\ket+\). They agree.

  3. Show that the outcome probabilities are independent of \(\ket\psi\), and explain why that matters.

    Show solutionHide solution

    The unnormalized output is \(\frac{1}{\sqrt2}\) times a unitary applied to \(\ket\psi\), so its squared length is \(\frac12\) for every input. The measurement therefore reveals nothing about \(\ket\psi\), which is necessary: a measurement that learned about the data would disturb it, and the gate could not be applied faithfully.

11.3.2 Cluster states and adaptive bases§

measurement-based quantum computationcluster statePauli frame

What if we repeat the step? Chain the construction. Prepare a line of qubits in \(\ket+\), apply controlled-\(Z\) between neighbours, and place the input at one end. Measuring the first qubit with angle \(\alpha_1\) teleports \(HP(-\alpha_1)\ket\psi\) onto the second; measuring the second with \(\alpha_2\) teleports \(HP(-\alpha_2)HP(-\alpha_1)\ket\psi\) onto the third; and so on. Can such products reach every single-qubit gate? Every single-qubit unitary is, up to a global phase, a product \(R_z(\gamma)R_x(\beta)R_z(\alpha)\) of rotations, the Euler decomposition. Here \(P(\beta)\) equals \(R_z(\beta)\) up to a global phase, and \(R_x(\beta)=HR_z(\beta)H\), so products of the steps \(HP(-\alpha_k)\) reach every single-qubit unitary: a few steps suffice for any one of them. On a two-dimensional grid of such entangled qubits, a cluster state, measurements can also apply entangling gates. This is measurement-based quantum computation (Raussendorf and Briegel, 2001): all entanglement is prepared in advance, and the computation consists of single-qubit measurements in adaptively chosen bases.

Measurement-based computation on a chainQubits in |+⟩ entangled by controlled-Z gates form a cluster chain. Measuring qubit 1 at angle α₁ and qubit 2 at angle α₂ (each a basis change followed by measurement) applies HP(−α₂)HP(−α₁) to the input, up to Pauli byproducts tracked in the Pauli frame. The second angle depends on the first outcome. Read each circuit left to right; double lines carry classical measurement records.Measurement-based computation on a chain|ψ⟩m₁|+⟩m₂|+⟩outputα₁±α₂
Qubits in \(\ket+\) entangled by controlled-\(Z\) gates form a cluster chain. Measuring qubit 1 at angle \(\alpha_1\) and qubit 2 at angle \(\alpha_2\) (each a basis change followed by measurement) applies \(HP(-\alpha_2)HP(-\alpha_1)\) to the input, up to Pauli byproducts tracked in the Pauli frame. The second angle depends on the first outcome.

Adaptivity is essential. A byproduct \(X\) from one step does not commute with the next step’s phase gate; instead \(P(\beta)X=e^{i\beta}XP(-\beta)\), so pushing the \(X\) through flips the sign of the next angle. The classical controller therefore chooses each measurement basis using earlier outcomes, flipping signs as needed, and keeps track of the remaining Pauli byproducts, a record called the Pauli frame, to reinterpret the final outcomes. Measurements whose bases do not depend on others can be done simultaneously, so the depth of the computation is set by the chain of classical dependencies.

The model is equivalent in power to the circuit model, not more powerful. Its appeal is architectural: photonic platforms, where two-qubit gates are probabilistic but entangled resource states can be built and checked in advance, use it naturally. Its costs are the size of the resource state, the precision of measurement angles, and fast classical feedforward.

Problems
  1. Two steps with angles \(\alpha_1,\alpha_2\) and outcomes \(m_1=0\), \(m_2=0\). What unitary is applied to \(\ket\psi\)?

    Show solutionHide solution

    \(HP(-\alpha_2)HP(-\alpha_1)\). With no byproducts, no corrections are needed.

  2. Verify \(P(\beta)X=e^{i\beta}XP(-\beta)\) by applying both sides to \(\ket0\) and \(\ket1\).

    Show solutionHide solution

    Left side on \(\ket0\): \(P(\beta)\ket1=e^{i\beta}\ket1\). Right side: \(e^{i\beta}XP(-\beta)\ket0=e^{i\beta}\ket1\). On \(\ket1\): left \(P(\beta)\ket0=\ket0\); right \(e^{i\beta}X(e^{-i\beta}\ket1)=\ket0\). Equal.

  3. If the first outcome is \(m_1=1\), how must the second measurement angle be changed to apply the intended \(HP(-\alpha_2)HP(-\alpha_1)\) up to Paulis?

    Show solutionHide solution

    The state after step 1 is \(XHP(-\alpha_1)\ket\psi\). Step 2 applies \(HP(-\alpha_2')\) to it: \[HP(-\alpha_2')X=e^{-i\alpha_2'}HXP(\alpha_2')=e^{-i\alpha_2'}ZHP(\alpha_2')\]. Choosing \(\alpha_2'=-\alpha_2\) gives \(ZHP(-\alpha_2)\) acting on \(HP(-\alpha_1)\ket\psi\): the intended gate with a \(Z\) byproduct added to the Pauli frame. So the second angle is negated.

11.3.3 Magic-state injection§

magic statestate injectionmagic-state distillation

Why do error-corrected computers need anything beyond Clifford gates? Error-correcting codes make Clifford gates (\(H\), \(S\), CNOT) comparatively easy to apply fault-tolerantly, but Clifford gates alone are not universal. A quoted theorem, the Gottesman–Knill theorem (Gottesman, 1998), shows that circuits of Clifford gates on computational-basis inputs, with computational-basis measurements, can be simulated efficiently classically. The \(T\) gate supplies the missing power, and in many codes it cannot be applied directly. Gate teleportation solves this by moving the difficulty into a state.

Prepare the magic state \(\ket A=T\ket+=\frac{1}{\sqrt2}(\ket0+e^{i\pi/4}\ket1)\). With data \(\ket\psi=a\ket0+b\ket1\), apply a CNOT from the data to the magic qubit, and measure the magic qubit:

\[\text{outcome }0:\ a\ket0+e^{i\pi/4}b\ket1=T\ket\psi,\qquad\text{outcome }1:\ e^{i\pi/4}\big(a\ket0+e^{-i\pi/4}b\ket1\big)\propto T^\dagger\ket\psi.\]

On outcome \(1\), apply \(S=T^2\): \(ST^\dagger=T\). Either way the data ends in \(T\ket\psi\), using only a CNOT, a measurement, and a classically controlled \(S\), all Clifford operations. This is state injection.

Injecting a T gate from a magic stateA CNOT from the data to the magic state |A⟩=T|+⟩, a measurement of the magic qubit, and a classically controlled S apply T to the data. Only Clifford operations act; the non-Clifford resource is the state |A⟩, prepared and distilled separately. Read each circuit left to right; double lines carry classical measurement records.Injecting a T gate from a magic state|ψ⟩T|ψ⟩|A⟩mS^m
A CNOT from the data to the magic state \(\ket A=T\ket+\), a measurement of the magic qubit, and a classically controlled \(S\) apply \(T\) to the data. Only Clifford operations act; the non-Clifford resource is the state \(\ket A\), prepared and distilled separately.

The non-Clifford difficulty has moved into preparing \(\ket A\) with very high fidelity. Magic-state distillation (Bravyi and Kitaev, 2005) takes many noisy copies of \(\ket A\) and, using only Clifford operations and measurements, outputs fewer copies with much lower error; for example, one standard protocol turns 15 copies with error \(p\) into one with error about \(35p^3\). Distillation dominates the cost of many fault-tolerant resource estimates, which is why algorithms are often costed in \(T\) gates or Toffolis, and why the synthesis costs of small rotations, in phase gates, Fourier transforms and simulation, matter.

This closes the technique sequence. Algorithm design, as the design process we began with laid out, has meant choosing compatible access, encoding the property that matters, engineering interference, constructing a readout, proving correctness, and counting every resource. Measurement and feedback, introduced here last, turn out to touch every stage: they shorten circuits, recycle qubits, and even supply the gates. The next course, Quantum Programming, turns these contracts and calculations into executable, tested circuits.

Problems
  1. Verify the outcome-\(0\) branch of state injection for \(\ket\psi=\ket1\).

    Show solutionHide solution

    The joint state is \(\ket1\otimes\frac{1}{\sqrt2}(\ket0+e^{i\pi/4}\ket1)\). CNOT flips the magic qubit: \(\ket1\otimes\frac{1}{\sqrt2}(\ket1+e^{i\pi/4}\ket0)\). Outcome \(0\) leaves \(e^{i\pi/4}\ket1=T\ket1\), with probability \(\frac12\).

  2. Why is the correction on outcome \(1\) an \(S\) gate and not a Pauli?

    Show solutionHide solution

    Outcome \(1\) applies \(T^\dagger\) instead of \(T\), and \(T(T^\dagger)^{-1}=T^2=S\). \(S\) is Clifford, so it is cheap fault-tolerantly, but it is not a Pauli; it cannot simply be tracked in a Pauli frame and must be applied (or tracked as a Clifford frame).

  3. A 15-to-1 distillation protocol maps input error \(p\) to about \(35p^3\). Starting from \(p=10^{-3}\), what error after one round and after two? How many raw states does two rounds consume per output?

    Show solutionHide solution

    One round: \(35\times10^{-9}=3.5\times10^{-8}\). Two rounds: \(35\times(3.5\times10^{-8})^3\approx1.5\times10^{-21}\). Two rounds consume \(15\times15=225\) raw magic states per output (ignoring failed rounds).

Summary

Questions and worked problems

Attempt each question before opening a hint. Explain your reasoning, then compare it with the solution.

1. Quick check §

In one-bit teleportation with α = π/2, what gate is applied (after correcting the byproduct)?

Hint 1

The applied gate is HP(−α).

Hint 2

P(−π/2) = S†.

Worked solution

HP(−π/2) = HS†. On outcome 1, apply X to remove the byproduct; the auxiliary qubit then holds HS†|ψ⟩.

Revisit the relevant explanation

2. Quick check §

Prepare \(\frac{1}{\sqrt2}(\ket{00}+\ket{11})\) and measure the first qubit in the \(\{\ket+,\ket-\}\) basis. What is the second qubit’s state for each outcome, and which feedforward correction makes it \(\ket+\) in both cases?

Hint 1

Rewrite the Bell state as \(\frac{1}{\sqrt2}(\ket{++}+\ket{--})\).

Hint 2

\(Z\ket-=\ket+\).

Worked solution

Since \(\frac{1}{\sqrt2}(\ket{00}+\ket{11})=\frac{1}{\sqrt2}(\ket{++}+\ket{--})\), outcome \(+\) leaves the second qubit in \(\ket+\) and outcome \(-\) leaves \(\ket-\), each with probability \(\frac12\). Applying \(Z\) after outcome \(-\) gives \(\ket+\) deterministically. The choice of measurement basis determines which states the partner can be steered to; the correction is a Pauli gate chosen by the record.

Revisit the relevant explanation

3. Quick check §

A qubit carries a pending Pauli byproduct \(X\) in the Pauli frame. The program then applies \(H\) and \(S\), and measures in the computational basis. How does the byproduct propagate, and must the measured bit be flipped? What if no \(H\) had been applied?

Hint 1

\(HX=ZH\), and \(S\) commutes with \(Z\).

Hint 2

A \(Z\) just before a computational-basis measurement does not change the outcome.

Worked solution

Moving the byproduct through the gates: \(SHX=SZH=ZSH\), so just before the measurement the frame holds \(Z\). A \(Z\) does not change computational-basis probabilities, so the measured bit is reported unchanged. Without the \(H\), \(SX=YS\), and \(Y=iXZ\) contains an \(X\), which flips a computational-basis outcome, so the classical controller must invert the measured bit. Tracking the frame lets the hardware skip the correction gates; only the interpretation of later outcomes changes.

Revisit the relevant explanation

4. Worked problem §

Run iterative phase estimation for φ = 7/8 = 0.111 in binary, giving each stage’s phase, correction, and outcome.

Hint 1

Stage 3 uses U⁴, stage 2 uses U², stage 1 uses U.

Hint 2

The correction at stage k is 2π(0.0 b_{k+1} … b_m).

Worked solution

Stage 3: phase 2π·(28/8) ≡ 2π·½, no correction, b₃ = 1. Stage 2: phase 2π·(14/8) ≡ 2π·¾, subtract 2π·¼, leaving π: b₂ = 1. Stage 1: phase 2π·⅞, subtract 2π·(0.011)₂ = 2π·⅜, leaving 2π·½ = π: b₁ = 1. Result 0.111 = 7/8.

Revisit the relevant explanation

5. Worked problem §

Run two-stage iterative phase estimation on an eigenstate with \(\phi=1/3\), which has no finite binary expansion. (a) Compute the probability of each outcome at stage 2 (controlled-\(U^2\), no correction). (b) For each stage-2 outcome, apply the correction \(P(-\omega_1)\) with \(\omega_1=2\pi(0.0b_2)\) and compute the stage-1 probabilities. (c) Tabulate the probabilities of the four estimates \(0.b_1b_2\) and compare them with textbook phase estimation with \(M=4\).

Hint 1

With phase \(\varphi\) on the control, \(\Pr[0]=(1+\cos\varphi)/2\).

Hint 2

Stage 2 phase: \(2\pi\cdot\frac23\). Stage 1 phase: \(2\pi\cdot\frac13-\omega_1\).

Worked solution

(a) Stage 2 sees phase \(4\pi/3\), so \(\Pr[b_2=0]=(1+\cos\frac{4\pi}{3})/2=\frac14\) and \(\Pr[b_2=1]=\frac34\). (b) If \(b_2=0\), there is no correction and stage 1 sees \(2\pi/3\): \(\Pr[b_1=0]=\frac14\). If \(b_2=1\), \(\omega_1=\pi/2\) and stage 1 sees \(2\pi/3-\pi/2=\pi/6\): \(\Pr[b_1=0]=(1+\cos\frac\pi6)/2\approx0.933\). (c) The estimates \(0.00,0.01,0.10,0.11\) (that is \(0,\frac14,\frac12,\frac34\)) have probabilities \(\frac14\cdot\frac14=0.0625\), \(\frac34\times0.933\approx0.700\), \(\frac14\cdot\frac34=0.1875\), and \(\frac34\times0.067\approx0.050\). Textbook phase estimation with \(M=4\) gives exactly the same four numbers. The two procedures are related by deferred measurement, so their output statistics agree even when the phase is not exact.

Revisit the relevant explanation

6. Worked problem §

In teleportation, the state just before Alice measures is \(\frac12\sum_{m_1,m_2}\ket{m_1m_2}\,X^{m_2}Z^{m_1}\ket\psi\). Apply the deferred-measurement principle: replace the classically controlled corrections by a CNOT from Alice’s second qubit and a controlled-\(Z\) from her first qubit to Bob’s. Find the final three-qubit state, and explain what Alice’s later measurements reveal.

Hint 1

The correction must undo \(X^{m_2}Z^{m_1}\): apply \(X^{m_2}\) first, then \(Z^{m_1}\).

Hint 2

\(Z^{m_1}X^{m_2}X^{m_2}Z^{m_1}=I\).

Worked solution

On the branch \(\ket{m_1m_2}\), the controlled gates apply \(Z^{m_1}X^{m_2}\) to Bob’s qubit, turning \(X^{m_2}Z^{m_1}\ket\psi\) into \(\ket\psi\). The final state is \(\frac12\sum_{m_1,m_2}\ket{m_1m_2}\ket\psi=\ket+\ket+\ket\psi\). Bob holds \(\ket\psi\), unentangled with Alice, and Alice’s qubits are in a fixed state that carries no information about \(\psi\). Measuring them gives two uniformly random bits. The deferred version gives the same statistics as the original, but it needs quantum control from Alice’s qubits to Bob’s, so it is no longer a protocol between distant parties. Classical communication is what lets teleportation work at a distance.

Revisit the relevant explanation

7. Worked problem §

On a three-qubit line cluster, the input sits on qubit 1. Measuring qubit 1 with angle \(\alpha_1\) and qubit 2 with angle \(\alpha_2\) applies \(X^{m_2}HP(-\alpha_2)X^{m_1}HP(-\alpha_1)\) to the input, which ends on qubit 3. (a) Choose \(\alpha_1,\alpha_2\) to apply \(T\), up to byproducts, when both outcomes are \(0\). (b) For \(m_1=1\), \(m_2=0\), find the byproduct on the output and say whether the second angle needs adapting.

Hint 1

\(HP(0)HP(\beta)=H^2P(\beta)=P(\beta)\).

Hint 2

Use \(HX=ZH\); \(P(0)=I\) commutes with everything.

Worked solution

(a) With \(\alpha_2=0\), the composite is \(HHP(-\alpha_1)=P(-\alpha_1)\). Choosing \(\alpha_1=-\pi/4\) gives \(P(\pi/4)=T\). (b) With \(m_1=1\), the operation is \(HP(0)XHT=HXHT=ZT\), so the output is \(ZT\ket\psi\). A \(Z\) byproduct is recorded in the Pauli frame and corrected later, or absorbed into the interpretation of a final measurement. Because \(\alpha_2=0\), flipping its sign changes nothing, so no adaptation is needed here. For a general \(\alpha_2\), the outcome \(m_1=1\) would require measuring with \(-\alpha_2\) instead, since \(P(\beta)X=e^{i\beta}XP(-\beta)\).

Revisit the relevant explanation

8. Misconception §

A student writes: “Iterative phase estimation uses one control qubit and \(m\) measurements, so it needs only \(m\) applications of controlled-\(U\) instead of \(2^m-1\).” Correct the claim, state what iterative phase estimation actually saves, and say when the number of controlled-\(U\) applications really is small.

Hint 1

Stage \(k\) still applies controlled-\(U^{2^{k-1}}\).

Hint 2

Compare the cost of \(U^{2^j}\) for modular multiplication and for \(e^{-iHt}\).

Worked solution

Stage \(k\) applies controlled-\(U^{2^{k-1}}\). Built from repeated controlled-\(U\), the stages cost \(1+2+\cdots+2^{m-1}=2^m-1\) applications in total, exactly as in the textbook circuit. Iterative estimation saves width: one recycled control qubit instead of \(m\), and no coherent inverse QFT. It also shortens the required coherence time of the control. The count of controlled powers is small only when \(U^{2^j}\) has a shortcut, as for modular multiplication, where \(U_a^{2^j}=U_{a^{2^j}\bmod L}\) costs the same as \(U_a\). For Hamiltonian evolution there is generally no such shortcut, and the total evolution time grows as \(2^m\), as the Heisenberg limit requires.

Revisit the relevant explanation

9. Extension §

A fault-tolerant algorithm needs 10⁸ T gates with total failure probability below 1%. Raw magic states have error 10⁻³, and the 15-to-1 protocol maps error p to 35p³. How many rounds of distillation are needed, and roughly how many raw magic states per T gate?

Hint 1

Each T gate may fail with probability at most about 10⁻¹⁰.

Hint 2

One round gives 3.5 × 10⁻⁸; two rounds give about 1.5 × 10⁻²¹.

Worked solution

Per-gate error must be below about 10⁻²/10⁸ = 10⁻¹⁰. One round gives 3.5 × 10⁻⁸, not enough; two rounds give about 1.5 × 10⁻²¹, more than enough. Two rounds consume about 15² = 225 raw states per output T gate (more with failed rounds), so about 2 × 10¹⁰ raw magic states in total. In practice protocols are mixed and tuned to avoid overshooting the target, which is why T counts dominate resource estimates.

Revisit the relevant explanation

10. Extension §

A circuit contains \(10^6\) repeat-until-success gadgets, each succeeding with probability \(p=3/4\) per attempt, all running in parallel. (a) What is the expected total number of attempts? (b) For one gadget, how many attempts guarantee success with probability \(1-10^{-9}\)? (c) Roughly how many attempts does the slowest of the \(10^6\) gadgets typically need, and why does this matter for scheduling?

Hint 1

One gadget needs more than \(k\) attempts with probability \((1-p)^k=4^{-k}\).

Hint 2

The slowest of \(G\) gadgets exceeds \(k\) attempts with probability about \(G\cdot4^{-k}\).

Worked solution

(a) Each gadget needs \(1/p=4/3\) attempts on average, so about \(1.33\times10^6\) attempts in total, which is the quantity that sets the expected \(T\) count. (b) \(4^{-k}\le10^{-9}\) needs \(k\ge9\log_410\approx15\) attempts. (c) The slowest gadget exceeds \(k\) attempts with probability about \(10^6\cdot4^{-k}\), which is of order one at \(k\approx\log_410^6\approx10\). So the slowest gadget typically needs about \(10\) attempts, although the average is \(1.33\). If later gates must wait for all gadgets, latency is set by this maximum, not the mean, and idle qubits decohere while they wait. Resource estimates for adaptive circuits should therefore report latency or depth separately from expected gate counts.

Revisit the relevant explanation

Where this leads. This completes the technique sequence. The Quantum Programming course turns these constructions into executable circuits, with tests that check contracts, amplitudes, and resource counts.

Search this book

Search the course.