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




