Skip to content
Lesson 1 · BeginnerAvailable

Understand the Hadamard gate

The Hadamard gate turns a definite basis state into an equal superposition. Here is what that means intuitively, mathematically and geometrically.

1 · Intuition

A qubit prepared in |0⟩ gives outcome 0 every time it is measured. After a Hadamard gate, the qubit is in a superposition: measuring it gives 0 or 1, each with probability ½. The state itself is not random — it is the definite state |+⟩. Randomness appears only at measurement.

2 · Mathematics

H=12(111−1),H∣0⟩=∣0⟩+∣1⟩2=∣+⟩,H∣1⟩=∣0⟩−∣1⟩2=∣−⟩H = \frac{1}{\sqrt{2}}\begin{pmatrix}1 & 1\\ 1 & -1\end{pmatrix},\qquad H|0\rangle = \frac{|0\rangle + |1\rangle}{\sqrt 2} = |+\rangle,\qquad H|1\rangle = \frac{|0\rangle - |1\rangle}{\sqrt 2} = |-\rangle

By the Born rule the probabilities are the squared magnitudes of the amplitudes:

P(0)=∣12∣2=12,P(1)=∣12∣2=12P(0) = \left|\tfrac{1}{\sqrt2}\right|^2 = \tfrac12,\qquad P(1) = \left|\tfrac{1}{\sqrt2}\right|^2 = \tfrac12

H is unitary and its own inverse: H2=IH^2 = I. Applying it twice returns |0⟩ — something a fair coin flip could never do. That is interference.

Relative phase

Now apply Z, which multiplies the |1⟩ amplitude by −1: Z∣+⟩=∣−⟩Z|+\rangle = |-\rangle. The probabilities are still ½ and ½, yet |+⟩ and |−⟩ are different, perfectly distinguishable states (apply H again: one gives |0⟩, the other |1⟩). The difference is a relative phase, which is physical — unlike a global phase.

3 · Geometry

On the Bloch sphere |0⟩ is the north pole (+Z). H is a rotation by π about the axis (X+Z)/√2, which carries +Z to +X. Z is a rotation by π about the Z axis, carrying +X to −X. Probabilities depend only on the height (z-coordinate), which is why Z leaves them unchanged.

4 · Try it

The preview below runs the real simulator. Apply H, then Z, then H again, and watch each representation.

Live previewcomputed in your browser
Visual
q0
H
Code
qc = QuantumCircuit(1)
qc.h(0)
Math
∣ψ⟩=∣0⟩+∣1⟩2|\psi\rangle = \frac{|0\rangle + |1\rangle}{\sqrt{2}}

P(0) = 50.0% · P(1) = 50.0%

Bloch

x = 1.00
y = 0.00
z = 0.00

|0⟩|1⟩+x−x
Same simulator and circuit model as the Studio.Open in Studio →

5 · Related concepts

Further reading

  • M. A. Nielsen and I. L. Chuang, Quantum Computation and Quantum Information (Cambridge University Press, 2010), §1.2–1.3.