What is a Quantum Gate?
A quantum gate is the quantum analog of a classical logic gate — it transforms the state of one or more qubits. Unlike classical gates, quantum gates are reversible: every gate has an inverse operation.
Mathematically, a single-qubit gate is a 2×2 unitary matrix. Applying a gate multiplies the state vector by that matrix.
Single-Qubit Gates
Hadamard Gate (H)
H = (1/√2) [[1, 1],
[1, -1]]
The Hadamard gate creates equal superposition from a basis state:
- H|0⟩ = |+⟩ = (|0⟩ + |1⟩)/√2
- H|1⟩ = |−⟩ = (|0⟩ − |1⟩)/√2
On the Bloch sphere, H rotates 180° around the diagonal between X and Z axes.
Pauli-X Gate (Quantum NOT)
X = [[0, 1],
[1, 0]]
Flips |0⟩ ↔ |1⟩. On the Bloch sphere, it's a 180° rotation around the X axis.
Pauli-Y Gate
Y = [[0, -i],
[i, 0]]
180° rotation around the Y axis. Includes a complex phase — Y|0⟩ = i|1⟩.
Pauli-Z Gate (Phase Flip)
Z = [[1, 0],
[0, -1]]
Leaves |0⟩ unchanged, flips the phase of |1⟩. 180° rotation around Z axis.
Phase Gate (S)
S = [[1, 0],
[0, i]]
90° rotation around Z. Transforms |+⟩ to |i⟩ (the +Y equator of the Bloch sphere).
T Gate (π/8 Gate)
T = [[1, 0],
[0, e^(iπ/4)]]
45° rotation around Z. Essential for universal quantum computation — along with H and CNOT, it forms a universal gate set.
Universal gate sets: H + T + CNOT can approximate any unitary operation to arbitrary precision. This is the quantum analog of the classical NAND gate's universality.
Multi-Qubit Gates
CNOT (Controlled-NOT)
CNOT = [[1,0,0,0],
[0,1,0,0],
[0,0,0,1],
[0,0,1,0]]
Two-qubit gate: if the control qubit is |1⟩, flip the target qubit. Otherwise, do nothing.
Key property: CNOT + Hadamard creates entanglement (the Bell states).
Bell State creation:
H on qubit 0 → then CNOT(0→1)
(|00⟩ + |11⟩)/√2 — the Φ⁺ Bell state
In the simulator: add a second qubit, press H on qubit 0, then click CNOT (Q0→Q1). Watch both purity bars drop — the qubits are now entangled.
CZ (Controlled-Z)
Applies a Z (phase flip) to the target qubit only when the control is |1⟩. Symmetric — it doesn't matter which qubit is control or target.
Quiz
Which gate applied to |+⟩ creates the |-⟩ state?
What makes CNOT + H capable of creating entanglement?
Try All Gates Live
Open the Bloch Sphere Simulator →
All gates (H, X, Y, Z, S, T) can be applied with keyboard shortcuts too — press the gate letter key!
Want to understand how data enters a quantum gate circuit? Read the Quantum Data Encoding Tutorial →