Quantum gates must be reversible
Classical software can overwrite a variable; a noiseless quantum gate cannot. Its matrix must be unitary, so another operation can reverse it. The closest quantum cousin of NOT is the Pauli-X gate.
| Classical idea | Quantum gate | What it does |
|---|---|---|
| NOT | X | Swaps |0⟩ and |1⟩ amplitudes. |
| Random-looking split | H | Creates an equal superposition with phase. |
| Controlled action | CNOT | Applies X to a target only when the control is 1. |
Why there is no direct AND gate
AND compresses four inputs into two outputs, so it loses information. Quantum circuits must remain reversible; boolean logic is embedded into reversible constructions with helper qubits.
H plus CNOT is the canonical pair
# Start at |00>
H on q0 → (|00> + |10>) / √2
CNOT q0 → q1 → (|00> + |11>) / √2
The CNOT creates a correlation but does not clone an unknown state. Together these gates create a Bell state, the smallest useful example of entanglement.
Place X, H, and CNOT in the interactive lab, then continue to the NumPy linear-algebra article.