Q&AIntermediateLab conventions

Why does the CNOT matrix in Qiskit differ from textbooks?

Textbooks put the control as the most significant qubit while Qiskit's Operator orders qubit 0 as least significant; same gate, different basis ordering.

In textbooks, the CNOT matrix in the basis $|00\rangle,|01\rangle,|10\rangle,|11\rangle$ (control first) is
$$\begin{pmatrix}1&0&0&0\\0&1&0&0\\0&0&0&1\\0&0&1&0\end{pmatrix}.$$
Qiskit's Operator for cx(0,1), however, orders the basis as $|q_1q_0\rangle$, with the control $q_0$ as the least significant bit, so the matrix appears as
$$\begin{pmatrix}1&0&0&0\\0&0&0&1\\0&0&1&0\\0&1&0&0\end{pmatrix}.$$
It is the same gate; the difference is a reordering of rows and columns. The lab displays two-qubit gate matrices in the textbook form (control first) because it is the most common in teaching, while the simulator applies gates in the little-endian convention that matches Qiskit; the results are identical.

Related topics

References

  1. IBM Quantum (2025). Qiskit SDK API documentation. IBM Quantum Documentation quantum.cloud.ibm.com
  2. Michael A. Nielsen; Isaac L. Chuang (2010). Quantum Computation and Quantum Information (10th Anniversary Edition). Cambridge University Press doi:10.1017/CBO9780511976667The standard reference for quantum computing; the Crossref record gives 2012 for the Cambridge Core online edition.