# How to apply 2x2 matrix transformation gates upon 1x4 tensor product columns of two tensored qubits?

The tensor product of two qubits yields a 4-row column vector. Once tensored, how are we supposed to apply common gates such as NOT on just one of the qubits, an operation which expects 2x2 or at least 1x2 input?

I understand how classical NOT works (1 qubit), and how CNOT works (2 qubits tensored). But circuit diagrams often show 2x2 gate operations applied onto just one of the qubits in a tensor product. Is it okay to just vertically partition the 4-row into two 2-row column vectors for the purposes of 2x2 matrix gate operations?

• It is general approach to have an identity operator on a qubit where no gate is applied. As a result, you always have to something on each qubit and you can calculate tensor product of the gates. Nov 6, 2021 at 7:41

You can also tensor product the operations you are applying to your bipartite system. Suppose you have $$X$$ on the first qubit and nothing on the second qubit, i.e., the identity gate $$I$$. Thus, to get the matrix you multiply your four-vector by, you tensor product these operators as $$X \otimes I$$ (or $$I \otimes X$$ if you are following little endian convention). This tensor products works as usual:
$$X \otimes I = \begin{bmatrix} 0&1 \\ 1&0 \end{bmatrix} \otimes \begin{bmatrix} 1 &0 \\ 0&1 \end{bmatrix} = \begin{bmatrix}0\begin{bmatrix} 1 &0 \\ 0&1 \end{bmatrix}&1\begin{bmatrix} 1 &0 \\ 0&1 \end{bmatrix} \\ 1\begin{bmatrix} 1 &0 \\ 0&1 \end{bmatrix}&0\begin{bmatrix} 1 &0 \\ 0&1 \end{bmatrix}\end{bmatrix} = \begin{bmatrix} 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0\end{bmatrix}$$
Then, you can multiply this matrix times your column vector with four elements. Perhaps this is easier to do following ket notation, particularly if you have more than two qubits. For example, assuming you have the $$\frac{1}{\sqrt{2}}(|01\rangle + |10\rangle)$$ state, you can apply $$X \otimes I$$ as follows:
\begin{align} X \otimes I \left[\frac{1}{\sqrt{2}}(|01\rangle + |10\rangle)\right] &= \frac{1}{\sqrt{2}}\left[ X\otimes I(|01\rangle + |10\rangle) \right] \\ &=\frac{1}{\sqrt{2}}(X|0\rangle I|1\rangle + X|1\rangle I|0\rangle) = \frac{1}{\sqrt{2}}(|11\rangle + |00\rangle) \end{align}