2
$\begingroup$

Section 2.3 of the Qiskit textbook shows us that

$$ CNOT|0+\rangle \ = \ \frac{1}{\sqrt2}(|00\rangle + |11\rangle)$$

which I was able to translate to a circuit as such:

qc = QuantumCircuit(2)
qc.h(1)
qc.cx(1,0)
qc.draw()

Resulting circuit.

I'm trying to see how to come to the same result by hand, but no order of operations is saving me here. In other words, could someone step through the process? To the best of my understanding, the convention is to tensor product upwards and multiply right to left, e.g.:

$$ [CNOT (H ⊗ I)] |0+\rangle$$

Could someone step through the math as a guided example?

$\endgroup$
3
$\begingroup$

Note that usually, the state $|0+\rangle$ can denote apply the operator $(I \otimes H)$ to the state $|00\rangle$. Hence, it would be the circuit:

$\hspace{8cm}$ Figure 1:

$\hspace{6.5 cm}$ enter image description here

and also in a standard textbook, this can be written as $I \otimes H$.

But because qiskit uses little-endian convention, the state $|0+\rangle$ actually actually means the first qubit is $|+\rangle$ and the second qubit is $|0\rangle$. That is, it is in reverse order. Thus, the circuit representation for this state is actually:

$\hspace{8cm}$Figure 2:

$\hspace{7 cm}$enter image description here

In term of tensor notation, this (gate operation in Figure 2) can be written as $(I \otimes H) |00\rangle$. That is, we read from bottom up instead of top to bottom like what we would have done in standard setting. That is because we reversed the qubit ordering so by doing this we make sure that the gate operation written in tensor notation stay the same as what we would have in standard textbook setting.

And now applying CNOT gate to this circuit we get:


$\hspace{8cm}$Figure 3:

$\hspace{6cm}$ enter image description here


In term of the math, first note that usually the matrix representation for CNOT is: $$CNOT = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1\\ 0 & 0 & 1 & 0\end{pmatrix} $$

but with little-endian, its matrix representation is

$$CNOT_{little \ endian} = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0\\ 0 & 1 & 0 & 0\end{pmatrix} $$

and so overall, we applying the operation $U = CNOT_{little \ endian} \cdot (I \otimes H)$ to the state $|00\rangle$. So if we use matrix notation to work this out, we will have the following:

$$ CNOT_{little \ endian} \cdot (I \otimes H) = \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0\\ 0 & 1 & 0 & 0\end{pmatrix} \cdot \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 & 0 & 0 \\ 1 & -1 & 0 & 0 \\ 0 & 0 & 1 & 1\\ 0 & 0 & 1 & -1\end{pmatrix} = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 & 0 & 0 \\ 0 & 0 & 1 & -1 \\ 0 & 0 & 1 & 1\\ 1 & 1 & 0 & 0\end{pmatrix} $$

and now the state $|00\rangle = \begin{pmatrix} 1 \\ 0 \\ 0 \\ 0 \end{pmatrix} $ so therefore $CNOT_{little \ endian} \cdot (I \otimes H) |00\rangle$ can be worked out as:

$$ \big( CNOT_{little \ endian} \cdot (I \otimes H) \big) |00\rangle = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 & 1 & 0 & 0 \\ 0 & 0 & 1 & -1 \\ 0 & 0 & 1 & 1\\ 1 & 1 & 0 & 0\end{pmatrix} \begin{pmatrix} 1 \\ 0 \\ 0 \\ 0 \end{pmatrix} = \dfrac{1}{\sqrt{2}} \begin{pmatrix} 1 \\ 0 \\ 0 \\ 1 \end{pmatrix} = \dfrac{|00\rangle + |11\rangle}{\sqrt{2}} $$

$\endgroup$
1
$\begingroup$

KAJ226 gave a very thorough answer! I thought it might be useful to give a summarized version here: $$\begin{align} |0+\rangle &= (I \otimes H) |00\rangle \\ &= I|0\rangle\otimes H|0\rangle \\ & =|0\rangle \otimes \frac{1}{\sqrt2}\left(|0\rangle+|1\rangle\right) \\ &= \frac{1}{\sqrt2}\left(|00\rangle+|01\rangle\right) \\ CNOT|0+\rangle &= CNOT\left[\frac{1}{\sqrt2}\left(|00\rangle+|01\rangle\right)\right] \\ &=\frac{1}{\sqrt2}\left(CNOT|00\rangle+CNOT|01\rangle\right) \\ &=\frac{1}{\sqrt2}\left(|00\rangle+|11\rangle\rangle\right) \end{align} $$ Here I am inferring that the convention is that a $CNOT$ gate acting on 2 qubits is using the 2nd qubit as the control qubit and the 1st qubit as the target qubit.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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