Phase Gates (S and T)

Every single-qubit gate either moves probability between ∣0⟩|0\rangle and ∣1⟩|1\rangle or it does not. The gates that do not — the diagonal ones — are the purest instruments of quantum phase, and the two most important of them are SS and TT. Both fix ∣0⟩|0\rangle and multiply ∣1⟩|1\rangle by a phase: SS by i=eiπ/2i=e^{i\pi/2}, TT by eiπ/4e^{i\pi/4}. On the Bloch sphere neither touches latitude; each is a rigid rotation of longitude, SS by a quarter turn and TT by an eighth. Stacked, they form a discrete clock — T2=ST^2=S, S2=ZS^2=Z, T8=IT^8=I — the finest ticks of the standard fault-tolerant toolkit. That tidy algebra hides the deepest fault line in quantum computing. SS is a Clifford gate: conjugating a Pauli by SS returns a Pauli, so a classical computer can track any SS-circuit with a stabilizer tableau (Gottesman–Knill). TT is not: conjugating XX by TT produces (X+Y)/2(X+Y)/\sqrt2, which is no Pauli at all. That single failure is where classical simulability ends and genuine quantum hardness — and universality — begins. In a real fault-tolerant machine the cost is brutal and asymmetric: Clifford gates like SS are nearly free, while each TT must be manufactured by magic-state distillation, so the TT-count is the number that decides whether an algorithm is affordable. This article develops both gates from their matrices, proves the Clifford split, and follows it to the magic-state economy that governs every serious quantum architecture.

Key takeaways
  • SS and TT are diagonal gates diag(1,eiθ)\mathrm{diag}(1,e^{i\theta}) with θ=π/2\theta=\pi/2 and π/4\pi/4: they fix ∣0⟩|0\rangle and multiply ∣1⟩|1\rangle by ii and eiπ/4e^{i\pi/4}, applying a pure relative phase.
  • Geometrically both are zz-axis rotations of the Bloch sphere — SS a 90°90° quarter turn, TT a 45°45° eighth turn — and they nest as T2=ST^2=S, S2=ZS^2=Z, T8=IT^8=I, a cyclic clock of order 8.
  • SS is a Clifford gate (SXS†=YSXS^\dagger=Y), so SS-circuits are efficiently classically simulable; TT is the canonical non-Clifford gate (TXT†=(X+Y)/2TXT^\dagger=(X+Y)/\sqrt2) that lifts {H,S,CNOT}\{H,S,\mathrm{CNOT}\} to universality.
  • The name "π/8\pi/8 gate" is a trap: TT applies a relative phase of eiπ/4e^{i\pi/4}, not eiπ/8e^{i\pi/8}; the π/8\pi/8 lives in the symmetric form T=eiπ/8Rz(π/4)T=e^{i\pi/8}R_z(\pi/4).
  • TT cannot be transversal in a 2D code (Eastin–Knill), so it is supplied by magic-state distillation — making TT-count and TT-depth the dominant cost in fault-tolerant compilation.
  • Key idea: SS and TT are diagonal diag(1,eiθ)\mathrm{diag}(1,e^{i\theta}) phase rotations satisfying T2=ST^2=S, S2=ZS^2=Z; SS is Clifford and classically tame, while TT is the cheap-to-write, expensive-to-distil non-Clifford resource that unlocks universality.
The core insight

SS and TT are diagonal diag(1,eiθ)\mathrm{diag}(1,e^{i\theta}) gates with θ=π/2,π/4\theta=\pi/2,\pi/4; they are zz-axis rotations satisfying T2=ST^2=S and S2=ZS^2=Z. SS is Clifford and classically tame, while TT is the cheap-to-state but fault-tolerantly expensive non-Clifford resource that unlocks universality.

Where this lives today

The SS/TT distinction is not a textbook nicety — it sets the budget of every serious fault-tolerant proposal. In the surface code that Google and IBM are scaling, Clifford gates including SS are realized by lattice surgery and Pauli-frame updates that are cheap and essentially error-limited only by the code itself, while every logical TT must be grown in a magic-state factory: a large block of the chip dedicated to distilling clean ∣T⟩|T\rangle states that are then teleported into the computation. Because those factories dominate both the qubit footprint and the runtime, quantum resource estimates are quoted in TT-count (or the closely related Toffoli count). The landmark 2021 estimate by Gidney and Ekerå for breaking 2048-bit RSA — roughly 20 million noisy physical qubits running for about 8 hours — is, at bottom, a count of how many magic states Shor's algorithm consumes and how fast the factories can supply them. Compiler research chases the same target from the software side: number-theoretic synthesizers such as gridsynth and the Ross–Selinger algorithm compile arbitrary rotations into near-optimal H,TH,T sequences of length ≈3log⁡2(1/ε)\approx3\log_2(1/\varepsilon), and TT-count optimizers reshuffle circuits to spend fewer of them. The frontier is making magic cheaper: 2024 "magic-state cultivation" proposals aim to prepare high-fidelity ∣T⟩|T\rangle states with far less overhead than traditional distillation, and small logical demonstrations of magic-state injection have begun on superconducting and trapped-ion hardware. Every one of these efforts is, in the end, a war on the TT-count.

