Two single-qubit gates you will meet often are the S gate and the T gate. Both act only on
the ∣1⟩ component of a state, leaving ∣0⟩ unchanged — they are called phase gates
because they shift the relative phase between the two basis amplitudes.
The S gate and its inverse
The S gate (also written P(π/2)) applies a phase of i=eiπ/2 to ∣1⟩:
S=(100i).
Its action on basis states is straightforward:
S∣0⟩=∣0⟩,S∣1⟩=i∣1⟩.
On a superposition α∣0⟩+β∣1⟩, the effect is to rotate β by
90° in the complex plane: S(α∣0⟩+β∣1⟩)=α∣0⟩+iβ∣1⟩.
The inverseS† (or S−1) undoes that rotation by applying −i=e−iπ/2:
S†=(100−i).
You can verify that S†S=I by multiplying the two matrices:
(100−i)(100i)=(1001)=I.
The T gate and its inverse
The T gate applies half the phase of S — a 45° rotation, eiπ/4:
T=(100eiπ/4).
This means S=T2: two T gates compose to one S gate. Similarly, T† applies the
conjugate phase e−iπ/4:
T†=(100e−iπ/4),T†T=I.
Why inverses matter
Every quantum gate is unitary — its inverse is just its conjugate transpose (Hermitian adjoint),
often written U†. Because of this, quantum operations are always reversible: you can run
any circuit backward by applying each gate's adjoint in reverse order. For phase gates the inverse
is simply the gate with the negated phase angle. Applying S followed immediately by S†
is therefore the identity transformation, and the qubit is left exactly as it started.
Try it
Apply S to qubit 0, then undo it with S†. The grader checks the whole unitary matrix
of your circuit, so doing nothing will not pass — you must actually apply both gates, and they
must cancel to the identity.
Run your code to see the quantum state.
Sign in on the full site to ask questions and join the discussion.