1
$\begingroup$

I want to implement a Hadamard gate on a single qubit in a register.
Given two qubits
q0 := $|0\rangle$ and
q1 := $|+\rangle$
I would like to use a Hadamard gate on the first qubit (q0).

My intuition is that

  • using Hadamard on the first qubit and building the register afterwards:
    Apply: q0' = Had(q0) = \begin{bmatrix} 1/\sqrt{2} \\ 1/\sqrt{2} \end{bmatrix}
    Build Register: reg0 := q0' tensor q1 = \begin{bmatrix} 1/2 \\ 1/2 \\ 1/2 \\ 1/2 \end{bmatrix}
    would lead to the same result as

  • using Hadamard Gate (H) on the first qubit after building the register:
    Building the register: reg1 := q0 tensor q1 = \begin{bmatrix} 1/\sqrt{2} \\ 0 \\ 1/\sqrt{2} \\ 0 \end{bmatrix} Apply: H tensor I mul reg1 =
    \begin{bmatrix} 1/\sqrt{2} && 0 && 1/\sqrt{2} && 0 \\ 0 && 1/\sqrt{2} && 0 && 1/\sqrt{2} \\ 1/\sqrt{2} && 0 && -1/\sqrt{2} && 0 \\ 0 && 1/\sqrt{2} && 0 && -1/\sqrt{2} \end{bmatrix} mul reg1 = \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix} So this is not the same. But what would be same is when we swap H and I: I tensor H mul reg1 = \begin{bmatrix} 1/\sqrt{2} && 1/\sqrt{2} && 0 && 0 \\ 1/\sqrt{2} && -1/\sqrt{2} && 0 && 0 \\ 0 && 0 && 1/\sqrt{2} && 1/\sqrt{2} \\ 0 && 0 && 1/\sqrt{2} && -1/\sqrt{2} \end{bmatrix} mul reg1 = \begin{bmatrix} 1/2 \\ 1/2 \\ 1/2 \\ 1/2 \end{bmatrix}

I found a Microsoft article and I think it has something to with that. It says:

Microsoft Article

I think this is weird. Can someone explain it?

$\endgroup$
3
  • 2
    $\begingroup$ "I think it is weird." Unclear what "it" refers to, and which part you're finding weird. $\endgroup$ Commented Nov 30, 2022 at 2:05
  • $\begingroup$ Also useful would be this answer: quantumcomputing.stackexchange.com/questions/14066/… $\endgroup$
    – Mike Ryan
    Commented Nov 30, 2022 at 2:35
  • $\begingroup$ The equation after "Building the register: reg1 := q0 tensor q1 =" is not correct. As Frank Yellin says in his answer below, the vector you wrote is $|+\rangle \otimes |0\rangle$, whereas you are looking for $|0\rangle \otimes |+\rangle = \begin{bmatrix} 1/\sqrt{2} \\ 1/\sqrt{2} \\ 0 \\ 0 \end{bmatrix}$. Then if you follow your logic after that, you will get the same result as your first method. $\endgroup$ Commented Jan 6, 2023 at 13:14

1 Answer 1

1
$\begingroup$

I'm not sure what you find confusing. You start off with with the matrix:

$$\begin{bmatrix} 1/\sqrt2 \\ 0 \\ 1/\sqrt2 \\ 0 \end{bmatrix}$$ which is $|+\rangle \otimes |0\rangle$.

Then: $$(H\otimes I)(|+\rangle \otimes |0\rangle) = (H|+\rangle) \otimes (I|0\rangle) = |0\rangle|0\rangle$$

$$(I\otimes H)(|+\rangle \otimes |0\rangle) = (I|+\rangle) \otimes (H|0\rangle) = |+\rangle|+\rangle$$

Which is exactly what you got in your calculations.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.