**This is an old revision of the document!**
Table of Contents
Quantum gate
A quantum gate is a unitary operation applied to one or more qubits. It is the quantum computing analog of a classical logic gate, but with two key differences: quantum gates are represented by matrices rather than truth tables, and they are always reversible — every quantum gate has an inverse.
A quantum gate acting on $n$ qubits is a $2^n \times 2^n$ unitary matrix $U$, meaning $U^\dagger U = I$. Applying a gate to a state vector $\lvert\psi\rangle$ is a matrix-vector multiplication $U\lvert\psi\rangle$. Unitarity ensures that the total probability remains 1 after the operation. The reversibility of quantum gates follows directly from unitarity: the inverse of $U$ is $U^\dagger$, so every gate operation can be undone by applying the conjugate transpose.
Classical logic gates like AND and OR are irreversible — given only the output, you cannot recover both inputs. Quantum gates cannot be irreversible in this way because unitary evolution is bijective. The only irreversible step in a quantum computation is measurement, which collapses the state vector and cannot be undone.
Single-qubit gates are $2 \times 2$ unitary matrices. The most general single-qubit gate is the U gate $U(\theta, \phi, \lambda)$, which subsumes all others as special cases. Two-qubit gates are $4 \times 4$ unitary matrices; the CNOT gate is the standard entangling two-qubit gate. Together, single-qubit gates and CNOT form a universal gate set: any $n$-qubit unitary can be approximated to arbitrary precision using only these.
List of quantum gates
- Pauli gates — the four Pauli matrices $I, X, Y, Z$ as a group
- $I$ gate (Identity gate) — identity
- $X$ gate (NOT gate) — bit flip (Pauli-X)
- Y gate — bit and phase flip (Pauli-Y)
- Z gate — phase flip (Pauli-Z)
- Hadamard gate — Hadamard
- Rotation gates — rotation gates $R_x, R_y, R_z$
- Phase gate — phase gate (generalizes $Z$, $S$, $T$)
- Unitary gate — universal single-qubit gate
- Multiqubit gates — overview of two- and three-qubit gates
- CNOT gate — controlled-NOT
- Toffoli gate — doubly-controlled-NOT (CCNOT)
- SWAP gate — qubit swap
- iSWAP gate — swap with imaginary phase
