|q⟩ Bad Qubits

advanced · Physics · Magic States & Distillation

The T Gate and Magic

The TT gate, also called the π/8\pi/8 gate, is the diagonal single-qubit unitary

T=(100eiπ/4)=eiπ/8(e−iπ/800eiπ/8).T = \begin{pmatrix} 1 & 0 \\ 0 & e^{i\pi/4} \end{pmatrix} = e^{i\pi/8}\begin{pmatrix} e^{-i\pi/8} & 0 \\ 0 & e^{i\pi/8} \end{pmatrix}.

The second form, factoring out the global phase eiπ/8e^{i\pi/8}, explains the historical name: TT is a rotation by π/4\pi/4 about the zz-axis of the Bloch sphere, i.e. T=eiπ/8Rz(π/4)T = e^{i\pi/8} R_z(\pi/4) where Rz(θ)=e−iθZ/2R_z(\theta) = e^{-i\theta Z/2}. Note that T2=S=diag⁡(1,i)T^2 = S = \operatorname{diag}(1, i), the phase gate, and S2=ZS^2 = Z. So TT is a "square root of SS" and a "fourth root of ZZ."

Where T sits in the Clifford hierarchy

The Clifford hierarchy organizes gates by how they conjugate Paulis. Level C(1)\mathcal{C}^{(1)} is the Pauli group itself; level C(k)\mathcal{C}^{(k)} consists of unitaries UU such that UPU†∈C(k−1)U P U^\dagger \in \mathcal{C}^{(k-1)} for every Pauli PP. The Clifford group is C(2)\mathcal{C}^{(2)}. The TT gate lives at level three:

TXT†=12 (X+Y),TZT†=Z.T X T^\dagger = \frac{1}{\sqrt2}\,(X + Y), \qquad T Z T^\dagger = Z .

Conjugating XX by TT produces a Clifford (here 12(X+Y)\tfrac{1}{\sqrt2}(X+Y), which is in C(2)\mathcal{C}^{(2)}), not a Pauli — so T∈C(3)∖C(2)T \in \mathcal{C}^{(3)} \setminus \mathcal{C}^{(2)}. This is the formal sense in which TT is the first "non-Clifford" gate, and why {H,S,CNOT,T}\{H, S, \mathrm{CNOT}, T\} achieves universality that {H,S,CNOT}\{H, S, \mathrm{CNOT}\} cannot.

The associated magic state

To each gate in C(3)\mathcal{C}^{(3)} we can associate a resource state by applying it to a stabilizer state. For TT the natural choice is

∣T⟩  ≡  T∣+⟩  =  12(∣0⟩+eiπ/4∣1⟩).|T\rangle \;\equiv\; T|+\rangle \;=\; \frac{1}{\sqrt2}\bigl(|0\rangle + e^{i\pi/4}|1\rangle\bigr).

This is the TT-type magic state. On the Bloch sphere it points along the direction

n^=(cos⁡π4, sin⁡π4, 0)=(12, 12, 0),\hat{n} = \bigl(\cos\tfrac{\pi}{4},\, \sin\tfrac{\pi}{4},\, 0\bigr) = \Bigl(\tfrac{1}{\sqrt2},\, \tfrac{1}{\sqrt2},\, 0\Bigr),

i.e. it lies in the equatorial xyxy-plane, bisecting the +X+X and +Y+Y axes. It is a pure state on the Bloch sphere — yet, as the next lessons show, no Clifford circuit can prepare it from ∣0⟩|0\rangle. That is exactly its value.

Why this matters for fault tolerance

We saw in the previous lesson that TT cannot generally be made transversal. But preparing the fixed state ∣T⟩|T\rangle is a state-preparation task that can be done offline and then cleaned up by distillation. Gate teleportation (next lessons) lets us spend one ∣T⟩|T\rangle to enact one logical TT. So the entire non-Clifford content of a universal fault-tolerant computation is bottled up in copies of this one single-qubit state.[^gottesman-chuang]

Try it

Prepare the magic state ∣T⟩=T∣+⟩|T\rangle = T|+\rangle on a single qubit, starting from ∣0⟩|0\rangle. The grader checks your full state vector against the reference, so getting the relative phase eiπ/4e^{i\pi/4} right is essential.

[^gottesman-chuang]: Gottesman, Chuang, Quantum Teleportation is a Universal Computational Primitive, arXiv:quant-ph/9908010.

Run your code to see the quantum state.

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