liveBook · Manning

Binary string

As explained in Quantum Programming in Depth

A bit string is a finite sequence of binary digits used here to represent a computational basis state.

A binary string is a finite sequence of 0s and 1s used to label a computational basis state, represent a measurement result, or encode a candidate input. For an n-qubit system, each basis-state label has n bits. A state written as \(\ket{b}\) has a corresponding binary label \(b\); measuring a system known to be in that basis state returns the label with probability 1. section 4.1.1

Binary strings also connect basis states to amplitude-array indexes. That connection depends on endianness: \(\ket{01}\) is integer 1 in big-endian notation and integer 2 in little-endian notation. Quantum tools need not agree: Qiskit uses little-endian notation, while Q# uses big-endian notation. section 2.3

Common roles include:

  • Representing every possible outcome of an n-qubit measurement; in a superposition, the string for integer \(k\) occurs with probability \(a_k^2\). section 4.1.1
  • Defining oracle inputs and marked search targets, such as a function that accepts three-bit strings and returns 1 only for selected inputs. section 7.1
  • Encoding constrained search candidates, such as N queens placements split into N-bit row chunks, each containing exactly one 1. section 8.2.1
  • Computing parity: a string has parity 0 when it contains an even number of 1s and parity 1 otherwise. section 4.6

Marked three-bit inputs

An oracle can mark \(001\) and \(110\): it returns 1 for those two binary strings and 0 for the other six three-bit inputs. This turns a list of target strings into a Boolean function suitable for quantum search algorithms. section 7.1

Table 7.1 The function that acts on three-bit strings and “marks” bit strings \(001\) and \(110\)
\(x\) \(000\) \(001\) \(010\) \(011\) \(100\) \(101\) \(110\) \(111\)
\(f(x)\) \(0\) \(1\) \(0\) \(0\) \(0\) \(0\) \(1\) \(0\)

Use the truth table to inspect all eight three-bit inputs and see how selected binary strings define an oracle’s marked set. section 7.1

How Quantum Programming in Depth covers it

How deep it goes
Defines binary strings operationally through indexing, measurement, parity, and search encodings, while deferring general encoding theory.
Examples
Uses \(\ket{01}\), measured two-qubit outcomes, marked strings \(001\) and \(110\), and N queens board encodings.
What it assumes
Assumes familiarity with qubits, basis states, amplitudes, and binary notation while briefly refreshing their measurement relationship.
What you can do after
Apply it via quantum programming tools by mapping basis labels to indexes and interpreting oracle or measurement inputs consistently.
How it connects
Connects binary strings to computational basis states, measurement, endianness, quantum oracles, Grover’s algorithm, and parity.

Also explained in

Compare how 5 books explain binary string →

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.