Little-endian notation converts a basis-state bit string to an integer by placing the least significant bit first. Thus |01⟩ is integer 2 in little-endian notation, whereas it is integer 1 in big-endian notation. This ordering matters whenever basis states are represented by amplitude-array indices, matrix rows and columns, control patterns, or measurement values. section 2.3 section 3.5.1
For an n-qubit state written as Σⱼ aⱼ|j⟩ₙ, integer kets provide a compact alternative to long bit strings. The qubit count must remain explicit or clear from context: |0⟩ can denote one qubit or many. Under little-endian notation, the first qubit is the least significant bit, so splitting amplitudes by that qubit separates even indices from odd indices. section 2.5 section 2.5.1
Use the convention consistently at representation boundaries:
- In recursive state preparation, write |2j⟩ₙ = |0⟩₁ ⊗ |j⟩ₙ₋₁ and |2j + 1⟩ₙ = |1⟩₁ ⊗ |j⟩ₙ₋₁. This makes the least significant qubit the branch that selects even or odd amplitude groups. section 2.5.1
- When deriving controlled-gate matrices, label row and column indices by least and most significant bits rather than ambiguous positional names. Matrix block placement depends on this mapping. section 3.5.1
- Adapt to language conventions rather than assuming one ordering everywhere. Qiskit uses little-endian notation, while Q# uses big-endian notation for the discussed state and register conventions. section 2.3 section 3.9.3
- Treat displayed measurement strings separately from internal preparation order. A Qiskit test can prepare an integer basis state by inspecting its bits little-endian, then parse the reversed output string as a standard binary integer. section 4.1.2
Reconciling a Q# control pattern
ApplyControlledOnInt converts its integer control argument using little-endian encoding. If a Q# register is being treated most-significant-bit first, reverse the control-qubit array before passing it to that operation. The reversal changes the array view, not the quantum state, and aligns the control pattern with the intended qubits. section 3.9.3
Figure 2.5 To prepare an \(n\)-qubit state, we prepare the least significant qubit in a superposition state and then adjust the state of the remaining \(n-1\) qubits. Same as in the two-qubit case, controlled variants of the state preparation operation allow us to adjust the states of the most significant \(n-1\) qubits conditionally, with separate handling of the least significant qubit being in \(\ket{0}\) and \(\ket{1}\) states.
The recursive layout begins with the least significant qubit, then conditionally prepares the remaining qubits for its |0⟩ and |1⟩ branches. section 2.5.1

