The Hadamard gate is a single-qubit quantum gate that maps the basis state |0⟩ to the equal superposition (|0⟩ + |1⟩)/√2 and maps |1⟩ to (|0⟩ − |1⟩)/√2. In quantum computing, and specifically in the study of quantum gates & circuits, it is the standard tool for creating superposition and for changing the measurement basis between the computational Z basis and the X basis.
Written as H, the gate appears at the start of almost every textbook algorithm, inside the quantum Fourier transform and in the encoding and decoding steps of many error-correcting codes. It is its own inverse, it belongs to the Clifford group, and on the Bloch sphere it acts as a 180-degree rotation about the axis halfway between X and Z.
How the Hadamard gate transforms qubit states
The Hadamard gate is defined by the 2×2 unitary matrix H = (1/√2)[[1, 1], [1, −1]]. Applied to a basis state, it produces a superposition in which both outcomes have probability 1/2; applied to one of those superpositions, it returns the original basis state. This symmetry is why the gate is described as a basis change rather than a randomizer: the information is preserved and can be recovered exactly.
The minus sign in the lower-right entry matters. It encodes a relative phase of π between the two components of the output state, and that phase is what allows later Hadamard gates to produce constructive and destructive interference. Without the sign, a second application could not undo the first, and the gate would not be unitary.
The following table lists how H acts on the six cardinal states of a single qubit, which shows that it swaps the Z and X axes and reverses the Y axis.
| Input state | Output state | Bloch sphere effect |
|---|---|---|
| |0⟩ | |+⟩ = (|0⟩ + |1⟩)/√2 | North pole to +X |
| |1⟩ | |−⟩ = (|0⟩ − |1⟩)/√2 | South pole to −X |
| |+⟩ | |0⟩ | +X to north pole |
| |−⟩ | |1⟩ | −X to south pole |
| |+i⟩ | e^(iπ/4)|−i⟩ | +Y to −Y |
| |−i⟩ | e^(−iπ/4)|+i⟩ | −Y to +Y |
Algebraic properties and identities
Several identities make the Hadamard gate central to circuit design. It is Hermitian and unitary at once, so H = H† and H² = I. Conjugating the Pauli operators with H exchanges X and Z, which is why the gate is the bridge between bit-flip and phase-flip descriptions of the same operation.
These relations are used constantly by circuit compilers and optimizers, which rewrite gate sequences to reduce depth or to match the hardware. The table summarizes the most useful identities and their practical consequence.
| Identity | Meaning | Practical use |
|---|---|---|
| H² = I | H is self-inverse | Cancel adjacent H pairs |
| HXH = Z | X becomes Z | Turn bit flips into phase flips |
| HZH = X | Z becomes X | Measure in the X basis |
| HYH = −Y | Y changes sign | Track phases in compilation |
| H = (X + Z)/√2 | Sum of two Pauli operators | Analytic derivations |
| (H⊗H)CNOT(H⊗H) | Reverses control and target | Route CNOT on fixed couplers |
Up to a global phase, the gate can also be decomposed into rotations: H equals a π/2 rotation about Y followed by a π rotation about X, or equivalently Z·RY(π/2). Hardware that lacks a native H gate implements it this way, often with virtual Z rotations that cost no physical pulse time.
The Hadamard gate in quantum algorithms
Algorithms use H in three recurring roles. First, a layer of n Hadamard gates applied to |0…0⟩ prepares a uniform superposition over all 2^n basis states, which lets an oracle act on every input at once. Second, a final layer of H gates converts phase information into amplitude information that measurement can read. Third, H serves as the one-qubit building block of the quantum Fourier transform.
The n-qubit transform H⊗n is known as the Walsh–Hadamard transform. Its output amplitudes carry a sign of (−1) raised to the bitwise inner product of input and output strings, which is exactly the structure exploited by Deutsch–Jozsa, Bernstein–Vazirani and Simon’s algorithm.
| Algorithm or protocol | Where H appears | Purpose |
|---|---|---|
| Deutsch–Jozsa | Before and after the oracle | Reveal constant versus balanced |
| Grover search | Initialization and diffusion step | Amplitude amplification |
| Quantum Fourier transform | Each qubit, between phase gates | Superpose frequency components |
| Bell state preparation | Before a CNOT | Create entanglement |
| Quantum teleportation | Sender side before measurement | Bell-basis measurement |
| BB84 key distribution | Random basis choice | Encode in X or Z basis |
Hadamard versus other single-qubit gates
The Hadamard gate is often confused with the Pauli X gate or with generic rotation gates. The distinction is that X flips a state within the Z basis, whereas H moves states between bases. Rotation gates such as RY(θ) can create unequal superpositions, while H always produces an exactly balanced one from a basis state.
| Gate | Effect on |0⟩ | Clifford | Self-inverse |
|---|---|---|---|
| Hadamard (H) | |+⟩ | Yes | Yes |
| Pauli X | |1⟩ | Yes | Yes |
| Phase gate (S) | |0⟩ | Yes | No |
| T gate | |0⟩ | No | No |
| RY(π/2) | |+⟩ | Yes | No |
Together with the phase gate S and the CNOT gate, H generates the full Clifford group. By the Gottesman–Knill theorem, circuits built only from these gates can be simulated efficiently on a classical computer, so a non-Clifford gate such as T is required for universal quantum computation.
Implementation, errors and common misconceptions
On superconducting and trapped-ion hardware, H is usually compiled into native pulses rather than calibrated directly. Typical single-qubit gate fidelities exceed 99.9 percent on leading devices, so the Hadamard gate is rarely the dominant error source, but its errors still accumulate in deep circuits with many basis changes.
- H does not measure or randomize. The output is a definite pure state; randomness appears only when the qubit is measured in the Z basis.
- H alone cannot create entanglement. Entanglement needs a two-qubit gate, typically a CNOT that follows the Hadamard gate.
- Global phase is irrelevant, relative phase is not. Decompositions that differ by a global phase are physically identical, but dropping the relative minus sign changes the gate.
- Adjacent H gates should cancel. Leaving redundant pairs in a compiled circuit adds depth and noise without changing the result.
In simple terms
The Hadamard gate is the operation that puts a qubit into a perfectly balanced in-between state. A qubit that was clearly 0 becomes something that would come out as 0 or 1 with equal odds of one half if it were checked.
It is not a coin toss, though. Applying the same gate a second time brings the qubit back exactly to where it started. A good comparison is turning a map by a fixed angle: the map looks different, but turning it back restores the original view. Quantum programs use this reversible change of viewpoint to let many possibilities interfere and leave only the useful answer.
A practical example
A graduate student testing a five-qubit superconducting processor wants to confirm that two qubits can be entangled. The circuit applies a Hadamard gate to qubit 0, then a CNOT from qubit 0 to qubit 1, which should produce the Bell state (|00⟩ + |11⟩)/√2.
After 4,000 shots, the results show roughly 49 percent 00 and 48 percent 11, with the remaining 3 percent spread over 01 and 10 because of readout and gate errors. To check that the state is coherent rather than a classical mixture, the student adds a Hadamard gate on both qubits before measurement. The correlations persist in the X basis, which confirms genuine entanglement and shows how H doubles as a tool for measuring in a different basis.