Curriculum / Quantum Gates Deep Dive / Hadamard Gate & Superposition
Hadamard Gate & Superposition
The most important gate in quantum computing. Create and destroy superposition.
Hadamard Gate & Superposition
The Hadamard gate, written H, is the gate that makes quantum computing look quantum. It turns definite classical states into equal superpositions, it turns superpositions back into definite states, and it is the workhorse behind Deutsch-Jozsa, Grover, quantum phase estimation, and BB84. If you understand H, you understand superposition.
The Matrix and What It Does
H = (1/√2) · [[1, 1],
[1, −1]]Applied to the computational basis states:
- •H|0⟩ = (|0⟩ + |1⟩)/√2 = |+⟩, an equal superposition with positive relative phase.
- •H|1⟩ = (|0⟩ − |1⟩)/√2 = |−⟩, an equal superposition with negative relative phase.
- •H|+⟩ = |0⟩ and H|−⟩ = |1⟩, H is its own inverse: H² = I.
Measured in the Z basis, both |+⟩ and |−⟩ yield 0 and 1 with probability 1/2 each. What distinguishes them is phase, and that phase becomes visible only when you later apply another gate (like another H).
Geometrically, H is a 180° rotation of the Bloch sphere about the diagonal axis (X+Z)/√2. That rotation swaps the north pole with the +X point, which is exactly "turning |0⟩ into |+⟩".
Interference: Why Two H's Is Nothing
Because H is self-inverse, H·H = I. If you apply H twice to |0⟩, you get back exactly |0⟩:
H|0⟩ = (|0⟩ + |1⟩)/√2
H·H|0⟩ = H·(|0⟩ + |1⟩)/√2
= (H|0⟩ + H|1⟩)/√2
= ((|0⟩ + |1⟩)/√2 + (|0⟩ − |1⟩)/√2)/√2
= |0⟩The |1⟩ contributions destructively interfere and cancel, while the |0⟩ contributions constructively interfere and return with amplitude 1.
[animation: interference] This is the whole game: quantum algorithms arrange amplitudes to cancel on wrong answers and reinforce on right ones. H is the simplest place to see it happen.
A 50/50 measurement distribution from |+⟩ looks just like a fair coin toss, until you apply another H and get |0⟩ with certainty. A real coin flipped twice does not return to heads. This is the operational signature of phase: it is real, it is carried by the qubit, and it steers interference.
This is the opening of the lesson. The full walkthrough, the interactive circuit, and the graded challenge continue inside myqubit.
How this lesson works
A hands-on coding challenge. You write Qiskit-compatible Python in the browser editor, run it instantly via WebAssembly, watch the circuit and Bloch sphere react, and pass automatic output checks. The AI tutor Qubitus gives Socratic hints if you get stuck.
Part of: Quantum Gates Deep Dive
Master single-qubit and multi-qubit gates. Understand rotations, phases, and the math behind every gate in Qiskit.
This lesson is part of Pro
Unlock Quantum Gates Deep Dive and all 10 tracks with Pro: $12.99/month, $79/year, or $97 lifetime. Start with the free track first if you are new.