The physical picture

Give a single qubit's relative phase a name: the longitude of its Bloch vector. The two phase gates do exactly one thing to that arrow — they turn its longitude by a fixed amount and leave its latitude untouched. SS turns it a quarter of the way around the equator, 90°90°; TT turns it half of that, 45°45°. A state sitting at a pole, ∣0⟩|0\rangle or ∣1⟩|1\rangle, has no longitude to turn and comes back unchanged (up to a global phase no measurement can see); a state on the equator like ∣+⟩|+\rangle is swept bodily around. The first figure looks straight down the zz-axis so the whole motion is a rotation in the plane.

Figure
Looking down the Bloch z-axis at the equator: S and T are pure longitude rotations. T turns the plus state by π/4 = 45° to the magic state, and S turns it by π/2 = 90° to the plus-i state. Latitude never changes, so the poles (the zero and one states) are fixed up to an invisible global phase
Phase gates rotate longitude only: T by 45°, S by 90°, poles fixed |+⟩ longitude 0 T|+⟩ magic state, 45° |+i⟩ = S|+⟩ 90° |−⟩ |−i⟩ π/4 π/2 poles |0⟩, |1⟩ (out of page) are fixed points

The names are a description of the algebra. TT is a smaller turn than SS, and two TTs make an SS; four TTs make a ZZ, the 180°180° phase-flip; eight TTs bring the arrow all the way home. So the diagonal phase gates are not a continuum but a discrete clock of zz-rotations with TT as its finest standard tick — the eighth roots of unity laid out on a dial. The second figure draws that clock and colours it by the property that matters most: whether a tick is Clifford or not.

Figure
The eight diagonal phase gates as a clock of z-rotations. The powers T^k = diag(1, e^{ikπ/4}) are the eighth roots of unity. Even ticks I, S = T², Z = T⁴, S† = T⁶ are Clifford (blue); odd ticks T, T³, T⁵, T⁷ are non-Clifford magic (amber). Two T's make an S, four make a Z, eight close the loop: T⁸ = I
The order-8 phase clock: even ticks Clifford, odd ticks non-Clifford magic T⁸ = I T² = S, T⁴ = Z I = T⁰ phase 1 T e^{iπ/4} S = T² T³ Z = T⁴ phase −1 T⁵ S† = T⁶ T⁷ = T† blue = Clifford amber = magic

The Clifford/non-Clifford split, which the colours in that clock already anticipate, is the practical heart of the subject. SS keeps you inside the stabilizer formalism — a world where every operator is a Pauli and a classical machine can track the full quantum state with a compact tableau. The instant you apply a TT, conjugating a Pauli stops yielding a Pauli, the state leaves the stabilizer polytope, and you have bought something a classical simulator can no longer follow cheaply. That is the sense in which TT is "magic," and it is why TT, alone among the standard gates, has to be manufactured through distillation. Geometrically the same fact powers universality: a 45°45° zz-rotation interleaved with the basis-changing Hadamard wanders SU(2)SU(2) ergodically, so any single-qubit unitary can be approximated arbitrarily well — the content of the Solovay–Kitaev theorem.

The core equations

Everything starts from two 2×22\times2 matrices. Fixing the computational ordering ∣0⟩=(1,0)T|0\rangle=(1,0)^{T}, ∣1⟩=(0,1)T|1\rangle=(0,1)^{T} turns each gate into four numbers, and because both are diagonal the numbers are trivial to multiply and to power.

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

where: ii — imaginary unit, i=eiπ/2i=e^{i\pi/2}, the relative phase applied by SS; eiπ/4=1+i2e^{i\pi/4}=\tfrac{1+i}{\sqrt2} — the relative phase applied by TT. Read it off directly: both matrices are unitary and diagonal, so they preserve populations and act only on the phase of the ∣1⟩|1\rangle amplitude. Applying the matrices to the basis kets shows why "phase gate" is the exact name: the ∣0⟩|0\rangle amplitude is never touched, only the ∣1⟩|1\rangle amplitude is rotated in the complex plane.

S∣0⟩=∣0⟩,S∣1⟩=i∣1⟩;T∣0⟩=∣0⟩,T∣1⟩=eiπ/4∣1⟩(2)S|0\rangle=|0\rangle,\quad S|1\rangle=i|1\rangle;\qquad T|0\rangle=|0\rangle,\quad T|1\rangle=e^{i\pi/4}|1\rangle \qquad (2)

where: ∣0⟩,∣1⟩|0\rangle,|1\rangle — computational basis states. The reading: because only the relative phase between ∣0⟩|0\rangle and ∣1⟩|1\rangle changes, the gates are invisible on the poles and maximal on the equator, exactly the picture of the first figure. The nesting relations are the algebra of the clock. Multiplying diagonal matrices adds the phases on the ∣1⟩|1\rangle entry, so powering TT simply advances one tick at a time.

