## Definition

The Hadamard gate is a single-qubit operation that maps the basis state $|0\rangle$ to $\frac{\vert 0 \rangle + \vert 1 \rangle}{\sqrt{2}}$ and $|1\rangle$ to $\frac{|0\rangle - |1\rangle}{\sqrt{2}}$, thus creating an equal superposition of the two basis states.

$H = \frac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 \ 1 & -1 \end{pmatrix}$

Examples:

        
H q[0] # execute Hadamard gate on qubit 0
H q[1:2,5] # execute Hadamard gate on qubits 1,2 and 5



## Decompositions

The Hadamard gate can also be expressed as a 90º rotation around the Y-axis, followed by a 180º rotation around the X-axis. So, $H = X Y^{1/2}$.

Useful XY-decompositions (also visualized below) are given by:
$H = X Y^{1/2}$
$H = Y^{-1/2} X$

Useful YZ-decompositions are:
$H = Z Y^{-1/2}$
$H = Y^{1/2} Z$