The Hadamard Gate —
Superposition Maker
It looks like a single letter inside a box: H. But that one symbol starts the coin spinning. It transforms a perfectly definite $|0\rangle$ into an equal mixture of $|0\rangle$ and $|1\rangle$ — and every quantum algorithm begins exactly here.
The Most Important Gate in Quantum Computing
In L19 you learned that every gate is a rotation on the Bloch sphere. The Hadamard gate rotates 180° around the diagonal axis between X and Z. If you start at the north pole $|0\rangle$, where does the arrow end up after H?
If you were only allowed to learn one quantum gate — just one — it would have to be the Hadamard gate.
Not because it is the most powerful on its own. But because without it, virtually no quantum computation is possible. The Hadamard gate is the gate that opens the search space. It takes a qubit sitting quietly in state $|0\rangle$ — completely definite, no quantum richness whatsoever — and transforms it into a perfect superposition where $|0\rangle$ and $|1\rangle$ are exactly equally likely.
Look at a circuit diagram for Grover's algorithm. The very first thing that happens, before any other operation, is a column of H gates applied to every qubit. Shor's algorithm. Same thing. Quantum phase estimation, the quantum Fourier transform, quantum error correction — the Hadamard gate is almost always the opening move.
The Spinning Coin — What H Actually Does
You have met the spinning coin before in L05. Let's return to it with fresh eyes, now that you understand circuits and gates.
Applying the Hadamard gate is like flicking the coin and setting it spinning.
The moment the coin is spinning, it is neither heads nor tails — it is genuinely both, in perfect equal proportion. If you tap the table and stop it (measurement), it will land heads 50% of the time and tails 50% of the time. But while it is spinning, it is in superposition.
The H gate does exactly this: it takes a definite qubit ($|0\rangle$ or $|1\rangle$) and starts it spinning. The result is a qubit in perfect 50/50 superposition — equally likely to be 0 or 1 when measured.
But H does something subtler than just "start it spinning." When you apply H to $|0\rangle$, you get the state physicists call $|+\rangle$ (pronounced "plus ket"). When you apply H to $|1\rangle$, you get $|-\rangle$ (pronounced "minus ket"). Both are equally balanced superpositions of 0 and 1 — but they have different phases. That difference in phase is what makes interference possible later in the circuit.
H on the Bloch Sphere
Every qubit state is a point on the Bloch sphere. The north pole is $|0\rangle$, the south pole is $|1\rangle$, and the equator is perfect 50/50 superposition. The Hadamard gate does something beautiful and geometric: it moves the arrow from pole to equator.
When you apply H to $|1\rangle$ (south pole), the arrow swings to the opposite side of the equator — the $|-\rangle$ state, pointing along the negative X-axis. Same probabilities when measured, but a different phase — which matters enormously for interference.
The Mathematics — Every Step Shown
Here is the complete mathematical picture of the Hadamard gate. Every step shown — no skipped derivations, every symbol defined on first use.
The Hadamard matrix
A qubit's state is a column vector with two entries — the complex amplitudes of $|0\rangle$ and $|1\rangle$. For $|0\rangle$: $\begin{pmatrix}1\\0\end{pmatrix}$; for $|1\rangle$: $\begin{pmatrix}0\\1\end{pmatrix}$. A gate is a matrix that transforms this vector.
Applying H to $|0\rangle$ — complete derivation
Applying H to $|1\rangle$ — complete derivation
Summary of H's action on all four states
| Input | Operation | Output state | Name | P(0) | P(1) |
|---|---|---|---|---|---|
| |0⟩ | → H → | $\tfrac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$ | |+⟩ | 50% | 50% |
| |1⟩ | → H → | $\tfrac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$ | |−⟩ | 50% | 50% |
| |+⟩ | → H → | $|0\rangle$ | |0⟩ | 100% | 0% |
| |−⟩ | → H → | $|1\rangle$ | |1⟩ | 0% | 100% |
The bottom two rows are remarkable: H applied to $|+\rangle$ returns $|0\rangle$, and H applied to $|-\rangle$ returns $|1\rangle$. This is the self-inverse property — $H \cdot H = I$. The gate is its own inverse. Two H gates in a row cancel completely.
Proving H is unitary: H² = I
Hadamard Explorer
Choose an input state, apply H, and watch the Bloch sphere arrow animate to its new position. Then measure — once or a hundred times — and see the probability histogram build. Everything from the sections above, made visible and manipulable.
Key things to observe: when you start from $|0\rangle$ or $|1\rangle$ and apply H, the measurement statistics converge to 50/50 as you take more shots. When you start from $|+\rangle$ or $|-\rangle$ and apply H, you get back to a classical state — always 100% on one outcome. That is the self-inverse property in action.
H Applied Twice — The Self-Inverse Property
One of the most elegant properties of the Hadamard gate is that applying it twice does nothing. You return exactly to where you started. This might seem like a limitation — but it is a profound feature exploited in many algorithms.
North pole
50/50 superpos.
H² = I ✓
Two identical "start spinning" operations reverse each other. The Hadamard gate's self-inverse property is mathematically equivalent: H followed by H is equivalent to doing nothing at all.
This property — called self-inverse or involutory — is written formally as $H^2 = I$, where $I$ is the identity matrix (the "do nothing" gate). We proved this in Section 4. In circuit notation, if you see H · H on the same wire, they cancel completely — circuit designers use this to simplify circuits.
Why H Opens Every Quantum Algorithm
Recall the quantum algorithm recipe from Section 3: Initialise → Superpose → Entangle → Interfere → Measure. The Superpose step is the Hadamard gate. Without it, you cannot open the search space. Without it, you are running a classical computation on quantum hardware — wasting everything the machine can do.
If you want $n$ qubits to simultaneously explore all $2^n$ possibilities, you apply H to every qubit. Each H independently creates a 50/50 superposition. But because the qubits are part of the same system, the combined state is a superposition of all $2^n$ possible bit strings simultaneously.
From this superposition, subsequent gates add structure — entangling qubits, adding phase differences, engineering the interference pattern that steers the computation toward the right answer. The Hadamard gate does not do this alone. But without it, the journey cannot begin.
What You Now Know About the Hadamard Gate
- H starts the coin spinning — it creates superpositionThe Hadamard gate transforms a definite qubit into a perfect 50/50 superposition. $|0\rangle$ becomes $|+\rangle = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle)$. $|1\rangle$ becomes $|-\rangle = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle)$. Both are equally likely to yield 0 or 1 when measured — but they have different phases that drive interference.
- On the Bloch sphere, H moves the arrow from pole to equator$|0\rangle$ (north pole) → $|+\rangle$ (equator, +X). $|1\rangle$ (south pole) → $|-\rangle$ (equator, −X). Geometrically, H is a 180° rotation around the (X+Z)/√2 axis. The equator is the zone of perfect superposition.
- H is the matrix $\frac{1}{\sqrt{2}}\begin{pmatrix}1&1\\1&-1\end{pmatrix}$The $\frac{1}{\sqrt{2}}$ preserves normalisation. The −1 creates the phase difference between $|+\rangle$ and $|-\rangle$. The matrix is symmetric and unitary — probabilities always sum to 1.
- H is its own inverse — H² = IApplying H twice returns the qubit to its original state. This self-inverse property means $|+\rangle \to |0\rangle$ and $|-\rangle \to |1\rangle$. Two H gates on the same wire always cancel — circuit designers use this constantly to simplify circuits and undo Hadamard operations.
- H opens every quantum algorithm through quantum parallelism$H^{\otimes n}|0\rangle^{\otimes n}$ creates an equal superposition of all $2^n$ states simultaneously. This is the first step of Grover's search, Shor's factoring, quantum phase estimation, and virtually every other quantum algorithm. Without H, there is no quantum parallelism.
You know what H does alone.
Now see what happens when H meets another gate —
one that creates entanglement between two qubits.
The CNOT gate. The next essential piece.
- Nielsen, M. A. & Chuang, I. L. — Quantum Computation and Quantum Information, Cambridge, 2000. §4.2 "Single qubit operations" — Hadamard matrix, H applied to basis states, unitarity proof, and Bloch sphere representation.
- IBM Qiskit Textbook — "The Hadamard gate." learning.quantum.ibm.com — Interactive H gate examples with real hardware execution and histogram statistics.
- Preskill, J. — Ph219 Lecture Notes, Chapter 2. theory.caltech.edu/~preskill/ph219/ — Geometric interpretation of H as a Bloch sphere rotation, connection to Hadamard matrices in combinatorics.