T2=S,S2=Z,S†=S3=diag(1,−i),T†=T7(3)T^2=S,\qquad S^2=Z,\qquad S^\dagger=S^3=\mathrm{diag}(1,-i),\qquad T^\dagger=T^7 \qquad (3)

where: Z=diag(1,−1)Z=\mathrm{diag}(1,-1) — the Pauli-ZZ phase-flip; S†,T†S^\dagger,T^\dagger — the Hermitian conjugates, which are the inverse rotations and equal high powers of the gate itself. The reading: SS has order 4 and TT order 8, so the inverse of each is just another power — a fact that matters when you assemble phase-kickback circuits and must not confuse TT with T†T^\dagger. Both gates are zz-rotations up to a global phase, and writing them in the symmetric (traceless-generator) form exposes where the misleading "π/8\pi/8" name comes from.

S=eiπ/4Rz ⁣(π2),T=eiπ/8Rz ⁣(π4),Rz(ϕ)=e−iϕZ/2=diag(e−iϕ/2,eiϕ/2)(4)S=e^{i\pi/4}R_z\!\left(\tfrac{\pi}{2}\right),\qquad T=e^{i\pi/8}R_z\!\left(\tfrac{\pi}{4}\right),\qquad R_z(\phi)=e^{-i\phi Z/2}=\mathrm{diag}\big(e^{-i\phi/2},e^{i\phi/2}\big) \qquad (4)

where: Rz(ϕ)R_z(\phi) — rotation by angle ϕ\phi about the Bloch zz-axis; eiπ/4,eiπ/8e^{i\pi/4},e^{i\pi/8} — the global phases relating S,TS,T to the traceless rotation. The reading: the relative phase TT applies is π/4\pi/4, but the symmetric generator carries ±π/8\pm\pi/8 on its diagonal — that π/8\pi/8, not the physical phase, is the origin of the historical name "π/8\pi/8 gate." The Clifford property is the pivot of the whole article, and it is one line: conjugating each Pauli by SS returns a Pauli.

SXS†=Y,SZS†=Z,SYS†=−X(5)S X S^\dagger = Y,\qquad S Z S^\dagger = Z,\qquad S Y S^\dagger = -X \qquad (5)

where: X,Y,ZX,Y,Z — the Pauli operators. The reading: SS normalizes the Pauli group — it permutes {X,Y,Z}\{X,Y,Z\} with signs, rotating the XX–YY plane by 90°90° while fixing the ZZ-axis — so by definition SS is a Clifford gate, and any circuit of H,S,CNOTH,S,\mathrm{CNOT} can be tracked classically. TT fails the same test, and the failure is the definition of "non-Clifford." Conjugating XX by TT rotates it only halfway toward YY, landing on an equal mixture that is no Pauli.

TXT†=cos⁡π4 X+sin⁡π4 Y=12 (X+Y)∉{±I,±X,±Y,±Z}(6)T X T^\dagger=\cos\tfrac{\pi}{4}\,X+\sin\tfrac{\pi}{4}\,Y=\tfrac{1}{\sqrt2}\,(X+Y)\notin\{\pm I,\pm X,\pm Y,\pm Z\} \qquad (6)

where: 12(X+Y)\tfrac{1}{\sqrt2}(X+Y) — a non-Pauli operator, the 45°45° image of XX in the XX–YY plane. The reading: TT does not normalize the Pauli group, so it lies outside the Clifford group; this single fact is what separates classically simulable circuits from universal ones and forces TT to be supplied by distillation. Adding TT to the Clifford generators makes the gate set universal, and Solovay–Kitaev bounds how expensive that approximation is.

{H,T} is universal for SU(2);#gates=O ⁣(log⁡c1ε),  c<4(7)\{H,T\}\ \text{is universal for}\ SU(2);\qquad \#\text{gates}=O\!\left(\log^{c}\tfrac{1}{\varepsilon}\right),\ \ c<4 \qquad (7)

where: ε\varepsilon — the operator-norm accuracy to which a target single-qubit unitary is approximated; cc — the Solovay–Kitaev exponent, provably below 4 and improvable to c≈1c\approx1 with number-theoretic synthesis. The reading: any unitary is reachable to precision ε\varepsilon with a number of H,TH,T gates growing only polylogarithmically in 1/ε1/\varepsilon, so universality is not just possible but efficient.

Derivation AThe cyclic ladder from T up to the identity

The goal is to prove that the diagonal phase gates are not a loose family but a single cyclic group of order 8, generated by TT, with SS, ZZ, and the identity sitting at its even rungs — so that the whole "clock" picture is an exact statement rather than a metaphor. The one fact that does all the work is that diagonal matrices multiply entrywise, so raising TT to a power simply multiplies the phases on the ∣1⟩|1\rangle entry, and the ∣0⟩|0\rangle entry stays pinned at 1 forever. We compute the general power and then read off each landmark rung.

