What is a Hadamard gate? ¶
The Hadamard gate is a gate in quantum computing that turns a state of $|0\rangle$ or $|1\rangle$ into an equal superposition of $|0\rangle$ and $|1\rangle.$
Learn about Hadamard gates in the PennyLane Codebook.
In a circuit diagram, a Hadamard gate is represented by a square with the letter ‘H’ in it, as shown below.

A Hadamard gate can be represented in matrix form as
If the input state is $|0\rangle$, the Hadamard gate turns it into $(|0\rangle + |1\rangle) / \sqrt2$. If the input state is $|1\rangle$, the Hadamard gate turns it into a state of $(|0\rangle - |1\rangle) / \sqrt2$.
The square of the Hadamard gate is just the identity gate: $H^{2} = I$. Thus, applying the Hadamard gate to the same qubit twice in a row has no effect on it.
The Hadamard gate in PennyLane is available as qml.Hadamard
. This gate is called HGate
in Qiskit.
Fun fact: The Hadamard gate is named after French mathematician Jacques Hadamard. It is one of the most important gates, and is used in a wide variety of quantum algorithms.