Quantum Computing Basics: Qubits, Superposition & Entanglement
Quantum computers are not faster classical computers — they are fundamentally different machines that exploit the weird rules of quantum mechanics to solve specific problems exponentially faster. Understanding them requires letting go of classical intuitions about bits and logic gates.
1. Classical Bits vs Qubits
A classical bit is a switch: it is either 0 or 1. No ambiguity. A qubit is a quantum two-level system such as an electron spin, a photon polarisation, or a superconducting Josephson junction. While un-measured, it exists in a quantum state described by:
α and β are complex amplitudes. This is not the same as saying "the qubit is probably 0 or probably 1" — the superposition is a genuine quantum state with interference effects. Upon measurement, the state collapses to either |0⟩ or |1⟩ irreversibly.
Classical bit
- Definite value: 0 OR 1
- Copying is trivial
- No entanglement
- Read without disturbing
- N bits store one N-bit number
Qubit
- Superposition: both 0 AND 1 (until measured)
- Cannot be cloned (no-cloning theorem)
- Can be entangled with others
- Measurement collapses the state
- N qubits simultaneously encode 2ᴺ complex amplitudes
2. Superposition & the Bloch Sphere
Any single-qubit state |ψ⟩ = α|0⟩ + β|1⟩ can be visualised as a point on the unit sphere (the Bloch sphere) using two angles θ and φ:
Quantum gates are rotations of the Bloch sphere. The Hadamard gate H flips a |0⟩ to |+⟩ — an equal superposition of 0 and 1. It is the quantum "coin flip" that creates superposition from a definite state.
3. Entanglement
Two qubits can be put into an entangled state that cannot be factored into individual qubit states. The four Bell states are maximally entangled:
In |Φ⁺⟩: if Alice measures qubit 1 and gets 0, qubit 2 is instantly 0. If she gets 1, qubit 2 is instantly 1 — regardless of how far apart the qubits are. Einstein called this "spooky action at a distance" and believed it indicated quantum mechanics was incomplete. Bell's theorem (1964) and Aspect's experiments (1982) confirmed: entanglement is real and cannot be explained by hidden local variables.
Entanglement is a computational resource: it creates correlations between qubits that allow algorithms to process 2ᴺ states simultaneously through quantum parallelism.
4. Quantum Gates & Circuits
Quantum gates are unitary matrices that rotate qubit states. They are reversible (unlike classical NAND gates). Common single-qubit gates:
- X gate (NOT): |0⟩ ↔ |1⟩
- Z gate (phase flip): |0⟩ → |0⟩, |1⟩ → −|1⟩
- H (Hadamard): Creates superposition: |0⟩ → |+⟩ = (|0⟩+|1⟩)/√2
- T gate (π/8): Adds phase e^(iπ/4) to |1⟩; key for universal computation
The essential two-qubit gate is CNOT (controlled-NOT): flips the target qubit if and only if the control qubit is |1⟩. CNOT + Hadamard together can create entanglement:
Any quantum algorithm — Shor's, Grover's, VQE — is ultimately a sequence of these gates arranged in a quantum circuit. Measurement at the output collapses the superposition and produces the answer (probabilistically; circuits are run thousands of times and results averaged).
5. Interference: Why It Computes
Superposition alone doesn't give a speedup — a superposition of all inputs would collapse to a random single answer upon measurement. The key is quantum interference: carefully crafting the algorithm so that wrong answers' amplitudes cancel (destructive interference) and correct answers' amplitudes reinforce (constructive interference).
This is exactly what Shor's algorithm does: it sets up a superposition of all 2ᴺ possible periods, uses the Quantum Fourier Transform (essentially quantum interference at scale) to amplify the correct period, then classical post-processing extracts the factors. The exponential speedup comes from computing all input/output pairs simultaneously then using interference to extract the answer.
6. Key Quantum Algorithms
- Shor's Algorithm (1994): Factors an N-digit integer in polynomial time O(N³) vs classical e^O(N^(1/3)). Breaks RSA-2048. Requires ~4,000 error-corrected logical qubits. Current machines have ~1,000 physical qubits with high error rates — far from breaking RSA.
- Grover's Algorithm (1996): Searches an unsorted database of N items in O(√N) vs classical O(N). Quadratic, not exponential, speedup. Relevant for combinatorial search and cryptanalysis.
- VQE (Variational Quantum Eigensolver): Estimates ground-state energy of quantum chemistry systems. Near-term NISQ algorithm. Critical for drug discovery and materials science.
- QAOA (Quantum Approximate Optimization): Approximates solutions to combinatorial problems (scheduling, routing) on NISQ devices. Early promising results on small instances.
7. Hardware: How Qubits Are Built
- Superconducting qubits (IBM, Google): Josephson junction circuits at 15 mK. Fast gates (20–100 ns). Coherence 50–500 µs. Fabricated on chips. IBM Condor: 1,121 qubits (2023). Scalability challenge: wiring.
- Trapped ions (IonQ, Quantinuum): Ytterbium or barium ions laser-cooled in electromagnetic traps. Very long coherence (minutes). High gate fidelity. Slower gates (1–10 µs). H2 processor: 32 physical qubits, all-to-all connectivity.
- Photonic qubits (PsiQuantum, Xanadu): Photons in waveguides. Room-temperature operation possible. Probabilistic gates. Scalable via chip fabrication.
- Topological qubits (Microsoft): Majorana fermions. Theoretically inherently error-protected. Still largely proof-of-concept despite decades of investment.