# In Qiskit, when creating multi-bit quantum and classical registers, what is the ordering of MSB to LSB?

When creating multi-bit quantum and classical registers, what is the ordering of MSB to LSB? For instance, I created a quantum register via

import qiskit
qr = qiskit.QuantumRegister(2, name='qr')


Is qr[1] the MSB, or is it qr[0]?

For an example of why I'm asking, please review the following:

import qiskit
qr = qiskit.QuantumRegister(2, name='qr')
cr = qiskit.ClassicalRegister(2, name='cr')
qc = qiskit.QuantumCircuit(qr, cr)

# Result should be Bell state (|00>+|11>)/sqrt(2)
qc.h(qreg[0])
qc.cx(qreg[0], qreg[1])

# Result should be state |00>
qc.cx(qreg[0], qreg[1])
qc.h(qreg[0])

# Result should be state |10>
qc.x(qreg[0])

qc.measure(qreg, creg)
qc.draw()


At the end here I expect the quantum register to be in the state |10>, but the histogram below shows the state |01>. This indicates to me the MSB is the right-most bit, but I don't understand why the authors would do that. Is there some fundamental misunderstanding in my approach?

EDIT: Also the example is a bit convoluted--I initialized a Bell state because that's what the input to my circuit will be, but the same result happens with just the NOT gate on qr[0].

## 1 Answer

Pulling from another question (Big Endian vs Little Endian in Qiskit) and their documentation (https://community.qiskit.org/textbook/ch-prerequisites/qiskit.html), it appears that the register is intentionally labeled right-to-left so that integers are intuitively represented. Consider your example, where you applied X(qr[0]):

$$|00\rangle \rightarrow |01\rangle$$, which is "1" as an integer. $$1 = 2^0$$

There example used X(qr[7]) on an 8 qubit register:

$$|00000000\rangle \rightarrow |10000000\rangle = 32 = 2^7$$

• Thank you! I was having trouble locating the documentation for that bit of information, so these will be useful references. – PyNoob Sep 27 '19 at 8:52