Step 1. Because T=diag(1,eiπ/4)T=\mathrm{diag}(1,e^{i\pi/4}) is diagonal, its kk-th power raises each entry to the kk: Tk=diag(1,(eiπ/4)k)=diag(1,eikπ/4)T^{k}=\mathrm{diag}(1,(e^{i\pi/4})^{k})=\mathrm{diag}(1,e^{ik\pi/4}). The ∣1⟩|1\rangle phase is kk ticks of π/4\pi/4 around the unit circle. Why: this collapses every question about products of phase gates into arithmetic on a single angle, so we never multiply matrices again.

Step 2. Set k=2k=2: T2=diag(1,eiπ/2)=diag(1,i)=ST^{2}=\mathrm{diag}(1,e^{i\pi/2})=\mathrm{diag}(1,i)=S. Two eighth-turns make a quarter-turn, which is exactly the SS gate. Why: this proves S=T2S=T^{2}, so TT is a genuine square root of SS, and SS inherits everything true of even powers of TT.

Step 3. Set k=4k=4: T4=diag(1,eiπ)=diag(1,−1)=ZT^{4}=\mathrm{diag}(1,e^{i\pi})=\mathrm{diag}(1,-1)=Z. Four ticks reach a half-turn, the Pauli-ZZ phase-flip, so TT is a fourth root of ZZ and SS a square root (S2=ZS^{2}=Z). Why: this places the Clifford landmark ZZ inside the same ladder, showing the Cliffords SS and ZZ are just the even rungs.

Step 4. Set k=8k=8: T8=diag(1,ei2π)=diag(1,1)=IT^{8}=\mathrm{diag}(1,e^{i2\pi})=\mathrm{diag}(1,1)=I. Eight ticks sum to 2π2\pi and the arrow returns home, so the group is cyclic of order 8, and inverses are high powers: T†=T7T^\dagger=T^{7}, S†=S3=T6S^\dagger=S^{3}=T^{6}. Why: closing the loop confirms there is no ninth distinct diagonal phase gate in this family — the standard toolkit's phase gates are exactly these eight elements.

Go deeper · Derivation B · 1 minWhy S is Clifford but T is not
Derivation BWhy S is Clifford but T is not

The aim is to make the Clifford/non-Clifford divide — the single most consequential fact about these two gates — a concrete matrix computation rather than an assertion, by conjugating the Pauli XX first by SS and then by TT and watching one land on a Pauli while the other does not. The definition in play is that a unitary UU is Clifford exactly when UPU†U P U^\dagger is a (signed) Pauli for every Pauli PP; we test it on XX, the hardest case, since SS and TT both commute with ZZ and trivially fix it. Everything reduces to multiplying a diagonal matrix, the off-diagonal XX, and the diagonal conjugate.

Step 1. Conjugate XX by SS: with S=diag(1,i)S=\mathrm{diag}(1,i) and S†=diag(1,−i)S^\dagger=\mathrm{diag}(1,-i), compute SXS†=diag(1,i) (0110) diag(1,−i)=(0−ii0)=YSXS^\dagger=\mathrm{diag}(1,i)\,\big(\begin{smallmatrix}0&1\\1&0\end{smallmatrix}\big)\,\mathrm{diag}(1,-i)=\big(\begin{smallmatrix}0&-i\\i&0\end{smallmatrix}\big)=Y. Why: the result is exactly the Pauli YY, so SS maps X→YX\to Y (and, by the same routine, Y→−XY\to-X, Z→ZZ\to Z) — it normalizes the Pauli group and is therefore Clifford.

Step 2. Conjugate XX by TT: with T=diag(1,eiπ/4)T=\mathrm{diag}(1,e^{i\pi/4}) and T†=diag(1,e−iπ/4)T^\dagger=\mathrm{diag}(1,e^{-i\pi/4}), the same sandwiching gives TXT†=(0e−iπ/4eiπ/40)TXT^\dagger=\big(\begin{smallmatrix}0&e^{-i\pi/4}\\e^{i\pi/4}&0\end{smallmatrix}\big). The off-diagonal entries are now phases, not ±1\pm1. Why: the appearance of e±iπ/4e^{\pm i\pi/4} instead of a bare 11 is the whole story — the output is no longer a single Pauli matrix.

Step 3. Decompose that result on the Pauli basis using e±iπ/4=1±i2e^{\pm i\pi/4}=\tfrac{1\pm i}{\sqrt2}: it equals cos⁡π4 X+sin⁡π4 Y=12(X+Y)\cos\tfrac{\pi}{4}\,X+\sin\tfrac{\pi}{4}\,Y=\tfrac{1}{\sqrt2}(X+Y), an equal blend of two Paulis. Why: TT rotates XX only 45°45° toward YY — halfway to where SS took it — so it lands strictly between Pauli axes, outside {±I,±X,±Y,±Z}\{\pm I,\pm X,\pm Y,\pm Z\}, and TT is non-Clifford by definition.

