Superposition with one Hadamard gate
The smallest interesting circuit: one qubit, one gate, and a perfectly fair quantum coin.
Beginner · 1 qubit · 1 gates · 0 two-qubit · depth 1 · reviewed November 2026
Open in the Circuit BuilderWhat is happening
A qubit starts in the state |0⟩. The Hadamard gate turns it into an equal blend of |0⟩ and |1⟩, usually written |+⟩. When you measure it, the result is 0 half the time and 1 half the time.
This is not a hidden coin that was already heads or tails. Before the measurement the qubit has amplitudes for both outcomes, and the measurement picks one with probability given by the square of each amplitude.
Step by step
1. Start in |0⟩
Every qubit in the builder begins in |0⟩ unless you flip its starting value.
2. Apply H
The Hadamard gate maps |0⟩ to (|0⟩ + |1⟩)/√2. Both amplitudes are about 0.707, so each outcome has probability 0.707² = 50%.
3. Measure
The shot histogram shows roughly half 0 and half 1. The exact split varies from run to run, just as a real coin does.
Expected result
Statevector: 0.707|0⟩ + 0.707|1⟩. Probabilities: 50% and 50%.
Qubit 0 is the leftmost bit. In Qiskit, bitstrings are printed in the reverse order.
Qiskit code
from qiskit import QuantumCircuit from math import pi qc = QuantumCircuit(1, 1) qc.h(0) qc.barrier() qc.measure(0, 0) # Qiskit prints bit strings with qubit 0 on the RIGHT; this site writes qubit 0 on the LEFT.
Try this
- Add a second H after the first. What happens, and why?
- Replace H with RY at π/2 and compare the probabilities.
- Turn on gate noise and see how the split changes.
Common misunderstanding
Myth: Superposition means the qubit is both 0 and 1 at the same time, like a spinning coin.
Fact: It is a state with definite amplitudes for each outcome. The word “both” hides the fact that the amplitudes can interfere, which a spinning coin cannot do.
Gates used
Related reading
Questions
Is a Hadamard-based random number truly random?
On real hardware the outcome of an ideal measurement is believed to be fundamentally random, though real devices have noise and bias. This simulator uses a pseudo-random generator, so its results are not truly random.