A qubit system is a quantum system made from qubits. With n qubits, one run ends in one binary string of length n: each digit corresponds to a qubit, and there are 2^n possible outcomes. Programs initialize the system, transform its state with instructions, then measure it; repeated runs reveal an outcome distribution. section 2.2 section 2.2.1
Its state assigns one complex amplitude to every possible outcome. A two-qubit system therefore has four amplitudes, while an n-qubit system has one amplitude for each length-n binary string. Python lists and state tables provide parallel programmatic and visual representations; squared amplitude magnitudes determine outcome probabilities. section 4.2 section 3.1.1
Registers group qubits to encode separate variables within one system:
- Use a binary measurement string as a compact result: qubit positions map directly to its digits. section 2.2.1
- Size each register for the range needed by its variable, such as an item selection, total value, or total weight. section 2.2.1
- Apply gates to change state amplitudes, then measure after the computation unless an earlier measurement is specified. section 2.2
Uniform three-qubit state
Start from the default three-qubit state, whose first amplitude is 1 and all others are 0. Applying a Hadamard gate to each qubit produces eight amplitudes of equal magnitude, so every binary outcome from 000 through 111 has equal probability. section 4.3.4
Figure 2.4 Three registers encoding an item selection, its total value, and its total weight for solving the knapsack problem
Use the register diagram to see how one qubit system can partition its binary outcomes into variables for a knapsack computation. section 2.2.1
Figure 12.7 A three-qubit quantum state (top) and a four-qubit quantum state (bottom) illustrated as two-dimensional arrays of pixels
Use the pixel-array view to see system composition: adding a qubit doubles an image dimension, while gates recombine rows or columns. section 12.4