Step 4. Read the consequence: since {H,S,CNOT}\{H,S,\mathrm{CNOT}\} generate the Clifford group and TT escapes it, the set {H,S,CNOT,T}\{H,S,\mathrm{CNOT},T\} generates a dense subgroup of the full unitary group. By Gottesman–Knill the Clifford part is classically simulable, so the TTs are the sole source of quantum hardness. Why: this ties the tiny matrix fact of Step 3 directly to universality and to the TT-count cost metric that dominates real compilation.

Go deeper · Derivation C · 1 minPhase kickback with a controlled-T
Derivation CPhase kickback with a controlled-T

The purpose is to show how a diagonal phase gate on a target qubit imprints its eigenvalue phase onto a control qubit — the mechanism that turns controlled-SS and controlled-TT into the working parts of the quantum Fourier transform and phase estimation. The set-up is a control prepared in ∣+⟩|+\rangle and a target held in ∣1⟩|1\rangle, which is an eigenstate of TT; we apply the controlled gate and watch the target's eigenphase reappear on the control while the target itself is left untouched. The only ingredients are the eigenvalue equation T∣1⟩=eiπ/4∣1⟩T|1\rangle=e^{i\pi/4}|1\rangle and the linearity of the controlled operation.

Step 1. Write the joint input by expanding the control: ∣+⟩∣1⟩=12(∣0⟩+∣1⟩)∣1⟩|+\rangle|1\rangle=\tfrac{1}{\sqrt2}(|0\rangle+|1\rangle)|1\rangle. The target sits in ∣1⟩|1\rangle, the eigenstate of TT with eigenvalue eiπ/4e^{i\pi/4}. Why: putting the control in an equal superposition is what lets the two branches — gate applied or not — interfere and expose a relative phase.

Step 2. Apply the controlled gate Λ(T)=∣0⟩⟨0∣⊗I+∣1⟩⟨1∣⊗T\Lambda(T)=|0\rangle\langle0|\otimes I+|1\rangle\langle1|\otimes T: the ∣0⟩|0\rangle branch does nothing, the ∣1⟩|1\rangle branch applies TT to the target, giving 12(∣0⟩∣1⟩+∣1⟩ T∣1⟩)\tfrac{1}{\sqrt2}(|0\rangle|1\rangle+|1\rangle\,T|1\rangle). Why: only the branch where the control is ∣1⟩|1\rangle picks up the target's phase, which is precisely how a difference between the branches is created.

Step 3. Use T∣1⟩=eiπ/4∣1⟩T|1\rangle=e^{i\pi/4}|1\rangle and factor the target back out: the state becomes 12(∣0⟩+eiπ/4∣1⟩) ∣1⟩=(T∣+⟩) ∣1⟩\tfrac{1}{\sqrt2}(|0\rangle+e^{i\pi/4}|1\rangle)\,|1\rangle=(T|+\rangle)\,|1\rangle. The eigenphase eiπ/4e^{i\pi/4} has jumped from the target onto the control, which now carries a TT; the target returns unchanged. Why: this "kickback" is the elementary step of phase estimation — a controlled unitary writes an eigenvalue phase into a control register, where a Fourier transform can read it out bit by bit.

Limiting cases

The phase gates are the θ=π/4\theta=\pi/4 and θ=π/2\theta=\pi/2 members of the diagonal family diag(1,eiθ)\mathrm{diag}(1,e^{i\theta}); sliding θ\theta interpolates between familiar landmarks.

CaseResultMeaning
Angle →0\to 0diag(1,eiθ)→I\mathrm{diag}(1,e^{i\theta})\to Ia vanishing relative phase is the identity; TT (θ=π/4\theta=\pi/4) and SS (θ=π/2\theta=\pi/2) are two ticks along the way
Angle =π=\pidiag(1,eiπ)=diag(1,−1)=Z\mathrm{diag}(1,e^{i\pi})=\mathrm{diag}(1,-1)=Za half-turn is the Pauli Z=S2=T4Z=S^2=T^4, the Clifford top of the cyclic chain
Symmetric formRz(θ)=diag(e−iθ/2,eiθ/2)R_z(\theta)=\mathrm{diag}(e^{-i\theta/2},e^{i\theta/2})S=eiπ/4Rz(π/2)S=e^{i\pi/4}R_z(\pi/2), T=eiπ/8Rz(π/4)T=e^{i\pi/8}R_z(\pi/4) — the global phase is the only difference, invisible to any measurement
Powers and rootsT2=S, S2=Z, T8=S4=Z2=IT^2=S,\ S^2=Z,\ T^8=S^4=Z^2=Ithe gates form a cyclic group of order 8 (mod global phase); T=S=Z4T=\sqrt{S}=\sqrt[4]{Z}
Clifford limitS,S†,Z∈S,S^\dagger,Z\in Clifford; T,T3,T5,T7∉T,T^3,T^5,T^7\notineven ticks of the clock are classically tame, odd ticks are magic — the boundary of efficient simulation

