# Question about H-gate on entangled qubits

I have a question about the Hadamard Gate on entangled qubits. I’m very newb to quantum computing and does not have any professional knowledge in physics nor mathematics. However I’ve tried some different algorithms in IBM’s quantum experience and think I got the idea about how the qubits works in the block sphere. Because of my poor knowledge in physics I need a simple explanation and I want to understand it...

My problem:

When I do the following operation:

q: H   ( + )   H
q:          *

( + ) = CNOT control
* = target


I get the following results when I measure q and q after 1000 shots:

1/4 times: 11 1/4 times: 01 1/4 times: 10 1/4 times: 00

What I don’t get is why the first qubit is measured as as a 1 (only) 1/2 times and as a 0 1/2 of the times. My theory before the measurement was that q would always be measured as a 1 all the times since I put it in superposition <+| and then put it back (after the second H gate and the CNOT) to be measured along the X-axis. So what have I missed?

• Next time please take a look at your formatted answer and see whether it's legible. Feb 26 '18 at 20:23
• I'm assuming the initial state is zero? Feb 26 '18 at 20:23
• Yes, starting state is zero on both qubits. Feb 26 '18 at 20:47

Assuming that the initial quantum state is $\left| 00 \right\rangle$, the effect of the circuit is $$\frac{1}{\sqrt{2}} \begin{bmatrix} 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 \\ 1 & 0 & -1 & 0 \\ 0 & 1 & 0 & -1 \end{bmatrix} \cdot \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{bmatrix} \cdot \frac{1}{\sqrt{2}} \begin{bmatrix} 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 \\ 1 & 0 & -1 & 0 \\ 0 & 1 & 0 & -1 \end{bmatrix} \cdot \begin{bmatrix} 1\\0\\0\\0 \end{bmatrix} = \begin{bmatrix} 1/2\\1/2\\1/2\\-1/2 \end{bmatrix},$$ where the rows and columns are indexed by $\left|q_0q_1\right\rangle = \left|00\right\rangle,\left|01\right\rangle,\left|10\right\rangle,\left|11\right\rangle$. When you measure the two qubits at the end, you should get each of the four possibilities with probability $(\pm 1/2)^2 = 1/4$, which is exactly what you have observed.
If, however, you apply the CNOT gate with input roles reversed, you get $$\frac{1}{\sqrt{2}} \begin{bmatrix} 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 \\ 1 & 0 & -1 & 0 \\ 0 & 1 & 0 & -1 \end{bmatrix} \cdot \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ 0 & 1 & 0 & 0 \end{bmatrix} \cdot \frac{1}{\sqrt{2}} \begin{bmatrix} 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 \\ 1 & 0 & -1 & 0 \\ 0 & 1 & 0 & -1 \end{bmatrix} \cdot \begin{bmatrix} 1\\0\\0\\0 \end{bmatrix} = \begin{bmatrix} 1\\0\\0\\0 \end{bmatrix},$$ so in this case you will always measure $\left|00\right\rangle$.