Hadamard gate

Definition

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

H=12(1111) 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=XY1/2H = X Y^{1/2}.

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

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

q[0]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
q[1]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
q[2]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
q[3]