The Quantum Engineer

E. Common Quantum Gates

The working gate table — symbol, matrix, action, and notes. Single-qubit:

I    = [[1,0],[0,1]]                     identity / idle (still decoheres)
X    = [[0,1],[1,0]]                     bit flip; X|0⟩=|1⟩; NOT
Y    = [[0,−i],[i,0]]                    bit+phase flip
Z    = [[1,0],[0,−1]]                    phase flip; Z|1⟩=−|1⟩
H    = (1/√2)[[1,1],[1,−1]]              basis change Z↔X; H|0⟩=|+⟩
S    = [[1,0],[0,i]]                     phase gate; S=S†† (Clifford)
T    = [[1,0],[0,e^{iπ/4}]]              π/8 gate; NON-Clifford — the costly one
RX(θ), RY(θ), RZ(θ)                      axis rotations; RZ(θ)=e^{−iθZ/2}

Two-qubit:

CX   = |0⟩⟨0|⊗I + |1⟩⟨1|⊗X    control-not; entangles; universal with 1q gates
CZ   = |0⟩⟨0|⊗I + |1⟩⟨1|⊗Z    symmetric; CX = (I⊗H)CZ(I⊗H)
SWAP = exchanges two qubits    = 3 CX; physical in some platforms
ECR, iSWAP, √X-variants        native on specific hardware (Ch. 44.5)

Three-qubit: Toffoli/CCX (universal reversible classical logic; 6 CX); CSWAP/Fredkin. Universality: {H,S,CX,T} suffices; any dense 1q-pair + entangling 2q gate suffices (Ch. 7). Costs to memorize: 1q ≈ free, CX ≈ 10× a 1q error, T ≈ 10³× under FTQ (Ch. 79.3).