+ Part II · Interference does the work

How arrows are steered, multiplied and made to cancel.

In one search over eight possible answers, two rounds of a simple routine bring out the right one 94.5 % of the time. In another computation, a sequence repeats every four steps, and a reading reveals that period without ever showing the sequence. Part II builds the machinery behind such results. Chapter 4 shows how gates turn arrows without reading them, and Chapter 5 how a register of qubits carries an arrow for every possible output. Chapter 6 shows how a search makes one answer's arrow grow, and Chapters 7 and 8 how Shor's algorithm turns factoring into finding a period and reads that period through interference.

04 — Gates

Turning arrows without looking.

+ The questionHow does a machine change the arrows without reading them?

A gate turns arrows

A gate is an operation that changes a qubit's arrows in a fixed and reversible way, without reading them. It is the quantum counterpart of a logic gate in an ordinary processor, with one difference that shapes everything after it: an ordinary gate takes in bits and puts out bits, while a quantum gate takes in arrows and puts out arrows. Nothing is learned about the qubit while a quantum gate acts. A computation is a sequence of gates followed, at the end, by a reading, and such a sequence of gates is called a circuit, a program of gates rather than the electrical circuit of Chapter 2.

A few gates recur throughout the guide. The X gate swaps the arrows for 0 and 1, so a qubit holding 0 ends up holding 1 and the reverse, which makes it the quantum version of NOT. The Z gate leaves the arrow for 0 alone and turns the arrow for 1 through half a turn. The S gate turns the arrow for 1 by a quarter turn, and the T gate by an eighth of a turn, 45 degrees. Applied to a qubit that reads 0 or 1 with certainty, the last three change nothing a reading could see, because their effect appears only when arrows later combine.

09 — Gates turn and swap arrows
BEFORE AFTER 0 1 0 1 X swaps the two arrows 0 1 0 1 Z turns 1 by half a turn 0 1 0 1 S turns 1 by a quarter turn 0 1 0 1 T turns 1 by an eighth, 45° 0 1 0 1 H from 0: same way 0 1 0 1 H from 1: opposite ways an eighth of a turn: cheap here, the costliest gate to protect every gate can be undone; only reading cannot X, Z, S and T shown on the 70/30 qubit
AmplitudeControl pulseFocal detail
Plate 09 — A gate changes a qubit's arrows in a fixed, reversible way without reading them. X swaps the arrows, Z, S and T turn the arrow for 1 by a half, quarter and eighth of a turn, and H spreads one outcome over two.

Every gate can be undone by another gate, because turning and swapping arrows loses no information. Reading is the only step in a quantum computation that cannot be reversed. Reversibility rules out some familiar logic. An ordinary AND gate takes two bits and returns one, so its output cannot reveal which inputs produced a 0, and information is thrown away. A quantum computer does its arithmetic with a reversible substitute, the Toffoli gate, which keeps both inputs and flips a third bit only when both inputs are 1. Every addition and multiplication inside Shor's algorithm is built from Toffoli gates and simpler ones, which is why estimates for RSA-2048 count Toffoli gates in their billions.

In hardware, a gate is a carefully shaped pulse. On Willow, a microwave pulse of 25 nanoseconds performs a single-qubit gate, and the pulse's duration, strength and timing decide how far the arrows turn. Chapter 18 follows the pulse from the electronics that shape it to the chip.

The mirror inside a qubit

The most important single-qubit gate is the Hadamard gate, written H, and it does to a qubit what a half-silvered mirror does to a photon. Applied to a qubit holding 0, it produces two arrows of length 0.707 pointing the same way, odds of fifty-fifty. Applied to a qubit holding 1, it produces two arrows of the same length pointing opposite ways, also fifty-fifty. A reading cannot tell the two results apart. The next gate can.

Solved example: the Hadamard gate, twice

