Bloch Sphere & Single-Qubit Quantum State Calculator

Visualize pure quantum states on the 3D Bloch sphere, calculate $|0 angle$ and $|1 angle$ measurement probabilities, simulate unitary quantum logic gates, and compute $2 imes 2$ density matrices.

📁 Developer🔒 100% Free & Private⚡ Instant Output
Quick Overview & Direct Answer

Bloch Sphere & Single-Qubit Quantum State Calculator: Free Bloch Sphere & Single-Qubit Quantum State Calculator tool: interactive 3D Bloch Sphere visualizer and single-qubit quantum state calculator..

Primary Use Code debugging, syntax validation, encoding/decoding, API payload inspection
Input Formats Code snippets, JSON, XML, SQL, regex expressions, data structures
Output Format Formatted code, validation feedback, generated hashes, AST trees
Processing Mode 100% Client-Side JavaScript Engine
Access Tier Free, unlimited, no sign-up needed

Qubit Polar Coordinates & Presets

degrees
0° corresponds to |0⟩; 180° corresponds to |1⟩.
degrees
Relative phase between |0⟩ and |1⟩ components.

Apply Unitary Quantum Logic Gates

Click any single-qubit quantum gate to apply unitary rotation to the current state:

Quantum State Vector & Probabilities

P(|0⟩) Probability
100.0%
Amplitude α = 1.000
P(|1⟩) Probability
0.0%
Amplitude β = 0.000
Bloch Vector (u, v, w)
(0.0, 0.0, 1.0)
Purity |r| = 1.000
State Representation
|0⟩
Normalized CP¹ state

Density Matrix ρ = |ψ⟩⟨ψ|

[ 1.000 + 0.000i, 0.000 + 0.000i ]
[ 0.000 + 0.000i, 0.000 + 0.000i ]

3D Bloch Sphere Orthographic Projection

■ State Vector |ψ⟩    ■ Z Axis (|0⟩ / |1⟩)    ■ X Axis    ■ Y Axis

1. The Geometry of Quantum State Space

In classical digital computing, the fundamental unit of information is the bit, existing strictly in one of two discrete states: $0$ or $1$. In quantum computing, the fundamental unit is the quantum bit (qubit). A qubit is a two-level quantum mechanical system whose state vector $|psi angle$ exists as a linear superposition in a two-dimensional complex Hilbert space $mathcal{H}_2$ spanned by the orthonormal computational basis vectors ${|0 angle, |1 angle}$:

$$|psi angle = alpha |0 angle + eta |1 angle, quad alpha, eta in mathbb{C}$$

where $alpha$ and $eta$ are complex probability amplitudes satisfying the Born rule normalization condition:

$$|alpha|^2 + |eta|^2 = 1$$

Because $alpha$ and $eta$ are complex numbers, each has two real parameters (magnitude and phase), totaling four real degrees of freedom. However, two physical constraints reduce these four degrees of freedom to exactly two:

  1. Unit Normalization ($|alpha|^2 + |eta|^2 = 1$): Eliminates one degree of freedom.
  2. Global Phase Invariance: Multiplying an entire state by an overall phase factor $e^{igamma}|psi angle$ leaves all measurement statistics and quantum mechanical expectation values completely unchanged ($langlepsi| mathbf{A} |psi angle = langlepsi| e^{-igamma} mathbf{A} e^{igamma} |psi angle$). Factoring out the global phase allows us to choose $alpha$ to be real and non-negative.

Applying these reductions yields the parameterized canonical representation of a pure qubit state:

$$|psi angle = cosleft( rac{ heta}{2} ight) |0 angle + e^{iphi} sinleft( rac{ heta}{2} ight) |1 angle$$

where $ heta in [0, pi]$ is the polar colatitude angle and $phi in [0, 2pi)$ is the azimuthal phase angle. This maps the complex projective line $mathbb{C}P^1$ directly onto the surface of a unit sphere in $mathbb{R}^3$, termed the Bloch Sphere.

2. Coordinate Mapping: From Hilbert Space to $mathbb{R}^3$

The position of a quantum state on the Bloch sphere is defined by the 3D Cartesian coordinates of the Bloch vector $mathbf{r} = (u, v, w) in mathbb{R}^3$:

$$egin{aligned} u &= sin heta cosphi = 2 ext{Re}(alpha^* eta) = langlepsi| sigma_x |psi angle v &= sin heta sinphi = 2 ext{Im}(alpha^* eta) = langlepsi| sigma_y |psi angle w &= cos heta = |alpha|^2 - |eta|^2 = langlepsi| sigma_z |psi angle end{aligned}$$

The components of the Bloch vector correspond physically to the expectation values of the three Pauli observables ($sigma_x, sigma_y, sigma_z$).

3. Standard Quantum Logic Gates as Bloch Sphere Rotations

Single-qubit quantum logic gates are represented by $2 imes 2$ unitary matrices $mathbf{U} in SU(2)$. Due to the double-cover Lie group homomorphism between $SU(2)$ and the 3D rotation group $SO(3)$, every single-qubit quantum gate corresponds to a pure spatial rotation of the Bloch sphere:

