A qubit is the basic unit of quantum information, but it is not simply a faster version of a classical bit. This guide explains the qubit-versus-bit distinction, shows how superposition and measurement work, provides a reference for common quantum gates, and ends with a compact Python exercise that builds a Bell state. Use it as a reusable checklist when reading a quantum circuit, choosing a simulator, or starting a new quantum programming tutorial.
Overview
A classical bit has one definite value at a time: 0 or 1. A qubit is represented by a state vector that combines the computational basis states |0⟩ and |1⟩:
|ψ⟩ = α|0⟩ + β|1⟩
Here, α and β are generally complex numbers, called amplitudes. Their squared magnitudes determine measurement probabilities, so |α|² + |β|² = 1. Before measurement, the qubit can have nonzero amplitudes for both outcomes. A measurement in the computational basis returns either 0 or 1 and changes the state to the observed basis state.
This is the practical answer to “what is a qubit?”: it is a controllable quantum state whose amplitudes can interfere. Superposition does not mean that a measurement prints every possible answer. It means that a circuit can transform amplitudes before measurement, increasing the probability of useful outcomes and reducing the probability of others.
| Concept | Classical bit | Qubit |
|---|---|---|
| State description | 0 or 1 | α|0⟩ + β|1⟩ |
| Before reading | Has a definite stored value | May be in a superposition |
| Readout | Normally reveals the value without changing it | Produces a probabilistic result and generally changes the state |
| Geometry | Often modeled with Boolean logic | Visualized with the Bloch sphere for a single qubit |
On the Bloch sphere, the north and south poles commonly represent |0⟩ and |1⟩. The equator contains equal-weight superpositions with different relative phases. The phase is not directly visible in a single computational-basis measurement, but gates can convert phase differences into measurable probability differences through interference.
Checklist by scenario
When learning a new circuit
- Identify the number of qubits and label their order. Libraries may display qubits in an order that differs from the order you expect.
- Write down the initial state, usually
|00...0⟩. - Read gates from the circuit's execution direction, not merely from the visual layout.
- Separate reversible gate operations from measurement operations.
- Ask which basis is being measured and what probability distribution the circuit should produce.
When checking common quantum gates
| Gate | Typical role | Developer check |
|---|---|---|
| X | Bit flip: swaps |0⟩ and |1⟩ | Comparable to a classical NOT, but applied to a quantum state |
| Z | Phase flip: changes the phase of the |1⟩ component | May not change immediate Z-basis counts by itself |
| H | Creates or removes equal superpositions | Apply it twice to the same qubit to return to the starting state |
| S and T | Introduce fixed phase rotations | Track the convention and angle used by the SDK |
| CNOT | Flips a target when the control is |1⟩ | Confirm control and target order |
| CZ | Applies a conditional phase change | Check whether the gate is symmetric in the framework |
When writing a small Python example
Keep the circuit short, name the intended qubits, and test the ideal state on a simulator before using hardware. A minimal Qiskit-style circuit looks like this:
from qiskit import QuantumCircuit
circuit = QuantumCircuit(1, 1)
circuit.h(0)
circuit.measure(0, 0)
print(circuit)
The Hadamard gate creates an equal superposition, so repeated measurements should approach a balanced distribution in an ideal simulator. Exact sampling output varies from run to run. SDK method names and execution APIs can change, so check the installed version's documentation before copying a backend or sampler call.
Step-by-step Bell-state exercise
A Bell state demonstrates entanglement between two qubits. The circuit applies a Hadamard gate to qubit 0, then a controlled-X gate with qubit 0 as control and qubit 1 as target:
from qiskit import QuantumCircuit
bell = QuantumCircuit(2, 2)
bell.h(0)
bell.cx(0, 1)
bell.measure([0, 1], [0, 1])
print(bell)
- Start in
|00⟩. - After
H(0), the ideal state is an equal combination of|00⟩and|10⟩, subject to the framework's qubit-order notation. - The controlled-X correlates the second qubit with the first, producing a Bell state commonly written as
(|00⟩ + |11⟩)/√2. - Measure many shots. In an ideal simulation, results should cluster around 00 and 11, while 01 and 10 should be absent or very uncommon depending on noise and execution settings.
For a simulator comparison, inspect both the state vector before measurement and the sampled counts after measurement. The state vector explains amplitudes; counts show what a finite experiment observes.
What to double-check
- Amplitude versus probability: An amplitude can be negative or complex. Probability is obtained from its squared magnitude, not from the amplitude itself.
- Global versus relative phase: A global phase does not affect measurement results, while relative phase can affect later interference.
- Gate convention: Matrix direction, rotation-angle signs, basis ordering, and control-target notation differ across explanations and software libraries.
- Bit-string order: Output strings may display the highest-index qubit first. Verify the convention with a simple basis-state test.
- Shots and noise: A simulator may be ideal or noisy, and a finite number of shots introduces sampling variation. Do not treat one count table as the exact underlying distribution.
- Measurement placement: Once measured, a qubit cannot normally be reused as though the pre-measurement superposition were still available.
When a circuit behaves unexpectedly, reduce it to one or two qubits, remove measurement, inspect the state representation if available, and then add operations back one at a time. This debugging approach is usually more informative than changing several gates at once.
Common mistakes
The most common beginner mistake is describing superposition as “the qubit is both 0 and 1” without mentioning amplitudes, interference, and measurement. That shorthand can hide the part that matters for programming: gates manipulate amplitudes, and measurement samples probabilities.
Another mistake is assuming that entanglement is just strong classical correlation. Entangled states have joint properties that cannot be represented by assigning each qubit an independent, pre-existing value in the usual way. In code, also avoid assuming that a CNOT automatically creates entanglement; its input state and the preceding gates matter.
Finally, do not compare circuit results without recording the SDK version, backend or simulator configuration, qubit order, shot count, and whether noise was enabled. For a fuller workflow, see our reproducible quantum experiment project template. Hardware runs may also require transpilation, which can change the physical gate sequence; this transpilation guide explains why.
When to revisit
Revisit this reference whenever you start a new quantum programming tutorial, encounter an unfamiliar gate, or need to explain a circuit to a teammate. Update your working examples after a major SDK release, because circuit-construction and execution APIs can change even when the underlying quantum notation does not.
Before moving from a simulator to hardware, repeat the checklist: confirm qubit order, inspect the transpiled circuit, identify the measurement basis, and decide how noise and shot variation will be handled. If results are sensitive to hardware errors, review quantum error mitigation techniques and the backend selection checklist.
Action plan: draw a one-qubit H-gate circuit, predict its probabilities, run it repeatedly, then build the two-qubit Bell circuit and verify its correlations. Save the code, environment details, circuit diagram, and observed counts. That small record becomes a reliable starting point for learning larger quantum algorithms.