Quantum
Module 3 · Single-qubit gates · Lesson 3

Phase gates: S and T

The subtle cousins of Pauli-Z. They do nothing at all in the computational basis — which turns out to be exactly what we need.

8 min read · Lesson 10 of 32

So far, every gate you’ve met has done something visible — flipping a bit, creating a superposition, rotating by π\pi. This lesson introduces two gates that look, in the computational basis, like they do almost nothing.

That’s the point.

The S gate

The SS gate, also called the phase gate, is:

S=(100i)S = \begin{pmatrix} 1 & 0 \\ 0 & i \end{pmatrix}

All it does is multiply the 1|1\rangle component by ii. It leaves 0|0\rangle alone. On a pure 0|0\rangle or pure 1|1\rangle state, you’d never know anything happened — 1|1\rangle and i1i|1\rangle are the same state up to global phase.

On a superposition, though, it rotates the relative phase by π/2\pi/2. Geometrically, it’s a π/2\pi/2 rotation around the zz-axis of the Bloch sphere. If you start at +|+\rangle on the equator and apply SS, you end up at +i|+i\rangle — still on the equator, but a quarter-turn around.

Here’s the crucial fact: SS is the square root of ZZ:

S2=ZS^2 = Z

Apply SS twice — you get ZZ. Which makes sense geometrically: ZZ is a π\pi rotation around the zz-axis, and SS is half of that.

The T gate

The TT gate is the square root of SS — an eighth of a full revolution around the zz-axis:

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

So TT rotates relative phase by π/4\pi/4 (that’s 45°45°). And:

T2=ST4=ZT8=IT^2 = S \qquad T^4 = Z \qquad T^8 = I

TT is even more subtle than SS. But it’s arguably the most important gate in fault-tolerant quantum computing — we’ll come back to why in a moment.

See them in action

The widget now has SS and TT buttons. Try these:

  1. Start from 0|0\rangle. Apply SS. Nothing visible happens. Apply TT. Still nothing.
  2. Reset. Apply HH first (making +|+\rangle). Now apply SS — the state moves from +|+\rangle to +i|+i\rangle. Apply SS again — now you’re at |-\rangle. Two SS gates = one ZZ gate, which is exactly what S2=ZS^2 = Z says.
  3. Reset. HH, then TT, then TT, then TT, then TT — four TTs should equal a ZZ.
  4. Reset. HH, then TT, then HH. Where does the state land? (This is a genuinely interesting place. It’s called a magic state.)

Why we care about T

There’s a deep theorem in quantum computing called the Solovay–Kitaev theorem that says: given a small universal set of gates, you can approximate any single-qubit gate to arbitrary precision using only gates from that set. The most commonly used universal set for fault-tolerant quantum computers is:

{H,S,CNOT,T}\{H, S, CNOT, T\}

The HH, SS, and CNOTCNOT gates are all “Clifford” gates — they have nice algebraic properties that make them easy to make fault-tolerant. But Clifford gates alone are not universal; you can only reach a finite subset of quantum states with them (this is the Gottesman–Knill theorem).

The one gate that breaks Clifford and gives you full universality is TT. It’s the magic ingredient.

The catch: TT is much harder to make fault-tolerant than Cliffords. On real fault-tolerant quantum hardware, the bottleneck is almost always the T count — the number of TT gates in your circuit. Quantum algorithms are often described in terms of how many TTs they need, because that’s what determines how long they take to run on a real machine.

So TT looks like the gentlest possible gate — a tiny phase twist — but it’s carrying more weight than any gate except maybe the Hadamard.

Quick check
What is S² equal to?
Quick check
If you apply S to a qubit in the state |0⟩, what state do you get?
Quick check
What does T⁸ equal?

What’s next

The Pauli, Hadamard, S, and T gates are all discrete — fixed rotations by specific angles. The next lesson introduces rotation gates, which give you continuous control over the angle. You’ll be able to rotate by any amount you want, and you’ll see that all the discrete gates we’ve met so far are just special cases of continuous rotations.