# How Do I Use a Single Qubit Gate, On a State With Multiple Qubits?

Say I have a vector, which is a combination of 2 qubits.

$V_1\lvert00\rangle + V_2\lvert01\rangle + V_3\lvert10\rangle + V_4\lvert11\rangle =\left( \begin{matrix} V_1\\V_2\\V_3\\ V_4\end{matrix} \right)$

How would I multiply this, by a 2x2 matrix, as to apply it to only one of the qubits? i.e, if I wanted to apply a NOT gate, with the matrix:

$X = \left[ \begin{matrix} 0 & 1\\1 & 0\end{matrix} \right]$

To only one of the qubits, how would I do it?

• AndreasBlass signaled a bad answer to the question. It is fixed now. Sorry
– user354674
Commented Aug 21, 2016 at 4:33

Let's put things in context

The value $V_1\lvert00\rangle + V_2\lvert01\rangle + V_3\lvert10\rangle + V_4\lvert11\rangle$ and $V_1^2+V_2^2+V_3^2+V_4^2 = 1$ results from the sum of 2 qubits like $\lvert \phi_1\rangle = a_1\lvert0\rangle + b_1\lvert1\rangle$ and $\lvert \phi_2\rangle = a_2\lvert0\rangle + b_2\lvert1\rangle$.

Their composition $\lvert \psi\rangle = \lvert \phi_1\rangle \otimes \lvert \phi_2\rangle = a_1 a_2 \lvert00\rangle + a_1 b_2\lvert01\rangle + a_2 b_1\lvert10\rangle + b_1 b_2\lvert11\rangle$. Then the coordinates $V_n$ are $V_1 = a_1 a_2$ , $V_2 = a_1 b_2$ , $V_3 = a_2 b_1$ and $V_4 = b_1 b_2$ .

To apply $\left( \begin{matrix} 0 & 1 \\ 1 & 0\end{matrix} \right)$ on the first qubit, $a_1$ and $b_1$ must be swapped, giving the transformation of $( V_1,V_2,V_3,V_4 )$ in $( V_3,V_4,V_1,V_2 )$. It's easy to verify starting from the above values or the $V_n$. The matrix doing this transformation is merely :

$\left( \begin{matrix} 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ \end{matrix} \right)$

To apply on the 2nd, $a_2$ and $b_2$ must be swapped, giving the transformation of $( V_1,V_2,V_3,V_4 )$ in $( V_2,V_1,V_4,V_3 )$ :

$\left( \begin{matrix} 0 & 1 & 0 & 0 \\ 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ \end{matrix} \right)$

• The question seems to be asking not about CNOT but about an "uncontrolled" NOT. That is, the OP apparently wants to apply a NOT gate (the matrix $X$ in the question) to one of the qubits regardless of what the other qubit is. Commented Aug 21, 2016 at 1:50
• @AndreasBlass yes, you are true, I read too quickly. I'll update the answer, TY
– user354674
Commented Aug 21, 2016 at 1:56
• @AndreasBlass: I hope it is fixed by the simplest way
– user354674
Commented Aug 21, 2016 at 4:25
• The matrices are correct, so I'll up-vote this answer. Commented Aug 21, 2016 at 4:28