The short version

Definition
Every quantum gate is a unitary matrix U satisfying U†U = I.
Always reversible
Apply U† and the state returns exactly to where it started.
Superposition
The Hadamard gate is the tool for creating it.
Entanglement
CNOT is the canonical two-qubit gate that produces it.
Universality
Clifford + T can approximate any unitary to arbitrary precision.

01 What is a quantum gate?

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†.

Quantum gates are always reversible. That 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.

02 Single-qubit gates

Each single-qubit gate is a 2x2 unitary matrix. All are their own inverse except S (inverse is S†) and T (inverse is T†).

  • Hadamard (H)

    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.

  • Pauli-X

    [[0, 1], [1, 0]]

    Bit flip. Maps |0⟩ to |1⟩ and |1⟩ to |0⟩. The quantum equivalent of a classical NOT gate.

  • Pauli-Y

    [[0, -i], [i, 0]]

    Combined bit and phase flip. Maps |0⟩ to i|1⟩ and |1⟩ to -i|0⟩.

  • Pauli-Z

    [[1, 0], [0, -1]]

    Phase flip. Leaves |0⟩ unchanged, maps |1⟩ to -|1⟩. Only affects the phase of the |1⟩ component.

  • Phase (S)

    [[1, 0], [0, i]]

    Applies a 90-degree phase shift to |1⟩. S = sqrt(Z). Two S gates are equivalent to one Z gate.

  • T 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.

  • Rotation Rx(θ)

    [[cos(θ/2), -i·sin(θ/2)], [-i·sin(θ/2), cos(θ/2)]]

    Rotates the qubit state by angle θ around the X axis of the Bloch sphere.

  • Rotation Ry(θ)

    [[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.

  • Rotation Rz(θ)

    [[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.

03 Two-qubit gates

Two-qubit gates are 4x4 unitary matrices. They are the primary mechanism for creating and manipulating entanglement between qubits.

  • CNOT (CX)

    Flips the target qubit if and only if the control qubit is |1⟩. The most common two-qubit gate; essential for creating entanglement.

  • CZ

    Applies a Z (phase flip) to the target qubit if the control qubit is |1⟩. Symmetric: either qubit can be treated as the control.

  • SWAP

    Exchanges the states of two qubits entirely. Used by compilers to route interactions between non-adjacent qubits on hardware.

  • iSWAP

    Swaps the |01⟩ and |10⟩ components and applies an i phase factor. Native gate on some superconducting hardware.

  • Controlled-H

    Applies the Hadamard gate to the target qubit only if the control qubit is |1⟩. Creates conditional superposition.

  • Controlled-Phase (CP)

    Applies a phase shift of e^(iθ) to the |11⟩ component only. Used in the quantum Fourier transform.

04 Three-qubit gates

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.

CCNOT

Toffoli gate

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.

CSWAP

Fredkin gate

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 conserves 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.

05 Universal gate sets

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.

H, S, CNOT + T

Clifford + T

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.

Minimal set

{H, T, CNOT}

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.

In hardware

Native gate sets

Hardware vendors define their own native gate sets based on what their physical qubits support directly. IBM's current Heron processors use the set {CZ, ID, RZ, SX, X} (earlier IBM generations used CX or ECR as the two-qubit gate), 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.

06 Courses covering quantum gates and circuits

Courses that teach quantum gate theory, circuit design, and hands-on implementation in Qiskit, PennyLane, or other frameworks.

  • Brilliant

    Vectors and Matrices

    Master vectors, matrices, transformations, and eigenvalues, the essential mathematical foundation for quantum computing, machine learning, and physics.

    Self-paced intermediate

  • QUANTUM CIRCUITS

    A Practical Introduction to Quantum Computing (CERN)

    Prof. Elias Fernandez-Combarro Alvarez, University of Oviedo

    CERN openlab's free lecture series on quantum computing covering qubits, quantum algorithms, QAOA, VQE, and quantum machine learning. Taught by a University of Oviedo professor with no physics background required.

    Self-paced (7 recorded lectures) beginner

  • QUANTUM ALGORITHM DESIGN

    Classiq Quantum Computing Tutorials

    Classiq engineering and research team

    Classiq's free library of hands-on quantum computing tutorials covering algorithm design, quantum machine learning, and optimization using the high-level Qmod language. No circuit assembly required.

    Self-paced intermediate

  • Brilliant

    Quantum Computing (Interactive)

    Brilliant's interactive quantum computing course, learn by doing with hands-on puzzles and visualisations. Subscription-based, covered by Brilliant's free trial.

    Self-paced beginner

  • Google

    Hands-On Quantum Error Correction with Google Quantum AI

    Austin Fowler

    Google Quantum AI's free-to-audit Coursera course on quantum error correction. Covers the surface code, stabilizer formalism, and the Stim and Crumble software tools used by Google researchers, with hands-on coding labs.

    3 weeks (about 10 hours per week) intermediate

  • Coursera

    Quantum Computing with Qiskit and Advanced Algorithms

    Packt

    A Qiskit-based course that moves from quantum fundamentals into the major quantum algorithms: teleportation, Deutsch, Bernstein-Vazirani, Grover's search, and Shor's factoring algorithm, with implementation on simulators and real quantum hardware.

    ~9 hours beginner

  • Udemy

    QC101 Quantum Computing & Intro to Quantum Machine Learning

    Kumaresan Ramanathan

    Udemy's bestselling quantum computing course, created by Kumaresan Ramanathan. Builds from quantum physics fundamentals to quantum programming with IBM Qiskit and Microsoft Q#, running programs on real quantum computers, plus an introduction to quantum machine learning.

    self-paced video beginner

07 Questions people ask

What makes a quantum gate different from a classical logic gate?
Classical logic gates (AND, OR, NOT) operate on bits and can be irreversible: two inputs can produce the same output, so you cannot always reconstruct the inputs from the output. Quantum gates are always reversible because they are represented by unitary matrices. A unitary matrix has an inverse equal to its conjugate transpose, so every quantum gate can be undone exactly. This reversibility is a direct consequence of the time-reversal symmetry of quantum mechanics and is not optional. Quantum gates also differ because they operate on continuous-valued amplitudes, can create superpositions, and can act on entangled states in ways that have no classical analog.
What is the Hadamard gate used for?
The Hadamard gate (H) is the primary tool for creating superposition. Applied to |0>, it produces an equal superposition (|0> + |1>) / sqrt(2). Applied to |1>, it produces (|0> - |1>) / sqrt(2). Circuits that begin by applying Hadamard gates to all qubits initialized in |0> create an equal superposition over all 2^n computational basis states, a key step in many quantum algorithms including Grover's algorithm, quantum phase estimation, and the quantum Fourier transform. The Hadamard gate is also its own inverse: applying H twice returns the qubit to its original state.
What is a CNOT gate?
The CNOT (Controlled-NOT, or CX) gate is a two-qubit gate with one control qubit and one target qubit. If the control qubit is |0>, the target qubit is left unchanged. If the control qubit is |1>, the target qubit is flipped (X is applied to it). The CNOT gate is the canonical two-qubit gate and is essential for creating entanglement. Applying a Hadamard gate to the first qubit followed by a CNOT produces a Bell state, a maximally entangled two-qubit state. CNOT is one of the most commonly used gates in circuit implementations and is available natively on most quantum hardware.
What is a universal quantum gate set?
A universal gate set is a small set of gates from which any unitary operation on any number of qubits can be approximated to arbitrary precision. This is analogous to how NAND gates alone can implement any classical Boolean function. Two common universal sets are the Clifford+T set (H, S, CNOT, and T) and {H, T, CNOT}. The Solovay-Kitaev theorem guarantees that any single-qubit unitary can be approximated efficiently using elements from a universal set. Universality matters because hardware only implements a finite native gate set, and compilers must decompose arbitrary unitaries into sequences of those native gates.
How are quantum gates implemented physically?
The physical implementation of quantum gates depends on the hardware platform. On superconducting processors, single-qubit gates are implemented with carefully shaped microwave pulses that drive transitions between energy levels; two-qubit gates use coupling between neighboring qubits via cross-resonance or parametric modulation. On trapped-ion systems, laser pulses drive transitions between internal electronic states; two-qubit gates use the shared vibrational modes of the ion chain to mediate interactions. On neutral-atom platforms, laser pulses implement single-qubit rotations and Rydberg blockade interactions implement two-qubit gates. In all cases the goal is to apply a precise unitary transformation as quickly and accurately as possible before decoherence degrades the state.