Start with a qubit holding 0 and apply H: arrows of 0.707 for 0 and 0.707 for 1. Apply H again. Each of the two arrows sends a share to each outcome, scaled by 0.707, and the share sent from the 1-arrow to outcome 1 is turned half a turn, so it points backward and is subtracted. Outcome 0 receives 0.707 × 0.707 + 0.707 × 0.707 = 0.5 + 0.5 = 1. Outcome 1 receives 0.707 × 0.707 − 0.707 × 0.707 = 0.5 − 0.5 = 0. The qubit is back at 0 with certainty. Now insert a Z gate between the two Hadamards: it turns the 1-arrow half a turn before the second H. Outcome 0 now receives 0.5 − 0.5 = 0, and outcome 1 receives 0.5 + 0.5 = 1. One gate that changed nothing a reading could see has changed the answer from certain 0 to certain 1.

10 — H, then H: interference inside one qubit
SPREAD MARK INTERFERE ARROWS ODDS OF READING 0 H H READ 0 100 % 1 0 % 0 H H Z READ 0 0 % 1 100 % 0 H H T READ 0 85 % 1 15 % for 0: two arrows 45° apart, total 0.924 one turn no reading could see flips the answer spread, mark, interfere: the three moves of every algorithm in Part II
AmplitudeControl pulseReadoutFocal detail
Plate 10 — Two Hadamards in a row return a qubit to 0. A Z gate between them, invisible to any reading on its own, turns the result into a certain 1, and a T gate gives 85 % and 15 %: the whole mechanism of a quantum algorithm in one qubit.

The example is the two-mirror experiment of Chapter 3 run inside a qubit, and it contains the whole mechanism of a quantum algorithm in miniature. The first Hadamard spreads the qubit over two outcomes, and a gate in the middle marks one of them with a turn. The second Hadamard then makes the arrows interfere, so that the mark decides which outcome survives. Chapters 6 and 8 repeat the same three moves on registers with millions of outcomes.

The mark need not be a half turn. With a T gate in the middle, which turns by an eighth of a turn, the two shares reaching outcome 0 point 45 degrees apart and add to an arrow of length about 0.924. The qubit then reads 0 about 85 % of the time and 1 about 15 %. Partial turns give partial interference, and that is how gates set any odds between certainty and fifty-fifty.

Gates on two qubits

Single-qubit gates cannot make qubits influence each other, and a computation needs that influence. The standard two-qubit gate is the controlled-NOT, or CNOT: it applies an X gate to one qubit, the target, if and only if the other, the control, holds 1. Its table of results is the ordinary truth table of a reversible XOR: 00 stays 00, 01 stays 01, 10 becomes 11, and 11 becomes 10. Two qubits carry one arrow for each of 00, 01, 10 and 11, as Chapter 5 shows. Google's processors perform a related gate directly in hardware, the controlled-Z, which turns the arrow of the combined outcome 11 through half a turn and leaves the others alone. A Hadamard on the target before and after a controlled-Z makes a CNOT.

Two-qubit gates are less accurate than single-qubit ones on every kind of hardware, and on superconducting chips they are also slower. On Willow, a controlled-Z takes 42 nanoseconds. Google's specification sheet for the error-correction chip gives an average error of 0.33 % per two-qubit gate, and the supplement to Google's paper on the chip gives 0.41 % for the same gates. The second figure is the Pauli error, a related measure that for two-qubit gates is five fourths of the average error. The specification sheet's single-qubit error is about a tenth of its two-qubit figure, so two-qubit gates are the main source of error in almost every computation.

A two-qubit gate also needs the two qubits to be coupled. On Willow, the qubits sit on a square grid and each is wired to at most four neighbors, and Google's sheet gives an average of 3.47 connections per qubit. Two distant qubits can interact only after their states are moved next to each other by a chain of swap operations, each made of gates that add time and error. Trapped ions and neutral atoms can instead bring distant qubits together physically, and Chapter 19 compares that approach with wiring.

Time is the other budget. Willow's qubits keep their state for about 68 microseconds on average, the time of about 1,600 two-qubit gates one after another. The loss can strike at any moment, so a computation must use only a small part of that time or be protected against the loss of state, as Chapter 12 shows.

