← Writing
Quantum Computing from First Principles · Part 2

Quantum Gates as Rotations: The Hadamard

In the last post, we built the Bloch sphere: every qubit state is a point on its surface. The north pole is 0|0\rangle, the south pole is 1|1\rangle, the equator is superposition. We have the map. Now we need operations: ways to move that point. But not every map from sphere to sphere is a valid quantum gate. The constraints are tight, and they have a name: unitarity. Understanding them is the same as understanding why the Hadamard works.


Gates as rotations

In the last post we established that a qubit’s state is a point on the surface of the Bloch sphere. The north pole is 0|0\rangle, the south pole is 1|1\rangle, and every other point is a superposition parametrized by θ\theta and φ\varphi.

A quantum gate is an operation that moves that point. The question is: which moves are allowed?

Not all moves preserve what needs to be preserved. A quantum state is a unit vector; its amplitudes satisfy α2+β2=1|\alpha|^2 + |\beta|^2 = 1. That constraint is the requirement that probabilities sum to 1. Any gate that stretched or compressed the sphere would violate it: after the gate, the probabilities would no longer add up.

The operations that preserve the sphere are exactly the rigid rotations. A rotation moves the point without changing the fact that it’s on the sphere.

There is a second requirement: quantum mechanics is reversible. Every valid gate must be undoable. Rotations are reversible; we can always rotate back. A projection or a map that collapses two states to one would be irreversible and therefore not a valid gate.

Unitarity

The formal name for the class of operations that are rigid rotations on the Bloch sphere is unitary transformations. A matrix UU is unitary if:

UU=UU=IU^\dagger U = UU^\dagger = I

where UU^\dagger is the conjugate transpose of UU. This is the matrix statement of “rigid rotation,” and it implies two things directly:

Norm preservation: for any state ψ|\psi\rangle, applying UU gives a state with the same norm. Probabilities still sum to 1.

Invertibility: U1=UU^{-1} = U^\dagger. Every gate has an inverse, and that inverse is the conjugate transpose. To undo a gate, apply its conjugate transpose.

Every valid single-qubit gate is a 2×22 \times 2 unitary matrix. No more, no less. [1, §4.2]

A classical NOT gate is a special case: it swaps 01|0\rangle \leftrightarrow |1\rangle, which is a 180° rotation around the x-axis of the Bloch sphere. Quantum gates generalize this to rotations around any axis, by any angle.

The Hadamard geometrically

The gate is named after Jacques Hadamard (1865–1963), a French mathematician whose work touched prime number theory, partial differential equations, and the geometry of determinants. In an 1893 paper [3], Hadamard studied a question about how large the determinant of a real matrix can be relative to its entries, and showed that matrices with entries in {+1,1}\{+1, -1\} achieve the maximum. These are now called Hadamard matrices. The 2×22 \times 2 case (up to the normalizing 1/21/\sqrt{2} factor) is the gate we’re studying. The name carried into quantum computing through the canonical textbook by Nielsen and Chuang [1], and has since become universal.

The Hadamard gate, written HH, is a 180° rotation around the axis pointing in the (x+z)/2(x+z)/\sqrt{2} direction, the diagonal halfway between the x and z axes of the Bloch sphere.

What this does to the named states:

  • 0|0\rangle (north pole, θ=0\theta = 0) maps to +=(0+1)/2|{+}\rangle = (|0\rangle + |1\rangle)/\sqrt{2}, the positive x-axis on the equator
  • 1|1\rangle (south pole, θ=π\theta = \pi) maps to =(01)/2|{-}\rangle = (|0\rangle - |1\rangle)/\sqrt{2}, the negative x-axis on the equator
  • +|{+}\rangle maps back to 0|0\rangle
  • |{-}\rangle maps back to 1|1\rangle

Because a 180° rotation applied twice is the identity, HH is its own inverse: H2=IH^2 = I.

Notice what HH does to the north pole: it takes a state with certainty of measuring 0, and moves it to a state with 50/50 probability. This is why the Hadamard is the superposition-creation gate; nearly every quantum algorithm begins with one.

Physical grounding

A qubit is the quantum state of a physical spin-½ particle: an electron, an atomic nucleus, or the quantized flux in a superconducting loop. The Bloch sphere rotations above correspond to real magnetic pulses applied to that particle. The geometry carries a consequence: a full 360° physical rotation returns the Bloch sphere point to its start, but multiplies the underlying spinor by −1. That sign flip is unobservable on its own (global phase is not measurable) but becomes visible when two paths interfere. That mechanism is the subject of Post 3.

