liveBook · Manning

Least-significant bit

As explained in Quantum Programming in Depth

The least significant bit is the lowest-place bit in a binary representation and has the smallest positional value.

The least significant bit is the lowest-place bit in a binary representation and carries the smallest positional value. In quantum matrix notation, it identifies one position in each binary row and column index. section 3.5.1

Quantum programming libraries assign different positions to this bit. Qiskit uses little-endian notation, placing the least significant bit first or leftmost; Q# uses big-endian notation, placing it last or rightmost. section 3.5.1

The least significant bit determines how controlled operations are interpreted:

  • A controlled gate may use the least significant qubit as its control and the other qubit as its target. section 3.5.1
  • For an n-qubit controlled operation, the least significant bits can encode the control pattern for index k in little-endian notation. section 3.9.1
  • Correctly identifying the bit prevents mismatches between mathematical matrix blocks and library-native gate behavior. section 3.5.1

Two-qubit controlled gate

For a 4 × 4 matrix, write row and column indices as two-bit strings. Choosing the least significant bit as control produces a controlled-gate variant whose matrix acts on the corresponding basis-state blocks. section 3.5.1

Figure 3.4 The row and column indices of \(4 \times 4\) matrices. The indices are written in binary using little-endian notation: the least significant bit is written first. You can see that the top-left and bottom-right blocks group the elements for which the most significant (the last) bit of the row index equals that of the column index: for the matrix \(A\) in the top-left block, the most significant bit is \(0\), and for the matrix \(B\) in the bottom-right block, the most significant bit is \(1\).
figure

Use the matrix-index figure to compare little-endian bit order with the block structure associated with each significant bit. section 3.5.1

How Quantum Programming in Depth covers it

How deep it goes
Derives two- and multi-qubit matrix patterns, then verifies them through binary indices and transformed basis states.
Examples
Uses Figure 3.4, 4 × 4 controlled-gate matrices, and index k with least-significant control bits.
What it assumes
Assumes binary basis-state indices and controlled-gate matrices while refreshing endian conversion and bit-position interpretation.
What you can do after
Evaluate controlled-gate matrices and translate bit-string positions correctly between Qiskit and Q# conventions.
How it connects
Connects binary representation, endianness, basis states, matrix notation, and controlled gates.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Quantum Programming in Depth. The section links point to the parts of the book it draws on.