15

Let's say we have a circuit with $2$ Hadamard gates:

enter image description here

Let's take the $|00\rangle$ state as input. The vector representation of $|00\rangle$ state is $[1 \ 0 \ 0 \ 0]$, but this is the representation of $2$ qubits and H accepts just $1$ qubit, so should we apply the first H gate to $[1 \ 0]$ and the second H gate to $[0 \ 0]$? Or should we input $[1 \ 0]$ in each H gate, because we are applying H gates to just one qubit of state $|0\rangle$ each time?

Sanchayan Dutta
  • 17,497
  • 7
  • 48
  • 110
Archil Zhvania
  • 2,187
  • 1
  • 20
  • 31

1 Answers1

20

Or should we input $[1 \ 0]$ in each H gate, because we are applying H gates to just qubit of state $|0\rangle$ each time?

Yes, when you have a two-qubit state (say you label the two qubits as $A$ and $B$ respectively), you need to apply the two Hadamard gates separately on each qubit's state. The final state will be the tensor product of the two "transformed" single-qubit states.

If your input is $|0\rangle_A\otimes|0\rangle_B$, the output will simply be $$\left(\frac{|0\rangle+|1\rangle}{\sqrt{2}}\right)_A\otimes\left(\frac{|0\rangle+|1\rangle}{\sqrt{2}}\right)_B$$


Alternative:

If the two input qubits are entangled, the above method won't work since you won't be able to represent the input state as a tensor product of the states of the two qubits. So, I'm outlining a more general method here.

When two gates are in parallel, like in your case, you can consider the tensor product of the two gates and apply that on the 2-qubit state vector. You'll end up with the same result.

$\frac{1}{\sqrt{2}}\begin{bmatrix}1&1\\1&-1\\ \end{bmatrix} \otimes \frac{1}{\sqrt{2}}\begin{bmatrix}1&1\\1&-1\\ \end{bmatrix} = \frac{1}{2}\begin{bmatrix}1&1&1&1\\1&-1&1&-1\\1&1&-1&-1\\1&-1&-1&1 \end{bmatrix}$

Now, on applying this matrix on the 2-qubit state $\begin{bmatrix}1\\0\\0\\0\end{bmatrix}$ you get:

$$\frac{1}{2}\begin{bmatrix}1&1&1&1\\1&-1&1&-1\\1&1&-1&-1\\1&-1&-1&1 \end{bmatrix} \begin{bmatrix}1\\0\\0\\0\end{bmatrix}=\begin{bmatrix}1/2\\1/2\\1/2\\1/2\end{bmatrix}$$

which is equivalent to $$\left(\frac{|0\rangle+|1\rangle}{\sqrt{2}}\right)_A\otimes\left(\frac{|0\rangle+|1\rangle}{\sqrt{2}}\right)_B$$

Justification

Tensor product of linear maps:

The tensor product also operates on linear maps between vector spaces. Specifically, given two linear maps $S : V \to X$ and $T : W \to Y$ between vector spaces, the tensor product of the two linear maps $S$ and $T$ is a linear map $(S\otimes T)(v\otimes w) = S(v) \otimes T(w)$ defined by $(S\otimes T)(v\otimes w) = S(v) \otimes T(w)$.

Thus, $$(\mathbf H|0\rangle_A) \otimes (\mathbf H|0\rangle_B) = (\mathbf H\otimes \mathbf H)(|0\rangle_A \otimes |0\rangle_B)$$

Sanchayan Dutta
  • 17,497
  • 7
  • 48
  • 110