The S and T gates

S and T turn the sphere about the z axis: S by a quarter turn (90°), T by an eighth of a turn (45°). Like Z, they leave ∣0⟩|{0}\rangle and ∣1⟩|{1}\rangle in place and change only the phase, so they never change the odds of measuring 0 or 1.

They're called phase gates: each multiplies the amplitude of ∣1⟩|{1}\rangle by a phase and leaves ∣0⟩|{0}\rangle alone. S† and T† turn the other way.

A Bloch sphere seen with z up: from |+⟩, a green arrow turned 90 degrees around the equator to |+i⟩ by S, and a violet arrow turned 45 degrees by T.ST|0⟩|1⟩|+⟩|−⟩|+i⟩|−i⟩
From ∣+⟩|{+}\rangle (dashed), S turns the arrow 90° to ∣+i⟩|{+i}\rangle (green), and T turns it 45° (violet).

The matrices

S=[100i],T=[100eiπ/4]S = \begin{bmatrix} 1 & 0 \\ 0 & i \end{bmatrix}, \qquad T = \begin{bmatrix} 1 & 0 \\ 0 & e^{i\pi/4} \end{bmatrix}
S (α∣0⟩+β∣1⟩)=α∣0⟩+iβ ∣1⟩,T (α∣0⟩+β∣1⟩)=α∣0⟩+eiπ/4β ∣1⟩S\,(\alpha|0\rangle + \beta|1\rangle) = \alpha|0\rangle + i\beta\,|1\rangle, \qquad T\,(\alpha|0\rangle + \beta|1\rangle) = \alpha|0\rangle + e^{i\pi/4}\beta\,|1\rangle

Multiplying β\beta by i=eiπ/2i = e^{i\pi/2} adds 90° to the phase φ; multiplying by eiπ/4e^{i\pi/4} adds 45°.

As rotations

S=eiπ/4 Rz(90∘),T=eiπ/8 Rz(45∘)S = e^{i\pi/4}\,R_z(90^\circ), \qquad T = e^{i\pi/8}\,R_z(45^\circ)

The factors in front are global phases, so S and T turn the sphere exactly like Rz(90∘)R_z(90^\circ) and Rz(45∘)R_z(45^\circ). The factor eiπ/8e^{i\pi/8} is why T is also called the π/8 gate, though it turns the sphere by π/4.

Square roots of Z

Two quarter turns make a half turn, and two eighth turns make a quarter turn:

S S=Z,T T=S,T4=Z,T8=IS\,S = Z, \qquad T\,T = S, \qquad T^4 = Z, \qquad T^8 = I

So S is a square root of Z and T a square root of S. Their inverses, S† and T†, turn back by 90° and 45°: S†S=IS^\dagger S = I.

What they do to the six key states

S

BeforeAfter SOn the sphere
∣0⟩|{0}\rangle∣0⟩|{0}\ranglestays put
∣1⟩|{1}\ranglei∣1⟩i|{1}\ranglestays put
∣+⟩|{+}\rangle∣+i⟩|{+i}\rangle+x → +y
∣−⟩|{-}\rangle∣−i⟩|{-i}\rangle−x → −y
∣+i⟩|{+i}\rangle∣−⟩|{-}\rangle+y → −x
∣−i⟩|{-i}\rangle∣+⟩|{+}\rangle−y → +x

T

BeforeAfter TOn the sphere
∣0⟩|{0}\rangle∣0⟩|{0}\ranglestays put
∣1⟩|{1}\rangleeiπ/4∣1⟩e^{i\pi/4}|{1}\ranglestays put
∣+⟩|{+}\rangle12∣0⟩+12 eiπ/4∣1⟩\tfrac{1}{\sqrt{2}}|0\rangle + \tfrac{1}{\sqrt{2}}\,e^{i\pi/4}|1\rangleto θ 90°, φ 45°
∣−⟩|{-}\rangle12∣0⟩+12 e−3iπ/4∣1⟩\tfrac{1}{\sqrt{2}}|0\rangle + \tfrac{1}{\sqrt{2}}\,e^{-3i\pi/4}|1\rangleto θ 90°, φ 225°
∣+i⟩|{+i}\rangle12∣0⟩+12 e3iπ/4∣1⟩\tfrac{1}{\sqrt{2}}|0\rangle + \tfrac{1}{\sqrt{2}}\,e^{3i\pi/4}|1\rangleto θ 90°, φ 135°
∣−i⟩|{-i}\rangle12∣0⟩+12 e−iπ/4∣1⟩\tfrac{1}{\sqrt{2}}|0\rangle + \tfrac{1}{\sqrt{2}}\,e^{-i\pi/4}|1\rangleto θ 90°, φ 315°

T moves the equator states off the six named points: ∣+⟩|{+}\rangle goes to the state with φ = 45°, halfway between ∣+⟩|{+}\rangle and ∣+i⟩|{+i}\rangle.

Try it

See also: Pauli-Z · Rotation gates · All gates