Bloch sphere
Prepare one pure qubit, apply gates and observe an ideal Z measurement.
About this tool
One ideal pure qubit is |ψ⟩ = a|0⟩ + b|1⟩, with |a|² + |b|² = 1. The qubit is prepared immediately from valid θ and φ values: a = cos(θ/2), b = exp(iφ) sin(θ/2), θ from 0 to 180° and φ from −180 to 180°. Exact fields and sliders change these preparation settings; a basis preset sets both. Editing either angle prepares a fresh trial. Gates change the current amplitudes without rewriting the preparation fields. Reset prepares the same entered angles again and clears the current trial.
The Bloch coordinates are x = 2 Re(a* b), y = 2 Im(a* b), z = |a|² − |b|², where a* is the complex conjugate. Current φ is wrapped into [−180°, 180°); at either pole it is undefined. The sphere is an abstract state representation, shown in a fixed orthographic projection. A shorter projected arrow does not mean the pure state has a shorter Bloch vector. +x and −x correspond to |±⟩; +y and −y to |±i⟩.
The matrices use the ordered basis (|0⟩, |1⟩): X exchanges a and b; Y maps them to −ib and ia; Z changes the sign of b; H gives (a+b)/√2 and (a −b)/√2; T multiplies b by exp(iπ/4). These are deterministic unitary operations. The displayed amplitudes retain their global phase through gates. Multiplying both amplitudes by the same exp(iχ) changes neither the Bloch point nor any measurement probabilities. Relative phase can change the effect of a later gate.
Measure Z draws one simulated outcome with Born probabilities P(0) = |a|² and P(1) = |b|², then replaces the state by |0⟩ or |1⟩. A further Z measurement without an intervening gate gives the same outcome with certainty. The last measurement shows its probabilities before collapse, separately from the probabilities now. The counters include all measurements since preparation, even if gates intervene; their frequencies do not estimate the current Born probabilities. Prepare clears counters and the action history. The last 24 actions are shown in time order. No ensemble, hardware noise, extra qubits or tomography is modeled.
Only exact preparation angle texts are retained, including unfinished/invalid/comma values. Old angle settings migrate; old generated qubits, counters, measurement results and histories are not restored. Reload or returning through navigation prepares the entered angles again. The action history and counters exist only during the current mounted trial. Tiny positive probabilities use scientific notation; floating-point precision is finite, with no intentional near-pole cutoff.
Sources: IBM Quantum Learning, Bloch sphere; Born rule and unitary gates; global phase; repeated measurements.