Lab: flip a quantum coin
Make a perfect 50/50 coin with a single gate, then flip it a thousand times.
Lesson 6 of 7 about 8 min
Your lab bench
Time to build. Below is a tiny version of Qanad Lab: one qubit, a few gates, and a measurement at the end. Each time you press Run, the qubit is prepared from scratch, sent through your gates and measured. Every run is a shot.
Every qubit starts at |0⟩. So what do you expect from a circuit with no gates at all? Run it and see.
Exact odds, from the simulator
No shots yet
The quantum NOT
The X gate is the quantum version of NOT: it turns |0⟩ into |1⟩. On the Bloch sphere, it's half a turn that swaps the North and South Poles.
Exact odds, from the simulator
No shots yet
Flip the quantum coin
Now the real thing. Swap the X for an H gate. It tips the arrow from the North Pole onto the equator: a perfect 50-50. You've built a quantum coin. Flip it a thousand times.
Exact odds, from the simulator
No shots yet
Your turn
Flip it twice
Here's a riddle. You flip an ordinary coin twice: still random. What if you flip the quantum coin twice, with two H gates in a row? Predict first, then run it.
Exact odds, from the simulator
No shots yet
Challenge: a certain 1, without X
Now a puzzle. You have only H and Z. Z flips the phase: half a turn around the sphere's up-down axis. Can you build a circuit that gives 1 every time?
Hint: think on the Bloch sphere. Get to the equator, go halfway round it, then come back off it.
Exact odds, from the simulator
No shots yet
The most random coin there is
Your quantum coin isn't only fun. Its randomness is the real thing. The “random” numbers in ordinary software come from a clever formula: if you knew the formula and its starting point, you could predict every one. A qubit on the equator can't be predicted by anyone, because nature itself hasn't decided until you measure.
That's why quantum random-number generators are sold for security and lotteries. Some phones sold in South Korea have even carried a tiny quantum random-number chip since 2020.
Your turn
Take your coin to the full Qanad Lab, with Bloch spheres, step-through and code export.
Open the coin flip Today's puzzleWhat you built
- No gates: a qubit stays |0⟩. X turns it into a certain 1.
- One H makes a perfect quantum coin: 50-50, and truly random.
- Results wobble around the odds; more shots, better estimates.
- Two H gates cancel out: interference, which no ordinary coin can do.
- H, Z, H gives a certain 1. Phases can be turned into answers.
One last stop before Level 2: a short checkpoint to lock in everything about qubits.