Worked examples

1 · The magic state and its measurement statistics (fully worked)

Prepare the TT-type magic state ∣T⟩=T∣+⟩|T\rangle=T|+\rangle and measure it in the XX-basis {∣+⟩,∣−⟩}\{|+\rangle,|-\rangle\}. Find the state, the outcome probabilities, and its Bloch vector — the numbers a distillation protocol has to improve.

Step 1. Apply TT to ∣+⟩=12(∣0⟩+∣1⟩)|+\rangle=\tfrac{1}{\sqrt2}(|0\rangle+|1\rangle): since TT fixes ∣0⟩|0\rangle and phases ∣1⟩|1\rangle, the result is ∣T⟩=12(∣0⟩+eiπ/4∣1⟩)|T\rangle=\tfrac{1}{\sqrt2}(|0\rangle+e^{i\pi/4}|1\rangle). This is a state on the equator at longitude 45°45° — exactly the amber point in the first figure.

Step 2. The XX-basis amplitude is ⟨+∣T⟩=12(1+eiπ/4)\langle+|T\rangle=\tfrac12(1+e^{i\pi/4}), so the probability of outcome ++ is ∣⟨+∣T⟩∣2=14∣1+eiπ/4∣2=14(2+2cos⁡π4)=2+24|\langle+|T\rangle|^2=\tfrac14|1+e^{i\pi/4}|^2=\tfrac14(2+2\cos\tfrac{\pi}{4})=\tfrac{2+\sqrt2}{4}. Numerically that is 0.8536\mathbf{0.8536}, and it equals cos⁡2(π/8)\cos^2(\pi/8); the other outcome carries sin⁡2(π/8)=0.1464\sin^2(\pi/8)=\mathbf{0.1464}. P(+) = cos²(π/8) ≈ 0.854, P(−) ≈ 0.146.

Step 3. The Bloch vector reads ⟨X⟩=cos⁡(π/4)=12≈0.707\langle X\rangle=\cos(\pi/4)=\tfrac{1}{\sqrt2}\approx0.707, ⟨Y⟩=sin⁡(π/4)=12≈0.707\langle Y\rangle=\sin(\pi/4)=\tfrac{1}{\sqrt2}\approx0.707, ⟨Z⟩=0\langle Z\rangle=0: the state points along (1,1,0)/2(1,1,0)/\sqrt2. That direction is a midpoint between the XX and YY axes — as far as any state can sit from the six vertices of the stabilizer octahedron — which is the geometric meaning of "maximally magic." |T⟩ points to (1,1,0)/√2, the most non-stabilizer equatorial direction.

2 · What one logical T gate actually costs (fully worked)

A fault-tolerant compiler must realize an arbitrary Rz(θ)R_z(\theta) rotation to accuracy ε=10−3\varepsilon=10^{-3}, and each TT it uses must first be distilled from noisy raw magic states of error rate p=10−2p=10^{-2} using the 15-to-1 protocol. Estimate the TT-count of the rotation and the distillation rounds needed per TT.

Step 1. Number-theoretic synthesis (Ross–Selinger / gridsynth) approximates a single Rz(θ)R_z(\theta) with a TT-count of about 3log⁡2(1/ε)3\log_2(1/\varepsilon). For ε=10−3\varepsilon=10^{-3} this is 3log⁡2(103)=3×9.97≈303\log_2(10^{3})=3\times9.97\approx\mathbf{30} TT gates for one rotation; tightening to ε=10−10\varepsilon=10^{-10} would need 3log⁡2(1010)≈1003\log_2(10^{10})\approx100. ≈ 30 T gates per rotation at ε = 10⁻³.

Step 2. Each of those TTs is spent as a distilled magic state. One round of the 15-to-1 Bravyi–Kitaev protocol consumes 15 raw states of error pp and outputs one of error pout≈35 p3p_{\text{out}}\approx35\,p^{3}. Starting from p=10−2p=10^{-2}: pout≈35×(10−2)3=35×10−6=3.5×10−5p_{\text{out}}\approx35\times(10^{-2})^{3}=35\times10^{-6}=\mathbf{3.5\times10^{-5}}. One round: 10⁻² → 3.5×10⁻⁵.

Step 3. If the algorithm demands logical TT error near 10−1210^{-12}, feed the first output into a second round: 35×(3.5×10−5)3≈35×4.3×10−14≈1.5×10−1235\times(3.5\times10^{-5})^{3}\approx35\times4.3\times10^{-14}\approx\mathbf{1.5\times10^{-12}}. Two rounds therefore consume 15×15=22515\times15=225 raw states to yield one clean TT. Two rounds: 225 raw states → one T at ≈ 10⁻¹² error. Multiply by the ≈30\approx30 TTs of Step 1 and a single accurate rotation already costs thousands of raw magic states — which is why SS (Clifford, free) and TT (distilled, dear) sit on opposite sides of every resource budget.

