Quantum Coin Flip

One qubit, one Hadamard gate, one measurement. Until you look, the coin is heads and tails at once.

READY
Tap the coin or press Flip once

0Heads
0Tails
0Total flips

The wavefunction, live

Two equal peaks mean a 50/50 superposition. When you flip, one peak takes all the probability: that is the collapse.

Bloch sphere

|+⟩ = (|0⟩ + |1⟩)/√2

Results

Dashed line: the 50% a perfect qubit predicts.

Last 40 flips, newest last.

Heads share settles toward 50%

Shaded band: the typical random wobble, ±1/√n of the total. It narrows as flips pile up.

How a qubit flips a coin

1. Start at |0⟩

Every qubit begins pointing straight up: definitely 0, definitely heads.

2. Hadamard gate

H swings the arrow down to the equator: halfway between 0 and 1. That is superposition.

3. Measure

Looking snaps it to a pole, up (heads) or down (tails), 50% each, decided by nature itself.

The circuit

q: |0⟩ H c: bit 0 or 1

Watch the pulse: one state goes in, the H gate splits it into two possibilities, the measurement lets only one come out.

What is superposition?

A normal coin is always secretly heads or tails. A qubit after a Hadamard gate is a genuine blend of both:

|ψ⟩ = (|0⟩ + |1⟩) / √2

Measuring forces a choice, each with probability (1/√2)² = 50%. This page runs that same statevector maths in your browser with the system's secure random source: a simulation of a qubit, not a quantum chip.

The same circuit in Qiskit
from qiskit import QuantumCircuit
from qiskit.primitives import StatevectorSampler

qc = QuantumCircuit(1)
qc.h(0)          # superposition
qc.measure_all() # collapse to 0 or 1

result = StatevectorSampler().run([qc], shots=1000).result()[0]
print(result.data.meas.get_counts())  # e.g. {'0': 507, '1': 493}