⚛️ Quantum Institute

Quantum Gates Reference

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

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.

Single-qubit: ━━[H]━━ (wire through a box labeled H) CNOT: ━━●━━ (control: filled dot) ━━⊕━━ (target: circled plus) Measurement: ━━[M]━━ (meter symbol, produces classical bit)

Identity Gate (I)

The identity gate does nothing. It is included for completeness and is useful in tensor products to indicate "no operation on this qubit."

I = | 1 0 | | 0 1 | I|0⟩ = |0⟩ I|1⟩ = |1⟩ Circuit symbol: empty wire (no box drawn)

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.

Pauli-Z (phase-flip)

Z = | 1 0 | Circuit: ━[Z]━ | 0 -1 | Z|0⟩ = |0⟩ Z|1⟩ = -|1⟩ Z|+⟩ = |-⟩ Z|-⟩ = |+⟩ Eigenvalues: +1 (eigenvector |0⟩), -1 (eigenvector |1⟩) Z² = I Z† = Z

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

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

S† gate (S-dagger, inverse of S)

S† = | 1 0 | Circuit: ━[S†]━ | 0 -i | S†|0⟩ = |0⟩ S†|1⟩ = -i|1⟩ S† = S⁻¹ = S³

T gate (π/4 phase, √S)

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.

T† gate (T-dagger)

T† = | 1 0 | Circuit: ━[T†]━ | 0 e^(-iπ/4) | T† = T⁻¹ = T⁷
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).

Rz(θ) — rotation about Z

Rz(θ) = | e^(-iθ/2) 0 | | 0 e^(iθ/2) | Rz(π) = -iZ Rz(π/2) = e^(-iπ/4)·S Rz(π/4) = e^(-iπ/8)·T

General single-qubit gate (ZYZ decomposition)

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.

CNOT = | 1 0 0 0 | Circuit: ━●━ (control) | 0 1 0 0 | | | 0 0 0 1 | ━⊕━ (target) | 0 0 1 0 | CNOT|00⟩ = |00⟩ CNOT|01⟩ = |01⟩ CNOT|10⟩ = |11⟩ CNOT|11⟩ = |10⟩ Control in |+⟩: CNOT(|+0⟩) = |Φ⁺⟩ = (|00⟩+|11⟩)/√2 → creates entanglement!

Properties

Other Two-Qubit Gates

CZ (Controlled-Z)

CZ = | 1 0 0 0 | Circuit: ━●━ | 0 1 0 0 | | | 0 0 1 0 | ━●━ (both dots: symmetric) | 0 0 0 -1 | CZ|11⟩ = -|11⟩ (phase flip only when both qubits are |1⟩) CZ is symmetric: control and target are interchangeable CZ = (I⊗H) CNOT (I⊗H) (convert between CZ and CNOT with H)

CZ is the native two-qubit gate on many superconducting platforms (Google Sycamore, Rigetti). It is symmetric, which simplifies circuit design.

SWAP

SWAP = | 1 0 0 0 | Circuit: ━×━ | 0 0 1 0 | | | 0 1 0 0 | ━×━ | 0 0 0 1 | SWAP|ψφ⟩ = |φψ⟩ (exchanges two qubits) SWAP = 3 CNOTs: CNOT₁₂ · CNOT₂₁ · CNOT₁₂

iSWAP

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

Two-qubit gate equivalences

GateDecomposition into CNOTCNOT count
CZ(I⊗H) CNOT (I⊗H)1
SWAPCNOT₁₂ CNOT₂₁ CNOT₁₂3
iSWAPH₁ CNOT₁₂ CNOT₂₁ H₂ S₂ CNOT₁₂3
√SWAPCNOT₁₂ Ry(π/2)₂ CNOT₁₂2
General SU(4)At most 3 CNOTs + local 1Q gates≤3

Three-Qubit Gates

Toffoli gate (CCX, CCNOT)

Toffoli flips the target qubit iff BOTH controls are |1⟩. Circuit: ━●━ (control 1) | ━●━ (control 2) | ━⊕━ (target) Truth table: |000⟩ → |000⟩ |100⟩ → |100⟩ |001⟩ → |001⟩ |101⟩ → |101⟩ |010⟩ → |010⟩ |110⟩ → |111⟩ ✔ |011⟩ → |011⟩ |111⟩ → |110⟩ ✔

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.

Universal gate sets

Gate setUniversal?Notes
{H, T, CNOT}YesStandard. H and T generate dense subset of SU(2).
{H, S, CNOT}No (Clifford)Efficiently simulable classically (Gottesman-Knill).
{H, T}Yes (1Q only)Dense in SU(2) but needs CNOT for multi-qubit.
{Ry, Rz, CNOT}YesContinuous parameters. Used in variational circuits.
{√SWAP, 1Q gates}YesAlternative native gate for some hardware.
{Toffoli, H}YesToffoli 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)

GateFidelityDurationNotes
Single-qubit (SX, Rz)99.95%~28 nsRz is virtual (0 ns)
ECR (native 2Q)99.0-99.5%~500 nsEchoed cross-resonance
CNOT (compiled)98.5-99.3%~500-700 nsDecomposed into ECR + 1Q
Readout98.5-99.5%~700 nsDispersive readout

Google Quantum AI (superconducting, Willow)

GateFidelityDurationNotes
Single-qubit99.85%~25 nsMicrowave pulses
CZ (native 2Q)99.4-99.7%~32 nsTunable coupler
iSWAP (native)~99.5%~32 nsAlternative native gate
Readout~99%~500 nsDispersive

IonQ (trapped ion, Forte Enterprise)

GateFidelityDurationNotes
Single-qubit99.97%~10 μsLaser-driven
Two-qubit (XX)99.4-99.6%~200-600 μsMolmer-Sorensen; all-to-all
Readout99.6%~100 μsFluorescence detection

Quantinuum (trapped ion, H2)

GateFidelityDurationNotes
Single-qubit99.99%~5 μsBest in class
Two-qubit (ZZ)99.5-99.8%~200 μsAll-to-all via shuttling
Readout99.7%~50 μsState-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.