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?


Posted 2019-08-17T07:41:56.413

Reputation: 47

Wouldn't this depend on the initial state? – Norbert Schuch – 2019-08-18T17:49:21.787



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$).


Posted 2019-08-17T07:41:56.413

Reputation: 12 247


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$$

Hopefully this answers your question.


Posted 2019-08-17T07:41:56.413

Reputation: 3 075

"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$. – Norbert Schuch – 2019-08-19T20:14:04.580

1@NorbertSchuch thank you for catching that. Very stupid mistake, edited to fix. – heather – 2019-08-19T21:05:19.197

1the 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 – user2723984 – 2019-08-22T06:54:52.797


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%.

Hubert Schölnast

Posted 2019-08-17T07:41:56.413

Reputation: 231

2$H$ is a rotation by 180 degrees (on the Bloch sphere). – Norbert Schuch – 2019-08-17T22:41:05.460

And in Hilbert space as well (at least if you take the usual matrix representation of the Hadamard, with eigenvalues $\pm 1$). – Niel de Beaudrap – 2019-08-18T22:25:30.863

1Indeed; I see no way to interpret $H^2=I$ as a 90 degree rotation ... which makes we wonder why this got 4 upvotes. – Norbert Schuch – 2019-08-19T09:37:57.647