Single-Qubit Gates (X, Y, Z, H, S, T, and Rotations)
February 5, 2025
Single-qubit gates are unitary matrices. They transform a qubit statevector while preserving normalization. Intuitively, most single-qubit gates correspond to rotations of the Bloch sphere.
If you have not read it yet, start with the Bloch sphere overview: Bloch sphere.
A tiny Qiskit helper (statevector)
The quickest way to sanity-check a gate is to look at the resulting statevector:
from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector
def show_state(circuit: QuantumCircuit):
return Statevector.from_instruction(circuit)Pauli-X (bit flip)
Matrix:
Effect:
- a 180° rotation about the X axis on the Bloch sphere
qc = QuantumCircuit(1)
qc.x(0)
print(show_state(qc))Pauli-Z (phase flip)
Matrix:
Effect:
- is unchanged
- gets a minus sign
- a 180° rotation about the Z axis
This is the first place where relative phase matters: and are different states.
qc = QuantumCircuit(1)
qc.h(0) # prepares |+>
qc.z(0) # flips phase of |1>
print(show_state(qc)) # should match |->Pauli-Y (bit + phase flip)
Matrix:
Effect:
- a 180° rotation about the Y axis
- mixes bit flips with phase factors ( and )
Hadamard (H)
Matrix:
Effect:
qc = QuantumCircuit(1)
qc.h(0)
print(show_state(qc))Want a focused explanation and common identities like ? See What is a Hadamard gate?.
Rotation gates: Rx, Ry, Rz
Rotation gates let you rotate by an arbitrary angle:
- : rotate around X by
- : rotate around Y by
- : rotate around Z by
In practice, is especially common because many compilers can implement Z-rotations efficiently (platform dependent).
from math import pi
qc = QuantumCircuit(1)
qc.h(0)
qc.rz(pi/4, 0)
print(show_state(qc))Phase gates: S and T
The S and T gates are special cases of Z-rotations:
- (up to a global phase)
- (up to a global phase)
Why do people care?
- and appear in fault-tolerant gate sets, compilation, and circuit identities.
When comparing gate matrices, you may see “equal up to a global phase.” Global phase does not affect measurement probabilities, but relative phase does.
Quick exercises
- Verify that using a circuit and statevector inspection.
- Start from . Apply for different . What changes and what stays the same on the Bloch sphere?
Next
- For multi-qubit operators and tracing out subsystems: Tensor products and partial trace
- For phase intuition (why Z rotations matter): we can add a dedicated “global vs relative phase” page next.