Physics of the portrait

The phase gates are elementary, but the framework that makes TT special — the Clifford group, its hierarchy, and the magic states that feed it — was built largely by one person turning quantum error correction into an algebra.

Origins · 1 minDaniel Gottesman and how this was discovered
DG
Daniel Gottesman
b. 1970 · the stabilizer formalism and the Clifford hierarchy that make T the canonical magic gate

Daniel Gottesman recast quantum error correction as group theory, and in doing so drew the map on which SS and TT occupy opposite territories. In his 1997 Caltech PhD thesis, written under John Preskill, he introduced the stabilizer formalism: a quantum code is specified not by its codewords but by an abelian subgroup of the Pauli group whose +1+1 eigenspace is the protected space, so that errors, syndromes, and logical operators all become Pauli bookkeeping. The following year his "Heisenberg representation of quantum computers" proved what is now the Gottesman–Knill theorem — that any circuit built from the gates normalizing the Pauli group (the Clifford group: HH, SS, and CNOT\mathrm{CNOT}) can be simulated efficiently on a classical computer by propagating Paulis instead of amplitudes. That result draws the exact line this article is about: SS is inside the Clifford group and classically tame, so genuine quantum power must come from somewhere else. In 1999, with Isaac Chuang, he showed that the missing ingredient — the non-Clifford π/8\pi/8 gate TT — can be applied by teleporting it through a specially prepared resource state, and organized the gates into a Clifford hierarchy whose first non-trivial level is exactly TT. That teleportation trick is the seed of magic-state distillation (developed by Bravyi and Kitaev in 2005), the process by which every fault-tolerant machine now manufactures its TT gates. Gottesman's stabilizer language is today the default dialect of quantum error correction, spoken by every surface-code experiment.

History
1995
— Barenco and co-authors catalogue the elementary gates, fixing S and the π/8 gate T in the standard universal set
1997
— Gottesman's thesis recasts error correction in the stabilizer formalism built on the Pauli group
1998
— the Gottesman–Knill theorem shows Clifford circuits (H, S, CNOT) are efficiently classically simulable
1999
— Gottesman and Chuang use gate teleportation and the π/8 gate to define the Clifford hierarchy
2005
— Bravyi and Kitaev introduce magic-state distillation to supply fault-tolerant T gates

Going further

Texts. Nielsen & Chuang, Quantum Computation and Quantum Information, §4.2 (single-qubit gates) and §10.6 (fault tolerance and the π/8\pi/8 gate) · Preskill, Lecture Notes on Quantum Computation, Ch. 5–7 · Watrous, The Theory of Quantum Information, Ch. 2 · Wilde, Quantum Information Theory, 2nd ed., Ch. 3 · Kitaev, Shen & Vyalyi, Classical and Quantum Computation (the Solovay–Kitaev theorem) · Gottesman, Stabilizer Codes and Quantum Error Correction (PhD thesis, 1997) · Bravyi & Kitaev, "Universal quantum computation with ideal Clifford gates and noisy ancillas," Phys. Rev. A 71, 022316 (2005). All matrices and identities are verifiable by direct 2×22\times2 multiplication: S=diag(1,i)S=\mathrm{diag}(1,i), T=diag(1,eiπ/4)T=\mathrm{diag}(1,e^{i\pi/4}), T2=ST^2=S, S2=ZS^2=Z, T8=IT^8=I; the Clifford relation SXS†=YSXS^\dagger=Y and the non-Clifford result TXT†=12(X+Y)TXT^\dagger=\tfrac{1}{\sqrt2}(X+Y). The rotation forms S=eiπ/4Rz(π/2)S=e^{i\pi/4}R_z(\pi/2), T=eiπ/8Rz(π/4)T=e^{i\pi/8}R_z(\pi/4) follow from Rz(ϕ)=diag(e−iϕ/2,eiϕ/2)R_z(\phi)=\mathrm{diag}(e^{-i\phi/2},e^{i\phi/2}). The magic-state statistics P(+)=cos⁡2(π/8)=2+24≈0.854P(+)=\cos^2(\pi/8)=\tfrac{2+\sqrt2}{4}\approx0.854 are elementary; the synthesis scaling ≈3log⁡2(1/ε)\approx3\log_2(1/\varepsilon) is the Ross–Selinger result and the Solovay–Kitaev bound O(log⁡c(1/ε))O(\log^c(1/\varepsilon)) with c<4c<4. The 15-to-1 distillation output pout≈35p3p_{\text{out}}\approx35p^3 is the Bravyi–Kitaev protocol; the 2048-bit RSA figures (≈20 million qubits, ≈8 hours) are from Gidney & Ekerå (2021).

Prerequisites. Pauli Gates (X, Y, Z) · Single-Qubit Rotation Gates · Bloch Sphere Representation of Gates · The Quantum Circuit Model. Leads to. Universal Gate Sets · The Controlled-Z Gate · Z-Y Decomposition of Single-Qubit Gates · Circuit Identities and Equivalences.

