Qiskit Global Summer School 2024: Quantum Computing and Simulation
IBM Quantum Research Team
Quantum gates are the operations that manipulate qubit states. This reference covers every major gate - single-qubit, two-qubit, and three-qubit - with its matrix representation, symbol, and plain-language explanation of what it does.
A quantum gate is an operation that transforms the state of one or more qubits. The analogy to classical logic gates is useful but limited: classical gates like AND and OR can discard information (two different input combinations can produce the same output), whereas quantum gates are always reversible.
Mathematically, every quantum gate is represented by a unitary matrix U satisfying U†U = I, where U† is the conjugate transpose of U. Unitarity guarantees two things: the transformation preserves the total probability (the state vector stays normalized), and the gate can always be undone by applying U†. This is not an engineering choice but a fundamental requirement of quantum mechanics.
When a gate is applied to a qubit in state |ψ⟩, the new state is simply U|ψ⟩ - matrix multiplication of the gate matrix by the state vector. For multi-qubit gates, the matrix dimension grows as 2^n where n is the number of qubits involved. A two-qubit gate is represented by a 4x4 unitary matrix; a three-qubit gate by an 8x8 matrix.
Each single-qubit gate is a 2x2 unitary matrix. All are their own inverse except S (inverse is S†) and T (inverse is T†).
1/√2 · [[1, 1], [1, -1]] Creates equal superposition from a basis state. Maps |0⟩ to (|0⟩+|1⟩)/√2 and |1⟩ to (|0⟩-|1⟩)/√2.
[[0, 1], [1, 0]] Bit flip. Maps |0⟩ to |1⟩ and |1⟩ to |0⟩. The quantum equivalent of a classical NOT gate.
[[0, -i], [i, 0]] Combined bit and phase flip. Maps |0⟩ to i|1⟩ and |1⟩ to -i|0⟩.
[[1, 0], [0, -1]] Phase flip. Leaves |0⟩ unchanged, maps |1⟩ to -|1⟩. Only affects the phase of the |1⟩ component.
[[1, 0], [0, i]] Applies a 90-degree phase shift to |1⟩. S = sqrt(Z). Two S gates are equivalent to one Z gate.
[[1, 0], [0, e^(iπ/4)]] Applies a 45-degree phase shift to |1⟩. T = sqrt(S). Critical for universality in the Clifford+T gate set.
[[cos(θ/2), -i·sin(θ/2)], [-i·sin(θ/2), cos(θ/2)]] Rotates the qubit state by angle θ around the X axis of the Bloch sphere.
[[cos(θ/2), -sin(θ/2)], [sin(θ/2), cos(θ/2)]] Rotates the qubit state by angle θ around the Y axis of the Bloch sphere. Used heavily in variational algorithms.
[[e^(-iθ/2), 0], [0, e^(iθ/2)]] Rotates the qubit state by angle θ around the Z axis. Often implemented as a virtual gate with no physical pulse.
Two-qubit gates are 4x4 unitary matrices. They are the primary mechanism for creating and manipulating entanglement between qubits.
Flips the target qubit if and only if the control qubit is |1⟩. The most common two-qubit gate; essential for creating entanglement.
Applies a Z (phase flip) to the target qubit if the control qubit is |1⟩. Symmetric: either qubit can be treated as the control.
Exchanges the states of two qubits entirely. Used by compilers to route interactions between non-adjacent qubits on hardware.
Swaps the |01⟩ and |10⟩ components and applies an i phase factor. Native gate on some superconducting hardware.
Applies the Hadamard gate to the target qubit only if the control qubit is |1⟩. Creates conditional superposition.
Applies a phase shift of e^(iθ) to the |11⟩ component only. Used in the quantum Fourier transform.
Three-qubit gates are 8x8 unitary matrices. They are rarely implemented as native hardware gates but appear frequently in circuit decompositions, error correction, and algorithm descriptions. They can always be decomposed into sequences of single- and two-qubit gates.
The Toffoli gate has two control qubits and one target qubit. The target is flipped only when both controls are |1⟩. It is the quantum equivalent of a classical AND gate (combined with a NOT) and is significant because it makes quantum circuits classically universal: any classical reversible computation can be expressed using Toffoli gates alone. In quantum error correction, Toffoli gates are used to implement syndrome measurements and fault-tolerant logical operations. A Toffoli gate can be decomposed into 6 CNOT gates plus several single-qubit gates.
The Fredkin gate has one control qubit and two target qubits. When the control is |1⟩, the two target qubits are swapped; when the control is |0⟩, both targets are unchanged. Like the Toffoli gate, the Fredkin gate is classically universal and reversible. It also has the property of conserving the number of |1⟩s in the target register, which makes it useful for quantum fingerprinting protocols and controlled SWAP tests - a standard subroutine for comparing two quantum states without measuring them directly.
A universal gate set is a finite collection of gates that can approximate any unitary operation to arbitrary precision. This matters because real quantum hardware only natively implements a small fixed set of gates. Any algorithm must be compiled down to that native gate set, and universality guarantees this is always possible.
The Clifford group consists of gates that map Pauli operators to other Pauli operators under conjugation. Key Clifford gates are H, S, and CNOT. The Clifford group alone is not universal - it can be efficiently simulated classically (Gottesman-Knill theorem). Adding the T gate makes the set universal. T gates are expensive to implement fault-tolerantly, which is why minimizing T-count is an important optimization target in quantum compiling.
This closely related set is explicitly universal. H creates superposition, T provides the non-Clifford rotation needed for universality, and CNOT provides entanglement. The Solovay-Kitaev theorem guarantees that any single-qubit unitary can be approximated to precision epsilon using O(log^c(1/epsilon)) gates from a universal set, where c is approximately 2. In practice this means efficient compilation is always possible.
Hardware vendors define their own native gate sets based on what their physical qubits support directly. IBM uses the set {CX, ID, RZ, SX, X}, while Rigetti uses CZ and XY family gates. Quantinuum's trapped-ion processors use a native two-qubit gate called ZZ. Quantum compilers automatically decompose any circuit into the target hardware's native gates, adding SWAP gates as needed for qubit routing.
Courses that teach quantum gate theory, circuit design, and hands-on implementation in Qiskit, PennyLane, or other frameworks.
IBM Quantum Research Team
Austin Fowler
Xanadu / PennyLane Team
IBM Quantum / Qiskit Team
Xanadu
Brilliant.org
Delft University of Technology (QuTech)
Delft University of Technology (QuTech)
IBM Quantum