What happens if $|\psi\rangle$ = $|0\rangle$ or $|\psi\rangle$ = $|1\rangle$ is passed as an input to two Hadamard gates in sequence?


I'm a computer science student and soon I will have a math exam. I'm really struggling with this preparation question. Also, includes the following:

How does this demonstrate that we need the “ket” (or the vector) representation of qubits, rather than just describing them in terms of probabilities (eg. “this is a qubit with 50% probability of being 1”)?

Could you help me please? enter image description here enter image description here


Posted 2020-04-20T05:37:44.930

Reputation: 13

Hi and welcome to Quantum Computing SE. Please find below the answer. I also added solution to your particular problem. – Martin Vesely – 2020-04-20T07:18:01.103



The gist of it : If you act two H gates on the qubit you will cancel the rotations thereby obtaining the initial qubit.

If you only pass one H gate then you have a superposition with a probability amplitude for each quantum state basis vector.

Longer explanation:

Just to illustrate this better I developed the first circuit with $\uparrow$:

enter image description here

Which will show the following state population distribution: enter image description here

If we add $X$ gate to the circuit to bit flip $\uparrow$ into $\downarrow$, then we obtain the following:

enter image description here

With a similar state population measured counts: enter image description here

Keep in mind the measurement number for this circuit is of 1000 times, so if you dial up this value you can find the distributions to get really close to each other.

Anyway, the idea I want to hammer home with the $H$ gates is that, it's an unitary, so $HH = H^2 = I$. This is why if you were to operate two of them in sequence, you will get back the original qubit for the $\uparrow$ state:

enter image description here

And for the $\downarrow$ state:

enter image description here

Now, when you have time later on and if you are curious:

We start by defining this as the Clifford Group (of Gates): \begin{eqnarray} G &=& \pm \Big \{ I, X, Y, Z \Big \} \end{eqnarray}

This group is defined by the following properties:

  1. Each $\mathbf{M} \in G$ is unitary such that $M^\dagger = M^{-1}$.
  2. For each element $\mathbf{M} \in G, M^2 = \pm I$.
  3. If $\mathbf{M}^2 = I$, $\mathbf{M}$ is hermitian; otherwise, $\mathbf{M}$ is anti-hermitian.
  4. $\forall \, \mathbf{M_i}, \mathbf{M_j} \in G$, their products either commute or anti-commute, $\mathbf{M_i}\mathbf{M_j} = \pm \mathbf{M_j}\mathbf{M_i}$.

It turns out one can represent $H = \frac{1}{\sqrt{2}} \Big ( X + Z \Big )$ operation. Thus it falls under these rules.

This stuff is really, really, powerful stuff!

Enrique Segura

Posted 2020-04-20T05:37:44.930

Reputation: 883


Hadamard gate is desribed by a matrix

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

If you apply the Hadamard on $|0\rangle$ you will have a superposition $$ H|0\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}1 \\ 1\end{pmatrix} = \frac{1}{\sqrt{2}}(|0\rangle + |1\rangle). $$ This superposition is denoted $|+\rangle$.

Application on $|1\rangle$ leads to a superposition $$ H|1\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}1 \\ -1\end{pmatrix} = \frac{1}{\sqrt{2}}(|0\rangle - |1\rangle). $$ This superposition is denoted $|-\rangle$.

Hadamard gate is inverse to itself, i.e. $HH = I$ (you can verify this by direct matrix multiplication). Hence $HH|0\rangle = |0\rangle$ and $HH|1\rangle = |1\rangle$, i.e. there is no change in input state. This can be generalized to any input state $|\psi\rangle$, i.e. $HH|\psi\rangle = |\psi\rangle$.

Now, concerning your particular problem.

In the first case $|1\rangle$ is returned after application of $H$ this means that input (B) had to be $|-\rangle$. Since $|-\rangle$ is result of application of another $H$, its input (A) had to be $|1\rangle$.

In the second case $|0\rangle$ is returned after application of $H$ this means that input (B) had to be $|+\rangle$. Since $|+\rangle$ is result of application of another $H$, its input (A) had to be $|0\rangle$.

Because a probability of measurement either state $|0\rangle$ or $|1\rangle$ is 50 % for both $|+\rangle$ and $|-\rangle$, you cannot distinguish $|+\rangle$ and $|-\rangle$ based only on probabilities, you also need phases (in plain words plus and minus before $|1\rangle$ in the superpositions). Hence you need "ket" notatiton and not only probabilities.

Martin Vesely

Posted 2020-04-20T05:37:44.930

Reputation: 7 763