In the qiskit textbook chapter 1.3.1 "The CNOT-Gate" it says that the matrix representation on the right is the own corresponding to the circuit shown above, with q_0 being the control and q_1 the target, but shouldn't this matrix representation be for the case of q_1 being the control and q_0 the target? This seems to be presented the other way round...or there seems to be something I am not quite getting yet.

Thanks so much :)

Quick edit: By "right" I am referring to this: enter image description here

  • $\begingroup$ Alright, I was guessing you meant something else. In this terms @Egretta.Thula is the correct one. Cheers! :) $\endgroup$
    – DEX7RA
    Jul 27 '21 at 13:48
  • $\begingroup$ I went to the textbook and it says that the left matrix corresponds to the circuit above: "In our case, the left matrix corresponds to the CNOT in the circuit above". $\endgroup$
    – epelaaez
    Jul 27 '21 at 13:50
  • $\begingroup$ Related: quantumcomputing.stackexchange.com/a/15287/9858 $\endgroup$
    – KAJ226
    Jul 27 '21 at 14:24

Qiskit uses "little endian" bit ordering. That means, if A and B are $2 \times 2$ unitary matrices then $B \otimes A$ (note the order) is equivalent to applying $A$ to first qubit and $B$ to second qubit.

Hence, $$CNOT = I \otimes P_0 + X \otimes P_1$$ where $$ P_0 = \left( {\begin{array}{*{20}{c}} 1&0 \\ 0&0 \end{array}} \right) , P_1 = \left( {\begin{array}{*{20}{c}} 0&0 \\ 0&1 \end{array}} \right) $$

If you do the matrix multiplication, you should get $$CNOT = \left( {\begin{array}{*{20}{c}} 1&0&0&0 \\ 0&0&0&1 \\ 0&0&1&0 \\ 0&1&0&0 \end{array}} \right)$$

  • $\begingroup$ Thank you so much! That's what I was missing :) $\endgroup$
    – Alvo
    Jul 27 '21 at 13:56
  • $\begingroup$ But the examples are not presented like this in text, right? Is there a footnote or anything that introduces this convention? It does make sense but it seems a bit inconsistent since the tensor product is not introduced nor treated with this convention... $\endgroup$
    – Alvo
    Jul 27 '21 at 14:03
  • $\begingroup$ Actually, it is in the same web page. Just (re)read section 2 in the same chapter (Single Qubit Gates on Multi-Qubit Statevectors). Notice the circuit where $H$ is applied to $q_0$ and $X$ is applied to $q_1$ and see how its unitary is calculated. $\endgroup$ Jul 27 '21 at 14:11
  • $\begingroup$ See here: qiskit.org/documentation/stubs/… $\endgroup$
    – KAJ226
    Jul 27 '21 at 14:20
  • $\begingroup$ @Egretta.Thula I am so sorry. I just copied it the other way round while doing the math, anticipating the change of order and basically changing it twice. Thanks so much for your patience!!! :))) $\endgroup$
    – Alvo
    Jul 27 '21 at 14:33

enter image description here

Hi there. the Matrix for 0,1 is to represent Q[0] = 1 to be effective, right, so that I wrote & got the answer for the Coefficient to be |01> is 1 in the last column of the Density Matrix.

Consequently do note that the for CNOT for 1,0 to be effecive Q[1] must be one so i get the representation of the the co-efficient of |10> to be 1 as the the last column of the matrix.

Also my Dears, Please do kindly note that the Density Matrix column has direct Relationship with the State Specially the 1st & last column.

  • 2
    $\begingroup$ The image that you linked isn't correctly displayed and please write your equations using Latex. Just enclose them in '\$' for inline equations and '\$\$' for equations centered in their own line. $\endgroup$
    – epelaaez
    Aug 2 '21 at 0:09

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.