Try it

The widget connects circuit notation to the Bloch sphere in a single view. Step through the circuit and watch the rotation happen on the sphere. The dashed line is the rotation axis, the (x+z)/2(x+z)/\sqrt{2} direction that HH rotates around.

Try both starting states. 0|0\rangle maps to +|{+}\rangle; 1|1\rangle maps to |{-}\rangle. Both land on the equator, but at opposite longitudes. They have identical measurement probabilities (both are 50/50) but different phases. That difference will matter in post 3.

Start:
H H
|0⟩
P(|0⟩) 1.000
P(|1⟩) 0.000
Start. State is |0⟩ — the north pole. Click Next Step to apply the first H gate.
Step 0 / 3

drag sphere to orbit · click gate boxes to jump to that step

The matrix

With the geometry in place, the matrix is just a coordinate description of the same rotation. In the standard 0|0\rangle/1|1\rangle basis:

H=12(1111)H = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 & 1 \\ 1 & -1 \end{pmatrix}

Verify H|0⟩ = |+⟩

H0=12(1111)(10)=12(11)=0+12H|0\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}1&1\\1&-1\end{pmatrix}\begin{pmatrix}1\\0\end{pmatrix} = \frac{1}{\sqrt{2}}\begin{pmatrix}1\\1\end{pmatrix} = \frac{|0\rangle + |1\rangle}{\sqrt{2}}

Verify H|1⟩ = |−⟩

H1=12(1111)(01)=12(11)=012H|1\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}1&1\\1&-1\end{pmatrix}\begin{pmatrix}0\\1\end{pmatrix} = \frac{1}{\sqrt{2}}\begin{pmatrix}1\\-1\end{pmatrix} = \frac{|0\rangle - |1\rangle}{\sqrt{2}}

Check unitarity: HH is real and symmetric, so H=HH^\dagger = H. And:

H2=12(1111)(1111)=12(2002)=IH^2 = \frac{1}{2}\begin{pmatrix}1&1\\1&-1\end{pmatrix}\begin{pmatrix}1&1\\1&-1\end{pmatrix} = \frac{1}{2}\begin{pmatrix}2&0\\0&2\end{pmatrix} = I

Both properties confirm what the geometry told us: HH is its own inverse.

Reading a quantum circuit

The widget uses the standard notation for quantum circuits. Here is what we need.

A wire represents a qubit over time, read left to right. The qubit starts in a known state at the left end and evolves as gates act on it.

A box on the wire is a gate. The label names the gate: HH for Hadamard, XX for NOT, ZZ for the phase flip. Read a wire from left to right to see the sequence of operations.

A meter symbol at the end of a wire is a measurement. It collapses the qubit to a classical bit, 0 or 1, based on the outcome probabilities. The double wire after the meter carries that classical bit.

Gates in sequence compose: the output of one gate is the input to the next. The widget shows 0HH|0\rangle \to H \to H \to measure. The first H creates superposition; the second H undoes it. Stepping through makes H·H = I visible.

Order matters. Matrix multiplication is not commutative in general, and neither is gate composition. Applying XX then HH is not the same as HH then XX. As a worked example: X0=1X|0\rangle = |1\rangle, then H1=H|1\rangle = |{-}\rangle, so XX followed by HH takes 0|0\rangle to |{-}\rangle. Compare that with H0=+H|0\rangle = |{+}\rangle, then X+=+X|{+}\rangle = |{+}\rangle (since +|{+}\rangle is a +1+1 eigenstate of XX), so HH followed by XX takes 0|0\rangle to +|{+}\rangle. The two results are different states with different phases. Order matters.


HH creates superposition, but superposition alone does not explain why quantum algorithms work. What matters is what happens to the phase, the longitude φ\varphi on the Bloch sphere, before measurement. +|{+}\rangle and |{-}\rangle have the same measurement probabilities but different phases. That difference becomes visible when we apply another gate before measuring. Two paths can reinforce each other or cancel out, depending on their relative phase.

That mechanism is quantum interference.

Further reading

Bloch Sphere
|ψ⟩ = |0⟩
P(|0⟩) = cos²(θ/2)
1.000
P(|1⟩) = sin²(θ/2)
0.000
θ
φ

drag to orbit · sliders to move · click states in text to navigate