How does one interpret the CNOT gate? The CNOT gate takes a separable state and turns into an entangled state. The oracle in the Deutsch algorithm does the same thing. But how does one understand this intuitively?
-
1$\begingroup$ What do you mean by intuitively? The classical analogue is the XOR gate, and the quantum version happens to also work on superposed basis states, if that helps. My intution is simply that it is a controlled not gate: if the control qubit is $|0\rangle$, do nothing to the target qubit while, if the control qubit is $|1\rangle$, perform a not (bit flip) operation on the target qubit. $\endgroup$– Quantum MechanicCommented Jul 17, 2021 at 22:46
-
1$\begingroup$ The CNOT doesn't inevitably turn a separable state into an entangled state - apply a CNOT to the state $|0\rangle|0\rangle$ and the state will be unchanged (still a product state). However what it does is (coherently) apply an operation to one qubit dependent on the state of another, thus (in general) correlating their states, and this coherent correlation is essentially what entanglement is. $\endgroup$– GotCarterCommented Jul 18, 2021 at 10:06
-
$\begingroup$ related: quantumcomputing.stackexchange.com/q/10075/55 $\endgroup$– glS ♦Commented Jul 18, 2021 at 18:14
3 Answers
The CNOT gate is two-qubit operation, where the first qubit is usually referred to as the control qubit and the second qubit as the target qubit.
- Case 1: The CNOT gate flips the second qubit (the target qubit) if and only if the first qubit (the control qubit) is 1
- Case 2: The CNOT leaves the target qubit unchanged when the control qubit is in state 0
That's the logical table for getting a better understanding:
Note: Any quantum circuit can be simulated to an arbitrary degree of accuracy using a combination of CNOT gates and single qubit rotations.
@DEX7RA's answer is really good. I just want to add another way of understadning the $CNOT$ gate, and any other gate, intuitively from its matrix representation. To do this, first let's remember the four basis states of a state space of two qubits:
$$ |00\rangle = \begin{pmatrix} 1 \\ 0 \\ 0 \\ 0 \end{pmatrix}, \; |01\rangle = \begin{pmatrix} 0 \\ 1 \\ 0 \\ 0 \end{pmatrix}, \; |10\rangle = \begin{pmatrix} 0 \\ 0 \\ 1 \\ 0 \end{pmatrix}, \; \text{and} \; |11\rangle = \begin{pmatrix} 0 \\ 0 \\ 0 \\ 1 \end{pmatrix} $$
Now, the matrix representation of the $CNOT$ gate is:
$$ \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{pmatrix} $$
When you multiply the $CNOT$ matrix by any of the basis states, you are pulling out one of the columns of the matrix. The column you pull out depends on the index where the 1 is located in the state vector. So for $|00\rangle$ and $|01\rangle$, you pick the first and second columns respectively, and you can see that the state doesn't change. (We are considering the leftmost qubit as the control.)
For $|10\rangle$, you pull out the third column that is $\begin{pmatrix} 0 & 0 &0 &1 \end{pmatrix}^T=|11\rangle$. As you can see, the target qubit was flipped becuase the control qubit was set to 1. Similarly, the state $|11\rangle$ is transformed into $|10\rangle$.
You can apply this same concept to any other matrix and with any other input state, even one in superposition. Consider, for example, the following state:
$$ |\psi\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ 0 \\ 1 \\ 0 \end{pmatrix} $$
Multiplying the $CNOT$ matrix by this state, you pull out columns 1 and 3, both scaled by a factor of $\frac{1}{\sqrt{2}}$. So, you get the state:
$$ CNOT|\psi\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ 0 \\ 0 \\ 0 \end{pmatrix} +\frac{1}{\sqrt{2}}\begin{pmatrix} 0 \\ 0 \\ 0 \\ 1 \end{pmatrix} = \frac{1}{\sqrt{2}}\begin{pmatrix} 1 \\ 0 \\ 0 \\ 1 \end{pmatrix} $$
Which is entangled ;)
In addition to the answers posted above, a different way to understand the operation on the target (the control bit always remain the same) is by adding the target and control modulo 2.
For instance, suppose we have
- Before: control $\vert 0 \rangle$ and target $\vert 0 \rangle$. After: control $\vert 0 \rangle$ and target $\vert 0 \oplus 0 \rangle = \vert 0 \rangle$
- Before: control $\vert 0 \rangle$ and target $\vert 1 \rangle$. After: control $\vert 0 \rangle$ and target $\vert 0 \oplus 1 \rangle = \vert 1 \rangle$
- Before: control $\vert 1 \rangle$ and target $\vert 1 \rangle$. After: control $\vert 1 \rangle$ and target $\vert 1 \oplus 1 \rangle = \vert 0 \rangle$
Note that the control bit always remains the same. Hope that helps :)