liveBook · Manning

Binary representation

As explained in Building Quantum Software with Python

A binary representation expresses a value using digits or states based on the two-element binary system.

Binary representation gives quantum-state simulation a direct way to identify computational-basis outcomes. For a target qubit t, pair outcomes whose binary strings differ only at position t; their decimal indices differ by 2^t. section 4.3.1

Use binary positions to organize single-qubit transformations:

  • Index qubits from right to left, with the rightmost binary digit representing qubit 0. section 4.3.1
  • For target t = 0, pair neighboring decimal indices; for t = 1 and t = 2, pair indices separated by 2 and 4. section 4.3.1
  • In an IQFT, recover binary digits from right to left through successive Hadamard gates and controlled phase shifts. section 7.4.1

Recovering 13 in binary

Repeatedly apply divmod by 2: 13 gives quotient 6 and remainder 1; 6 gives 3 and 0; 3 gives 1 and 1; 1 gives 0 and 1. Reading remainders from last to first produces 1101. section 7.4.1

How Building Quantum Software with Python covers it

How deep it goes
Explains positional pairing, powers-of-two offsets, successive division, and stepwise IQFT digit recovery without presenting full implementation code.
Examples
Demonstrates three-qubit outcome pairings and converts decimal 13 into 1101 using repeated divmod operations.
What it assumes
Assumes decimal-to-binary conversion and qubit-position indexing, while demonstrating successive division from the beginning.
What you can do after
Apply via Python's divmod and index arithmetic to organize amplitude pairs and trace binary digits recovered by IQFT.
How it connects
Connects binary representation to qubits, quantum states, amplitudes, single-qubit gates, IQFT, and phase shifts.

Also explained in

Compare how 6 books explain binary representation →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building Quantum Software with Python. The section links point to the parts of the book it draws on.