We now cash in the central promise of the module: given one copy of the magic state ∣T⟩=T∣+⟩
and only Clifford operations, apply a T gate to an arbitrary data qubit. The technique is gate
teleportation, and the specific instance is T-gate injection.[^gottesman-chuang]
The injection circuit
Let the data qubit be ∣ψ⟩=a∣0⟩+b∣1⟩ on wire 0, and prepare the ancilla on
wire 1 in the magic state
∣A⟩=T∣+⟩=21(∣0⟩+eiπ/4∣1⟩).
Apply a single CNOT with the data as control and the ancilla as target, then measure the
ancilla in the computational (Z) basis. Writing the joint state and applying CNOT0→1,
Ancilla measures 0 (probability 21): the data collapses to a∣0⟩+beiπ/4∣1⟩=T∣ψ⟩. Done — no correction.
Ancilla measures 1 (probability 21): the data collapses to aeiπ/4∣0⟩+b∣1⟩∝a∣0⟩+be−iπ/4∣1⟩=T†∣ψ⟩.
The Clifford correction
In the outcome-1 branch we have T†∣ψ⟩ instead of T∣ψ⟩. We repair it with a
single S gate, which is Clifford:
ST†=(100i)(100e−iπ/4)=(100eiπ/4)=T.
So the recipe is: if the ancilla read 1, apply S to the data. Either way the data ends up in exactly
T∣ψ⟩, and every operation we performed — CNOT, Z-measurement, and a classically
conditioned S — is Clifford. The lone non-Clifford ingredient was the state∣A⟩, prepared
offline.
Why the correction must be classically conditioned
The byproduct S is not optional decoration — without it, the outcome-1 branch applies T†, the
inverse of what we wanted, and the computation is corrupted. The measurement result must be fed forward
to decide whether to apply S. This feed-forward of measurement outcomes is the operational heart of
fault-tolerant non-Clifford gates, and it is why a fault-tolerant machine needs fast classical control.
Try it
Verify the protocol from first principles. For a real test input ∣ψ⟩=cos(0.4)∣0⟩+sin(0.4)∣1⟩, compute the corrected data state in both measurement branches (apply S in the
outcome-1 branch), and return the worst-case fidelity F=∣⟨Tψ∣corrected⟩∣2.
A correct protocol gives F=1 on both branches.