How do 2 Hadamard gates act on a single qubit?

When I perform $$2$$ Hadamard $$H$$ gates on a single qubit, why is the probability of getting $$0$$ as the outcome 100%? Why is it not 50% 0 and 50% 1 instead?

Why is the second $$H$$ gate not putting the input from the first $$H$$ gate into a superposition state?

• Wouldn't this depend on the initial state? Aug 18 '19 at 17:49

If you apply the same gate twice on a state $$|\psi\rangle$$ you will get out the state $$|\psi\rangle$$ if the hermitian of the gate is the same as the gate. In your case, you applied the Hadamard gate, $$H$$, twice on (presumably) the $$|0\rangle$$ state, and so you got $$|0\rangle$$ as your result.

This happens because it is a requirement for quantum computing that gates be unitary. A unitary matrix $$U$$ is defined as a matrix where $$UU^\dagger = I$$ where $$I$$ is of course the identity matrix. Let's do $$H^\dagger$$ real quick: that requires doing the transpose of the matrix (i.e., flipping the elements across the diagonal), and then the complex conjugate of each of the elements. There's no complex numbers in the matrix, so we don't need to worry about that - and doing the transpose just means flipping $$1$$ and $$1$$. So $$H^\dagger = H$$.

So when you apply $$H$$ twice to your state, you are effectively doing $$HH$$ - and it is a requirement that this come out to $$I$$. $$I$$ is literally defined as a matrix where $$XI=X$$So here's what you are doing: $$HH|\psi\rangle$$ and we know that $$HH = I$$, so you are doing $$I|\psi\rangle$$ and we know that any thing multiplied by $$I$$ gives itself so you just get out $$|\psi\rangle$$

• "If you apply the same gate twice on a state |𝜓⟩ you will always get out the state |𝜓⟩." -- No. Applying the same gate twice is $U^2$, not $U^\dagger U$ or $UU^\dagger$. Aug 19 '19 at 20:14
• @NorbertSchuch thank you for catching that. Very stupid mistake, edited to fix. Aug 19 '19 at 21:05
• the intuition behing this is that the Hadamard gate correspond to a $\pi$ rotation around a certain axis in the Bloch sphere, so of course applying it twice is equivalent to doing nothing Aug 22 '19 at 6:54

Most probably because your input state was $$|0\rangle$$.

The Hadamard gate has the property that $$H^2=I$$, thus acting on an arbitrary input $$|\psi\rangle$$ with the Hadamard gate twice in a row results in the output being identical to the input (that is, $$|\psi\rangle$$).

An $$H$$ gate doesn't always create superposition. It just rotates all statevectors by 45°. So, when you have a state that is colinear to a component of the vector basis, and you measure it, this state vector always will collapse to the basis vector to which it is colinear, and so you will measure this state with a probability of 100%.

Then you rotate the vector by 45° (this is what the $$H$$ operator does). When you measure it now, it will collapse to both basis vectors with the same probability (i.e. 50%). So you will measure it as often as 0 as 1. This is what we call a superposition of both states. The qubit is not in one of both states, but exactly in between.

Then you rotate if again by 45°, which in sum gives 90°. If your original state was colinear to 1, then now it is colinear to 0 vice versa. When you measure it now, it can't do anything else but collapse to the basis vector to which it is colinear now. So, the probability to measure this new state (which is exactly the negation of the original state) is exactly 100%.

• $H$ is a rotation by 180 degrees (on the Bloch sphere). Aug 17 '19 at 22:41
• And in Hilbert space as well (at least if you take the usual matrix representation of the Hadamard, with eigenvalues $\pm 1$). Aug 18 '19 at 22:25
• Indeed; I see no way to interpret $H^2=I$ as a 90 degree rotation ... which makes we wonder why this got 4 upvotes. Aug 19 '19 at 9:37