Quantum Gate Matrix Operator Geometric Bloch Rotation Canonical Transformation
Pauli-X (NOT) $$egin{bmatrix}0&11&0end{bmatrix}$$ $180^circ$ rotation around $X$-axis. $|0 angle leftrightarrow |1 angle$
Pauli-Y $$egin{bmatrix}0&-ii&0end{bmatrix}$$ $180^circ$ rotation around $Y$-axis. $|0 angle o i|1 angle, quad |1 angle o -i|0 angle$
Pauli-Z (Phase) $$egin{bmatrix}1&0&-1end{bmatrix}$$ $180^circ$ rotation around $Z$-axis. $|0 angle o |0 angle, quad |1 angle o -|1 angle$
Hadamard ($H$) $$ rac{1}{sqrt{2}}egin{bmatrix}1&11&-1end{bmatrix}$$ $180^circ$ rotation around diagonal $(X+Z)/sqrt{2}$. $|0 angle o |+ angle, quad |1 angle o |- angle$
Phase ($S$) $$egin{bmatrix}1&0&iend{bmatrix}$$ $+90^circ$ ($pi/2$) rotation around $Z$-axis. $|+ angle o |+i angle, quad S^2 = Z$
$pi/8$ Gate ($T$) $$egin{bmatrix}1&0&e^{ipi/4}end{bmatrix}$$ $+45^circ$ ($pi/4$) rotation around $Z$-axis. $T^2 = S, quad T^4 = Z$

4. Density Matrix & Pure vs Mixed States

The state of a qubit can be represented generally by its $2 imes 2$ density operator $ ho$. For a pure state $|psi angle$:

$$ ho = |psi angle langlepsi| = egin{bmatrix} cos^2( heta/2) & cos( heta/2)sin( heta/2)e^{-iphi} cos( heta/2)sin( heta/2)e^{iphi} & sin^2( heta/2) end{bmatrix} = rac{1}{2}left(mathbf{I} + u sigma_x + v sigma_y + w sigma_z ight)$$

A pure state satisfies $ ho^2 = ho$ and $ ext{Tr}( ho^2) = 1$, placing the state vector directly on the unit sphere ($|mathbf{r}| = 1$). In real quantum computers (superconducting transmons, trapped ions), interaction with the environment causes quantum decoherence, shrinking the vector into the interior of the Bloch ball ($|mathbf{r}| < 1$). The center of the sphere $mathbf{r} = (0, 0, 0)$ represents the maximally mixed state $ ho = rac{1}{2}mathbf{I}$, where measurement yields equal $50%$ probability with zero phase coherence.

5. Worked Mathematical Example: Hadamard Gate on $|0 angle$

Initial State: $|0 angle implies heta = 0^circ, phi = 0^circ$. Bloch vector: $mathbf{r} = (0, 0, 1)$.

Step 1: Apply Hadamard Matrix

$$H |0 angle = rac{1}{sqrt{2}} egin{bmatrix} 1 & 1 1 & -1 end{bmatrix} egin{bmatrix} 1 0 end{bmatrix} = rac{1}{sqrt{2}} egin{bmatrix} 1 1 end{bmatrix} = rac{1}{sqrt{2}} |0 angle + rac{1}{sqrt{2}} |1 angle = |+ angle$$

Step 2: Solve New Bloch Angles

$$cos( heta/2) = rac{1}{sqrt{2}} implies rac{ heta}{2} = 45^circ implies heta = 90^circ$$ $$e^{iphi} sin( heta/2) = rac{1}{sqrt{2}} implies e^{iphi} = 1 implies phi = 0^circ$$

Step 3: New Bloch Coordinates & Measurement Probabilities

$$u = sin(90^circ) cos(0^circ) = 1.0, quad v = 0.0, quad w = cos(90^circ) = 0.0 implies mathbf{r} = (1.0, 0.0, 0.0)$$ $$P(|0 angle) = left| rac{1}{sqrt{2}} ight|^2 = 0.50 quad (50%), quad P(|1 angle) = left| rac{1}{sqrt{2}} ight|^2 = 0.50 quad (50%)$$

The state has rotated from the North Pole down to the positive $X$-axis on the equator, creating an ideal equal superposition.

Frequently Asked Questions

Named after physicist Felix Bloch, the Bloch Sphere is a 2D spherical representation of the state space of a two-level quantum mechanical system (a qubit). Any pure state can be written as |ψ⟩ = cos(θ/2)|0⟩ + e^(iφ)sin(θ/2)|1⟩, where θ (0 to π) is the polar colatitude and φ (0 to 2π) is the azimuthal relative phase angle. This maps the complex projective Hilbert space CP^1 directly onto the surface of a unit sphere in R^3.

Multiplying a quantum state by a global phase factor e^(iγ)|ψ⟩ does not alter any observable measurement probability: |e^(iγ)α|^2 = |α|^2. Because global phase is physically unobservable, we can factor it out, fixing the coefficient of |0⟩ to be real non-negative (cos(θ/2)) and assigning all relative phase information (e^(iφ)) to the |1⟩ component.

Geometrically, the Hadamard gate represents a 180° rotation of the Bloch sphere around the diagonal axis (X + Z)/sqrt(2). It transforms the computational basis state |0⟩ into the equal superposition state |+⟩ = (|0⟩ + |1⟩)/sqrt(2) on the +X axis, and transforms |1⟩ into |-⟩ = (|0⟩ - |1⟩)/sqrt(2) on the -X axis.

Pure quantum states reside strictly on the outer spherical surface where the Bloch vector length is exactly |r| = 1. Mixed states—representing statistical ensembles or decohered qubits entangled with the environment—lie strictly inside the sphere (|r| < 1). The maximally mixed state (r = 0 at the origin) represents complete ignorance, where measurement of |0⟩ or |1⟩ is a pure 50/50 coin flip.