# Multi qubit states and the CNOT gate

I'm stuck on this passage from a book:

Suppose we try to copy a qubit in the unknown state $$|ψ\rangle = a|0\rangle + b|1\rangle$$ in the same manner by using a $$\text{CNOT}$$ gate. The input state of the two qubits may be written as $$\big[a|0\rangle + b|1\rangle \big]\ |0\rangle = a |00\rangle + b |10\rangle$$

The function of $$\text{CNOT}$$ is to negate the second qubit when the first qubit is $$1$$, and thus the output is simply

$$a |00\rangle + b |11\rangle$$

It seems $$|0\rangle$$ distributes over $$\big[a|0\rangle + b|1\rangle \big]$$ to get $$a |00\rangle + b |10\rangle$$, so the first part makes sense, but supposing the first qubit state is $$|1\rangle$$ then wouldn't the final state be

$$\big[a|0\rangle + b|1\rangle \big]\ |1\rangle = a |01\rangle + b |11\rangle$$

since the second qubit is changed by the gate? Where does $$a |00\rangle + b |11\rangle$$ come from?

I've realized that

$$|0\rangle |0\rangle = |0\rangle \otimes |0\rangle$$

is short hand for the tensor product.

• The first (left) qubit controls the negation of the second (right) qubit. If the first qubit is $|1\rangle$, the second qubit will be negated. The second qubit is assumed to have been initialized to $|0\rangle$, so when the first qubit is $|1\rangle$ the second qubit gets negated by the CNOT gate from $|0\rangle$ to $|1\rangle$. May 13, 2022 at 19:58

By linearity of quantum mechanics, the action of applying the operation $$U$$ on a superposition state $$a|\psi\rangle + b|\phi\rangle$$,
$$U(a|\psi\rangle + b|\phi\rangle) = a\,U|\psi\rangle + b\,U|\phi\rangle$$ So, $$\text{CNOT}(a|00\rangle + b|10\rangle) = a\,\text{CNOT}|00\rangle + b\,\text{CNOT}|10\rangle$$ Now,
$$\text{CNOT}|00\rangle = |00\rangle$$, and
$$\text{CNOT}|10\rangle = |11\rangle$$
Hence, $$\text{CNOT}(a|00\rangle + b|10\rangle) = a|00\rangle + b|11\rangle$$
The CNOT operation, like all quantum transformations, is linear. The CNOT (where the first qubit is the "control" and the second qubit is the "target") maps the basis states of the two-qubit space $$|00\rangle \to |00\rangle$$, $$|01\rangle \to |01\rangle$$, $$|10\rangle\to |11\rangle$$, and lastly $$|11\rangle \to |10\rangle$$. This is why it is expressed as the matrix $$\text{CNOT}=\begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{pmatrix}.$$ Now, because the operation is linear, when it it applied to a superposition it acts as follows $$\text{CNOT}(a|00\rangle+b|10\rangle)=a\cdot\text{CNOT}|00\rangle+b\cdot\text{CNOT}|10\rangle=a|00\rangle+b|11\rangle.$$ It acts this this way because CNOT does nothing to the $$|00\rangle$$ state because the control is $$0$$ (or "off"), but does "flip" the target $$0$$ bit in $$|10\rangle$$ because here the control bit was a $$1$$ (or "on").