Tools / Single-qubit state
One qubit, one sphere.
A pure state of a single qubit has two physical angles. Drag the arrow on the Bloch sphere, or set θ and φ directly. The green n̂ handle chooses the axis any unitary turns about: drag it, or set its two angles. Then apply a gate — a fixed one, or one you build from that axis, angle and phase — measure the qubit, and watch the amplitudes follow.
Single-qubit state explorer
Current state
|0⟩
- α
- 1.000
- β
- 0.000
- P(0)
- 1.000
- P(1)
- 0.000
Outcome 0
Outcome 1
What the sphere shows
A pure state of one qubit is a pair of complex numbers α and β with |α|² + |β|² = 1. An overall phase and an overall scale have no physical meaning, which leaves exactly two real parameters. This tool writes them as α = cos(θ/2) and β = eiφ sin(θ/2), and draws the arrow at (sin θ cos φ, sin θ sin φ, cos θ).
Because the arrow has length one, every pure state sits on the surface. Opposite points are orthogonal states: |0⟩ and |1⟩ on the vertical axis, |+⟩ and |−⟩ on x, |+i⟩ and |−i⟩ on y. A measurement along z returns 0 with probability |α|² and 1 with probability |β|², which is why moving the arrow around the equator leaves the probabilities alone: phase appears in interference, not in a single computational-basis readout.
The half angles are not decoration. Turning the qubit through 2π sends α and β to their negatives — a global phase, and the same point on the sphere. The arrow returns to its starting direction only after a 4π turn, and that sign has been measured with neutrons, not just argued.
The most general single-qubit gate
A gate must keep the total probability equal to one, so it is a 2 × 2 unitary matrix, \(U^\dagger U=I\). Every such matrix can be written with four real numbers, an overall phase \(\gamma\) and three angles \(a\), \(b\), \(c\):
\[U=e^{i\gamma}\begin{pmatrix}e^{-i(a+c)/2}\cos\frac{b}{2} & -e^{-i(a-c)/2}\sin\frac{b}{2}\\ e^{i(a-c)/2}\sin\frac{b}{2} & e^{i(a+c)/2}\cos\frac{b}{2}\end{pmatrix}=e^{i\gamma}R_z(a)\,R_y(b)\,R_z(c),\]
where \(R_z(a)=e^{-iaZ/2}\) and \(R_y(b)=e^{-ibY/2}\) are rotations of the arrow about the \(z\) and \(y\) axes. So every gate is a turn about \(z\), a turn about \(y\) and another turn about \(z\). Equivalently, every gate is one rotation by an angle \(\theta\) about a single unit axis \(\hat n=(n_x,n_y,n_z)\):
\[U=e^{i\gamma}\Bigl(\cos\tfrac{\theta}{2}\,I-i\sin\tfrac{\theta}{2}\,(n_xX+n_yY+n_zZ)\Bigr),\]
and its effect on the sphere is exactly that: the arrow turns by \(\theta\) about \(\hat n\). The phase \(e^{i\gamma}\) multiplies \(\alpha\) and \(\beta\) together and never moves the arrow, which is why the sphere needs only three of the four numbers. The half angles are the same ones as in the amplitudes: a full turn, \(\theta=2\pi\), gives \(-I\).
The Apply any unitary controls build this matrix directly. Set the axis with two angles — \(\theta_n\) from the \(z\) axis and \(\phi_n\) around it — then the rotation angle \(\theta\) and the global phase \(\gamma\). The four entries of \(U\) appear beside the sliders, and the dashed diameter on the sphere is \(\hat n\). Apply U turns the arrow by \(\theta\) about that diameter, while \(\alpha\) and \(\beta\) also pick up \(e^{i\gamma}\): set \(\gamma=180^\circ\) and both amplitudes change sign with the arrow untouched. The light dotted circle is the full orbit about \(\hat n\); the darker arc and the translucent cone under it show how far the rotation actually went, and they stay visible until the state moves again. The turn itself is animated so it can be followed; with reduced motion it lands at once.
The six gate buttons above are special cases. X, Y and Z are half-turns, \(\theta=\pi\), about the \(x\), \(y\) and \(z\) axes, each times a phase \(-i\), so \(\gamma=90^\circ\) in the controls above rebuilds them. H is \(-i\) times a half-turn about the axis \((1,0,1)/\sqrt2\), halfway between \(x\) and \(z\), which is why it swaps |0⟩ and |+⟩. S and T are quarter- and eighth-turns about \(z\): \(S=e^{i\pi/4}R_z(\pi/2)\) and \(T=e^{i\pi/8}R_z(\pi/4)\).
Things to try
- Set the state angle θ = 30° and compare α with cos 15° = 0.966 and β with sin 15° = 0.259.
- From |0⟩ press H: the arrow lands on |+⟩ with probabilities 0.500 and 0.500. Press S: the arrow moves to |+i⟩ and P(0) does not move.
- From |0⟩ press X to reach |1⟩, then H to reach |−⟩. Both |+⟩ and |−⟩ measure 0 half the time, so the probabilities alone cannot tell them apart.
- Prepare |+⟩ and press Measure: the arrow jumps to |0⟩ or |1⟩ — the collapse — and the probabilities become certain. Press |+⟩ and Measure again a few times to watch the counts approach 50 / 50.
- Set n̂ to x, θ = 180° and γ = 90°, then Apply U: the matrix equals X and the arrow moves exactly as it does with the X button.
- Leave the axis on z, set θ = 90° and γ = 45°: the matrix is S. Set γ = 0° instead and the same turn leaves every probability alone, because a phase about z is invisible on |0⟩.
- Drag slowly near the north pole and quickly near the equator: the half angle compresses the whole sphere into the amplitudes.
This model shows pure states only. A noisy qubit sits inside the sphere, where the arrow is shorter, and needs a density-matrix view that this tool does not yet provide. Measurements here use your browser's random number generator, so a short run of outcomes can look surprising: that is statistics, not a bias.