|q⟩ Bad Qubits

advanced · Physics · Magic States & Distillation

Magic-State Injection

We now cash in the central promise of the module: given one copy of the magic state T=T+|T\rangle = T|+\rangle and only Clifford operations, apply a TT gate to an arbitrary data qubit. The technique is gate teleportation, and the specific instance is TT-gate injection.[^gottesman-chuang]

The injection circuit

Let the data qubit be ψ=a0+b1|\psi\rangle = a|0\rangle + b|1\rangle on wire 00, and prepare the ancilla on wire 11 in the magic state

A=T+=12(0+eiπ/41).|A\rangle = T|+\rangle = \frac{1}{\sqrt2}\bigl(|0\rangle + e^{i\pi/4}|1\rangle\bigr).

Apply a single CNOT\mathrm{CNOT} with the data as control and the ancilla as target, then measure the ancilla in the computational (ZZ) basis. Writing the joint state and applying CNOT01\mathrm{CNOT}_{0\to1},

ψA CNOT01 12[(a0+beiπ/41)0a+(aeiπ/40+b1)1a].|\psi\rangle|A\rangle \xrightarrow{\ \mathrm{CNOT}_{0\to1}\ } \tfrac{1}{\sqrt2}\Bigl[\bigl(a|0\rangle + b\,e^{i\pi/4}|1\rangle\bigr)|0\rangle_a + \bigl(a\,e^{i\pi/4}|0\rangle + b|1\rangle\bigr)|1\rangle_a\Bigr].

Reading off the two ancilla branches:

The Clifford correction

In the outcome-11 branch we have TψT^\dagger|\psi\rangle instead of TψT|\psi\rangle. We repair it with a single SS gate, which is Clifford:

ST=(100i)(100eiπ/4)=(100eiπ/4)=T.S\,T^\dagger = \begin{pmatrix}1&0\\0&i\end{pmatrix}\begin{pmatrix}1&0\\0&e^{-i\pi/4}\end{pmatrix} = \begin{pmatrix}1&0\\0&e^{i\pi/4}\end{pmatrix} = T .

So the recipe is: if the ancilla read 11, apply SS to the data. Either way the data ends up in exactly TψT|\psi\rangle, and every operation we performed — CNOT\mathrm{CNOT}, ZZ-measurement, and a classically conditioned SS — is Clifford. The lone non-Clifford ingredient was the state A|A\rangle, prepared offline.

Why the correction must be classically conditioned

The byproduct SS is not optional decoration — without it, the outcome-11 branch applies TT^\dagger, the inverse of what we wanted, and the computation is corrupted. The measurement result must be fed forward to decide whether to apply SS. 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|\psi\rangle = \cos(0.4)|0\rangle + \sin(0.4)|1\rangle, compute the corrected data state in both measurement branches (apply SS in the outcome-11 branch), and return the worst-case fidelity F=Tψcorrected2F = |\langle T\psi | \text{corrected}\rangle|^2. A correct protocol gives F=1F = 1 on both branches.

[^zhou-leung-chuang]: Zhou, Leung, Chuang, Methodology for quantum logic gate construction, arXiv:quant-ph/0002039.

Run your code to see the quantum state.

Sign in on the full site to ask questions and join the discussion.