Reading through IBM's intro to quantum computing and gates and I'm confused about the Hadamard gate. When you use an H gate it appears to rotate the qubit along the X axis pi/4 putting it in a superposition.

If my base state was |0> and I pass it through an H gate it will be put into |>. Another H gate will put it back into |0>.

If my base state was |1> then the same happens, where two H gates will return to |1>.

I'd expect two H gates would be the same as a NOT gate and flip |0> to |1>.

I see what is happening but I don't know why. Why doesn't two H gates turn |0> to |1> ?

• What do you mean by "|>"? – Nathaniel Oct 7 '17 at 6:04
• If by rotations, you refer to the Bloch sphere representation, the Hadamard gate is a rotation of $\pi$ about the vector $\hat{x}+\hat{z}$, not $\pi/4$ about the vector $\hat{x}$ as you stated. – user154997 Oct 7 '17 at 6:39

The most clear mathematical representation is to look at the Hadamard gate as a 2x2 matrix 1/$\sqrt{2}$ [[1,1],[1,-1]]. Square it and you get unity. It might also help to look into the Bloch sphere: Understanding the Hadamard gate on the Bloch sphere