What a Quantum Computer Is (and Is Not)
A quantum computer is a machine that stores information in the states of quantum systems (a superconducting circuit, a trapped ion, a neutral atom, a photon) and manipulates it with precisely controlled operations. It is not a faster classical computer. It will not make your web server, your database or your spreadsheet faster. It is a different computational model that gives dramatic speed-ups on a narrow set of problems and none on most others.
The useful mental model for a programmer: a quantum computer is a very unusual coprocessor. You hand it a small circuit, it runs the circuit many times, and you get back a histogram of results. Everything interesting happens in how the circuit is designed so that wrong answers cancel and right answers reinforce.
Bits vs Qubits
A classical bit is 0 or 1. A qubit is described by two complex numbers, called amplitudes, written as a vector:
|ψ⟩ = α|0⟩ + β|1⟩ with |α|² + |β|² = 1
|0⟩and|1⟩are the two basis states, the quantum analogue of the bit values.αandβare amplitudes. They can be negative or complex, which is what makes interference possible.- The squared magnitude of an amplitude is the probability of seeing that outcome when you measure (the Born rule).
That is the whole state of one qubit: two numbers constrained by one equation. Nothing mystical, just linear algebra.
Superposition Is Not "Both at Once"
When α and β are both non-zero, the qubit is in a superposition. The popular phrase "it is both 0 and 1" suggests the qubit secretly holds two classical values. It does not. It holds one definite quantum state, a particular vector, and that vector has a definite probability of giving 0 or 1 if you measure it. Before measurement there is no hidden classical bit waiting to be revealed.
The state (|0⟩ + |1⟩)/√2, called |+⟩, gives 0 half the time and 1 half the time. The state (|0⟩ − |1⟩)/√2, called |−⟩, also gives 0 half the time and 1 half the time, yet it is a different state. The sign is invisible to a single measurement but changes how the qubit behaves when gates act on it. That hidden sign (the phase) is the raw material of quantum algorithms.
Measurement: Sampling, Not Reading
Measuring a qubit samples one outcome with the probabilities above and destroys the superposition: afterwards the qubit is in the basis state you observed. So you cannot read out the amplitudes directly. To estimate a probability you rerun the whole circuit many times (called shots) and count results. This is why quantum programs return histograms such as {'0': 503, '1': 497}, not single values.
Build a Qubit Simulator in 20 Lines
This runs on any laptop with NumPy and reproduces everything above. Gates are matrices, state is a vector, measurement is weighted random sampling.
import numpy as np
rng = np.random.default_rng(42)
ket0 = np.array([1, 0], dtype=complex) # |0>
H = np.array([[1, 1], [1, -1]], dtype=complex) / np.sqrt(2) # Hadamard gate
Z = np.array([[1, 0], [0, -1]], dtype=complex) # phase-flip gate
def measure(state, shots=1000):
probs = np.abs(state) ** 2 # Born rule
outcomes = rng.choice(len(state), size=shots, p=probs)
return np.bincount(outcomes, minlength=len(state))
plus = H @ ket0
print("amplitudes:", np.round(plus, 3)) # [0.707+0.j 0.707+0.j]
print("counts :", measure(plus)) # roughly [500 500]
print("H twice :", np.round(H @ H @ ket0, 3)) # [ 1.+0.j -0.+0.j] back to |0>
print("H Z H :", np.round(H @ Z @ H @ ket0, 3)) # [-0.+0.j 1.+0.j] now |1>Two lines of output deserve attention. Applying the Hadamard gate twice returns the qubit to |0⟩ with certainty. If the first Hadamard really made a coin flip, the second one could not undo it. It can, because the two paths to |1⟩ have opposite signs and cancel. That is interference. Then notice that inserting a Z gate between the two Hadamards flips the final answer to |1⟩: a phase change you could not see in a single measurement became a visible bit flip.
Quantum speed-ups do not come from "trying every answer in parallel". They come from arranging amplitudes so that wrong answers cancel and right answers add up before you measure. Every quantum algorithm is an exercise in choreographing that interference.
Why Simulating Qubits Gets Expensive Fast
One qubit needs 2 amplitudes. Two qubits need 4. n qubits need 2ⁿ amplitudes, because a general state can be a superposition over every combination of bit values. At 16 bytes per complex number, 30 qubits take 2³⁰ × 16 bytes = 16 GiB of memory, and 40 qubits would need 16 TiB. That exponential growth is the reason classical laptops can simulate roughly 30 qubits comfortably and why real hardware is interesting. It is also why you should be wary of the claim that "a quantum computer holds 2ⁿ numbers": you can never read most of them back out.
Common Misconceptions
| Claim | Reality |
|---|---|
| A qubit is both 0 and 1 | It is one state vector with probabilities for 0 and 1 on measurement |
| Quantum computers try all answers at once | They shape interference so wrong answers cancel; you still read out one sample per shot |
| They will speed up everything | Only specific problem classes (some search, simulation, factoring) have known advantages |
| More qubits always means more power | Qubit quality (error rate, connectivity, coherence time) matters as much as the count |
| You can read the whole state | Measurement collapses it; you only get samples |
Where Quantum Computers May Actually Help
- Simulating quantum systems (molecules, materials): the original motivation, since nature is quantum and classical simulation scales exponentially.
- Factoring and discrete logarithms (Shor's algorithm): breaks RSA and elliptic-curve cryptography on a large fault-tolerant machine, which is why post-quantum cryptography matters today.
- Unstructured search (Grover's algorithm): a quadratic speed-up, useful but modest.
- Optimisation and machine learning: active research, with no broadly accepted practical advantage yet. Treat strong claims sceptically.
Where to Go Next
The next article, Quantum Gates and Circuits with Qiskit, introduces entanglement and runs real circuits on a simulator. If you want to understand what is physically available today, read Quantum Hardware and Error Correction.
Frequently Asked Questions
Is a qubit really both 0 and 1 at the same time?
No. A qubit has a single quantum state described by two complex amplitudes. When both amplitudes are non-zero the state is a superposition, which gives a definite probability of 0 or 1 when measured. It is not a hidden pair of classical values.
Do I need physics or advanced maths to learn quantum computing?
No. Basic linear algebra (vectors and matrices) and complex numbers are enough to understand circuits and simulate them. A simulator written in NumPy, like the one in this article, covers the core ideas.
How many qubits can a laptop simulate?
Memory doubles with every added qubit. At 16 bytes per amplitude, 30 qubits need about 16 GiB, so roughly 25 to 32 qubits is the practical limit for a state-vector simulation on a typical machine.
Will quantum computers replace classical computers?
No. They are expected to work as specialised accelerators for particular problems such as quantum simulation and factoring. Everyday workloads like web serving and databases gain nothing from them.
Why does measuring a qubit change it?
Measurement samples one outcome according to the Born rule and leaves the qubit in the corresponding basis state. The original superposition is gone, which is why quantum programs run many shots and report counts.