Quantum Circuit Lab / conceptual bridge
Lesson 04 · conceptual bridge

Quantum Logic Gates: AND, OR, NOT to X, H & CNOT

Translate familiar boolean logic into reversible quantum gates and learn why Hadamard and CNOT are the first two gates to master.

Beginner12–15 min readsoftware engineering · quantum computing

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 ideaQuantum gateWhat it does
NOTXSwaps |0⟩ and |1⟩ amplitudes.
Random-looking splitHCreates an equal superposition with phase.
Controlled actionCNOTApplies 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.

Common mistake: “H means random” is incomplete. H creates amplitudes with a relative phase that later gates can make interfere.

Place X, H, and CNOT in the interactive lab, then continue to the NumPy linear-algebra article.