Qubit Ordering (Little-endian Convention)
Qiskit and the lab use little-endian ordering: qubit 0 is the least significant bit, so bitstrings are printed as $q_{n-1}\dots q_1q_0$ with qubit 0 rightmost.
Each computational basis state $|x\rangle$ of $n$ qubits corresponds to an integer $x=\sum_iq_i2^i$. In the Little-endian convention used in Qiskit and in this lab, qubit $q_0$ is the least significant bit, so the string is written $q_{n-1}\dots q_1q_0$ and $|q_{n-1}\dots q_0\rangle=|q_{n-1}\rangle\otimes\dots\otimes|q_0\rangle$. Many textbooks, including Nielsen and Chuang, write the first qubit on the left.
Practical consequences: applying $X$ to qubit 0 in a two-qubit circuit gives the string 01, not 10; the amplitude index in the state vector is 1. A gate on qubit 0 is represented by $I\otimes U$. The textbook CNOT matrix $\begin{pmatrix}1&0&0&0\\0&1&0&0\\0&0&0&1\\0&0&1&0\end{pmatrix}$ assumes the control is the most significant qubit; in Qiskit it is cx(1,0) that matches it, while cx(0,1) has a different matrix in Qiskit ordering.
In the lab, two-qubit gate inputs such as “10” are read in the same order: the left symbol is the higher qubit. State the convention explicitly when comparing results with a textbook or another library.
In circuits drawn by Qiskit, qubit 0 appears at the top, whereas in the printed string it appears on the far right; this is a common source of confusion for beginners.
Mathematical formula
Worked example
The following code (Qiskit 2.x) applies $X$ to qubit 0:
```python
from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector
qc = QuantumCircuit(2)
qc.x(0)
sv = Statevector.from_instruction(qc)
print({str(k): float(v) for k, v in sv.probabilities_dict().items()})
print(sv.data)
```
The actual output:
```
{'01': 1.0}
[0.+0.j 1.+0.j 0.+0.j 0.+0.j]
```
The string 01 means $q_1=0,\ q_0=1$, and the amplitude 1 is at index $x=1\cdot2^0=1$.
Test your understanding
The quiz needs JavaScript.
Related topics
References
- IBM Quantum (2025). Qiskit SDK API documentation. IBM Quantum Documentation quantum.cloud.ibm.com
- Ali Javadi-Abhari et al. (2024). Quantum computing with Qiskit. arXiv:2405.08810 doi:10.48550/arXiv.2405.08810
