⬜ Qubit & Bloch Sphere

|
|
Qubit State
θ (polar):0.000°
φ (azimuth):0.000°
P(|0⟩):100.0%
P(|1⟩):0.0%
|ψ⟩ = |0⟩
Gate History
|ψ⟩ = |0⟩
α = 1+0i
β = 0+0i
Gates applied: 0

🔮 Qubit & Bloch Sphere — Quantum Gates

Visualise a qubit state on the Bloch sphere and apply quantum gates in real time. Pauli X, Y, Z, Hadamard, S and T gates rotate the state vector, showing how quantum computation manipulates superposition and phase.

🔬 What It Demonstrates

Every single-qubit state |ψ⟩ = α|0⟩ + β|1⟩ maps to a unique point on the Bloch sphere. Quantum gates are rotations: X rotates 180° around the x-axis (bit flip), Z around z (phase flip), H maps |0⟩ to an equal superposition on the equator.

🎮 How to Use

Click gate buttons to apply them sequentially. Watch the state vector rotate smoothly on the sphere. The probability display shows |α|² and |β|² updating live. The gate log records your sequence.

💡 Did You Know?

The Bloch sphere is named after Felix Bloch, who developed it to visualise nuclear magnetic resonance states. IBM's quantum processors let anyone run real qubit gates on the cloud using the same Bloch-sphere visualisation.

About this simulation

This simulation places a single qubit on the Bloch sphere, a unit sphere where every pure single-qubit state |ψ⟩ = α|0⟩ + β|1⟩ corresponds to one surface point. The state is stored as the complex amplitudes α and β, and applying a gate multiplies that two-component vector by the gate's 2×2 unitary matrix. The Bloch coordinates are computed directly from the amplitudes, so each quantum gate appears on screen as a precise rotation of the state arrow.

🔬 What it shows

It shows how single-qubit gates act on a quantum state. Internally the state is a vector [α, β] of complex amplitudes, and each gate (X, Y, Z, H, S, T) is its standard 2×2 unitary matrix. The Bloch vector is derived as x = 2Re(α*β), y = |α|²−|β|², z = 2Im(α*β), with |α|² and |β|² giving the measurement probabilities of |0⟩ and |1⟩.

🎮 How to use

Click the X, Y, Z, H, S or T buttons to apply each gate in sequence; the purple arrow rotates smoothly to the new state. The Reset button returns the qubit to |0⟩. Drag with the mouse to orbit the 3D view, and scroll to zoom. Live panels report θ, φ, the α and β amplitudes, the P(|0⟩)/P(|1⟩) bars and a running gate history.

💡 Did you know?

The Hadamard gate turns |0⟩ into an equal superposition (|0⟩ + |1⟩)/√2, the building block of quantum parallelism. Applying H twice returns the qubit exactly to |0⟩, because the Hadamard matrix is its own inverse.

Frequently asked questions

What is a qubit and what is the Bloch sphere?

A qubit is the basic unit of quantum information, written |ψ⟩ = α|0⟩ + β|1⟩ where α and β are complex amplitudes with |α|² + |β|² = 1. The Bloch sphere is a geometric picture in which every such pure state is a single point on a unit sphere, with |0⟩ at the north pole and |1⟩ at the south pole.

How does the simulation apply a gate?

The qubit is held as the amplitude pair [α, β], and each gate is its standard 2×2 unitary matrix. Pressing a button multiplies the current state by that matrix, producing the new α and β. The Bloch coordinates and the |α|² and |β|² probabilities are then recomputed and the arrow animates to its new orientation.

What do the six gate buttons do?

X, Y and Z are the Pauli gates: X is a bit flip (180° rotation about the x-axis), Z is a phase flip about z, and Y combines both. H (Hadamard) maps |0⟩ to an equal superposition on the equator. S adds a 90° phase and T a 45° phase, both rotations about the z-axis.

Is the visualisation physically accurate?

Yes. It uses the exact unitary matrices for the X, Y, Z, H, S and T gates and the standard formulas for the Bloch vector, so the displayed rotations and probabilities match real single-qubit quantum mechanics. The model omits measurement collapse and noise, focusing instead on the unitary evolution of an idealised, perfectly isolated qubit.

Why can a qubit hold more than 0 or 1 before measurement?

Between gates a qubit exists in superposition, a weighted complex combination of |0⟩ and |1⟩ described by α and β. The square magnitudes |α|² and |β|² are the probabilities of reading 0 or 1 if you measure. Only at measurement does the state collapse to a definite bit, which is why the sphere can show intermediate orientations.