liveBook · Manning

Quantum bit

As explained in Building Quantum Software with Python

A qubit, or quantum bit, is the fundamental unit of quantum information and can exist in a superposition of two computational-basis states.

A quantum bit, or qubit, is the fundamental unit of a quantum computing system. Measurement returns 0 or 1, but before measurement its state assigns an amplitude—and therefore an outcome probability—to each possible result. Unlike a classical bit, a qubit can be in a superposition, so computation changes outcome probabilities before one result is observed. section 1.4.2 section 2.5

A variable-bias coin is a useful programming analogy: instead of switching directly between two values, computation changes the chances of heads and tails, then measurement produces one outcome. The analogy stops short of the full model because quantum amplitudes have direction as well as magnitude; probability is the squared length of an amplitude. section 1.4.2

With multiple qubits:

  • Each qubit supplies one digit of the measured binary string. Two qubits can yield 00, 01, 10, or 11; n qubits have 2^n possible outcomes. section 1.4.3 section 2.2.1
  • The system state has one amplitude for every possible outcome. An n-qubit state can be represented programmatically as an array of 2^n complex numbers whose squared magnitudes sum to 1. section 1.4.3 section 4.6
  • Qubits can be grouped into quantum registers to represent logical variables, such as an item selection, its value, and its weight. section 2.2.1
  • Quantum gates transform amplitudes; controlled transformations use other qubits as controls. Circuits combine these transformations to create useful probability distributions. section 4.6
Figure 1.9 The steps of a quantum computation using quantum bits (qubits). The example in the diagram uses three qubits, so there are eight possible outcomes, each with a certain measurement probability represented by the filled part of the sectors. When a measurement is performed, we get one result according to the probabilities. The result is interpreted as a binary string.
figure

This three-qubit view connects a state with eight possible outcomes to the single binary string returned by measurement. section 1.4.3

Encoding a knapsack candidate

Use a register of qubits for item selection and separate registers for total value and total weight. A run returns one binary string; its digits can be interpreted as the encoded variables. For optimization, transformations aim to increase the probability of desired outcomes. section 2.2.1 section 2.5

How Building Quantum Software with Python covers it

How deep it goes
Develops single- and multi-qubit states through amplitudes, measurements, registers, gates, and array representations while deferring hardware details.
Examples
Uses a variable-bias coin, two- and three-qubit binary outcomes, state visualizations, and knapsack registers.
What it assumes
Introduces qubits through classical-bit and coin analogies, while binary-string-to-decimal conversion may require separate review.
What you can do after
Evaluate/understand quantum-program outputs as binary strings and relate qubit states to outcome probabilities.
How it connects
Connects superposition, quantum measurement, amplitudes, quantum gates, quantum circuits, quantum registers, entanglement, and amplitude amplification.

Also explained in

Compare how 2 books explain quantum bit →

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.