Every standard quantum gate: matrix representation, circuit notation, physical meaning, decomposition, and hardware fidelity.
What Is a Quantum Gate?
A quantum gate is a unitary operation that transforms qubit states. Unitary means the operation is reversible: U†U = UU† = I. Every quantum gate can be represented as a unitary matrix.
Key properties
Reversibility: Every quantum gate has an inverse (its conjugate transpose). Unlike classical gates (AND, OR), no information is destroyed.
Composition: Applying gate A then B is the matrix product BA (right to left, matching circuit left to right).
Universality: A small set of gates can approximate any unitary operation to arbitrary precision. {H, T, CNOT} is universal.
Circuit notation
In circuit diagrams, qubits are horizontal lines (wires) and gates are boxes or symbols on those lines. Time flows left to right. Multi-qubit gates connect wires with vertical lines.
When specifying multi-qubit operations, I ⊗ H means "do nothing to qubit 0, apply H to qubit 1."
Pauli Gates (X, Y, Z)
The three Pauli matrices, along with the identity, form a basis for all 2×2 Hermitian matrices. They are simultaneously the generators of SU(2) rotations and the most common error operators in quantum error correction.
Pauli-X (NOT gate, bit-flip)
X = | 0 1 | Circuit: ━[X]━ or ━⊕━
| 1 0 |
X|0⟩ = |1⟩ X|1⟩ = |0⟩
X|+⟩ = |+⟩ X|-⟩ = -|-⟩
Eigenvalues: +1 (eigenvector |+⟩), -1 (eigenvector |-⟩)
X² = I X† = X
The quantum analog of the classical NOT gate. On the Bloch sphere, it is a 180-degree rotation about the X axis.
Pauli-Y
Y = | 0 -i | Circuit: ━[Y]━
| i 0 |
Y|0⟩ = i|1⟩ Y|1⟩ = -i|0⟩
Y = iXZ
Eigenvalues: +1 (eigenvector |i⟩), -1 (eigenvector |-i⟩)
Y² = I Y† = Y
Combines both bit-flip and phase-flip. 180-degree rotation about the Y axis of the Bloch sphere.
Flips the phase of the |1⟩ component without changing probabilities. 180-degree rotation about Z axis. The computational basis states are eigenstates of Z.
Pauli algebra
Commutation: [X,Y] = 2iZ [Y,Z] = 2iX [Z,X] = 2iY
Anti-commute: {X,Y} = 0 {Y,Z} = 0 {Z,X} = 0
Products: XY = iZ YZ = iX ZX = iY
XYZ = iI
Hadamard Gate (H)
The Hadamard gate is the most important single-qubit gate. It creates superpositions from computational basis states and is the starting point for nearly every quantum algorithm.
H = (1/√2) | 1 1 | Circuit: ━[H]━
| 1 -1 |
H|0⟩ = |+⟩ = (|0⟩ + |1⟩) / √2
H|1⟩ = |-⟩ = (|0⟩ - |1⟩) / √2
H|+⟩ = |0⟩
H|-⟩ = |1⟩
H² = I (self-inverse: applying H twice returns to original state)
H = (X + Z) / √2
On the Bloch sphere, H is a 180-degree rotation about the axis halfway between X and Z (the X+Z direction). It maps the Z-basis to the X-basis and vice versa.
Uses
Creating superposition: Start in |0⟩, apply H to get equal superposition |+⟩.
Changing measurement basis: Apply H before Z-measurement to effectively measure in the X-basis.
Quantum parallelism: H⊗ⁿ applied to |0⟩⊗ⁿ creates uniform superposition over all 2ⁿ computational basis states.
Part of universal gate set: {H, T, CNOT} is universal for quantum computation.
Phase Gates (S, S†, T, T†)
Phase gates add a relative phase to the |1⟩ component without affecting |0⟩. They are rotations about the Z axis of the Bloch sphere.
S gate (π/2 phase, √Z)
S = | 1 0 | Circuit: ━[S]━
| 0 i |
S|0⟩ = |0⟩ S|1⟩ = i|1⟩
S|+⟩ = |i⟩ S|-⟩ = |-i⟩
S = Z^(1/2) = Rz(π/2) (up to global phase)
S² = Z S†S = I
T = | 1 0 | Circuit: ━[T]━
| 0 e^(iπ/4) |
T|0⟩ = |0⟩ T|1⟩ = e^(iπ/4)|1⟩
T = S^(1/2) = Z^(1/4) = Rz(π/4) (up to global phase)
T² = S T⁴ = Z T⁸ = I
The T gate is critical for universality. The Clifford gates alone (H, S, CNOT) can be efficiently simulated classically (Gottesman-Knill theorem). Adding the T gate makes the set universal, enabling any quantum computation.
The Clifford group is generated by {H, S, CNOT}. Clifford circuits can be simulated classically in polynomial time (Gottesman-Knill theorem). The T gate breaks out of the Clifford group and is the key ingredient for quantum computational advantage. In fault-tolerant quantum computing, T gates are by far the most expensive operation, requiring magic state distillation.
Rotation Gates
Rotation gates parameterize continuous rotations about the X, Y, and Z axes of the Bloch sphere. Any single-qubit gate can be decomposed as a sequence of three rotations (ZYZ or ZXZ decomposition).
Rx(θ) — rotation about X
Rx(θ) = | cos(θ/2) -i·sin(θ/2) |
| -i·sin(θ/2) cos(θ/2) |
Rx(π) = -iX (Pauli X up to global phase)
Rx(π/2): the √X gate
Ry(θ) — rotation about Y
Ry(θ) = | cos(θ/2) -sin(θ/2) |
| sin(θ/2) cos(θ/2) |
Ry(π) = -iY
Ry(θ)|0⟩ = cos(θ/2)|0⟩ + sin(θ/2)|1⟩
Note: Ry has only real entries. Useful for preparing states
with real amplitudes (common in variational circuits).
Any U ∈ SU(2) can be written as:
U = e^(iα) · Rz(β) · Ry(γ) · Rz(δ)
where α is a global phase and β, γ, δ are Euler angles.
This means at most 3 rotation gates suffice for any 1Q operation.
The general phase gate P(θ)
P(θ) = | 1 0 |
| 0 e^(iθ) |
P(π) = Z
P(π/2) = S
P(π/4) = T
This is Rz(θ) up to a global phase: P(θ) = e^(iθ/2) Rz(θ)
CNOT Gate (Controlled-X)
The CNOT (controlled-NOT) gate is the most important two-qubit gate. It flips the target qubit if and only if the control qubit is |1⟩. Together with single-qubit gates, CNOT is sufficient for universal quantum computation.
iSWAP = | 1 0 0 0 |
| 0 0 i 0 |
| 0 i 0 0 |
| 0 0 0 1 |
iSWAP|01⟩ = i|10⟩ iSWAP|10⟩ = i|01⟩
Native gate on some superconducting architectures.
iSWAP = SWAP · CZ (up to single-qubit phases)
√SWAP
√SWAP = | 1 0 0 0 |
| 0 (1+i)/2 (1-i)/2 0 |
| 0 (1-i)/2 (1+i)/2 0 |
| 0 0 0 1 |
(√SWAP)² = SWAP
√SWAP is universal: combined with single-qubit gates, it can build any circuit.
Controlled-U (general)
CU = | I 0 | (block matrix form)
| 0 U |
Applies unitary U to target qubit only when control is |1⟩.
CNOT = CX, CZ = Controlled-Z, CS = Controlled-S, etc.
Controlled-Rz(θ): native in many hardware platforms
The Toffoli gate is the quantum version of the classical AND gate (when target starts at |0⟩). It is universal for classical reversible computing and, combined with H, is universal for quantum computing.
Toffoli decomposition
The Toffoli can be decomposed into 6 CNOTs + single-qubit gates:
━●━━━━━●━━━━━●━━━━━━━
| | |
━━●━━━●━━━━━●━●━━━━━
| | | |
━[H]⊕[T†]⊕[T]━━━[T†]⊕[T][H]━
(Simplified schematic - actual decomposition uses
H, T, T†, and CNOT gates in specific arrangement)
Fredkin gate (CSWAP)
Fredkin swaps two target qubits iff the control is |1⟩.
Circuit: ━●━ (control)
|
━×━ (target 1)
|
━×━ (target 2)
CSWAP|1⟩|ψ⟩|φ⟩ = |1⟩|φ⟩|ψ⟩
CSWAP|0⟩|ψ⟩|φ⟩ = |0⟩|ψ⟩|φ⟩
Decomposes into: 1 Toffoli + 2 CNOTs (or 8 CNOTs total)
The Fredkin gate is useful for comparison (the SWAP test for state overlap) and is also universal for classical reversible computation.
Gate Decomposition
Any quantum gate can be built from a small universal gate set. The standard universal set is {H, T, CNOT}. The Solovay-Kitaev theorem guarantees that any single-qubit gate can be approximated to precision ε using O(log³⁄²(1/ε)) gates from this set.
Continuous parameters. Used in variational circuits.
{√SWAP, 1Q gates}
Yes
Alternative native gate for some hardware.
{Toffoli, H}
Yes
Toffoli is classical-universal; H adds superposition.
Solovay-Kitaev theorem
Theorem: If a set of gates generates a dense subgroup of SU(2),
then any target gate U can be ε-approximated using
O(log^c(1/ε)) gates, where c ≈ 3.97 (best known: c ≈ 1.44).
Example: To approximate Ry(π/7) to 10⁻¹⁰ precision
using {H, T}: roughly 100-200 gates needed.
Modern approach: Use the Ross-Selinger algorithm (2014)
which achieves optimal T-count for single-qubit synthesis
with O(log(1/ε)) T gates.
Common decompositions
S = T²
Z = S² = T⁴
X = HZH
Y = XZ · (global phase i)
SWAP = CNOT₁₂ CNOT₂₁ CNOT₁₂
CZ = (I⊗H) CNOT (I⊗H)
Toffoli = 6 CNOTs + 1Q gates (optimal)
Any 1Q gate = Rz(α) Ry(β) Rz(γ) · e^(iδ)
Gate Fidelity on Real Hardware
Gate fidelity measures how close a real gate operation is to the ideal unitary. Fidelity = 1 means perfect; real hardware has errors from decoherence, calibration drift, crosstalk, and control imprecision.
IBM Quantum (superconducting, Heron r2)
Gate
Fidelity
Duration
Notes
Single-qubit (SX, Rz)
99.95%
~28 ns
Rz is virtual (0 ns)
ECR (native 2Q)
99.0-99.5%
~500 ns
Echoed cross-resonance
CNOT (compiled)
98.5-99.3%
~500-700 ns
Decomposed into ECR + 1Q
Readout
98.5-99.5%
~700 ns
Dispersive readout
Google Quantum AI (superconducting, Willow)
Gate
Fidelity
Duration
Notes
Single-qubit
99.85%
~25 ns
Microwave pulses
CZ (native 2Q)
99.4-99.7%
~32 ns
Tunable coupler
iSWAP (native)
~99.5%
~32 ns
Alternative native gate
Readout
~99%
~500 ns
Dispersive
IonQ (trapped ion, Forte Enterprise)
Gate
Fidelity
Duration
Notes
Single-qubit
99.97%
~10 μs
Laser-driven
Two-qubit (XX)
99.4-99.6%
~200-600 μs
Molmer-Sorensen; all-to-all
Readout
99.6%
~100 μs
Fluorescence detection
Quantinuum (trapped ion, H2)
Gate
Fidelity
Duration
Notes
Single-qubit
99.99%
~5 μs
Best in class
Two-qubit (ZZ)
99.5-99.8%
~200 μs
All-to-all via shuttling
Readout
99.7%
~50 μs
State-dependent fluorescence
What fidelity means in practice
For a circuit with N two-qubit gates:
Overall success probability ≈ F^N
Example with 99.5% gate fidelity:
10 gates: (0.995)^10 = 95.1% ✓ usable
100 gates: (0.995)^100 = 60.6% marginal
1000 gates:(0.995)^1000 = 0.7% ✗ unusable without QEC
Shor's algorithm for RSA-2048: ~10⁸-10¹⁰ gates needed
→ requires fault-tolerant QEC with logical error rate < 10⁻¹⁰
Current hardware can reliably execute circuits with tens to low hundreds of two-qubit gates. For deeper circuits, error mitigation techniques (zero-noise extrapolation, probabilistic error cancellation) can extend the useful range, as demonstrated by IBM's 127-qubit experiments (Nature, 2023). True fault tolerance requires quantum error correction — see the QEC page.