1
$\begingroup$

A CNOT gate flips the target bit when the control bit is set to $|1\rangle$. Thus, defining it by $|c\rangle |t\rangle \rightarrow |c\rangle |t \oplus c\rangle $ makes sense to me.

On the other hand, its matrix representation

$$\begin{pmatrix}1 & 0 & 0 &0 \\ 0 & 1 & 0 &0 \\ 0& 0 & 0&1 \\ 0 & 0 & 1 & 0\end{pmatrix}$$

doesn't seem right, because if I multiply it by a vector

$$\begin{pmatrix}a \\ b \\ c \\ d \end{pmatrix}$$

representing the control bit ($a|0\rangle + b|1\rangle$) and the taget bit ($c|0\rangle + d|1\rangle$), I always get

$$\begin{pmatrix}a \\ b \\ d \\ c \end{pmatrix}$$

which means I am flipping the target bit regardless the value of control bit.

Can someone please explain what is wrong with my understanding here?

$\endgroup$

1 Answer 1

2
$\begingroup$

The vector you're trying to apply the gate to is wrong.

The matrix representation lives on the two-qubit space $\mathbb{C}^4$ with basis $\lvert 00\rangle,\lvert 01\rangle,\lvert 10\rangle,\lvert 11\rangle$, where the first number is for the control qubit and the second one for the target. So for your definition of $a,b,c,d$ the vector you have to apply the matrix to is actually $(a\lvert 0\rangle + b\lvert 0 \rangle)\otimes (c\lvert 0 \rangle + d\lvert 1 \rangle)$ which would be represented by the vector $(ac,ad,bc,bd)$.

In more detail: Any state of the two-qubit system can be written as $$ \lvert \psi \rangle = \alpha \lvert 00\rangle + \beta \lvert 01\rangle + \gamma \lvert 10\rangle + \delta \lvert 11\rangle$$ where the states are $\lvert ij\rangle = \lvert i\rangle_\text{control}\otimes \lvert j\rangle_\text{target}$. When you have the control qubit in the general state $a\lvert 0\rangle_\text{control} + b\lvert 1\rangle_\text{control}$ and the target in $c\lvert 0\rangle_\text{target} + d\lvert 1\rangle_\text{target}$, then this corresponds to $\alpha = ac$, $\beta = ad$, $\gamma = bc$ and $\delta = bd$, since the full two-qubit state is $(a\lvert 0\rangle_\text{control} + b\lvert 1\rangle_\text{control})\otimes (c\lvert 0\rangle_\text{target} + d\lvert 1\rangle_\text{target})$.

$\endgroup$
6
  • $\begingroup$ hello @ACuriousMind. What do you mean by "the first number is for the control qubit and the second one for the target" ? $\endgroup$ Commented Dec 11, 2016 at 15:27
  • 1
    $\begingroup$ @Vitor I mean that, for instance, $\lvert 01\rangle$ is the state where the control qubit is in the state $\lvert 0\rangle$ and the target qubit is in the state $\lvert 1\rangle$ $\endgroup$
    – ACuriousMind
    Commented Dec 11, 2016 at 15:30
  • $\begingroup$ But is has a value $ad$ associated with it, so does it mean the control qubit is $ad|0\rangle$ and the target is $ad|1\rangle$ $\endgroup$ Commented Dec 11, 2016 at 15:36
  • 1
    $\begingroup$ @Vitor I have made the answer a bit more explicit. $\endgroup$
    – ACuriousMind
    Commented Dec 11, 2016 at 15:43
  • $\begingroup$ I understand this tensor product language. I think my problem is thinking on separated bits on the component quantum spaces... So, if the control bit is set to zero, the state will be $|\psi_0 \rangle = \alpha |00\rangle + \beta|01\rangle $ and when it is set to one, we have $|\psi_1 \rangle = \gamma |10\rangle + \delta |11\rangle$, right? $\endgroup$ Commented Dec 11, 2016 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.