Computing Library › Quantum Error Correction
Quantum Error Correction

Magic States and the T Gate

The non-Clifford T gate, needed for universality, is enacted by consuming a special magic state through gate teleportation.

Why the T gate is special

The Clifford gates, H, S, and CNOT, are easy to make fault-tolerant, often transversally, but they are not universal; a circuit of only Clifford gates is classically simulable by the Gottesman-Knill theorem. To reach universal quantum computation one non-Clifford gate suffices, and the usual choice is the T gate, a phase rotation of pi/4 that sends |1> to e^{i pi/4}|1>. By the Eastin-Knill theorem this gate cannot be transversal wherever the Cliffords are.

The magic state

Kronos motion — error correction

The trick is to move the difficulty into a resource state. The magic state |T> = (|0> + e^{i pi/4}|1>)/sqrt(2) is prepared ahead of time. Given a fresh |T> and only Clifford operations plus measurement, one can apply a T gate to any data qubit by gate teleportation: a CNOT couples data and magic state, the magic state is measured, and a Clifford correction conditioned on the outcome completes the T. The hard, non-Clifford content is fully contained in |T>.

python
# Inject a T gate using a magic state |T> on ancilla m
circuit.cx(data, m)
result = circuit.measure(m)
if result == 1:
    circuit.s(data)   # Clifford correction

Getting clean magic states

The catch is that preparing |T> directly is noisy and cannot be made fault-tolerant by transversal means. The solution is magic state distillation: consume many noisy copies of |T> and, using Clifford circuits and measurement, output fewer copies of much higher fidelity. Distillation, and the factories that run it, are among the most resource-hungry parts of a fault-tolerant computer, often dominating the qubit budget analyzed in overhead.

Magic states thus package universality into a consumable resource, cleanly separating the easy Clifford operations from the one expensive ingredient.