Every single-qubit gate is a rotation of the Bloch sphere. The Pauli gates X, Y, and Z
rotate 180° about the x-, y-, and z-axes respectively. The Hadamard gate H fits the same
pattern — but its rotation axis is the diagonal direction halfway between +x and +z.
The rotation axis
The normalised axis is n^=21(1,0,1), pointing equally along +x and
+z. A rotation by angle θ about n^ is described by
Rn^(θ)=cos2θI−isin2θ(n^⋅σ),
where σ=(X,Y,Z) is the vector of Pauli matrices. For H, the angle is
θ=π (180°), so cos(π/2)=0 and sin(π/2)=1, which gives
H=−i(n^⋅σ)=−i⋅2X+Z=−i⋅21(111−1).
The prefactor −i is a global phase and has no observable effect, so we conventionally write
H=21(111−1).
What the rotation does geometrically
Because H rotates 180° about the axis n^, it swaps any two points that are mirror
images of each other across n^. In particular:
The north pole ∣0⟩ (the +z point) is sent to the +x point, which is ∣+⟩.
The +x point ∣+⟩ is sent back to ∣0⟩.
The south pole ∣1⟩ is sent to the −x point, which is ∣−⟩.
This explains a key identity: applying H twice returns every state to itself (H2=I), because
two 180° rotations about the same axis cancel.
The Z–X basis swap
One elegant consequence of the Hadamard rotation axis is that Hexchanges the Z eigenstates
with the X eigenstates:
H∣0⟩=∣+⟩,H∣1⟩=∣−⟩,H∣+⟩=∣0⟩,H∣−⟩=∣1⟩.
Conjugation by H therefore converts a Z measurement into an X measurement and vice versa.
This is not coincidence — it follows directly from the rotation axis being exactly midway between
the two axes, so the 180° rotation swaps them.
Try it
Implement the Hadamard gate. The grader compares the full unitary matrix, so an empty circuit will
not pass — you must place the correct rotation.
Run your code to see the quantum state.
Sign in on the full site to ask questions and join the discussion.