liveBook · Manning

Qubit system

As explained in Building Quantum Software with Python

A multi-qubit system is a quantum system composed of two or more qubits whose joint state can be represented and measured.

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
figure

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
figure

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

How Building Quantum Software with Python covers it

How deep it goes
Explains state representation, gate-driven evolution, measurement, simulation, and image views without covering qubit hardware.
Examples
Demonstrates knapsack registers, a three-qubit uniform distribution, and pixel-array representations of three- and four-qubit states.
What it assumes
Assumes familiarity with binary strings and complex numbers, while using tables and Python lists to make states inspectable.
What you can do after
Build it from scratch as a Python simulator state for any number of qubits and transform it with gates.
How it connects
Connects quantum states, amplitudes, quantum gates, quantum circuits, quantum registers, measurement, and uniform distributions.

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.