Quantum Computing for Developers
From zero to a correct working mental model: qubits, amplitudes, measurement, gates, entanglement — every claim runnable, no physics degree required.
Quantum computers are specialised accelerators, not faster general-purpose machines. A QPU pays off only when a verified quantum algorithm matches the problem's structure — and measurement returns a few classical bits per run, never the full internal state.
A bit holds one readable value, 0 or 1. A qubit carries two amplitudes — one for each outcome — and measuring it returns a single bit, with probability equal to each amplitude's squared magnitude.
An amplitude is a signed or complex number attached to an outcome; the outcome's probability is the amplitude's squared magnitude, and a valid state's probabilities sum to exactly 1. Squaring erases sign information — phase — which later gates can still exploit.
One shot returns one classical bit, sampled from the state's probabilities; finite counts fluctuate around the ideal distribution with a typical error that shrinks like 1/√N. Measurement also updates the qubit to the basis state that was observed.
The Bloch sphere plots one pure qubit as a point on a globe: latitude sets the 0/1 probability balance, longitude records relative phase, and gates are rotations. The picture is exact for a single qubit and does not extend to entangled multi-qubit states.
X swaps the amplitudes of |0⟩ and |1⟩, Z flips the sign of the |1⟩ amplitude, and Y does both with factors of i. Z changes phase the current histogram cannot see — later gates can convert that hidden change into visible probabilities.
Hadamard adds and subtracts amplitudes, each divided by √2: it turns |0⟩ into an even superposition and is its own inverse. A phase inserted between two H gates decides the final outcome — H is a phase detector, not a randomiser.
Phase gates (Z, S, T, RZ) turn the direction of the |1⟩ amplitude without changing the readout probabilities on their own — an H before and after converts that hidden turn into a visible, even deterministic, histogram change. Rotation gates take an angle in radians and reshape probabilities directly: RY(θ) on |0⟩ gives cos²(θ/2) zeros, so the probability follows the half-angle, not the angle.
n qubits are described by one amplitude per joint outcome — 2ⁿ amplitudes in total — not by n separate pairs. QPU137 displays bitstrings with q0 as the rightmost (least significant) bit, and while some joint states factor into independent per-qubit states, entangled ones cannot.
CX (CNOT) flips its target qubit inside exactly those components of the joint state where the control qubit is 1 — a conditional applied per component, with no measurement and no runtime branch. The operand order [control, target] is part of the program: swap it and you run a different circuit.
H then CX turns |00⟩ into the Bell state (|00⟩+|11⟩)/√2: each bit alone is a fair coin, yet the two bits agree on every shot, and simple arithmetic shows no pair of independent per-qubit descriptions can reproduce this. The correlation is a property of the joint state — it cannot be used to send a message.
Interference means amplitudes add before they are squared into probabilities, so same-sign contributions reinforce and opposite-sign contributions cancel. In H–Z–H the two contributions to outcome 0 are +0.5 and −0.5 and cancel exactly: a phase-only change becomes a deterministic 1.
A circuit is a program: an ordered list of operations, each naming a gate, its qubit operands, and any parameters — the diagram is just a rendering of that list. Gate count and depth measure different costs, and operand order is semantics: transposing one [control, target] pair changes the output.
The capstone is one complete experiment: write a numeric prediction for the Bell circuit, run 1,000 shots, check the counts against sampling statistics, change one gate with a fresh prediction, and record the circuit, shot count, seed, counts and explanation so someone else can reproduce both the result and the reasoning.