Quantum Computing — Qubits, Gates, Entanglement & Grover's Algorithm

Six simulations that make quantum mechanics tangible: visualise qubit states on the Bloch sphere, compose and run a quantum circuit, witness Bell-state entanglement, watch a particle tunnel through a classically forbidden barrier, and run Grover's O(√N) search algorithm step by step.

The Qubit and Quantum Gates

Classical bits are 0 or 1. A qubit is a two-level quantum system whose state is the superposition α|0⟩ + β|1⟩, where |α|² + |β|² = 1 and α, β are complex amplitudes. The Bloch sphere — a unit sphere in 3D Euclidean space — maps every pure qubit state to a unique point on its surface. The north pole is |0⟩, the south pole is |1⟩, and every superposition lands somewhere on the sphere.

Quantum State & Measurement

Pure qubit state: |ψ⟩ = cos(θ/2)|0⟩ + e^(iφ)sin(θ/2)|1⟩
Bloch sphere coordinates: (sin θ cos φ, sin θ sin φ, cos θ)

Gate as unitary matrix U (2×2 complex, UU† = I):
  Hadamard: H = (1/√2)[[1,1],[1,−1]]
  Phase: S = [[1,0],[0,i]]    T = [[1,0],[0,e^(iπ/4)]]

Measurement probabilities: P(0) = |α|², P(1) = |β|²
Post-measurement collapse: |ψ⟩ → |0⟩ with prob P(0), |1⟩ with prob P(1)

Quantum Phenomena & Algorithms

Beyond qubits and gates, quantum mechanics enables phenomena with no classical analogue: a particle penetrating a barrier it has nowhere near enough energy to cross, and a search algorithm that finds a needle in a haystack of N items with only √N queries instead of N/2.

Why O(√N) and not O(1)? Grover's algorithm provides a quadratic speedup, not exponential. For a database of 1 million items, classical search needs on average 500 000 queries; Grover needs ~785. The speedup is provably optimal for unstructured search. Exponential speedups (like Shor's algorithm for factoring) require structure in the problem.

Algorithms at a Glance

SU(2) state vector Unitary gate matrices Bloch sphere projection Density matrix Bell state preparation CHSH inequality Larmor precession Crank-Nicolson PDE WKB approximation Grover diffusion operator Amplitude amplification

Suggested Learning Paths

📘 Physics / Computer Science Students
  1. Qubit Bloch Sphere — state and gates
  2. Quantum Entanglement — Bell states basics
  3. Quantum Tunneling — wave mechanics
  4. Quantum Spin — Larmor precession
🎓 Quantum Computing / QIS
  1. Quantum Circuit Simulator — multi-qubit gates
  2. Grover's Algorithm — amplitude amplification
  3. Quantum Entanglement — CHSH violation
  4. Qubit Bloch Sphere — SU(2) geometry