In the Introduction to Qubit article, we established that a qubit is not a simple binary switch. It lives in a world of probabilities, wavefunctions, and superposition — committing to a definite value only at the moment of measurement. If the qubit is the atom of quantum computing, then quantum gates are the logic that shapes it. And of all the gates that exist in a quantum circuit, none is more fundamental — or more surprising — than the Hadamard gate.
This article explains what the Hadamard gate does, why it matters, and how it interacts with qubit states before and after measurement. It also addresses a question that catches many newcomers off-guard: what actually happens when you apply the Hadamard gate to a qubit that is already in superposition?
With that intuition in place, let us pull back the curtain on the actual mechanics.
What Is a Quantum Gate?
Classical computers manipulate bits using logic gates — AND, OR, NOT, and their combinations. These gates are irreversible: once you AND two bits together, you cannot recover the original inputs from the output alone.
Quantum gates work differently. They are unitary operations, meaning they are always reversible and always preserve the total probability of all possible outcomes. Think of a quantum gate as rotating a qubit in a precise, mathematically defined way — changing its probability distribution without destroying any information. Every gate applied to a qubit can be undone by applying its inverse.
The Hadamard gate, named after the French mathematician Jacques Hadamard, is one of the simplest and most powerful of these rotations. It is typically written as the single letter H.
What the Hadamard Gate Actually Does
Recall from the qubit introduction that any qubit state can be written as:
|\psi\rangle = \alpha|0\rangle + \beta|1\rangle
where \alpha and \beta are complex amplitudes and |\alpha|^2 + |\beta|^2 = 1. When a qubit sits cleanly in the ground state |0\rangle, it has \alpha = 1 and \beta = 0. When it sits in the excited state |1\rangle, it has \alpha = 0 and \beta = 1.
The Hadamard gate takes each of these clean states and creates a perfect superposition — a state where the probability of measuring 0 and the probability of measuring 1 are exactly equal:
H|0\rangle = \frac{1}{\sqrt{2}}\bigl(|0\rangle + |1\rangle\bigr) = |{+}\rangle
H|1\rangle = \frac{1}{\sqrt{2}}\bigl(|0\rangle - |1\rangle\bigr) = |{-}\rangle
The resulting states |{+}\rangle and |{-}\rangle are so commonly used that they have their own names. Both give a 50/50 measurement outcome, but they differ in the phase of their components — the minus sign in |{-}\rangle is invisible at the moment of a single measurement, but becomes crucial when gates are chained together in a quantum algorithm.
The Hadamard Matrix
In quantum computing, a gate is represented as a matrix that multiplies the qubit’s state vector. The Hadamard gate is the 2×2 matrix:
H = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}
Let us verify the first rule by hand. A qubit in state |0\rangle is represented as the column vector:
|0\rangle = \begin{pmatrix} 1 \\ 0 \end{pmatrix}
Applying the gate means multiplying:
</p> <p>Which is exactly [latex]\frac{1}{\sqrt{2}}(|0\rangle + |1\rangle), confirming our formula. The probability of each outcome is:
P(0) = \left|\frac{1}{\sqrt{2}}\right|^2 = \frac{1}{2}, \qquad P(1) = \left|\frac{1}{\sqrt{2}}\right|^2 = \frac{1}{2}
A perfect coin flip — guaranteed by the mathematics, every single time.
A Note on the \frac{1}{\sqrt{2}} Factor
The factor \frac{1}{\sqrt{2}} is not cosmetic. Recall that for a valid quantum state, all probabilities must sum to 1. Without the normalisation factor, the amplitudes would be 1 and 1, giving probabilities of 1^2 + 1^2 = 2 — physically impossible. Dividing by \sqrt{2} brings both amplitudes to \frac{1}{\sqrt{2}}, and \left(\frac{1}{\sqrt{2}}\right)^2 + \left(\frac{1}{\sqrt{2}}\right)^2 = \frac{1}{2} + \frac{1}{2} = 1. The universe stays consistent.
Does the Qubit Need to Be Measured Before Applying H?
The short answer is: it depends on what you need for the algorithm.
Starting from a Known State — No Measurement Needed
At the start of most quantum algorithms, qubits are initialised into a known, definite state — typically |0\rangle. This is the computational equivalent of wiping a whiteboard clean before writing. Because the starting state is already definite, there is no need to measure it first. You simply apply H directly:
# Qiskit example: apply Hadamard to a fresh qubit from qiskit import QuantumCircuit qc = QuantumCircuit(1, 1) # Qubit starts in |0⟩ by default — no measurement needed before H qc.h(0) # Apply Hadamard gate qc.measure(0, 0) # Measure to get classical result qc.draw('text')
This is the standard pattern. The qubit begins life at |0\rangle, H rotates it into |{+}\rangle, and measurement collapses it randomly to 0 or 1 with equal probability.
Starting from a Superposition State
This is where the Hadamard gate reveals one of its most elegant properties. If you apply H to a qubit that is already in the |{+}\rangle superposition state — without measuring first — the gate acts as its own inverse:
H|{+}\rangle = H\left(\frac{|0\rangle + |1\rangle}{\sqrt{2}}\right) = |0\rangle
H|{-}\rangle = H\left(\frac{|0\rangle - |1\rangle}{\sqrt{2}}\right) = |1\rangle
In matrix terms, this is because H \cdot H = I, the identity matrix:
Applying H twice returns the qubit to its original state. This self-inverse property is not a curiosity — it is used deliberately in algorithms such as the Deutsch–Jozsa algorithm and quantum phase estimation, where a second Hadamard is used to “decode” the superposition back into a readable answer.
Measuring Before Applying H
Returning to the qubit introduction’s boat analogy: the act of measurement takes the “photo” and locks the boat into floating or sunk. Once a qubit has been measured, its superposition has collapsed. It is now in a definite classical state, either |0\rangle or |1\rangle. Applying H after that is perfectly valid — you are simply treating the collapsed state as a fresh input and creating a new superposition from it.
In most practical circuits, however, measuring mid-circuit and then applying further gates is avoided unless intentional, because the randomness of the collapse will propagate into the rest of the algorithm in ways that are hard to control. The quantum advantage comes from keeping the qubit in superposition for as long as possible, allowing the mathematics to explore many paths simultaneously before a final measurement forces a definite answer.
Key rule of thumb: Apply H to a qubit in a known definite state to create superposition. Apply H again — without measuring in between — to undo it. Measuring in between resets the quantum memory and discards the phase information the algorithm was accumulating.
The Bloch Sphere: Visualising What H Actually Does
All of the algebra above has a beautiful geometric interpretation on what is known as the Bloch sphere — a unit sphere where every possible single-qubit state maps to a unique point on its surface.
The rules are straightforward:
- The north pole represents |0\rangle
- The south pole represents |1\rangle
- Any point on the equator is an equal superposition of 0 and 1 — differing only in phase
- |{+}\rangle sits on the equator at the positive X-axis
- |{-}\rangle sits on the equator at the negative X-axis
The Hadamard gate, in this picture, is a 90-degree rotation of the state vector — specifically a rotation of 180° around the axis halfway between X and Z, which maps the north pole to the equator and the equator back to the poles. The interactive Bloch sphere below lets you explore this visually.
Notice the probability bars on the right side of the sphere. At |0\rangle (north pole), P(0) = 100% and P(1) = 0%. The moment the Hadamard gate acts, the vector swings to the equator and both bars equalise to 50%. Applying H a second time — watch the H² mode — swings the vector back to the pole and the certainty returns.
Why Does Any of This Matter?
The Hadamard gate is the starting point of most quantum algorithms. Without it, a qubit would simply sit in a definite state and behave no differently from a classical bit. With it, a quantum computer gains the ability to process 2^n possibilities simultaneously by placing all \(n\) qubits into superposition at once — a property known as quantum parallelism.
Consider three qubits. A classical computer processes them as one of 2^3 = 8 possible states at a time — 000, 001, 010, and so on. A quantum computer, with one H applied to each qubit, holds all 8 states simultaneously as a superposition. An operation applied to the quantum register then acts on all 8 states in parallel. The trick — and this is where the real difficulty of quantum algorithm design lies — is constructing the rest of the circuit so that when measurement finally collapses everything, the right answer is the one with the highest probability of emerging.
This is why the Hadamard gate appears in virtually every textbook quantum circuit: Deutsch’s algorithm, Grover’s search, the Quantum Fourier Transform, Bernstein–Vazirani, Simon’s algorithm. It is the gateway through which a qubit enters the quantum realm.
Practical Implementation Notes
Qiskit (IBM)
from qiskit import QuantumCircuit # Scenario 1: H on |0⟩ — creates |+⟩ qc = QuantumCircuit(1, 1) qc.h(0) qc.measure(0, 0) # Scenario 2: H twice — returns to |0⟩ qc2 = QuantumCircuit(1, 1) qc2.h(0) # |0⟩ → |+⟩ qc2.h(0) # |+⟩ → |0⟩ (no measurement between) qc2.measure(0, 0) # Will always return 0 # Scenario 3: H after measurement — new superposition from collapsed state qc3 = QuantumCircuit(1, 2) qc3.h(0) qc3.measure(0, 0) # Collapse to 0 or 1 randomly qc3.h(0) # Creates new superposition from the collapsed state qc3.measure(0, 1) # Another random result
Cirq (Google)
import cirq q = cirq.LineQubit.range(1)[0] # H on |0⟩ circuit = cirq.Circuit(cirq.H(q), cirq.measure(q, key='result')) # H twice circuit_hh = cirq.Circuit(cirq.H(q), cirq.H(q), cirq.measure(q, key='result')) print(circuit) print(circuit_hh)
Summary
The Hadamard gate is a single operation that bridges the classical and quantum worlds. It takes a qubit from certainty into superposition, and — if no measurement intervenes — it can bring it back again. Its matrix is simple, its geometry on the Bloch sphere is clean, and yet its consequences are at the heart of every quantum speedup we know of today.
To close with the boat analogy from the qubit introduction: the Hadamard gate is the storm that sets the boat rocking. While the boat rocks, it is neither floating nor sunk — it is exploring both possibilities at once. The job of the rest of the quantum algorithm is to steer that storm so that when the photograph is finally taken, the boat is almost always in the position we need it to be.
Disclaimer: The graphics in this page were generated with the assistance of Claude AI

