Reference
Quantum gate cheatsheet
Every gate you'll meet in a quantum-computing tutorial — with the matrix, what it does on the Bloch sphere, the Qiskit call, and the CNOT cost on real hardware. Bookmarkable.
Single-qubit gates
| Gate | Matrix | Bloch action | Qiskit | ||||
|---|---|---|---|---|---|---|---|
| I Identity |
Does nothing. Useful as a placeholder for delay-equivalent operations. | no rotation | qc.id(0) | ||||
| X Pauli-X / NOT |
Bit flip. |0⟩ ↔ |1⟩. 180° rotation around the x-axis of the Bloch sphere. | 180° around x | qc.x(0) | ||||
| Y Pauli-Y |
Bit flip + phase flip combined. 180° rotation around the y-axis. | 180° around y | qc.y(0) | ||||
| Z Pauli-Z |
Phase flip. Leaves |0⟩ alone, sends |1⟩ → −|1⟩. 180° rotation around the z-axis. | 180° around z | qc.z(0) | ||||
| H Hadamard |
Maps |0⟩ → |+⟩ and |1⟩ → |−⟩. The superposition-maker. Self-inverse: H² = I. | 180° around (x̂ + ẑ)/√2 | qc.h(0) | ||||
| S Phase (S = √Z) |
Quarter-turn phase: |1⟩ picks up factor of i. S² = Z. Clifford. | 90° around z | qc.s(0) | ||||
| T T (= ⁴√Z) |
Eighth-turn phase. T⁴ = Z, T⁸ = I. Non-Clifford — drives quantum advantage. | 45° around z | qc.t(0) | ||||
| Rx(θ) Rotation around x |
Continuous rotation around x. Note the half-angle (spinor). | θ around x | qc.rx(theta, 0) | ||||
| Ry(θ) Rotation around y |
Continuous rotation around y. The only Pauli-axis rotation with all real entries. | θ around y | qc.ry(theta, 0) | ||||
| Rz(θ) Rotation around z |
Continuous phase rotation. Diagonal — never changes Z-basis probabilities. | θ around z | qc.rz(theta, 0) |
Multi-qubit gates
| Gate | What it does | CNOT cost | Qiskit |
|---|---|---|---|
| CNOT (CX) Controlled-NOT | Flips target iff control is |1⟩. The canonical entangler. Self-inverse. | 1 (native) | qc.cx(control, target) |
| CZ Controlled-Z | Flips phase of |11⟩, leaves others alone. Symmetric in control/target. | 1 (= H · CNOT · H on target) | qc.cz(0, 1) |
| SWAP SWAP | Exchanges two qubits' states. Lots of qubit-routing cost on real hardware. | 3 CNOTs | qc.swap(0, 1) |
| iSWAP iSWAP | SWAP with extra i on the off-diagonal. Native on some superconducting hardware. | ~4 CNOTs | qc.append(iSwapGate(), [0, 1]) |
| CCNOT (Toffoli) Controlled-controlled-NOT | Reversible AND. Flips target iff both controls are |1⟩. Foundation of quantum arithmetic. | 6 CNOTs + 7 T gates | qc.ccx(0, 1, 2) |
| CSWAP (Fredkin) Controlled-SWAP | Swaps qubits 1 and 2 iff qubit 0 is |1⟩. | 1 Toffoli + 2 CNOTs | qc.cswap(0, 1, 2) |
| Controlled-U Generic controlled unitary | Apply any single-qubit U to target iff control is |1⟩. | 2 CNOTs + 3 single-qubit rotations | U.control(1) |
Useful identities
| X² = Y² = Z² = I | Each Pauli is its own inverse. |
| XY = iZ, YZ = iX, ZX = iY | Cyclic Pauli products. |
| S² = Z, T² = S, T⁴ = Z, T⁸ = I | The phase-gate tower. |
| H X H = Z, H Z H = X, H Y H = −Y | Hadamard swaps the x and z axes. |
| CNOT(a→b) = (I ⊗ H) · CZ · (I ⊗ H) | CNOT and CZ differ by Hadamards on the target. |
| SWAP = CNOT(0→1) · CNOT(1→0) · CNOT(0→1) | Three-CNOT decomposition of SWAP. |
| U = e^{iα} Rz(γ) Ry(β) Rz(δ) | Any single-qubit gate as 3 Euler-angle rotations. |
| Rz(2π) = −I (not I) | Half-angle = spinor weirdness; Rz(4π) = I. |
Hardware gate-error budget
Two-qubit gates dominate real-hardware error. Rough 2026 numbers:
| Hardware | 2-qubit gate error | Coherence T₁ |
|---|---|---|
| IBM Heron r2 | 3 × 10⁻³ | ~300 µs |
| Quantinuum H2 | 1 × 10⁻³ | ~50 s |
| IonQ Forte | 4 × 10⁻⁴ | ~60 s |
| Google Willow | 4 × 10⁻³ | ~100 µs |
| QuEra (neutral atom) | 5 × 10⁻³ | ~20 s |
Rule of thumb: for a circuit with n two-qubit gates and per-gate error p, expected fidelity ≈ (1 − p)n. A 50-CNOT circuit on Heron r2 lands at ~85% fidelity; 200 CNOTs at ~55%; 500 CNOTs is mostly noise.
Want the full derivation behind any of these? The Gates & Circuits track covers each gate from first principles. Or try them in the playground.