A quantum gate is a unitary matrix acting on the state vector of one or more qubits. A circuit is a product of such matrices, followed by measurement. I use this page as a lookup table: the standard matrices, the identities that let you rewrite circuits, and how the textbook gates turn into the handful of operations a real chip implements.

Gates are the moves you can make: each one turns the qubit's arrow in a fixed way. Image: Rxtreme, CC BY-SA 4.0, via Wikimedia Commons.
Mental Model
- Gates are unitary: . That makes them reversible and norm-preserving, and it is why no gate can copy an unknown state or erase information.
- On a single qubit, a gate is a rotation of the Bloch sphere. The Paulis are half-turns, is a turn by any angle.
- A small set of gates is enough for everything: single-qubit rotations plus one entangling gate, or Clifford plus T if you want a finite set.
- Clifford gates (H, S, CX) are cheap to simulate and, on error-corrected machines, cheap to run. T is the expensive one.
- Hardware has its own native gates. Everything else is compiled into them.
1. Single-Qubit Gates
| Gate | Matrix | Action |
|---|---|---|
| bit flip, | ||
| bit and phase flip | ||
| phase flip, | ||
| basis to basis | ||
| quarter turn about , | ||
| eighth turn about , | ||
| half of an , |
The Paulis square to the identity and anticommute: and cyclic permutations. Each Pauli has eigenvalues , which is why they double as measurement observables (see Measurement and the Born Rule).
Rotations
The continuous family is for . It rotates the Bloch vector by around the axis. In matrix form,
So , which is up to a global phase. The phase gate equals up to global phase, and , . Any single-qubit unitary can be written as times a global phase, so three angles suffice.
Identities Worth Remembering
Conjugating by swaps the and axes:
These are all verified numerically. They explain basis changes: to measure , apply and measure . A related one is and , which again checks out in numpy.
2. Two-Qubit and Controlled Gates
Controlled- applies to the target when the control is :
CX (CNOT) is the case , and CZ is . CZ is symmetric in its two qubits, since it only puts a on . SWAP exchanges two qubits and equals three CX gates with alternating control and target. I checked in Qiskit that the three-CX circuit gives the same unitary as the SWAP gate.
CX and CZ are related by a basis change on the target:
I checked this with Operator.equiv, and it holds exactly, with no phase to ignore. It matters on hardware: a device whose native entangler is CZ implements CX by wrapping CZ in two Hadamards on the target.
The Toffoli (CCX) flips the target when both controls are 1. It can be built from 6 CX gates together with , and gates (Qiskit’s transpiler produces 6 CX, 4 T and 3 with 2 H). It is the quantum version of a reversible AND, and the standard building block for classical logic inside algorithms like Grover’s Search.
Intuition
A controlled gate is where the control stops being a switch and becomes a participant. With the control in superposition, produces a state in which the target has done two things at once, and the amplitudes of the two branches interfere later. Entanglement (see Entanglement and Bell States) and phase kickback both come from this.
3. Universality
Two results, one exact and one approximate:
- Any unitary on qubits can be written exactly as a circuit of single-qubit gates and CX (Barenco et al., 1995). The count can be exponential in , but the gate set is finite in kind.
- A finite set such as approximates any unitary to accuracy . The Solovay-Kitaev theorem says that for single-qubit gates the sequence length grows only polylogarithmically in , so approximating is cheap.
The Clifford group is the set of unitaries that map Pauli operators to Pauli operators under conjugation, and it is generated by , and CX. Adding breaks out of it. The Gottesman-Knill theorem says circuits made only of Clifford gates, stabilizer-state inputs and Pauli measurements can be simulated efficiently on a classical computer. So the T gate is where the potential quantum advantage in this gate set comes from, and on error-corrected hardware it is the costly gate (see Quantum Error Correction).
4. Native Gates and Decomposition
Real chips run a short list of operations. On IBM Heron the native set used in the QGSS labs is . is a “virtual” gate, a change of reference frame done in software at zero duration, so it costs no time and adds no error. Everything else is compiled:
Running Qiskit’s transpiler with basis_gates=["rz", "sx", "x", "cz"] on a Bell circuit gives 6 rz, 3 sx and 1 cz, and the unitary still matches the original:
from qiskit import QuantumCircuit, transpile
from qiskit.quantum_info import Operator
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
t = transpile(qc, basis_gates=["rz", "sx", "x", "cz"], optimization_level=1)
print(t.count_ops()) # rz: 6, sx: 3, cz: 1
print(Operator(t).equiv(Operator(qc))) # TrueThe three Hadamards are one for the explicit H and two wrapped around the CZ that replaces the CX, each expanded into . A SWAP, three CX, becomes three CZ plus single-qubit gates, which is the “SWAP costs 3 CZ” figure in QGSS: Circuits for Real Hardware. Two-qubit gates dominate the error budget on real devices, so counting CZ gates after transpilation is the number to watch (see Qubit Hardware Platforms).
5. A Short Worked Example
Start with and apply , then , then . After the state is at . is a quarter turn about and takes it to at . The final swaps and and flips , so at maps to , which is . Equivalently, is a up to phase, a quarter turn about , applied to at the north pole.
Related
- Qubits and the Bloch Sphere for the geometric picture behind rotations.
- Measurement and the Born Rule for basis changes using H and S.
- Entanglement and Bell States for the H plus CX circuit.
- Qubit Hardware Platforms for why native sets differ between platforms.
- Quantum Error Correction for why T counts matter.
- QGSS: Circuits for Real Hardware for transpilation to Heron in a real lab.