# How does the CNOT gate work?

As defined, CNOT should for the two input states $$|0\rangle = \pmatrix{1 \\ 0}$$ and $$\pmatrix{\alpha \\ \beta}$$ should result in the second state unchanged: $$\pmatrix{\alpha \\ \beta}$$. However, to me it does not seem to be the case.

The matrix for CNOT is defined as:

$$\pmatrix{1\;0\;0\;0 \\ 0\;1\;0\;0 \\ 0\;0\;0\;1 \\ 0\;0\;1\;0}$$

Now, I am not sure how to interpret the two input states, it makes sense to me to use their XOR as the input:

$$\pmatrix{1 \\ 0} \otimes \pmatrix{\alpha \\ \beta} = \pmatrix{ \alpha \\ 0 \\ \beta \\ 0 }$$

Now:

$$\pmatrix{1\;0\;0\;0 \\ 0\;1\;0\;0 \\ 0\;0\;0\;1 \\ 0\;0\;1\;0} \pmatrix{ \alpha \\ 0 \\ \beta \\ 0 } = \pmatrix{\alpha \\ 0 \\ 0 \\ \beta}$$

which is a state impossible to write as XOR of two states. Besides obviously being different from the first one, even though it should not have changed.

How is that?

$$\begin{pmatrix} 1 \\ 0 \end{pmatrix} \otimes \begin{pmatrix} \alpha \\ \beta \end{pmatrix} = \begin{pmatrix} \alpha \\ \beta \\ 0 \\0 \end{pmatrix}$$
$$\begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \\ \end{pmatrix} \begin{pmatrix} \alpha \\ \beta \\ 0 \\0 \end{pmatrix} = \begin{pmatrix} \alpha \\ \beta \\ 0 \\0 \end{pmatrix},$$
Where you say "xor", you should mean (and, indeed, you're using the notation for) the tensor product. However, you have not calculated the tensor product correctly. You should be getting $$[\alpha,\beta,0,0]^T$$ before application of the cnot, and hence $$[\alpha,\beta,0,0]^T$$ after the action of the cnot as well.