Solved example: a thousand gates at 0.33 %

If each two-qubit gate fails independently with a chance of 0.33 %, it succeeds 99.67 % of the time. The chance that 100 such gates all succeed is 0.9967 multiplied by itself 100 times, about 72 %. For 1,000 gates it is about 3.7 %, and for 10,000 gates less than 1 in 10¹⁴. Shor's algorithm for RSA-2048 needs billions of operations. Without some way to correct errors as they occur, no physical qubits of 2026 could finish it.

11 — Two-qubit gates in a row at 0.33 % each
1 1 in 10⁵ 1 in 10¹⁰ 1 in 10¹⁵ 1 10 100 1,000 10,000 CHANCE THAT ALL SUCCEED (LOG) TWO-QUBIT GATES IN A ROW (LOG) computed: 0.9967 per gate 68 µs average lifetime = the time of ≈ 1,600 gates 100 gates: 72 % 10,000 gates: below 1 in 10¹⁴ a thousand gates: 3.7 %
Noise and errorFocal detail
Plate 11 — At 0.33 % error per two-qubit gate, 100 gates in a row succeed 72 % of the time, 1,000 gates 3.7 % and 10,000 gates almost never. Without error correction no physical qubit of 2026 can run billions of operations.

A short list of gates does everything

A small set of gates is enough to build any computation. Single-qubit gates together with the CNOT can produce any operation on any number of qubits, and even a finite list is enough: the Hadamard, S, T and CNOT gates can approximate any operation as closely as needed. The cost of that approximation is modest: a 2016 analysis shows that turning one qubit's arrow by an arbitrary angle, to an accuracy of 1 part in 10¹⁰, takes about 100 T gates, together with cheaper gates between them.

The T gate is counted separately for a reason that belongs to Part V. Error correction stores each protected qubit across many physical qubits, using schemes called error-correcting codes. These codes make some gates easy to perform on protected information, including the Hadamard, S and CNOT, but not the T gate. A protected T gate needs a specially prepared ingredient called a magic state, which is made separately, checked, and discarded if it is faulty. In a December 2025 preprint, a paper posted before peer review, Google's team reported magic states prepared on a superconducting processor at a fidelity of 99.99 %, keeping 8 % of the attempts. Fidelity measures how closely a prepared state matches the intended one, with 100 % a perfect match. Chapter 16 shows that the factories making magic states occupy much of an error-corrected machine.

Count the T gates, not only the gates

A circuit's total number of gates is a poor guide to its cost on an error-corrected machine. Cheap gates, such as the Hadamard and CNOT, can run on protected qubits at modest cost, but each T gate consumes magic states, and so does each Toffoli gate, the closely related gate used in arithmetic. Resource estimates for useful algorithms, including every estimate for RSA-2048, are therefore stated mainly in T or Toffoli gates.

Ask for gate counts by kind, and for depth

When an algorithm or a demonstration states its size, ask for three numbers. The count of two-qubit gates drives the error on today's hardware, and the count of T or Toffoli gates drives the cost on a protected machine. The third is the depth, the number of time steps when gates that can run at once are run together, which sets how long the qubits must hold their state. A count of qubits without these numbers says little about what a computation demands.

+ What this chapter established
  • A gate turns or swaps a qubit's arrows without reading them, and every gate can be undone; reading is the only irreversible step.
  • The Hadamard gate is a half-silvered mirror for a qubit: applied twice it returns the qubit to where it started, and a Z gate between the two changes a certain 0 into a certain 1.
  • Two-qubit gates such as the controlled-Z on Willow take about 42 nanoseconds and fail about 1 time in 300, so 1,000 of them in a row succeed only about 4 % of the time.
  • A short list of gates builds any computation, and on an error-corrected machine the T gate, which needs magic states, dominates the cost.
Created with Claude (Anthropic).
Educational reference material, not engineering, regulatory or clinical advice. Product and company names referenced are the property of their respective owners.