Ask the tutor: ask me to conjugate any Pauli by SS or TT, walk the order-8 phase clock, or estimate the TT-count and magic-state cost of a rotation you care about.

Why is T called the "π/8 gate" when it applies a phase of π/4?

The name comes from the symmetric way of writing the gate, not from the phase you actually see. T=diag(1,eiπ/4)T=\mathrm{diag}(1,e^{i\pi/4}) imprints a relative phase of π/4\pi/4 on the ∣1⟩|1\rangle amplitude. But if you factor out a global phase to make the generator traceless, you get T=eiπ/8 diag(e−iπ/8,eiπ/8)=eiπ/8Rz(π/4)T=e^{i\pi/8}\,\mathrm{diag}(e^{-i\pi/8},e^{i\pi/8})=e^{i\pi/8}R_z(\pi/4), and now ±π/8\pm\pi/8 appears on the diagonal. Early papers named the gate after that π/8\pi/8. It is a genuinely confusing convention, and most modern writing prefers "TT gate" precisely to avoid the trap. When you compute, always use the physical relative phase eiπ/4e^{i\pi/4}.

What does it actually mean for T to be "non-Clifford"?

A Clifford gate is one that sends Pauli operators to Pauli operators under conjugation — UPU†U P U^\dagger is again a Pauli for every Pauli PP. The single-qubit Cliffords are the 24 rotations that permute the XX, YY, ZZ axes with signs, and SS is one of them (SXS†=YSXS^\dagger=Y). TT rotates XX only 45°45°, giving 12(X+Y)\tfrac{1}{\sqrt2}(X+Y), which sits between two Pauli axes and so is not a Pauli. That is exactly what "non-Clifford" means. The consequence is enormous: circuits of Cliffords alone can be simulated classically (Gottesman–Knill), so TT is where the classical description breaks and true quantum computational power enters.

Why can't we just build a fault-tolerant T gate directly, like we do for S?

Because of the Eastin–Knill theorem, which proves that no quantum error-correcting code can implement a universal set of gates transversally — that is, by acting independently on each physical qubit, the safe way that stops errors from spreading. In the surface code the Clifford gates including SS have cheap fault-tolerant implementations, but a transversal TT is provably impossible. The workaround is indirect: prepare many noisy copies of the magic state ∣T⟩=T∣+⟩|T\rangle=T|+\rangle, distil a few high-fidelity copies from them using only Clifford operations and measurement, and then teleport each clean state into the circuit to enact one logical TT. That distillation is the price of universality.

How are S and T related to the quantum Fourier transform?

Intimately. The QFT circuit is almost entirely Hadamards and controlled phase rotations Λ(Rk)\Lambda(R_k) with Rk=diag(1,e2πi/2k)R_k=\mathrm{diag}(1,e^{2\pi i/2^k}). The small-kk members are exactly the gates of this article: R2=diag(1,i)=SR_2=\mathrm{diag}(1,i)=S and R3=diag(1,eiπ/4)=TR_3=\mathrm{diag}(1,e^{i\pi/4})=T, so controlled-SS and controlled-TT are literally the second and third rungs of the QFT's rotation ladder. Phase estimation, the QFT's main application, works by phase kickback (Derivation C): a controlled phase gate writes a target's eigenvalue phase onto a control register, which the inverse QFT then reads out. So SS and TT are not just abstract examples — they are structural components of Shor's algorithm and quantum simulation.

If a T is so expensive, why not compile everything out of Clifford gates?

Because you cannot — Clifford gates are not universal. By the Gottesman–Knill theorem, any circuit of HH, SS, and CNOT\mathrm{CNOT} acting on stabilizer inputs with Pauli measurements can be simulated on a laptop in polynomial time, which means such a circuit can never do anything a classical computer cannot already do efficiently. Universality — the ability to approximate any unitary — requires at least one non-Clifford gate, and TT is the standard choice. So the TTs are not wasteful overhead you could optimize away entirely; they are the irreducible quantum content of the computation. The most you can do is minimize their number, which is exactly what TT-count optimization aims at.

Is the S gate ever the interesting one, or is it always T that matters?

SS matters constantly, just not as a source of computational hardness. As a Clifford gate it is a workhorse of state preparation and basis change — it rotates the XX-eigenbasis to the YY-eigenbasis, so HSHHSH-type combinations build the single-qubit Cliffords you need to measure in different bases and to conjugate errors. In error correction SS appears in the logical Clifford operations that shuttle information around a code, and in randomized benchmarking and Pauli twirling it is part of the random Clifford ensemble. What SS does not do is take you outside the stabilizer world, which is why the spotlight for universality and cost falls on TT. In practice a circuit is a large, cheap Clifford scaffold (HH, SS, CNOT\mathrm{CNOT}) studded with a precious few TTs.

Before this

Where this leads