Skip to content

/learn · six lessons · ~10 minutes

Quantum computing, from zero to my thesis

Everything on this page is computed live by the same 2-qubit simulator that powers this site — no videos, no canned animations. Scroll, drag, and break things.

lesson 1 / 6

The qubit

A bit is a light switch: on or off. A qubit is a point on a sphere — and that difference is the whole story.

A classical bit is either 0 or 1. A qubit's state is written α|0⟩ + β|1⟩ — a mixture of both possibilities at once, where α and β are numbers called amplitudes. Squaring an amplitude gives the probability of finding the qubit in that state when you look: P(0) = |α|², P(1) = |β|².

Every possible qubit state maps to a point on a sphere — the Bloch sphere. North pole is |0⟩, south pole is |1⟩, and everywhere in between is a genuine quantum state. Two dials move the arrow: θ tilts it between the poles (changing the probabilities), φ spins it around the axis (changing something subtler — you'll meet it in the next lesson).

try it

Drag the sphere, or move the θ and φ sliders. Watch the amplitudes α and β update, and see the probability bars follow |α|² and |β|². Notice: tilting θ shifts probability between 0 and 1; spinning φ doesn't move the bars at all.

A qubit isn't "0 and 1 at the same time" — it's an arrow on a sphere. Where the arrow points decides the odds of what you'll see when you measure.

go deeper

The two dials are exactly the two rotation gates in this site's simulator: RY(θ) tilts, RZ(φ) spins. The state is stored as two complex amplitudes, and the arrow you're dragging is computed from them — the code is 166 lines, and it's the same engine that trains the classifier on the homepage.

|0⟩|1⟩
P(0)
81.1%
P(1)
18.9%

α=0.900 · |β|=0.435 · state = α|0⟩ + βe|1⟩

lesson 2 / 6

Superposition

"Both at once" has a precise meaning: the arrow sits on the equator.

Press the H (Hadamard) gate on a fresh |0⟩ qubit and the arrow swings from the north pole to the equator. Now P(0) = P(1) = ½ — a perfect coin toss. That's superposition: not magic, just a definite arrow pointing sideways.

But here's the part most explanations skip. Once on the equator, the arrow can still spin around the axis — that angle is called phase. Spin it anywhere you like: the probabilities refuse to move. Phase is invisible to a single measurement — yet it's the fuel of every quantum algorithm, because gates can convert hidden phase differences back into visible probability differences.

try it

Press H and watch the swing. Then drag the phase slider: the arrow orbits the equator, the probability bars stay frozen at 50/50. You are changing the state without changing the odds.

Superposition is an equator arrow; phase is its hidden direction. Quantum algorithms work by choreographing phases you can't see until the final step.

go deeper

Mathematically the equator state is (|0⟩ + e^{iφ}|1⟩)/√2. The e^{iφ} factor cancels when you square amplitudes for probabilities — that's why the bars freeze — but interference between paths depends on it completely.

|0⟩|1⟩
P(0)
100.0%
P(1)
0.0%

lesson 3 / 6

Entanglement

Two qubits can hold information that neither one carries alone. Watch each sphere forget — while the pair remembers.

Take two qubits. Put the first in superposition (H), then apply CNOT — a gate that flips the second qubit only when the first is 1. The result is the Bell state: (|00⟩ + |11⟩)/√2. Measured together, they only ever agree — both 0 or both 1, never mixed.

The eerie part shows up on the spheres. Each qubit's own arrow shrinks to nothing: ask either qubit alone "what state are you in?" and the honest answer is "no state at all — 50/50, no direction." All the information has moved into the correlation between them. The ⟨Z⊗Z⟩ meter reads +1: perfect agreement.

try it

Press H, then CNOT, and watch both arrows collapse toward the center while the correlation meter climbs to +1 and the joint histogram empties out 01 and 10. Reset and try CNOT without H — nothing interesting happens. The order matters.

Entanglement moves information from individual qubits into their relationship. That's the resource behind quantum teleportation, error correction — and the reason quantum computers can't be simulated one qubit at a time.

go deeper

The arrow's length is the qubit's purity. A lone qubit in the Bell pair is in a "maximally mixed" state — its reduced density matrix is ½·I, which has zero Bloch vector. This site's engine computes it by partial trace, exactly as a textbook would.

lesson 4 / 6

Measurement

Looking at a qubit is not free. Measurement is a weighted dice roll — and it destroys the state you rolled.

Until you measure, the qubit is its arrow: definite, continuous, spinnable. The moment you measure, two things happen at once. First, you get a plain classical answer — 0 or 1 — drawn randomly with probabilities |α|² and |β|². Second, the arrow snaps to the pole matching your answer. The superposition is gone; measuring again just repeats the same answer.

That's why quantum algorithms are shaped the way they are: compute in superposition, interfere phases, and only measure at the very end — one shot at extracting an answer from an arrow you spent the whole circuit preparing.

try it

Prepare any state with the sliders, then press measure — repeatedly. Each shot flashes, snaps the arrow to a pole, and adds a tick to the tally. Watch the histogram of your shots converge toward the theoretical bars. Same state, same odds, different rolls.

Measurement converts amplitudes to probabilities and erases the quantum state. Everything a quantum computer does must be choreographed to survive that final, destructive question.

go deeper

The snap is projection: the state is projected onto the measured outcome and renormalized to length 1. On the Bell pair from Lesson 3, measuring one qubit instantly fixes the other — try it there and watch both arrows snap together.

lesson 5 / 6

Training a quantum circuit

Put dials on a quantum circuit and it becomes a machine-learning model. This is quantum machine learning — and it's what runs on this site's homepage.

A variational circuit is a circuit whose rotation angles are trainable parameters — the quantum cousin of a neural network's weights. To classify a data point: encode it as a rotation, pass it through the parameterized gates, measure ⟨Z⟩, and read the sign as the predicted class.

Training needs gradients, and quantum circuits have a beautiful trick: the parameter-shift rule. Evaluate the circuit twice — once with a dial turned +π/2, once −π/2 — and half the difference is the exact gradient: ∂⟨Z⟩/∂θ = [⟨Z⟩(θ+π/2) − ⟨Z⟩(θ−π/2)] / 2. No approximation. Then it's ordinary gradient descent, just like any ML model.

try it

Watch the four θ dials tick as gradient descent runs, the loss curve fall, and the Bloch arrows settle. Then drag the two data points — you're changing the problem, and the circuit retrains in front of you. Move them close together and watch it struggle.

Quantum ML = circuits as models, parameter-shift for gradients, descent for training. The physics does the forward pass; calculus stays classical.

go deeper

This is the exact code running on the homepage hero — same simulator, same parameter-shift gradients, unit-tested against finite differences. My thesis benchmarked these models (CVQNN, quanvolutional networks) on MNIST with PennyLane and IBM's real quantum hardware.

lesson 6 / 6

Quanvolution: QML on images

A convolution slides a filter across an image. A quanvolution slides a quantum circuit. This was my thesis.

In a classical CNN, a small filter sweeps the image, computing one number per patch — stacked filters produce feature maps that reveal edges, textures, shapes. A quanvolutional layer keeps the sweep but replaces the filter's arithmetic with a 2-qubit circuit: the four pixels of each 2×2 patch become four RY rotation angles, a CNOT entangles the qubits, and the measured ⟨Z⟩ is the output pixel. Four different rotation offsets give four channels — four quantum feature maps from one drawing.

Why bother? The quantum filter computes a nonlinear, entanglement-mixed function of the patch that classical filters don't naturally express — and exploring where that helps is an open research question.

try it

Draw on the grid. Watch a patch lift into the circuit, transform, and land in the four feature maps — each channel seeing your sketch differently. Every value is a real ⟨Z⟩ from the same simulator you've used all page.

Quantum layers can drop into classical ML architectures. Encoding data into rotations, entangling, and measuring — the three moves you learned in lessons 1–4 — compose into a working image-processing layer.

go deeper

My undergraduate thesis — "Machine Learning In The Realm Of Quantum" — compared a quanvolutional network and a continuous-variable QNN against classical CNN baselines on MNIST, on PennyLane simulators: the gate-based model reached 92% test accuracy against a 96% classical CNN. The distilled paper is on this site.

colophon

Every number on this page came from a ~200-line statevector simulator, written in TypeScript and unit-tested against textbook identities — the same engine that trains the classifier on the homepage.

[read the source][the thesis]